Skip to content

Instantly share code, notes, and snippets.

@petrohs
Created May 24, 2020 23:39
Show Gist options
  • Save petrohs/0e7aaaf3e02756dfb3d0c4e8b0d327b0 to your computer and use it in GitHub Desktop.
Save petrohs/0e7aaaf3e02756dfb3d0c4e8b0d327b0 to your computer and use it in GitHub Desktop.
Vxrandr¦ activa o desactiva monitores
#!/bin/bash
if [[ -e /tmp/xrandr.petrohs ]]
then
xrandr --output VGA-1 --off --output eDP-1 --primary --mode 1600x900 --pos 0x0 --rotate normal --output HDMI-3 --off --output HDMI-2 --off --output HDMI-1 --off --output DP-3 --off --output DP-2 --off --output DP-1 --off
rm /tmp/xrandr.petrohs
exit 0;
fi
xrandr | grep "HDMI-3 connected " >/dev/null 2>/dev/null
if [[ $? -eq 0 ]]
then
xrandr --output VGA-1 --mode 1920x1080 --pos 1920x0 --rotate normal --output eDP-1 --primary --mode 1600x900 --pos 0x1080 --rotate normal --output HDMI-3 --mode 1920x1080 --pos 0x0 --rotate normal --output HDMI-2 --off --output HDMI-1 --off --output DP-3 --off --output DP-2 --off --output DP-1 --off
echo "HDMI3" > /tmp/xrandr.petrohs
else
xrandr | grep "VGA-1 connected " >/dev/null 2>/dev/null
if [[ $? -eq 0 ]]
then
xrandr --output VGA-1 --mode 1440x900 --pos 1600x0 --rotate normal --output eDP-1 --primary --mode 1600x900 --pos 0x0 --rotate normal --output HDMI-3 --off --output HDMI-2 --off --output HDMI-1 --off --output DP-3 --off --output DP-2 --off --output DP-1 --off
echo "VGA1" > /tmp/xrandr.petrohs
fi
fi
exit 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment