#!/bin/sh

START_EMACS=0

if [[ $1 == '-s' ]] ; then
    START_EMACS=1
    shift
fi

cd
CDIR=$(pwd)

for DIR in "$@" ; do
    cd $DIR
    mr mysync
    cd $CDIR
done

if [[ $START_EMACS -eq 1 ]] ; then
    i3-run \
        i3-workspace-layout emacs-here 1
fi

_alarm
