switch-layout 595 B

123456789101112131415161718192021222324252627
  1. #!/bin/zsh -f
  2. if [[ $# -eq 0 ]] ; then
  3. echo "switch-layout [ name | list | define ]"
  4. exit
  5. fi
  6. LAYOUT=$1
  7. case ${LAYOUT} in
  8. define)
  9. arandr
  10. ;;
  11. list)
  12. for layout in ~/.screenlayout/*.sh ;
  13. do
  14. echo " - $(basename -- ${layout} .sh)"
  15. done
  16. ;;
  17. *)
  18. if [[ -e ~/.screenlayout/${LAYOUT}.sh ]] ; then
  19. sh ~/.screenlayout/${LAYOUT}.sh
  20. [[ -e ~/.screenlayout/${LAYOUT}.sh-after ]] && \
  21. sh ~/.screenlayout/${LAYOUT}.sh-after
  22. echo Switched to ${LAYOUT} layout
  23. fi
  24. esac