constantin-net

displayexec.sh

May 6th, 2021
854
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. [ -z "$1" -o -z "$2" -o -z "$3" ] && echo "display1 action display2 side" && exit 0
  3. if [[ "$2" == "duplicate" ]]; then
  4.     xrandr --output "$1" --output "$3" --same-as "$1"
  5.     echo "awesome.restart()" | awesome-client
  6. fi
  7. if [[ "$2" == "switch" ]]; then
  8.     xrandr --output "$3" --auto --output "$1" --off
  9.     echo "awesome.restart()" | awesome-client
  10. fi
  11. side=""
  12. if [[ "$2" == "extend" ]]; then
  13.   case "$4" in
  14.   left)
  15.     side='--left-of'
  16.     ;;
  17.   right)
  18.     side='--right-of'
  19.     ;;
  20.   above)
  21.     side='--above'
  22.     ;;
  23.   below)
  24.     side='--below'
  25.     ;;
  26.   *)
  27.     side='--left-of'
  28.     ;;
  29.   esac
  30.     xrandr --output "$1" --auto --output "$3" --auto $side "$1"
  31.     echo "awesome.restart()" | awesome-client
  32. fi
  33. exit 0
RAW Paste Data