More work on gettings things working.

This commit is contained in:
Storm Dragon
2026-04-21 16:44:05 -04:00
parent 93b7ad2ae5
commit a8fe5d1eab
4 changed files with 41 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
%wheel ALL=(ALL) NOPASSWD: /usr/lib/stormux/stormux_alsa_state.sh *
@@ -0,0 +1,8 @@
[Unit]
RequiresMountsFor=/home/stormux/.local/state/alsa
[Service]
ExecStart=
ExecStart=-/usr/lib/stormux/stormux_alsa_state.sh restore
ExecStop=
ExecStop=-/usr/lib/stormux/stormux_alsa_state.sh store
+4
View File
@@ -333,6 +333,10 @@ class VoicedMenu:
['pactl', 'set-sink-volume', '@DEFAULT_SINK@', f'{volumePercent}%'],
check=True
)
subprocess.run(
['sudo', '-n', '/usr/lib/stormux/stormux_alsa_state.sh', 'store'],
check=False
)
self.volume = volumePercent
self.save_settings()
return True
+28
View File
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
set -euo pipefail
stateDir="${STORMUX_ALSA_STATE_DIR:-/home/stormux/.local/state/alsa}"
stateFile="${stateDir}/asound.state"
action="${1:-}"
usage() {
printf 'Usage: %s restore|store\n' "${0##*/}" >&2
}
case "$action" in
restore)
if [[ ! -f "$stateFile" ]]; then
exit 0
fi
exec /usr/bin/alsactl -f "$stateFile" restore
;;
store)
install -d -o root -g root -m 755 "$stateDir"
exec /usr/bin/alsactl -f "$stateFile" store
;;
*)
usage
exit 2
;;
esac