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