More work on gettings things working.
This commit is contained in:
@@ -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
|
||||||
@@ -333,6 +333,10 @@ class VoicedMenu:
|
|||||||
['pactl', 'set-sink-volume', '@DEFAULT_SINK@', f'{volumePercent}%'],
|
['pactl', 'set-sink-volume', '@DEFAULT_SINK@', f'{volumePercent}%'],
|
||||||
check=True
|
check=True
|
||||||
)
|
)
|
||||||
|
subprocess.run(
|
||||||
|
['sudo', '-n', '/usr/lib/stormux/stormux_alsa_state.sh', 'store'],
|
||||||
|
check=False
|
||||||
|
)
|
||||||
self.volume = volumePercent
|
self.volume = volumePercent
|
||||||
self.save_settings()
|
self.save_settings()
|
||||||
return True
|
return True
|
||||||
|
|||||||
Executable
+28
@@ -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
|
||||||
Reference in New Issue
Block a user