12345678910111213141516171819202122232425262728293031323334 |
- #!/bin/zsh -f
- if [[ $# -eq 0 ]] ; then
- echo "i3-layout [ name workspace | list | define workspace name | edit name ]"
- exit
- fi
- LAYOUT=$1
- WORKSPACE=$2
- case ${LAYOUT} in
- define)
- NAME=$3
- i3-save-tree --workspace ${WORKSPACE} > ~/.config/i3/layouts/${NAME}.json
- emacsclient --alternate-editor="" -n ~/.config/i3/layouts/${NAME}.json
- ;;
- edit)
- NAME=$3
- emacsclient --alternate-editor="" -n ~/.config/i3/layouts/${NAME}.json
- ;;
- list)
- for layout in ~/.config/i3/layouts/*.json ;
- do
- echo " - $(basename -- ${layout} .json)"
- done
- ;;
- *)
- if [[ -e ~/.config/i3/layouts/${LAYOUT}.json ]] ; then
- i3-msg "workspace ${WORKSPACE}; append_layout ~/.config/i3/layouts/${LAYOUT}.json"
- [[ -e ~/.config/i3/layouts/${LAYOUT}.after ]] && sh ~/.config/i3/layouts/${LAYOUT}.after
- else
- i3-nagbar -m "${LAYOUT} not available" -t error
- fi
- esac
|