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

widgets: fall back to Xwayland #234

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions qui/tray/domains.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,10 @@ def update_stats(self, memory_kb, cpu_usage):
class DomainTray(Gtk.Application):
''' A tray icon application listing all but halted domains. ” '''

def hide_menu(self, _unused_event):
self.tray_menu.hide()
return False

def __init__(self, app_name, qapp, dispatcher, stats_dispatcher):
super().__init__()
self.qapp = qapp
Expand All @@ -537,6 +541,7 @@ def __init__(self, app_name, qapp, dispatcher, stats_dispatcher):
_('<b>Qubes Domains</b>\nView and manage running domains.'))

self.tray_menu = Gtk.Menu()
self.widget_icon.connect('focus-out-event', self.hide_menu)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nov 25 20:30:55.566508 dom0 widget-wrapper[3696]: Traceback (most recent call last):
Nov 25 20:30:55.567032 dom0 widget-wrapper[3696]:   File "/usr/bin/qui-domains", line 33, in <module>
Nov 25 20:30:55.567032 dom0 widget-wrapper[3696]:     sys.exit(load_entry_point('qui==0.1', 'gui_scripts', 'qui-domains')())
Nov 25 20:30:55.567032 dom0 widget-wrapper[3696]:              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
Nov 25 20:30:55.567032 dom0 widget-wrapper[3696]:   File "/usr/lib/python3.13/site-packages/qui/tray/domains.py", line 927, in main
Nov 25 20:30:55.567032 dom0 widget-wrapper[3696]:     app = DomainTray(
Nov 25 20:30:55.567032 dom0 widget-wrapper[3696]:         'org.qubes.qui.tray.Domains', qapp, dispatcher, stats_dispatcher)
Nov 25 20:30:55.567032 dom0 widget-wrapper[3696]:   File "/usr/lib/python3.13/site-packages/qui/tray/domains.py", line 544, in __init__
Nov 25 20:30:55.567032 dom0 widget-wrapper[3696]:     self.widget_icon.connect('focus-out-event', self.hide_menu)
Nov 25 20:30:55.567032 dom0 widget-wrapper[3696]:     ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 25 20:30:55.567032 dom0 widget-wrapper[3696]: TypeError: <Gtk.StatusIcon object at 0x722941d2e000 (GtkStatusIcon at 0x5e0a8c5d4f30)>: unknown signal name: focus-out-event
Nov 25 20:30:55.597149 dom0 widget-wrapper[3695]: exiting with 1

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should work if you connect it to the self.tray_menu, but I only tested it on X, not on Wayland.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.widget_icon.connect('focus-out-event', self.hide_menu)
self.tray_menu.connect('focus-out-event', self.hide_menu)

this change to be exact, looks like it does not break anything on X at least.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also this would still require some sort of hacky "hide if visible" modification to the show_menu function, otherwise I can get it funnily stuck on X

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On our first test it does not work correctly at all in Wayland (the menu does not hide). Probably some other event? Or something.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe this is a direction to go to? https://stackoverflow.com/a/3687273

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nvm, looks like another thing that is broken under Wayland


self.icon_cache = IconCache()

Expand Down
11 changes: 11 additions & 0 deletions qui/widget-wrapper
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ if ! [ -e /etc/qubes-release ] && ! [ -e /var/run/qubes-service/guivm ]; then
exit 0
fi

if [[ -z "${DISPLAY:+test}" ]]; then
if [[ -n "${WAYLAND_DISPLAY:+test}" ]]; then
echo "The widgets require Xwayland, but it is not available."
else
echo "DISPLAY empty or unset"
fi >&2
exit 1
fi

export WAYLAND_DISPLAY=

"$@"

exit_code=$?
Expand Down