feat(ags): remove eventbox from systray because of bug
This commit is contained in:
parent
7b8d0d4b54
commit
1488f4992f
3 changed files with 51 additions and 36 deletions
|
@ -1,47 +1,47 @@
|
||||||
const { SystemTray } = ags.Service;
|
const { SystemTray } = ags.Service;
|
||||||
const { Box, Button, Icon, MenuItem } = ags.Widget;
|
const { Box, Button, Icon, MenuItem } = ags.Widget;
|
||||||
const { Gtk } = imports.gi;
|
const { Gtk } = imports.gi;
|
||||||
|
import { EventBox } from '../common.js';
|
||||||
|
|
||||||
// this one uses a MenuBar and shouldn't throw that destroyed widget warning
|
|
||||||
const SysTrayItem = item => MenuItem({
|
const SysTrayItem = item => MenuItem({
|
||||||
className: 'tray-item',
|
className: 'tray-item',
|
||||||
child: Icon({
|
child: Icon({
|
||||||
size: 24,
|
size: 24,
|
||||||
}),
|
}),
|
||||||
submenu: item.menu,
|
submenu: item.menu,
|
||||||
connections: [[item, btn => {
|
connections: [[item, btn => {
|
||||||
btn.child.icon = item.icon;
|
btn.child.icon = item.icon;
|
||||||
btn.tooltipMarkup = item.tooltipMarkup;
|
btn.tooltipMarkup = item.tooltipMarkup;
|
||||||
}]]
|
}]]
|
||||||
});
|
});
|
||||||
|
|
||||||
export const SysTrayModule = () => ags.Widget({
|
const SysTrayModule = () => ags.Widget({
|
||||||
type: Gtk.MenuBar,
|
type: Gtk.MenuBar,
|
||||||
className: 'sys-tray',
|
className: 'sys-tray',
|
||||||
properties: [
|
properties: [
|
||||||
['items', new Map()],
|
['items', new Map()],
|
||||||
['onAdded', (box, id) => {
|
['onAdded', (box, id) => {
|
||||||
const item = SystemTray.getItem(id);
|
const item = SystemTray.getItem(id);
|
||||||
if (box._items.has(id) || !item)
|
if (box._items.has(id) || !item)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const widget = SysTrayItem(item);
|
const widget = SysTrayItem(item);
|
||||||
box._items.set(id, widget);
|
box._items.set(id, widget);
|
||||||
box.add(widget);
|
box.add(widget);
|
||||||
box.show_all();
|
box.show_all();
|
||||||
}],
|
}],
|
||||||
['onRemoved', (box, id) => {
|
['onRemoved', (box, id) => {
|
||||||
if (!box._items.has(id))
|
if (!box._items.has(id))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
box._items.get(id).destroy();
|
box._items.get(id).destroy();
|
||||||
box._items.delete(id);
|
box._items.delete(id);
|
||||||
}],
|
}],
|
||||||
],
|
],
|
||||||
connections: [
|
connections: [
|
||||||
[SystemTray, (box, id) => box._onAdded(box, id), 'added'],
|
[SystemTray, (box, id) => box._onAdded(box, id), 'added'],
|
||||||
[SystemTray, (box, id) => box._onRemoved(box, id), 'removed'],
|
[SystemTray, (box, id) => box._onRemoved(box, id), 'removed'],
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
export const SysTray = SysTrayModule();
|
export const SysTray = SysTrayModule();
|
||||||
|
|
|
@ -11,6 +11,15 @@
|
||||||
all: unset;
|
all: unset;
|
||||||
padding: 0px 2px 0px 2px;
|
padding: 0px 2px 0px 2px;
|
||||||
font-size: 25px;
|
font-size: 25px;
|
||||||
|
border-radius: 100%;
|
||||||
|
transition: background-color 0.5s ease-in-out,
|
||||||
|
border 0.5s ease-in-out;
|
||||||
|
&:hover {
|
||||||
|
background: rgba(127, 132, 156, 0.4);
|
||||||
|
border-radius: 100%;
|
||||||
|
transition: background-color 0.5s ease-in-out,
|
||||||
|
border 0.5s ease-in-out;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
menu {
|
menu {
|
||||||
|
|
|
@ -138,7 +138,13 @@
|
||||||
.sys-tray .tray-item {
|
.sys-tray .tray-item {
|
||||||
all: unset;
|
all: unset;
|
||||||
padding: 0px 2px 0px 2px;
|
padding: 0px 2px 0px 2px;
|
||||||
font-size: 25px; }
|
font-size: 25px;
|
||||||
|
border-radius: 100%;
|
||||||
|
transition: background-color 0.5s ease-in-out, border 0.5s ease-in-out; }
|
||||||
|
.sys-tray .tray-item:hover {
|
||||||
|
background: rgba(127, 132, 156, 0.4);
|
||||||
|
border-radius: 100%;
|
||||||
|
transition: background-color 0.5s ease-in-out, border 0.5s ease-in-out; }
|
||||||
.sys-tray menu {
|
.sys-tray menu {
|
||||||
background: #282a36;
|
background: #282a36;
|
||||||
padding-top: 5px;
|
padding-top: 5px;
|
||||||
|
|
Loading…
Reference in a new issue