autorandr-ctrl 500 B

12345678910111213141516171819202122232425
  1. #!/bin/sh
  2. function list_layouts () {
  3. autorandr 2>&1 | awk -e '{print $1}'
  4. echo "*create*"
  5. echo "*name-it*"
  6. }
  7. if [[ -e $(which rofi) ]] ; then
  8. LAYOUT=$(list_layouts | rofi -dmenu -p layout)
  9. else
  10. LAYOUT=$(list_layouts | dmenu -p layout)
  11. fi
  12. if [[ $LAYOUT == "" ]] ; then
  13. echo Nothing to do.
  14. elif [[ $LAYOUT == "*create*" ]] ; then
  15. arandr
  16. elif [[ $LAYOUT == "*name-it*" ]] ; then
  17. NAME=$(rofi -dmenu -p 'name')
  18. autorandr -s ${NAME}
  19. else
  20. autorandr -l $LAYOUT
  21. fi