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

Conversation

DemiMarie
Copy link

The widgets do not work under Wayland, so just use Xwayland for now.

If GTK somehow still connects to Wayland despite WAYLAND_DISPLAY being unset I will not be happy.

This is broken under KDE because of a bug in KDE (https://bugs.kde.org/show_bug.cgi?id=468085), but that can be fixed.

Copy link

codecov bot commented Nov 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.42%. Comparing base (2191a8c) to head (5d08789).
Report is 126 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #234      +/-   ##
==========================================
+ Coverage   93.23%   93.42%   +0.19%     
==========================================
  Files          57       57              
  Lines       10584    10997     +413     
==========================================
+ Hits         9868    10274     +406     
- Misses        716      723       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@marmarek
Copy link
Member

This doesn't seem to work. For some reason it still connects to Wayland anyway. It does it when I set XDG_SESSION_TYPE=x11 too. The only way I could find to force it to use X11 is chmod 0 /run/user/1000/wayland-0 (and then indeed widget seems to work), which ofc is not feasible.
When I say "seems to work", I mean the icon shows up, the menu shows up on click and is functional (looks to be quite reliable), but I can close the menu only with the "esc" key. Clicking on the widget again doesn't close it, and also clicking outsize of the menu doesn't close it either (that latter one is kinda expected, widgets from VMs behave the same way, for similar reason).

@marmarek
Copy link
Member

Defaulting to wayland-0 seems to be caused by https://gitlab.gnome.org/GNOME/gtk/-/commit/55ea6e4dcc4bbe6c7fc40c8e814ad2ee99b3b2e2 (if I got the URL right, right now it says HTTP 503...). Setting WAYLAND_DISPLAY to an empty value seems to work better. But still, the issue with closing the menu remains. Note that closing the menu by clicking on the widget the second time works fine with nm-applet, so it's likely not directly a KDE issue but more like an interaction of some more components. But with real Xorg, widgets work in this regard just fine...

@qubesos-bot
Copy link

qubesos-bot commented Nov 25, 2024

OpenQA test summary

Complete test suite and dependencies: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.3&build=2024112600-4.3&flavor=pull-requests

Test run included the following:

New failures, excluding unstable

Compared to: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.3&build=2024111705-4.3&flavor=update

  • system_tests_gui_tools

    • qui_widgets_domains: unnamed test (unknown)
    • qui_widgets_domains: Failed (test died)
      # Test died: no candidate needle with tag(s) 'qui-domains-open' mat...
  • system_tests_kde_gui_interactive

    • gui_keyboard_layout: wait_serial (wait serial expected)
      # wait_serial expected: "echo -e '[Layout]\nLayoutList=us,de' | sud...
  • system_tests_guivm_vnc_gui_interactive

    • guivm_manager: unnamed test (unknown)
    • guivm_manager: Failed (test died)
      # Test died: no candidate needle with tag(s) 'menu-qubes-tools' mat...
  • system_tests_basic_vm_qrexec_gui@hw1

    • startup: unnamed test (unknown)
    • startup: Failed (test died)
      # Test died: no candidate needle with tag(s) 'nm-connection-establi...
  • system_tests_gui_tools@hw7

    • qui_widgets_domains: unnamed test (unknown)
    • qui_widgets_domains: Failed (test died)
      # Test died: no candidate needle with tag(s) 'qui-domains-open' mat...

Failed tests

13 failures
  • system_tests_gui_tools

    • qui_widgets_domains: unnamed test (unknown)
    • qui_widgets_domains: Failed (test died)
      # Test died: no candidate needle with tag(s) 'qui-domains-open' mat...
  • system_tests_pvgrub_salt_storage

    • [unstable] TC_41_HVMGrub_fedora-40-xfce: test_000_standalone_vm (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 120 seco...

    • [unstable] TC_41_HVMGrub_fedora-40-xfce: test_010_template_based_vm (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 120 seco...

  • system_tests_kde_gui_interactive

    • gui_keyboard_layout: wait_serial (wait serial expected)
      # wait_serial expected: "echo -e '[Layout]\nLayoutList=us,de' | sud...

    • gui_keyboard_layout: Failed (test died)
      # Test died: command 'test "$(cd ~user;ls e1*)" = "$(qvm-run -p wor...

  • system_tests_basic_vm_qrexec_gui_zfs

    • switch_pool: Failed (test died)
      # Test died: command 'dnf install -y ./zfs-release.rpm' failed at /...
  • system_tests_guivm_vnc_gui_interactive

    • guivm_manager: unnamed test (unknown)
    • guivm_manager: Failed (test died)
      # Test died: no candidate needle with tag(s) 'menu-qubes-tools' mat...
  • system_tests_basic_vm_qrexec_gui@hw1

    • startup: unnamed test (unknown)
    • startup: Failed (test died)
      # Test died: no candidate needle with tag(s) 'nm-connection-establi...
  • system_tests_gui_tools@hw7

    • qui_widgets_domains: unnamed test (unknown)
    • qui_widgets_domains: Failed (test died)
      # Test died: no candidate needle with tag(s) 'qui-domains-open' mat...

Fixed failures

Compared to: https://openqa.qubes-os.org/tests/119126#dependencies

2 fixed
  • system_tests_extra

    • TC_00_QVCTest_whonix-gateway-17: test_010_screenshare (failure)
      ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^... AssertionError: 0 == 0
  • system_tests_audio@hw1

Unstable tests

  • system_tests_pvgrub_salt_storage

    TC_41_HVMGrub_debian-12-xfce/test_000_standalone_vm (1/5 times with errors)
    • job 115648 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 120 seco...
    TC_41_HVMGrub_fedora-40-xfce/test_000_standalone_vm (1/5 times with errors)
    • job 115648 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 120 seco...
    TC_41_HVMGrub_debian-12-xfce/test_010_template_based_vm (1/5 times with errors)
    • job 115648 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 120 seco...
    TC_41_HVMGrub_fedora-40-xfce/test_010_template_based_vm (2/5 times with errors)
    • job 115078 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 120 seco...
    • job 115648 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 120 seco...
  • system_tests_usbproxy

    TC_20_USBProxy_core3_fedora-40-xfce/test_070_attach_not_installed_front (1/5 times with errors)
    • job 117582 NameError: name 'santizied_stderr' is not defined
  • system_tests_network_updates

    VmUpdates_fedora-40-xfce/test_000_simple_update (1/5 times with errors)
    • job 116867 AssertionError: 1 not found in [0, 100] : dnf clean all; dnf check-...
    VmUpdates_debian-12-xfce/test_020_updates_available_notification (1/5 times with errors)
    • job 117610 subprocess.CalledProcessError: Command '/usr/lib/qubes/upgrades-sta...
    VmUpdates_debian-12-xfce/test_121_updates_available_notification_qubes_vm_update_cli (1/5 times with errors)
    • job 116867 subprocess.CalledProcessError: Command '/usr/lib/qubes/upgrades-sta...
  • system_tests_basic_vm_qrexec_gui_zfs

    TC_00_Basic/test_120_start_standalone_with_cdrom_dom0 (1/5 times with errors)
    • job 109480 AssertionError: 1 != 0 : b'Timeout waiting for dom0:loop6 device to...
  • system_tests_audio

    TC_20_AudioVM_Pulse_fedora-40-xfce/test_223_audio_play_hvm (1/5 times with errors)
    • job 115623 libvirt.libvirtError: internal error: libxenlight failed to create ...
    TC_20_AudioVM_Pulse_debian-12-xfce/test_224_audio_rec_muted_hvm (1/5 times with errors)
    • job 115623 libvirt.libvirtError: internal error: libxenlight failed to create ...
    TC_20_AudioVM_Pulse_whonix-workstation-17/test_224_audio_rec_muted_hvm (1/5 times with errors)
    • job 115623 libvirt.libvirtError: internal error: libxenlight failed to create ...
    TC_20_AudioVM_Pulse_debian-12-xfce/test_225_audio_rec_unmuted_hvm (1/5 times with errors)
    • job 115623 libvirt.libvirtError: internal error: libxenlight failed to create ...
    TC_20_AudioVM_Pulse_whonix-workstation-17/test_225_audio_rec_unmuted_hvm (1/5 times with errors)
    • job 115623 libvirt.libvirtError: internal error: libxenlight failed to create ...
    TC_20_AudioVM_PipeWire_whonix-workstation-17/test_251_audio_playback_audiovm_pipewire_late_start (1/5 times with errors)
    • job 115623 AssertionError: too short audio, expected 10s, got 9.34507936507936...
    TC_20_AudioVM_Pulse_debian-12-xfce/test_252_audio_playback_audiovm_switch_hvm (1/5 times with errors)
    • job 115623 libvirt.libvirtError: internal error: libxenlight failed to create ...
    TC_20_AudioVM_Pulse_fedora-40-xfce/test_252_audio_playback_audiovm_switch_hvm (1/5 times with errors)
    • job 115623 libvirt.libvirtError: internal error: libxenlight failed to create ...
    TC_20_AudioVM_Pulse_whonix-workstation-17/test_252_audio_playback_audiovm_switch_hvm (1/5 times with errors)
    • job 115623 libvirt.libvirtError: internal error: libxenlight failed to create ...
    TC_20_AudioVM_PipeWire_fedora-40-xfce/test_260_audio_mic_enabled_switch_audiovm (2/5 times with errors)
    • job 116847 AssertionError: too short audio, expected 10s, got 0.00013605442176...
    • job 117586 AssertionError: too short audio, expected 10s, got 0.00013605442176...
    TC_20_AudioVM_PipeWire_whonix-workstation-17/test_260_audio_mic_enabled_switch_audiovm (1/5 times with errors)
    • job 115623 AssertionError: too short audio, expected 10s, got 9.05353741496598...
  • system_tests_audio@hw1

    TC_20_AudioVM_Pulse_fedora-40-xfce/test_223_audio_play_hvm (1/5 times with errors)
    • job 115623 libvirt.libvirtError: internal error: libxenlight failed to create ...
    TC_20_AudioVM_Pulse_debian-12-xfce/test_224_audio_rec_muted_hvm (1/5 times with errors)
    • job 115623 libvirt.libvirtError: internal error: libxenlight failed to create ...
    TC_20_AudioVM_Pulse_whonix-workstation-17/test_224_audio_rec_muted_hvm (1/5 times with errors)
    • job 115623 libvirt.libvirtError: internal error: libxenlight failed to create ...
    TC_20_AudioVM_Pulse_debian-12-xfce/test_225_audio_rec_unmuted_hvm (1/5 times with errors)
    • job 115623 libvirt.libvirtError: internal error: libxenlight failed to create ...
    TC_20_AudioVM_Pulse_whonix-workstation-17/test_225_audio_rec_unmuted_hvm (1/5 times with errors)
    • job 115623 libvirt.libvirtError: internal error: libxenlight failed to create ...
    TC_20_AudioVM_PipeWire_whonix-workstation-17/test_251_audio_playback_audiovm_pipewire_late_start (1/5 times with errors)
    • job 115623 AssertionError: too short audio, expected 10s, got 9.34507936507936...
    TC_20_AudioVM_Pulse_debian-12-xfce/test_252_audio_playback_audiovm_switch_hvm (1/5 times with errors)
    • job 115623 libvirt.libvirtError: internal error: libxenlight failed to create ...
    TC_20_AudioVM_Pulse_fedora-40-xfce/test_252_audio_playback_audiovm_switch_hvm (1/5 times with errors)
    • job 115623 libvirt.libvirtError: internal error: libxenlight failed to create ...
    TC_20_AudioVM_Pulse_whonix-workstation-17/test_252_audio_playback_audiovm_switch_hvm (1/5 times with errors)
    • job 115623 libvirt.libvirtError: internal error: libxenlight failed to create ...
    TC_20_AudioVM_PipeWire_fedora-40-xfce/test_260_audio_mic_enabled_switch_audiovm (2/5 times with errors)
    • job 116847 AssertionError: too short audio, expected 10s, got 0.00013605442176...
    • job 117586 AssertionError: too short audio, expected 10s, got 0.00013605442176...
    TC_20_AudioVM_PipeWire_whonix-workstation-17/test_260_audio_mic_enabled_switch_audiovm (1/5 times with errors)
    • job 115623 AssertionError: too short audio, expected 10s, got 9.05353741496598...
  • system_tests_basic_vm_qrexec_gui_btrfs

    TC_30_Gui_daemon/test_002_clipboard_300k (1/5 times with errors)
    • job 116856 : Clipboard copy operation failed - content...

@DemiMarie
Copy link
Author

Is it necessary for clicking outside the menu to close the menu, or is it good enough to require clicking again on the widget? The latter might be fixable in the menu itself, by closing the menu when the widget is clicked.

The widgets do not work under Wayland, so just use Xwayland for now.

If GTK somehow still connects to Wayland despite WAYLAND_DISPLAY being
unset I will not be happy.
@marmarta
Copy link
Member

Is it necessary for clicking outside the menu to close the menu, or is it good enough to require clicking again on the widget? The latter might be fixable in the menu itself, by closing the menu when the widget is clicked.

It is necessary, it is a dom0 widget, it should not have the bad behavior of the vm widgets (which also should work better wrt to closing, but that's out of scope here).

This will hopefully allow it to be dismissed by clicking elsewhere.
@DemiMarie
Copy link
Author

Is it necessary for clicking outside the menu to close the menu, or is it good enough to require clicking again on the widget? The latter might be fixable in the menu itself, by closing the menu when the widget is clicked.

It is necessary, it is a dom0 widget, it should not have the bad behavior of the vm widgets (which also should work better wrt to closing, but that's out of scope here).

Can you try my most recent commit? That dismisses the menu when it loses focus.

@marmarta
Copy link
Member

I don't think this addresses the root cause, which is some wayland failure - this works correctly under X and so, from what you said previously, should work correctly under XWayland. I don't think we want to patch the whole world, if it requires additional workarounds like this (which BTW duplicate what the menu generally does on its own) I don't think this is a good solution.

@@ -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.

@@ -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.

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

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

Successfully merging this pull request may close these issues.

4 participants