-
-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
System tray #70
System tray #70
Conversation
fixed color issues of icons
# Conflicts: # src/ags.src.gresource.xml
Found a few issues with this. Steam icon has no tooltip so get_tooltip_markup blows up - needs a truthy check and early return. get_pixbuf always blows up on icon change for discord when you get a message or if you read a pending message. I don't seem to be able to control the size of the icons even setting font-size on various things. I ended up adding a size param to get_icon just so I could get it to work. |
I managed to fix the icon change by doing a _refresh_all_properties when NewIcon signal is received and changed the logic in getIcon to instead of checking status (as status here is "active") instead just use the attentionicon/pixmap if there is one otherwise use the regular. |
fixed
fixed it is weird, that refreshing only the icon properties is not sufficient. |
One more minor thing, when an icon updates it's position in the output array is changing. So when you re-render icon goes from first to last for example. Might want to add some kind of stable sort to the getter for the items. |
Icons can't update their position. The array of the item is always sorted by time of registration. The order is already stable. |
Might have been discord doing something weird as it seems fine after restarting it. |
The Error UnknownMethod is raised, when the called method is not implemented by the dbus interface. But the only method being called here is the Get method of the I will look into this more closely in the coming days. I guess more error checking is needed in general. Note: maybe it would be better to open such issues over at my fork to keep this PR more clean and have a better overview which has to be done.
I rewrote the css in my config and this issue went away. So maybe this isn't an issue with the system tray implementation. |
If its possible to check if a dbus name corresponds to a SNI, then yeah, looping over them then registering them would be a solution, but I don't see this as much of an issue, because the end goal is to have a config that will run from start to finish throughout a session and there shouldn't be a need to restart ags
Most probably due to custom css. I kind of don't like doing this arr.map(item => Button({
child: SystemTray.get_icon(item),
tooltipMarkup: SystemTray.get_tooltip_markup(item)
})); Making a wrapper class for item proxies would be better imo, so something like this is possible SystemTray.items.map(item => Button({
child: Icon(),
connections: [[item, button => {
button.child.icon = item.icon;
button.tooltipMarkup = item.tooltipMarkup;
}]],
}); item.icon could be either pixbuf or a string, Widget.Icon would need some modification to support pixbufs like this Also having an |
implemented added/removed signals
done const systemtray = Box({
connections: [[SystemTray, box => {
box.children = SystemTray.items.map(item => Button({
child: Icon(),
onPrimaryClick: (_, event) => item.activate(event),
onSecondaryClick: (_, event) => item.openMenu(event),
connections: [[item, button => {
button.child.icon = item.icon;
button.tooltipMarkup = item.tooltipMarkup;
}]],
}));
}
]]
}); |
I'm a bit of a newbie to AGS, how do I implement this into my config? |
I am trying to build this branch on NixOS but I keep getting this error when launching ags :
I tried adding libdbusmenu in buildInputs but it wouldn't change anything. |
Also there are more problems that I was able to find fiddling with copyq. Right click behavior on copyq for ags system tray is not consistent. When I click on three dots (...) I get the following in my console: |
that is most probably due to custom css |
Yeah some of them are, but still got to experience the similar behavior with example config. I figured it is changing only once I search for something under copyq (this is in turn narrowing down the results - can be achieved with the left click of the icon) thus it somehow keeps that state and displays in in the system tray. |
with libdbusmenu-gtk3 now they are, it simplified the code a lot too.
I think this is an issue with copyq |
here are some examples you can // will give you a warning about destroyed widgets if there are multiple items registering
// but you can ignore that
const SysTray = () => Box({
connections: [[SystemTray, box => {
box.children = SystemTray.items.map(item => Button({
child: Icon(),
onPrimaryClick: (_, event) => item.activate(event),
onMiddleClick: (_, event) => item.secondaryActivate(event),
onSecondaryClick: (_, event) => item.openMenu(event),
connections: [[item, button => {
button.child.icon = item.icon;
button.tooltipMarkup = item.tooltipMarkup;
}]],
}));
}]]
}); // this one uses a MenuBar and shouldn't throw that destroyed widget warning
const SysTrayItem = item => MenuItem({
child: Icon({
size: 24,
}),
submenu: item.menu,
connections: [[item, btn => {
btn.child.icon = item.icon;
btn.tooltipMarkup = item.tooltipMarkup;
}]]
});
export const SysTray = () => Widget({
type: Gtk.MenuBar,
className: 'systray',
properties: [
['items', new Map()],
['onAdded', (box, id) => {
const item = SystemTray.getItem(id);
if (box._items.has(id) || !item)
return;
const widget = SysTrayItem(item);
box._items.set(id, widget);
box.add(widget);
box.show_all();
}],
['onRemoved', (box, id) => {
if (!box._items.has(id))
return;
box._items.get(id).destroy();
box._items.delete(id);
}],
],
connections: [
[SystemTray, (box, id) => box._onAdded(box, id), 'added'],
[SystemTray, (box, id) => box._onRemoved(box, id), 'removed'],
],
});
|
* connections prop can take any GObject * mark Service.register as deprecated * stop using @ts-ignore * renamed apps.js to applications.js * every Service can be imported from service.js
implemented added/removed signals
The system tray is working with only a few issues left (see list below).
Some applications behave different than expected, so maybe more testing is required.
introduces a dependency on
@girs/dbusmenu-0.4
fixes #22
usage
Here is small snippet you can use in your config.
Known issues: