switch-layout 535 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. if [[ ${LAYOUT} == "define" ]] ; then
  8. arandr
  9. exit
  10. fi
  11. if [[ ${LAYOUT} == "list" ]] ; then
  12. for lout in ~/.screenlayout/*.sh ;
  13. do
  14. echo `basename -- "${lout}" .sh`
  15. done
  16. exit
  17. fi
  18. if [[ -e ~/.screenlayout/${LAYOUT}.sh ]] ; then
  19. sh ~/.screenlayout/${LAYOUT}.sh
  20. [[ -e ~/.screenlayout/${LAYOUT}.sh-after ]] && sh ~/.screenlayout/${LAYOUT}.sh-after
  21. echo Switched to ${LAYOUT} layout
  22. fi