Skip to content

Instantly share code, notes, and snippets.

@pdalpra
Created August 7, 2016 17:41
Show Gist options
  • Save pdalpra/584d2d8ee7a6762665e8770ce5b64356 to your computer and use it in GitHub Desktop.
Save pdalpra/584d2d8ee7a6762665e8770ce5b64356 to your computer and use it in GitHub Desktop.
auto_monitor
#!/bin/bash
export DISPLAY=:0
export XAUTHORITY=/home/pdalpra/.Xauthority
function mirror() {
xrandr --output eDP1 --dpi 168 --output DP1 --mode 1920x1080 --scale 1.67x1.67
}
function single() {
xrandr --output DP1 --off
xrandr --output eDP1 --dpi 168
}
xrandr | grep "^DP1 connected" &> /dev/null && mirror || single
i3-msg -q 'restart'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment