Is it possible to trigger Qubes widget menus with a keyboard shortcut?

E.g. the Qubes widget with the qube list or the devices widget…they can be navigated via the keyboard’s arrow keys once the menus are opened by clicking on them with the mouse (and Enter also works to activate the selected item), but how can I get the menus to open without using the mouse/touchpad?

Edit: one thing that sort of works is something like xdotool mousemove 1685 15 click 1 mousemove restore, but only if the widget icons are always in the same place, so I’ll clarify that I’m looking for a less hacky way, if possible.

Okay actually I think that solution works pretty well, after all :smile:

If the top panel is set up such that nothing changes to the right of the notification area then the device and qubes widgets should actually stay in place all the time, unless something is full-screen (not typical for QubesOS).

I’m using sh -c 'sleep 0.1 && xdotool mousemove 1685 15 click 1 mousemove restore' as the command for the shortcut in the Keyboard app for one of the widgets…
Edit: and of course I missed a corner case: the updater icon will shift devices and qubes widgets to the left; this can easily be fixed, however, by modifying the “Notification Area” item order in the Panel menu.

Nevertheless, if anyone has a solution that will trigger a specific widget’s menu directly, please post and I’ll mark that as the solution instead.

I asked Marta about this recently, and she said that you can assign an Xfce keyboard shortcut to the new app menu in 4.2. The new app menu is actually a widget that doesn’t fully replace Xfce’s own app menu, so you’ll want to use the command for the new app menu as the command that gets executed when the keyboard shortcut of your choosing is pressed. (Sorry, I don’t know what the command is off the top of my head.)

2 Likes

The command is qubes-app-menu. I can never remember these either, but this helps to narrow it down:

[user@dom0 ~]$ qubes-<TAB><TAB>
qubes-app-menu             qubes-policy
qubes-backup               qubes-policy-admin
qubes-backup-restore       qubes-policy-editor
qubes-bug-report           qubes-policy-editor-gui
qubes-create               qubes-policy-lint
qubes-dom0-update          qubes-prefs
qubes-fwupdmgr             qubes-prepare-vm-kernel
qubes-global-config        qubes-qube-manager
qubes-guid                 qubes-template-manager
qubes-guivm-session        qubes-update-gui
qubes-hcl-report           qubes-vm-boot-from-device
qubes-input-sender         qubes-vm-clone
qubes-input-trigger        qubes-vm-create
qubes-log-viewer           qubes-vm-settings
qubes-new-qube             qubes-vm-update
2 Likes

To trigger the already running instance of qubes-app-menu (which is faster than launching a new one):

3 Likes

Cool, that’ll help with Qubes 4.2, especially once the widgets are fully integrated into the app-menu.

In the meantime, however, I tried this:

gdbus call --session --dest org.qubes.qui.tray.Devices --object-path "/org/qubes/qui/tray/Devices" --method org.freedesktop.Application.Activate "{}"

to no avail (returns only ‘()’). Maybe I need to call a different method? Or is this not supposed to work anyway for the existing widgets?

Oops, I missed that your question was about the other widgets. Those don’t seem to be DBus activatable.

Try e.g.

xdotool search --onlyvisible --name qui-domains mousemove --window %1 0 0 click 1

But mousemove relative to a --window can’t be chained with mousemove restore for some reason. You might want to extract the position from getwindowgeometry instead, and then do an absolute mousemove + click + mousemove restore.

Oh.

Maybe there’s some way to interface with the xfce4-panel systray that swallowed the icons? I haven’t looked.

1 Like

Thanks! Yeah I don’t know how to interface with the panel Notification Area either, but your suggestion for getting the click to land on the widget is more robust, so I’m choosing it as the solution.

For anyone interested, I created a dom0 script widget-click.sh in home with content

#!/bin/bash
sleep 0.1
read -r x y <<<$(xdotool search --onlyvisible --name qui-$1 getwindowgeometry | egrep -o 'Position: [0-9]+,[0-9]+ ' | tr ',' ' ' | tr -dc '0-9 ')
xdotool mousemove $x $y click 1 mousemove restore

and am calling it with a keyboard shortcut using either devices or domains as an argument.

1 Like