2018-12-11 23:10:51 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
|
|
|
2022-07-02 13:35:31 +00:00
|
|
|
program_kills=(
|
|
|
|
Discord
|
|
|
|
)
|
|
|
|
|
|
|
|
systemd_services=(
|
|
|
|
streamdeck
|
|
|
|
)
|
|
|
|
|
|
|
|
function log() {
|
|
|
|
echo "$@" >&2
|
|
|
|
}
|
2018-12-19 18:44:56 +00:00
|
|
|
|
2019-01-17 23:21:36 +00:00
|
|
|
# Stop MPD playback when mpc client was found
|
|
|
|
(which mpc >/dev/null 2>&1) && mpc stop
|
|
|
|
|
2022-07-02 13:35:31 +00:00
|
|
|
# Disable systemd user services
|
|
|
|
for svc in "${systemd_services[@]}"; do
|
|
|
|
systemctl is-active ${svc} >/dev/null 2>&1 && systemctl --user stop ${svc} || log "Service ${svc} not active / not found"
|
|
|
|
done
|
2020-06-12 13:51:41 +00:00
|
|
|
|
2021-09-12 10:55:00 +00:00
|
|
|
# Terminate Discord in order to get mobile notifications
|
2022-07-02 13:35:31 +00:00
|
|
|
for prog in "${program_kills[@]}"; do
|
|
|
|
killall -TERM ${prog} || true
|
|
|
|
done
|
2021-09-12 10:55:00 +00:00
|
|
|
|
|
|
|
# Mute default sink & source
|
|
|
|
pactl set-sink-mute @DEFAULT_SINK@ true || true
|
2022-02-22 11:33:42 +00:00
|
|
|
pactl set-source-mute @DEFAULT_SOURCE@ true || true
|
2021-09-12 10:55:00 +00:00
|
|
|
|
2021-03-27 20:05:10 +00:00
|
|
|
i3lock -e -f -n -c 000000
|
2020-06-12 13:51:41 +00:00
|
|
|
|
2022-07-02 13:35:31 +00:00
|
|
|
# Restart user-services
|
|
|
|
for svc in "${systemd_services[@]}"; do
|
|
|
|
systemctl is-enabled ${svc} >/dev/null 2>&1 && systemctl --user start ${svc} || log "Service ${svc} not enabled, skipping start"
|
|
|
|
done
|