dotfiles-old/.local/init/init.sh

39 lines
556 B
Bash
Executable File

#!/bin/sh
#default startup file is defined, redefinable by second argument
FILENAME="$HOME/.local/init/startup"
HM="$HOME"
[ -f "$2" ] && FILENAME="$2"
sleep 2
close() {
while read CMD
do
echo "killing: $CMD"
pkill $CMD
done < "$FILENAME"
}
init() {
while read CMD
do
if [ -z "$(pgrep "$CMD")" ]; then
echo "starting: $CMD"
$CMD &
fi
done < "$FILENAME"
}
if [ "$1" = "-i" ]; then
init
elif [ "$1" = "-c" ]; then
close
swaymsg exit
else
close
fi