2018-12-11 23:10:51 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
|
|
|
2022-07-02 13:35:31 +00:00
|
|
|
program_kills=(
|
2024-05-01 17:37:00 +00:00
|
|
|
'electron.*discord/resources/app.asar'
|
2022-07-02 13:35:31 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
systemd_services=(
|
2023-04-18 09:45:38 +00:00
|
|
|
streamdeck
|
2022-07-02 13:35:31 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
function log() {
|
2023-04-18 09:45:38 +00:00
|
|
|
echo "$@" >&2
|
2022-07-02 13:35:31 +00:00
|
|
|
}
|
2018-12-19 18:44:56 +00:00
|
|
|
|
2019-01-17 23:21:36 +00:00
|
|
|
# Stop MPD playback when mpc client was found
|
2024-07-22 13:12:32 +00:00
|
|
|
(which mpc >/dev/null 2>&1) && mpc stop || true
|
2019-01-17 23:21:36 +00:00
|
|
|
|
2022-07-02 13:35:31 +00:00
|
|
|
# Disable systemd user services
|
|
|
|
for svc in "${systemd_services[@]}"; do
|
2023-04-18 09:45:38 +00:00
|
|
|
systemctl --user is-active ${svc} >/dev/null 2>&1 && systemctl --user stop ${svc} || log "Service ${svc} not active / not found"
|
2022-07-02 13:35:31 +00:00
|
|
|
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
|
2023-04-18 09:45:38 +00:00
|
|
|
kill -TERM $(pgrep -fo "${prog}") || true
|
2022-07-02 13:35:31 +00:00
|
|
|
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
|
2023-04-18 09:45:38 +00:00
|
|
|
systemctl --user is-enabled ${svc} >/dev/null 2>&1 && systemctl --user start ${svc} || log "Service ${svc} not enabled, skipping start"
|
2022-07-02 13:35:31 +00:00
|
|
|
done
|