config

Personal configuration.
git clone git://code.dwrz.net/config
Log | Files | Refs

monitor-hotplug (438B)


      1 #!/usr/bin/env bash
      2 
      3 export DISPLAY=:0.0
      4 
      5 connect() {
      6   xrandr --output eDP-1 --off --output DP-3 --auto && \
      7     notify-send "Connected external monitor."
      8 }
      9 
     10 disconnect() {
     11   xrandr --output eDP-1 --auto --output DP-3 --off && \
     12     notify-send "Disconnected external monitor."
     13 }
     14 
     15 main() {
     16   if xrandr | grep -q "DP-3 connected"; then
     17     connect
     18   else
     19     disconnect
     20   fi
     21 
     22   map-bg
     23   xmodmap "${HOME}/.config/X11/xmodmap"
     24 }
     25 
     26 main "$@"