Skip to main content

hyprland: exclude rdp windows from super+q

·1 min

proudly figured out by googling and reading docs.

problem: Super+Q (killactive) closes rdp sessions (xfreerdp) “accidentally” aka i can not remember or get used to my vm keybindings…

solution: replace the killactive bind with a script that checks the active window class first.

~/.config/hypr/scripts/close-window.sh:

#!/bin/bash
class=$(hyprctl activewindow -j | grep -o '"class": *"[^"]*"' | cut -d'"' -f4)

case "$class" in
    xfreerdp|wlfreerdp) ;;
    *) hyprctl dispatch killactive ;;
esac

keybinds.conf:

bindd = $mainMod, Q, Closes (not kill) current window, exec, ~/.config/hypr/scripts/close-window.sh

so far this works well and i get a bit less frustrated, since rdp just stays open. it also reminds me slighly less that i apprently cannot adjust to different mod keys (alt in the vm).

note: to me it feels like suppressevent close should exist, but killactive is not an event, it’s a direct compositor action i guess.