Created
July 13, 2018 14:12
-
-
Save atx/8f53b424e41e3fa1e6655c63632d2f7d to your computer and use it in GitHub Desktop.
Hacky script to support automatic screen resize with virt-manager VMs with arbitrary window manager (see https://bugzilla.redhat.com/show_bug.cgi?id=1352226 for details )
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/bash | |
if ! pgrep -u $(whoami) spice-vdagent; then | |
echo "Starting vdagent" | |
spice-vdagent | |
fi | |
INTERVAL=1 | |
while true; do | |
# No multiple outputs supported | |
outname=$(xrandr | grep "^Virtual-" | head -n1 | cut -d' ' -f1) | |
if xrandr | grep "$outname" -A1 | tail -n1 | grep -vq '\*'; then | |
echo "Resizing..." | |
xrandr --output "$outname" --auto | |
fi | |
sleep $INTERVAL | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment