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

34 lines
533 B
Bash
Raw Normal View History

2022-03-10 03:42:22 +00:00
#!/bin/sh
#default startup file is defined, redefinable by second argument
FILENAME="$HOME/.local/init/startup"
[ -f "$2" ] && FILENAME="$1"
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