1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- #!/bin/sh
- cd
- XSESS=1
- SSH_TIME=${SSH_TIME:-3h}
- START_EMACS=${START_EMACS:-1}
- if [ -x "${DISPLAY}" ] ; then
- XSESS=0
- fi
- if [ $# -lt 1 ] ; then
- echo "$(basename $0) [ start | end ]" >&2
- exit 1
- fi
- check_ssh() {
- ssh-add -l >/dev/null
- SSH_ADDED=$?
- if [ $SSH_ADDED != 0 ] ; then
- ssh-add -t ${SSH_TIME}
- fi
- }
- start_emacs() {
- if [ $START_EMACS -eq 1 ] ; then
- i3-run i3-workspace-layout emacs-here "1: emacs"
- fi
- }
- notify() {
- send-notification "$1" "$2"
- }
- restart_i3() {
- if [ $XSESS -eq 1 ] ; then
- i3-msg restart
- fi
- }
- if [ $1 == "start" ] ; then
- check_ssh
- sync-dirs . School Projects
- restart_i3
- start_emacs
- send_notification "Starting Day" "On $(hostname -s)."
- elif [ $1 == "end" ] ; then
- check_ssh
- sync-dirs . School Projects
- send_notification "Ending Day" "On $(hostname -s)."
- else
- echo "$(basename $0) [ start | end ]" >&2
- exit 1
- fi
|