Quick Quality-of-Life Improvements

A post was split to a new topic: Improve your workflow using Zenity-based GUI

I really appreciate the work you’ve put into this solution and this post. I’m sure it’ll come in useful for some so it deserves to be its own post.

As written in the introduction, this thread is for quick solutions that only take a few line of coding. The source code you posted, while it can solve a lot of problems, goes beyond a few lines and therefore doesn’t fit into the scope of this post. The entry that explains your idea would need to be multiple times longer than what everyone else’s entries are.

I will spin this off into its own thread so it gets more recognition. Be sure to let me know what the title should be.

3 Likes

thats fine…

1 Like

Post can’t be empty

2 Likes

Can be simplified to:
myqube="sys-usb"; qvm-shutdown --quiet --force --wait "$myqube" ; qvm-start "$myqube"

4 Likes

We already have an entry for keeping sys-usb alive which involves crontab.

I can see why people would want to use your version but I don’t want to have two entries that do essentially the same thing. The crontab version shouldn’t need inputting every boot, so I’m partial to that one.

Let’s put it to a vote

  • Prevent loss of control from sys-usb shutdown - [dom0] crontab -e, then enter * * * * * qvm-start --skip-if-running sys-usb > /dev/null 2>&1 and save. Reverse the change by commenting out that line
  • Prevent loss of control from sys-usb shutdown - [dom0] myqube="sys-usb"; qvm-shutdown --quiet --force --wait "$myqube" ; qvm-start "$myqube". Apply only when needed
0 voters

Poll closes June 15

These two solve different problems.

One of them creates the problem of starting sys-usb at boot, even when ‘qubes.skip_autostart’ is set. That can be extremely annoying, if sys-usb fails to start correctly, although I understand that some people might be prepared to take the risk. I tried it once, and… “Never again !”

1 Like

As far as I know I actually originated using crontab to restart sys-usb, and yes it DID burn me when I had to boot without it and it started up.

I didn’t abandon the method, but decided to make the check-and-restart interval every five minutes, instead of every minute. That gives me time to log in and edit the crontab. I’m willing to deal with that in extraordinary circumstances (which having to run without sys-usb is–an extraordinary circumstance).

1 Like

Hi, i’m quite new to linux and even newer to Qubes, so i’m hoping i can get some thorough guidance on how to make these two scripts as I can’t seem to figure it out.

I’ve followed the steps as described. I’ve made a .sh file in /user/bin/, they are executable (double checked with $ls -l), they aren’t in DOS or MAC format, and i’ve copied the code directly from the quoted text.

after that, I open Keyboard commands in dom0, pick the corresponding shell script, and punch in a keyboard command. However when i try it, nothing happens.

When i run the scripts in terminal, this is the error i get for the halt-vm-by-window.sh [emphasis own]:

qubespad@dom0 bin]$ ./halt-vm-by-window.sh
usage: qvm-run [–verbose] [–quiet] [–help] [–user USER] [–autostart]
[–no-autostart] [–pass-io] [–localcmd COMMAND] [–gui]
[–no-gui] [–colour-output COLOUR] [–colour-stderr COLOUR]
[–no-colour-output] [–no-colour-stderr]
[–filter-escape-chars] [–no-filter-escape-chars] [–service]
[–no-shell] [–dispvm [BASE_APPVM] | --all]
[–exclude EXCLUDE]
[VMNAME] COMMAND …
qvm-run: error: no such domain: ‘_QUBES_VMNAME:’
usage: qvm-run [–verbose] [–quiet] [–help] [–user USER] [–autostart]
[–no-autostart] [–pass-io] [–localcmd COMMAND] [–gui]
[–no-gui] [–colour-output COLOUR] [–colour-stderr COLOUR]
[–no-colour-output] [–no-colour-stderr]
[–filter-escape-chars] [–no-filter-escape-chars] [–service]
[–no-shell] [–dispvm [BASE_APPVM] | --all]
[–exclude EXCLUDE]
[VMNAME] COMMAND …
qvm-run: error: no such domain: ‘_QUBES_VMNAME:’
usage: qvm-shutdown [–verbose] [–quiet] [–help] [–all] [–exclude EXCLUDE]
[–wait] [–timeout TIMEOUT] [–force] [–dry-run]
[VMNAME …]
qvm-shutdown: error: no such domain: ‘_QUBES_VMNAME:’

Can someone help me troubleshoot this please?

You have not assigned a shortcut to the script?
Do not run them as scripts from a terminal

I never presume to speak for the Qubes team.
When I comment in the Forum I speak for myself.

I have assigned
a shortcut but it hasn’t run. I mentioned how i did it in my initial n post and i don’t think i missed any steps there. Was i meant to restart dom0 or qubes after assigning them?

It’s not running shell scripts in terminal a qubes thing or a Linux thing?

I’ve closed the polls. Since no one bothered to vote, I’ll stick with your crontab version but update it to 5 min intervals.

dark filemanager and info boxes in Fedora appVMs, with:

xfconf-query -c xsettings -p /Net/ThemeName -s “Adwaita-dark”

1 Like

I voted with a comment… the 3rd option would be “both”. I could vote for that.

Works fine for me, this looks for the pid file of qubesdb in /run/qubes/qubesdb.QUBE_NAME.pid, if that file changes (which is the case on deletion), it runs qvm-start to run it again. Slightly tested, it worked fine for me. Note that this can’t start the qube the first time, but it should not be a problem as Qubes OS handles this.

In dom0 create /etc/systemd/system/always-on-qube.path

[Path]
PathChanged=/run/qubes/qubesdb.sys-usb.pid

[Install]
WantedBy=multi-user.target

Create /etc/systemd/system/always-on-qube.service

[Service]
ExecStart=-/usr/bin/qvm-start sys-usb
Type=oneshot

Start the listener and make it the default at boot time:

systemctl enable --now always-on-qube.path
3 Likes

Added; thanks.

Since dom0 is also Fedora, this should work there too? Don’t have time to check.

This is the most elegant solution so far, so I’m going to adopt it. Thanks!

1 Like

I’ll make a community guide out of it

3 Likes

Script that can be used as a shortcut to open the qube settings for the active window

#!/bin/bash

CUR_WIN_ID=`xdotool getwindowfocus`
CUR_VM=`xprop _QUBES_VMNAME -id $CUR_WIN_ID |cut -d \" -f2`

qubes-vm-settings $CUR_VM

exit 0
2 Likes

Added; thanks

We have a lot of “map to shortcut” suggestions. To lighten everyone’s loads, we should add suggested key bindings so people won’t have to figure out how to make around ten unique bindings that aren’t commonly used.

The format goes as follows: Someone makes a suggestion, or shares what they currently use, and if you see a key binding that clashes with something you use, speak up and we’ll try again until we get a workable set. Bonus points for making a coherent and intuitive set (e.g. all start with alt, and things that escape use esc).

I’ll start: For “shut down selected window’s VM”, alt + esc.

2 Likes