Skip to content
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

[FEATURE] Bar relative context menus on systray #1221

Open
ToxicMushroom opened this issue Nov 3, 2024 · 1 comment
Open

[FEATURE] Bar relative context menus on systray #1221

ToxicMushroom opened this issue Nov 3, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@ToxicMushroom
Copy link

ToxicMushroom commented Nov 3, 2024

Description of the requested feature

Example of a bar relative context menu.
image

Reasons:

  • Looks nice and consistent
  • The context menu then can't cover other systray items, allowing you to always access other systray items. Although I Just noticed that you can't directly switch to another item's context menu when you have one open so not sure how useful this is.

Proposed configuration syntax

:location ["bar" | "cursor"]
:spacing 8

Location would set the origin point for where to position the menu.
spacing would be applicable to :location "bar" to have it sticking to or spaced further from the bar

Additional context

Screenshot is from quickshell

@ToxicMushroom ToxicMushroom added the enhancement New feature or request label Nov 3, 2024
@bbb651
Copy link

bbb651 commented Nov 26, 2024

I tried Menu::popup_at_widget, this seems like a bug somewhere either in gtk3, gtk-layer-shell, compositors or all of the above, I tested many compositors and every single one has a different and undesired behavior:

diff --git a/crates/notifier_host/src/item.rs b/crates/notifier_host/src/item.rs
index a6cb2af..a314b95 100644
--- a/crates/notifier_host/src/item.rs
+++ b/crates/notifier_host/src/item.rs
@@ -90,7 +90,13 @@ impl Item {

     pub async fn popup_menu(&self, event: &gtk::gdk::EventButton, x: i32, y: i32) -> zbus::Result<()> {
         if let Some(menu) = &self.gtk_menu {
-            menu.popup_at_pointer(event.downcast_ref::<gtk::gdk::Event>());
+            menu.popup_at_widget(
+                &menu.attach_widget().expect("attach widget is set in `set_menu`"),
+                gtk::gdk::Gravity::South,
+                gtk::gdk::Gravity::North,
+                Some(event), // Also tested with `None`
+            );
             Ok(())
         } else {
             self.sni.context_menu(x, y).await

labwc (niri behaves the same, except the popup doesn't open/instantly closes sometimes)

image

sway

image
image

qtile (refuses to open any popoup at all)

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants