Guest User

Untitled

a guest
Oct 4th, 2020
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.92 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. usage(){
  4.     echo "Usage: $(basename $0) [-h] [-s] [-c]
  5.     -s: Turn on laptop display
  6.     Otherwise turn on external display
  7.     -c: Start compositor
  8.     Otherwise turn off compositor"
  9. }
  10.  
  11. SMALLDISPLAY=false
  12. COMPOSITOR=false
  13.  
  14. while getopts 'hsc' c
  15. do
  16.     case $c in
  17.         h) usage; exit ;;
  18.         s) SMALLDISPLAY=true ;;
  19.         c) COMPOSITOR=true ;;
  20.     esac
  21. done
  22.  
  23. shift $((OPTIND-1))
  24.  
  25. if [ $COMPOSITOR = true ]
  26. then
  27.     # start compositor
  28.     picom --config ~/.config/picom/picom.conf &
  29. else
  30.     # kill compositor, this is recommended when turning on the external screen as it may cause problems otherwise
  31.     killall picom
  32. fi
  33.  
  34. if [ $SMALLDISPLAY = false ]
  35. then
  36.     # turn on big display
  37.     xrandr --output HDMI-1-0 --left-of eDP-1 --auto
  38.     #turn off laptop display
  39.     xrandr --output eDP-1 --off
  40. else
  41.     #turn on laptop display
  42.     xrandr --output eDP-1 --left-of HDMI-1-0 --auto
  43.     # turn off external display
  44.     xrandr --output HDMI-1-0 --off
  45. fi
Add Comment
Please, Sign In to add comment