-
Notifications
You must be signed in to change notification settings - Fork 11
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
Handle mouse clicks for systray items #6
Conversation
|
Hi, I've tested your changes and I really like the ability to change the spacing, but I noticed that the context menu window is no longer nicely aligned with the icon/bar, but instead appears right where the cursor is when the icon is right-clicked. Is this intentional? Also, double-clicks do not seem to be handled. I have an application called "Barrier" that normally opens its window when double-clicked (e.g. when displayed in the Polybar tray area), but in EWW a double-click does nothing. |
// @prop pack-direction - how to arrange tray items | ||
prop(pack_direction: as_string) { gtk_widget.set_pack_direction(parse_packdirection(&pack_direction)?); }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry to ask, but has this been removed on purpose? I just realized that the pack direction does not work with your fork.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The orientation
property partially supersedes it, allowing you to switch between horizontal and vertical layouts. The ltr/rtl
provided by pack_direction
isn't meaningful because the icons are already randomly ordered, and vice versa for ttb/btt
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ltr/rtl provided by pack_direction isn't meaningful because the icons are already randomly ordered
At least for me, the implementation of @ralismark shows the icons in the same order that programs are adding them. For example I configure :pack_directon "rtl"
and have three programs currently open:
[a] [b] [c]
If I launch a 4th program [D]
, the icon is added to the left side:
[D] [a] [b] [c]
which is nice if the tray is on the right side of the bar because then all previous icons stay in the same place and do not move around as new apps are launched.
Without this property, the icons always get added to the right side. They are only ordered randomly when the bar reloads (due to a config change for example) but I'd say this is not the normal case and I guess this is nothing that can be worked around easily.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is easy to implement, just need to choose between pack_start()
and pack_end()
when adding the icon widget to the container, and that would require adding another property for the user to configure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is now a prepend-new
property to achieve this goal.
Yes. The anchor of the context menu is expected to be your mouse cursor in the current implementation. Aligning it to the bar border can be added in the future, with a new property to allow users to toggle it.
Indeed it's not and I don't think it's possible. According to the spec https://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/StatusNotifierItem/ there's no way to tell the program whether it's a single click or double click, so this implementation handles single clicks only, and a double click is treated as two single clicks. p.s.: other systray implementations might map the left button double-click to the middle button single-click, it's worth trying if the middle button opens your application. |
This is sad..
Unfortunately it does not. But it's not too big of a deal since I can still use right-click > show to open the window (and I really don't need to open it all the time). Anyways, thanks for your answer 🙂 |
The major benefit of MenuItem is automatic handling of context menus. However, MenuItem cannot properly process right mouse click, making it less useful. Hence, this patch replaces it (as long as the container) with a simple EventBox and process button clicks on our own.
Thanks, this works great! Most importantly (for me), I can now quit tray apps via their menu, which wasn't possible before. |
Moved to elkowar#1059 |
No description provided.