Created
December 28, 2023 12:02
-
-
Save festival4799/26ab23ac84d8b00a161baa10bd558d60 to your computer and use it in GitHub Desktop.
udev rule to dynamilcally change screen resolution of a libvirt guest with spice display
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # /etc/udev/rules.d/50-x-resize.rules | |
| ACTION=="change",KERNEL=="card0", SUBSYSTEM=="drm", RUN+="/usr/local/bin/x-resize" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # /usr/local/bin/x-resize | |
| PATH=/usr/bin | |
| desktopuser=$(/bin/ps -ef | /bin/grep -oP '^\w+ (?=.*vdagent( |$))') || exit 0 | |
| export DISPLAY=:0 | |
| export XAUTHORITY=$(eval echo "~$desktopuser")/.Xauthority | |
| xrandr --output $(xrandr | awk '/ connected/{print $1; exit; }') --auto |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment