Quick Quality-of-Life Improvements

I’m using the super key (Windows key) for shortcuts that use the active window, but it could be the alt key for people without the super key.

super + s, opens setting
super + t, opens terminal
super + i, opens terminal in template (install)

5 Likes

We also have a lot of suggestions that use the same basic template.
Identify the active window -> do something.
Does this make sense? Wouldnt it be better to highlight that, and then
under subcategory put the various implementations.
(I should make it clear that I have no idea how this thread looks in
practice.)

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

1 Like

I too use the Super key for many such shortcuts - the same super+s and
super+t bindings.

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

4 Likes

I’m totally stealing this for opening qube’s template’s salt formula

2 Likes

@unman The main post relies heavily on markdown, so I’m sure it’ll look strange to you via email. I’d take a screenshot and post it, but I’m not even sure if images are included in the email posts (or if you’ve enabled images in your emails).

There’s some repetition since there’s an emphasis on readability and ease of use. Users should be able to spot something they like and have everything they need to implement it without chasing down references. I think we have a good balance between ease of use and density, and won’t have to go full DRY (Do Not Repeat yourself).

 

So right now the key set is super + s, t, i, esc. There should be some shortcut entries without anything but I don’t have time right now.

Will suggest users without super to substitute with alt where possible

Do the super combinations above clash with anything anyone knows of?

1 Like

Images are always an issue for me,tbh.

Thanks for that. I just thought there would be a space where someone
could say “I can use that to do…”

In KDE, I dont think there are significant clashes, or at least not in
my workflow. Users are always warned of clash with existing shortcuts.
Meta+t - toggle tiling

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

Reusing this, it’s easy to open the file manager, whatever the template is:

#!/bin/sh

ID=`xdotool getwindowfocus`
QUBE=`xprop _QUBES_VMNAME -id $ID | cut -f 2 -d\"`

if [[ "$QUBE" == "$_QUBES_VMNAME:  not found." ]]; then
    exit
else
    qvm-run "$QUBE" /usr/bin/xdg-open /home/user &
fi
4 Likes

Added; thanks

Just want to double check that this works with typical installations for both Debian and Fedora.

Also, I assigned super + f to this, and updated relevant entries to include suggested shortcuts.

1 Like

Update for R4.3

The contents of this thread have been verified for R4.2 only.

There’s a small chance some tips may not work with R4.3 and above.

If you encounter any problems, please let us know!

At the moment of writing qvm-device DEVICE_CLASS assign / unassign throws an error if the system is already in the desired state. This gets in the way because there is no native device module for configuration management systems. You can trap the error and parse the message:

#!/usr/bin/env bash

(
    set -o errtrace
    set -o errexit
    set -o nounset

    action="$2"
    log=""

    parse_error() {
        if { 
            [[ "$action" == 'assign' ]] && [[ "$@" =~ .*(already assigned).* ]] 
        } || { 
            [[ "$action" == 'unassign' ]] && [[ "$@" =~ .*(not assigned).* ]] 
        }
        then
            echo "System is in the desired state"
            exit 0
        else
            echo "$@" >&2
            exit 1
        fi
    }
    trap 'parse_error "$log"' ERR

    log="$(qvm-device "$@" 2>&1)"
)

This is a hackjob, real module should be written instead. Note that you must specify device class for the script to work.

Asking the user for confirmation might be a better alternative in some cases. Luckily, Qubes OS has PyQt installed in dom0 by default, it can be used to make a simple confirmation dialog. Here’s what I ended up with:

#!/usr/bin/python3

import sys
from PyQt6.QtWidgets import QApplication
from PyQt6.QtWidgets import QDialog
from PyQt6.QtWidgets import QVBoxLayout
from PyQt6.QtWidgets import QHBoxLayout
from PyQt6.QtWidgets import QLabel
from PyQt6.QtWidgets import QPushButton

class ConfirmationDialog(QDialog):
    def __init__(
            self,
            title=None,
            message=None,
            parent=None
        ):
        super().__init__(parent)
        self.setWindowTitle("Confirm action" if title is None else title)
        label = QLabel("Are you sure?" if message is None else message)
        label.setWordWrap(True)

        layout = QVBoxLayout()
        layout.addWidget(label)

        self.setModal(False)
        self.setMinimumSize(1,1)

        button_layout = QHBoxLayout()

        yes = QPushButton("&Yes")
        no  = QPushButton("&No")

        yes.clicked.connect(self.accept)
        no.clicked.connect(self.reject)

        button_layout.addWidget(yes)
        button_layout.addWidget(no)

        layout.addLayout(button_layout)
        self.setLayout(layout)

def main():
    try:
        if len(sys.argv) == 3:
            title = sys.argv[1]
            message = sys.argv[2]
        else:
            sys.stderr.write(
                "Bad arguments were given. Usage:\n" +
                "{} TITLE MSG\n".format(sys.argv[0]) +
                "But my argument list is: {}\n".format(str(sys.argv[1:]))
            )
            return 3

        app = QApplication([])
        dialog = ConfirmationDialog(title,message)
        result = dialog.exec()
        app.exit()

        if result == QDialog.DialogCode.Accepted:
            return 0
        elif result == QDialog.DialogCode.Rejected:
            return 1
        else:
            return 2
    except:
        sys.stderr.write("{} ERROR: something went very wrong\n".format(sys.argv[0]))
        return 4

if __name__ == "__main__":
    sys.exit(main())

In the script:

confirm "Confirm shutdown" "Shut $target_vm down?" \
&& qvm-shutdown --wait "$target_vm"

By default PyQt’s confirmation dialog uses Esc for no and Enter for yes, good for keyboard-centric workflow.

3 Likes

I’m using a small py script that automatically pauses (qvm-pause and qvm-unpause) Qube’s if they are not focused in i3wm (with a list of exceptions of VMs for which this doesnt apply). This means half of my VMs don’t eat any ressources. Quite handy!

2 Likes

Is the “Open file manager” still working on 4.3? I couldn’t get it to work. I don’t know where the mistake was. The content of the the executable file is correct. I ran:

chmod +x /bin/open_file_manager.sh

Then added the keyboard shortcut Super+f to

sh /bin/open_file_manager.sh

Nothing happens when type Super+f.

Is there a difference between “-f 2” placement?

CUR_VM=xprop _QUBES_VMNAME -id $CUR_WIN_ID | cut -d \" -f 2
QUBE=xprop _QUBES_VMNAME -id $ID | cut -f 2 -d\"

This script work fine:

#!/bin/sh

ID=xdotool getwindowfocus
QUBE=xprop _QUBES_VMNAME -id $ID | cut -f 2 -d\"

if [[ “$QUBE” == “$_QUBES_VMNAME:  not found.” ]]; then
exit
else
qvm-run “$QUBE” /usr/bin/xdg-open /home/user &
fi 

Thanks. I still have not been able to get it to work. Should the keyboard shortcut Super+f command be:

sh /bin/open_file_manager.sh

or

/bin/open_file_manager.sh

Or something else?

I tested both and neither are working.

This is my open_file_manager.sh

#!/bin/sh

ID=“xdotool getwindowfocus”
QUBE=‘xprop _QUBES_VMNAME -id $ID | cut -f 2 -d"’

if [[ “$QUBE” == “$_QUBES_VMNAME: not found.” ]]; then
exit
else
qvm-run “$QUBE” /usr/bin/xdg-open /home/user &
fi

I use a mapping to the somewhat more basic:

#!/usr/bin/bash
ID=$(xdotool getwindowfocus)
QUBE=$(xprop _QUBES_VMNAME -id $ID|cut -f2 -d\" )
if [[ "$QUBE" == "_QUBES_VMNAME:  not found." ]]; then
  exit
else
  qvm-shutdown --force $QUBE 
fi

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

@unman THANK YOU! it worked!! This is what worked:

#!/bin/sh

ID=$(xdotool getwindowfocus)
QUBE=$(xprop _QUBES_VMNAME -id $ID|cut -f2 -d\" )
if [[ "$QUBE" == "$_QUBES_VMNAME: not found." ]]; then
   exit
else
   qvm-run $QUBE /usr/bin/xdg-open /home/user
fi

should be:

#!/bin/sh
ID=$(xdotool getwindowfocus)
QUBE=$(xprop _QUBES_VMNAME -id "$ID" | cut -f 2 -d '"')

if [ "$QUBE" = "$_QUBES_VMNAME:  not found." ]; then
    exit
else    
    qvm-run "$QUBE" /usr/bin/xdg-open /home/user &
fi
setup-appvm-shortcuts-qubes.sh
#!/usr/bin/env bash

#######################################################################
# File Name    : setup-appvm-shortcuts-qubes.sh
# Description  : This script adds keyboard shortcuts in the current
#                focused qube using xdotool and xprop in Qubes Xfce.
# Dependencies : xdotool, xprop, xfconf-query
# Usage        : • Transfer this script from appvm to dom0 with:
#                [user@dom0 ~]$ qvm-run -p appvm 'cat ~/setup-appvm-shortcuts-qubes.sh' > ~/setup-appvm-shortcuts-qubes.sh
#                • Make the script executable with:
#                [user@dom0 ~]$ chmod +x setup-appvm-shortcuts-qubes.sh
#                • Run the script with:
#                [user@dom0 ~]$ bash ~/setup-appvm-shortcuts-qubes.sh
# Author       : Me, the bois and the girls: unman, tasket, solene
# License      : Free of charge, no warranty
# Last edited  : 2026-08-22
#######################################################################

# Safety check
set -eu

# Configuration (format: "shortcut:application")
SHORTCUTS="
<Super>f:firefox-esr
<Super>b:librewolf
<Super>h:thunderbird
<Super>t:xfce4-terminal
<Super><Shift>t:terminal-root
<Super>e:file-manager
<Ctrl><Shift>q:halt-vm
"

# Verify dom0
if [ "$(hostname)" != "dom0" ]; then
    echo "ERROR: This script should only run in dom0!" >&2
    exit 1
fi

# Check if xfconf-query is available
if ! command -v xfconf-query > /dev/null; then
    echo "ERROR: xfconf-query is not installed. This script requires Xfce." >&2
    exit 1
fi

# Create generic launcher script for an application
create_launcher_script() {
  local app="$1"
  local script_path="/usr/local/bin/launch-in-focused-${app}"

  sudo tee "$script_path" > /dev/null << EOF
#!/bin/sh

ID=\$(xdotool getwindowfocus)
QUBE=\$(xprop _QUBES_VMNAME -id "\$ID" | cut -f 2 -d '"')

if [ "\$QUBE" = "_QUBES_VMNAME:  not found." ] || [ -z "\$QUBE" ]; then
  exit
else
  qvm-run "\$QUBE" "/usr/bin/$app" &
fi
EOF

  sudo chmod +x "$script_path"
  echo "Created launcher: $script_path"
}

# Create Qubes specialized scripts
create_specialized_scripts() {
  # Terminal script
  local terminal_script="/bin/open_terminal.sh"
  sudo tee "$terminal_script" > /dev/null << 'EOF'
#!/bin/bash

ID=$(xdotool getwindowfocus)
QUBE=$(xprop _QUBES_VMNAME -id "$ID" | cut -f 2 -d '"')

if [[ "$QUBE" == "_QUBES_VMNAME:  not found." ]]; then
  exit
else
  qvm-run $QUBE /usr/bin/qubes-run-terminal &
fi
EOF

  sudo chmod +x "$terminal_script"
  echo "Created terminal script: $terminal_script"

  # Terminal as root script
  local terminal_root_script="/bin/open_terminal_root.sh"
  sudo tee "$terminal_root_script" > /dev/null << 'EOF'
#!/bin/bash

ID=$(xdotool getwindowfocus)
QUBE=$(xprop _QUBES_VMNAME -id "$ID" | cut -f 2 -d '"')

if [[ "$QUBE" == "_QUBES_VMNAME:  not found." ]]; then
  exit
else
  qvm-run -u root $QUBE /usr/bin/qubes-run-terminal &
fi
EOF

  sudo chmod +x "$terminal_root_script"
  echo "Created terminal as root script: $terminal_root_script"

  # File manager script
  local filemanager_script="/bin/open_file_manager.sh"
  sudo tee "$filemanager_script" > /dev/null << 'EOF'
#!/bin/sh

ID=$(xdotool getwindowfocus)
QUBE=$(xprop _QUBES_VMNAME -id "$ID" | cut -f 2 -d '"')

if [[ "$QUBE" == "_QUBES_VMNAME:  not found." ]]; then
  exit
else
  qvm-run "$QUBE" /usr/bin/xdg-open /home/user &
fi
EOF

  sudo chmod +x "$filemanager_script"
  echo "Created file manager script: $filemanager_script"

  # Halt VM script
  local halt_script="/bin/halt-vm-by-window.sh"
  sudo tee "$halt_script" > /dev/null << 'EOF'
#!/bin/sh

ID=$(xdotool getwindowfocus)
QUBE=$(xprop _QUBES_VMNAME -id "$ID" | cut -f 2 -d '"')

if [[ "$QUBE" == "_QUBES_VMNAME:  not found." ]]; then
  exit
else
   qvm-shutdown --quiet --force "$QUBE"
fi
EOF

  sudo chmod +x "$halt_script"
  echo "Created halt script: $halt_script"
}

# Create shortcut with xfconf-query
create_shortcut() {
  local shortcut_key="$1"
  local command="$2"
  local path="/commands/custom/$shortcut_key"

  # Delete existing property if it exists
  xfconf-query -c xfce4-keyboard-shortcuts -p "$path" -r 2>/dev/null || true

  # Create new property in xfce
  xfconf-query -c xfce4-keyboard-shortcuts -p "$path" -n -t string -s "$command"

  echo "OK! $shortcut_key → $command"
}

# Main execution
echo "Setting up shortcuts for Qubes..."

# Create specialized scripts
echo -e "\nCreating specialized scripts..."
create_specialized_scripts

# Create launcher and shortcuts
echo -e "\nCreating launcher scripts and keyboard shortcuts..."

# Handle each shortcut
echo "$SHORTCUTS" | while IFS=: read -r shortcut app; do

  # Skip empty lines
  [ -z "$shortcut" ] && continue

  # Special cases
  case "$app" in
  "xfce4-terminal")
    # Use the specialized terminal script for terminal shortcut
    command="/bin/open_terminal.sh"
    create_shortcut "$shortcut" "$command"
    ;;
  "file-manager")
    # Use the specialized file manager script
    command="/bin/open_file_manager.sh"
    create_shortcut "$shortcut" "$command"
    ;;
  "halt-vm")
    # Use the halt VM script
    command="/bin/halt-vm-by-window.sh"
    create_shortcut "$shortcut" "$command"
    ;;
  "terminal-root")
    # Use the terminal as root script
    command="/bin/open_terminal_root.sh"
    create_shortcut "$shortcut" "$command"
    ;;
  *)
    # For other apps, create standard launcher
    create_launcher_script "$app"
    command="/usr/local/bin/launch-in-focused-${app}"
    create_shortcut "$shortcut" "$command"
    ;;
  esac
done

echo -e "\nFinish"
setup-wm-shortcuts-qubes.sh
#!/usr/bin/env bash

########################################################################
# File Name    : setup-wm-shortcuts-qubes.sh
# Description  : Script to add custom window manager shortcuts using
#                xfconf-query in dom0 of Qubes Xfce. It makes a backup
#                before reset previous rules. Note: copying content
#                from others qubes compromises the Qubes OS security
#                model.
# Dependencies : Xfce
# Usage        : • Transfer this script from appvm to dom0 with:
#                [user@dom0 ~]$ qvm-run -p appvm 'cat ~/setup-wm-shortcuts-qubes.sh' > ~/setup-wm-shortcuts-qubes.sh
#                • Make the script executable with:
#                [user@dom0 ~]$ chmod +x setup-wm-shortcuts-qubes.sh
#                • Run the script with:
#                [user@dom0 ~]$ bash setup-wm-shortcuts-qubes.sh
# Author       : Me and the bois
# License      : Free of charge, no warranty
# Last editedd : 2026-08-22
########################################################################

# Safety check
set -eu

# Verify dom0
if [ "$(hostname)" != "dom0" ]; then
    echo "ERROR: This script should only run in dom0!" >&2
    exit 1
fi

# Check if xfconf-query is available
if ! command -v xfconf-query > /dev/null; then
    echo "ERROR: xfconf-query is not installed. This script requires Xfce." >&2
    exit 1
fi

# Backup current settings
backup_shortcuts() {
    local backup_file="$HOME/keyboard_shortcuts_backup_$(date +%Y%m%d_%H%M%S).xml"
    echo "Backing up current keyboard shortcuts to $backup_file..."
    xfconf-query -c xfce4-keyboard-shortcuts -lv > "$backup_file"
    echo "Backup created successfully."
}

# Reset existing keyboard shortcuts
reset_shortcuts() {
    echo "Resetting ALL keyboard shortcuts to empty state..."

    # Completely reset the entire channel
    xfconf-query -c xfce4-keyboard-shortcuts -p / -rR 2>/dev/null

    # Ensure basic structure exists (optional)
    xfconf-query -c xfce4-keyboard-shortcuts -p / -n -t string -s "" 2>/dev/null

    echo "Keyboard shortcuts have been reset to empty state."
}

# Create shortcuts with xfconf-query
create_shortcut() {
    local path="$1"
    local value="$2"
    local type="${3:-string}"

    # Delete existing property if it exists
    xfconf-query -c xfce4-keyboard-shortcuts -p "$path" -r 2>/dev/null

    # Create new property with specified type
    xfconf-query -c xfce4-keyboard-shortcuts -p "$path" -n -t "$type" -s "$value"
}

# Function flow
backup_shortcuts  # Keep your backup function
reset_shortcuts    # Wipe all existing shortcuts

echo "Configuring keyboard shortcuts for Qubes Xfce..."

# Qubes-specific shortcuts
create_shortcut "/commands/custom/<Primary><Alt>Escape" "qvm-xkill" "string"
create_shortcut "/commands/custom/<Primary><Alt>l" "xflock4" "string"

# Boolean properties (override and startup-notify)
create_shortcut "/xfwm4/custom/override" "true" "bool"
create_shortcut "/commands/custom/<Super>r/startup-notify" "true" "bool"

# Window management shortcuts
create_shortcut "/xfwm4/custom/<Primary>q" "close_window_key" "string"
create_shortcut "/xfwm4/custom/<Alt>Tab" "cycle_windows_key" "string"
create_shortcut "/xfwm4/custom/<Shift><Alt>Tab" "cycle_reverse_windows_key" "string"
create_shortcut "/xfwm4/custom/<Alt><Super>space" "resize_window_key" "string"
create_shortcut "/xfwm4/custom/<Alt><Super>Control_L" "move_window_key" "string"
create_shortcut "/xfwm4/custom/<Super>d" "show_desktop_key" "string"
create_shortcut "/xfwm4/custom/<Super>m" "hide_window_key" "string"
#create_shortcut "/xfwm4/custom/<Primary><Super>KP_0" "hide_window_key" "string"
create_shortcut "/xfwm4/custom/<Shift><Super>m" "maximize_window_key" "string"
#create_shortcut "/xfwm4/custom/<Primary><Super>KP_5" "maximize_window_key" "string"
create_shortcut "/xfwm4/custom/<Alt>space" "popup_menu_key" "string"
create_shortcut "/xfwm4/custom/Escape" "cancel_key" "string"

# Navigation shortcuts
create_shortcut "/xfwm4/custom/Up" "up_key" "string"
create_shortcut "/xfwm4/custom/Down" "down_key" "string"
create_shortcut "/xfwm4/custom/Left" "left_key" "string"
create_shortcut "/xfwm4/custom/Right" "right_key" "string"

# Window tiling shortcuts (using Ctrl+Super)
create_shortcut "/xfwm4/custom/<Primary><Super>1" "tile_up_left_key" "string"
create_shortcut "/xfwm4/custom/<Primary><Super>2" "tile_up_right_key" "string"
create_shortcut "/xfwm4/custom/<Primary><Super>3" "tile_down_left_key" "string"
create_shortcut "/xfwm4/custom/<Primary><Super>4" "tile_down_right_key" "string"
#create_shortcut "/xfwm4/custom/<Primary><Super>KP_7" "tile_up_left_key" "string"
#create_shortcut "/xfwm4/custom/<Primary><Super>KP_9" "tile_up_right_key" "string"
#create_shortcut "/xfwm4/custom/<Primary><Super>KP_1" "tile_down_left_key" "string"
#create_shortcut "/xfwm4/custom/<Primary><Super>KP_3" "tile_down_right_key" "string"
create_shortcut "/xfwm4/custom/<Primary><Super>Down" "tile_down_key" "string"
create_shortcut "/xfwm4/custom/<Primary><Super>Right" "tile_right_key" "string"
create_shortcut "/xfwm4/custom/<Primary><Super>Up" "tile_up_key" "string"
create_shortcut "/xfwm4/custom/<Primary><Super>Left" "tile_left_key" "string"
#create_shortcut "/xfwm4/custom/<Primary><Super>KP_2" "tile_down_key" "string"
#create_shortcut "/xfwm4/custom/<Primary><Super>KP_6" "tile_right_key" "string"
#create_shortcut "/xfwm4/custom/<Primary><Super>KP_8" "tile_up_key" "string"
#create_shortcut "/xfwm4/custom/<Primary><Super>KP_4" "tile_left_key" "string"

# Window movement (using Ctrl+Shift)
create_shortcut "/xfwm4/custom/<Primary><Shift>exclam" "move_window_workspace_1_key" "string"
create_shortcut "/xfwm4/custom/<Primary><Shift>at" "move_window_workspace_2_key" "string"
create_shortcut "/xfwm4/custom/<Primary><Shift>numbersign" "move_window_workspace_3_key" "string"
create_shortcut "/xfwm4/custom/<Primary><Shift>dollar" "move_window_workspace_4_key" "string"
#create_shortcut "/xfwm4/custom/<Primary><Shift>KP_1" "move_window_workspace_1_key" "string"
#create_shortcut "/xfwm4/custom/<Primary><Shift>KP_2" "move_window_workspace_2_key" "string"
#create_shortcut "/xfwm4/custom/<Primary><Shift>KP_3" "move_window_workspace_3_key" "string"
#create_shortcut "/xfwm4/custom/<Primary><Shift>KP_4" "move_window_workspace_4_key" "string"

# Window movement in workspace (using Ctrl+Shift+Alt)
create_shortcut "/xfwm4/custom/<Primary><Shift><Alt>Left" "move_window_prev_workspace_key" "string"
create_shortcut "/xfwm4/custom/<Primary><Shift><Alt>Right" "move_window_next_workspace_key" "string"
create_shortcut "/xfwm4/custom/<Primary><Shift><Alt>Up" "move_window_up_workspace_key" "string"
create_shortcut "/xfwm4/custom/<Primary><Shift><Alt>Down" "move_window_down_workspace_key" "string"
#create_shortcut "/xfwm4/custom/<Primary><Shift><Alt>KP_4" "move_window_prev_workspace_key" "string"
#create_shortcut "/xfwm4/custom/<Primary><Shift><Alt>KP_6" "move_window_next_workspace_key" "string"
#create_shortcut "/xfwm4/custom/<Primary><Shift><Alt>KP_8" "move_window_up_workspace_key" "string"
#create_shortcut "/xfwm4/custom/<Primary><Shift><Alt>KP_2" "move_window_down_workspace_key" "string"

# Workspace movement (using Shift+Alt)
create_shortcut "/xfwm4/custom/<Shift><Alt>exclam" "workspace_1_key" "string"
create_shortcut "/xfwm4/custom/<Shift><Alt>at" "workspace_2_key" "string"
create_shortcut "/xfwm4/custom/<Shift><Alt>numbersign" "workspace_3_key" "string"
create_shortcut "/xfwm4/custom/<Shift><Alt>dollar" "workspace_4_key" "string"
#create_shortcut "/xfwm4/custom/<Shift><Alt>KP_1" "workspace_1_key" "string"
#create_shortcut "/xfwm4/custom/<Shift><Alt>KP_2" "workspace_2_key" "string"
#create_shortcut "/xfwm4/custom/<Shift><Alt>KP_3" "workspace_3_key" "string"
#create_shortcut "/xfwm4/custom/<Shift><Alt>KP_4" "workspace_4_key" "string"

# Workspace movement (using Ctrl+Alt)
create_shortcut "/xfwm4/custom/<Primary><Alt>Right" "next_workspace_key" "string"
create_shortcut "/xfwm4/custom/<Primary><Alt>Left" "prev_workspace_key" "string"
create_shortcut "/xfwm4/custom/<Primary><Alt>Down" "down_workspace_key" "string"
create_shortcut "/xfwm4/custom/<Primary><Alt>Up" "up_workspace_key" "string"
#create_shortcut "/xfwm4/custom/<Primary><Alt>KP_6" "next_workspace_key" "string"
#create_shortcut "/xfwm4/custom/<Primary><Alt>KP_4" "prev_workspace_key" "string"
#create_shortcut "/xfwm4/custom/<Primary><Alt>KP_2" "down_workspace_key" "string"
#create_shortcut "/xfwm4/custom/<Primary><Alt>KP_8" "up_workspace_key" "string"

# Application switching
create_shortcut "/xfwm4/custom/<Alt>Escape" "switch_application_key" "string"
create_shortcut "/xfwm4/custom/<Shift><Alt>Escape" "switch_window_key" "string"

echo "Keyboard shortcuts configuration complete."
echo "Note: Some shortcuts may require restarting xfwm4 to take effect."
echo "You may need to log out and back in for all changes to apply."

Hey,

I adjusted @anon40243023’s script to support toggling.
You might lose the granularity of providing the weight value (hardcoded in the script) but for me this works just fine.

#!/bin/bash

# A script by @anon40243023 to boost a selected VM by doubling it's xen scheduling weight
# see: https://forum.qubes-os.org/t/quick-quality-of-life-improvements/23380/107

# NOTE: adjusted by me in order to work with toggling

set -euo pipefail

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

if [[ "$CUR_VM" == "_QUBES_VMNAME:  not found." ]];
then
    notify-send "[dom0]: ignored for boosting"
    exit 1
fi

CUR_WEIGHT=$(xl sched-credit2 -d $CUR_VM | awk 'NR == 2 { print $3 }')
DEFAULT_WEIGHT=256
BOOST_WEIGHT=512


if (( CUR_WEIGHT > DEFAULT_WEIGHT ));
then
    xl sched-credit2 -d $CUR_VM -w $DEFAULT_WEIGHT
    notify-send "[$CUR_VM]: reverting to normal."
else
    xl sched-credit2 -d $CUR_VM -w $BOOST_WEIGHT
    notify-send "[$CUR_VM]: boosting now."
fi

Personally I put it under /usr/bin/boost-vm-by-window because it’s conceptually similar to the halt-vm-by-window script. But everyone to their liking.