3o14r473 / qmenu

Manage QubesOS via dmenu.
GNU General Public License v3.0
3 stars 3 forks source link
dmenu keyboard posix qubes suckless

qmenu

Collection of tools that utilize dmenu, a dynamic menu for X, to provide the user with a drop down menu for QubesOS administration.

List, start and stop your qubes, attach and detach connected devices, manage qube preferences, firewall rules and tags, switch per-qube keyboard layouts, take notes and screenshots, launch applications and more, very quickly with only the keyboard.

Usage

By default, dmenu is completely controlled by the keyboard. Items are selected using the arrow keys, Page Up, Page Down, Home, End and multiple shortcuts like Ctrl-p (up) and Ctrl-n (down).

Return selects the highlighted item, Ctrl+Return will let you select multiple items and Shift+Return will select the user input, instead of the highlighted item.

Consult the manpage of dmenu for more information.

qmenu-am

Launch domU and dom0 applications.

Usage: qmenu-am [OPTION]

 --all              List all applications
 --focused          List every application available to the qube of the focused window

qmenu-dm

List and manage your connected devices.

Usage: qmenu-dm [OPTION]

 --all              List all devices, select a running qube to attach/detach
 --focused          List all devices, attach/detach to/from the qube of the focused window

qmenu-vm

List, manage and configure your qubes.

Usage: qmenu-vm [OPTION] (MENU ITEM)

 --all              List all qubes
 --focused          Manage the qube of the focused window
 --halted           List halted qubes
 --paused           List paused qubes
 --running          List running qubes
 --qube=[QUBE]      Manage the given qube
 --tags=[TAG]       List all qubes marked with the given tag

MENU ITEM is optional and can be any item that is listed in the menu after a qube has been selected. For example, qmenu-vm --focused Shutdown will prompt you to shutdown the qube that the focused window belongs to and qmenu-vm --running Command lists all running qubes and launches into the command prompt for the selected one(s).

Screenshots

Screenshots taken via qmenu-vm are placed in $HOME/Pictures/, inside the relevant domU qube.

Configuration and appearance

Label color

Whenever relevant, the selected background color of dmenu will be defined by a qube label. Each qube label can be assigned a qmenu color in $HOME/.config/qmenu.conf, inside dom0, denoted as a hex triplet like this:

purple=#[RRGGBB]
blue=#[RRGGBB]
...
black=#[RRGGBB]
Try this example: ~~~ purple=#9a009a blue=#4363d8 gray=#bebebe green=#3cb44b yellow=#ffe119 orange=#f58231 red=#e6194b black=#000000 ~~~

Labels that have not been assinged a color will default to pure black.

qmenu tools use dmenu's -sb flag to send this information to it.

dmenu

Everything else, like display options, font size and other colors, is handled by dmenu, therefore extensive customization can be achieved by modifying it.

Alternatively, dmenu can be completely replaced and symlinked.

Qube Settings

Executing the Qube Settings application will launch the Qube Manager qube settings. This can be changed to launch qmenu-vm instead, which makes it possible to use qmenu-am to quickly launch into the qmenu-vm settings for a particular qube, without first listing a set of qubes or using the --focused option.

Simply create an executable file called qubes-vm-settings in /usr/local/bin/ inside dom0 with the following contents: qmenu-vm --qube="$1"

Dependencies

All qmenu tools are written in POSIX-compliant shell script and solely depend on the POSIX-compliant variants of the (nonqubes-)utilities they use.

dmenu and X11-tools can be replaced and symlinked.

qmenu-am * cut * dmenu * grep * _xdotool_ (For '--focused' option) * _xprop_ (For '--focused' option) *
Qubes tools * _qvm-prefs_ (For '--focused' option) * qvm-run

qmenu-dm * awk * cut * dmenu * grep * sed * sort * wc * _xdotool_ (For '--focused' option) * _xprop_ (For '--focused' option) *
Qubes tools * qvm-device * qvm-ls * qvm-prefs

qmenu-vm - dom0 * awk * cut * dmenu * grep * ls * _notify-send_ * sed * sleep * sort * wc * _xdotool_ (For '--focused' option) * _xprop_ (For '--focused' option) *
Qubes tools * qubes-log-viewer * qubes-prefs * qubes-vm-boot-from-device * qvm-appmenus * qvm-block * qvm-check * qvm-clone * qvm-create * qvm-devices * qvm-firewall * qvm-kill * qvm-ls * qvm-pause * qvm-pci * qvm-pool * qvm-prefs * qvm-remove * qvm-run * qvm-service * qvm-shutdown * qvm-start * qvm-tags * qvm-unpause * qvm-volume
  • domU
    • scrot (For taking screenshots)
    • setxkbmap (For switching keyboard layouts)

Installation

dmenu

Clone https://git.suckless.org/dmenu, compile it, copy the resulting binary to dom0, place it in /usr/local/bin/ and make it executable.

Alternatively, use the dom0 package manager to install dmenu from the repositories to quickly try it out:

[@dom0 ~]# qubes-dom0-update dmenu

Keep in mind that dmenu can only be configured before compilation, so if you wish to change default colors or have it centered in the middle of the screen and add a border (which changes color depending on qube label) to it for example, you will have to compile it yourself.

dmenu can be replaced with qubes-rofi, among others.

qmenu

qmenu is part of the official contributed package repository, the latest release can therefore be conviniently downloaded, verified and installed by the dom0 package manager:

[@dom0 ~]# qubes-dom0-update qubes-repo-contrib

[@dom0 ~]# qubes-dom0-update --clean qmenu

If you prefer to manually install the most recent version from the dev branch, you can follow these steps:

Warning: This repository, and therefore the dev branch, is not reviewed by the Qubes Team.

[@dispXXXX ~]$ git clone https://github.com/3o14r473/qmenu/

[@dom0 ~]$ qvm-run --pass-io --filter-escape-chars --no-color-output dispXXXX 'cat /home/user/qmenu/qmenu-XX' > /tmp/qmenu-XX

[@dom0 ~]# cp /tmp/qmenu-XX /usr/local/bin/

[@dom0 ~]# chmod 755 /usr/local/bin/qmenu-XX

For qmenu-vm, additionally:

[@dom0 ~]$ mkdir /tmp/qmenu_vm

[@dom0 ~]$ for file in $(qvm-run --pass-io --filter-escape-chars --no-color-output dispXXXX 'ls /home/user/qmenu/lib/qmenu_vm/'); do qvm-run --pass-io --filter-escape-chars --no-color-output dispXXXX "cat /home/user/qmenu/lib/qmenu_vm/$file" > /tmp/qmenu_vm/$file; done

[@dom0 ~]# cp -r /tmp/qmenu_vm/ /lib/

Author