summaryrefslogtreecommitdiff
path: root/.scripts/toggle_user_unit.sh
blob: 693758517ee712fd3946cae7f10131a430fa491b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/sh

unit=$1

which systemctl &> /dev/null || exit 1
systemctl --user &> /dev/null || exit 1

if systemctl --user --quiet is-enabled $unit; then
	systemctl --quiet --user is-active $unit &&
		systemctl --user stop $unit || \
		systemctl --user start $unit
fi