Add a script for automatically scaling KDE VM when resolution changes

This commit is contained in:
2026-07-24 19:20:53 +02:00
parent 96d1fb171a
commit 68460f499b
4 changed files with 294 additions and 0 deletions
@@ -0,0 +1,22 @@
# auto-scale-virtual.rules
#
# When the virtio-gpu display ("card0") reports a mode change — which
# spice-vdagent fires as it resizes Virtual-1 to match the SPICE client window
# (e.g. on dock/undock) — re-run the auto-scale script so Plasma's scale is
# fixed to match the new resolution.
#
# Install with:
# sudo install -m 644 99-auto-scale-virtual.rules \
# /etc/udev/rules.d/99-auto-scale-virtual.rules
# sudo udevadm control --reload-rules
#
# The script is invoked as the logged-in user via systemd-run, with the Plasma
# Wayland session environment hardcoded inside the script so it can reach
# kscreen-doctor. A short debounce lives in the script itself (flock), so the
# burst of change events from a single resize collapses to one application.
#
# Adjust the --uid/--gid values to match your user (run `id -u` / `id -g`).
ACTION=="change", SUBSYSTEM=="drm", KERNEL=="card0", \
RUN+="/usr/bin/systemd-run --uid=1001 --gid=1001 --no-block \
/home/hendrik/.local/bin/auto-scale-virtual.sh"