2022-03-10 03:42:22 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#default startup file is defined, redefinable by second argument
|
|
|
|
FILENAME="$HOME/.local/init/startup"
|
2022-09-11 16:49:36 +00:00
|
|
|
|
|
|
|
HM="$HOME"
|
|
|
|
|
2022-06-12 01:58:45 +00:00
|
|
|
[ -f "$2" ] && FILENAME="$2"
|
2022-03-10 03:42:22 +00:00
|
|
|
|
2022-09-11 16:49:36 +00:00
|
|
|
sleep 2
|
|
|
|
|
2022-03-10 03:42:22 +00:00
|
|
|
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
|