#!/bin/zsh -f if [[ $# -eq 0 ]] ; then echo "switch-layout [ name | list | define ]" exit fi LAYOUT=$1 if [[ ${LAYOUT} == "define" ]] ; then arandr exit fi if [[ ${LAYOUT} == "list" ]] ; then for lout in ~/.screenlayout/*.sh ; do echo `basename -- "${lout}" .sh` done exit fi if [[ -e ~/.screenlayout/${LAYOUT}.sh ]] ; then sh ~/.screenlayout/${LAYOUT}.sh [[ -e ~/.screenlayout/${LAYOUT}.sh-after ]] && sh ~/.screenlayout/${LAYOUT}.sh-after echo Switched to ${LAYOUT} layout fi