diff options
author | Amin Bandali <bandali@kelar.org> | 2024-04-01 15:21:11 -0400 |
---|---|---|
committer | Amin Bandali <bandali@kelar.org> | 2024-04-01 15:21:11 -0400 |
commit | 22a270eba9568af1394a46429f1a379200496cf9 (patch) | |
tree | 03a1de7c3719fa58c1c6c3fbefe77a94014592e1 /.local/bin/b-pacify | |
parent | 1d18d65c2b6260f6e58d1cdf974ccb13d59cbf9d (diff) | |
download | configs-22a270eba9568af1394a46429f1a379200496cf9.tar.gz configs-22a270eba9568af1394a46429f1a379200496cf9.tar.xz configs-22a270eba9568af1394a46429f1a379200496cf9.zip |
Break pulse volume code out of bar and into its own script
In part so that it could easily be used in Emacs as well.
Also rename pacify-pulseaudio to b-pacify (as in PAcify).
Diffstat (limited to '.local/bin/b-pacify')
-rwxr-xr-x | .local/bin/b-pacify | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/.local/bin/b-pacify b/.local/bin/b-pacify new file mode 100755 index 0000000..18d6ee5 --- /dev/null +++ b/.local/bin/b-pacify @@ -0,0 +1,28 @@ +#!/bin/sh + +# Copyright (c) 2024 Amin Bandali <bandali@kelar.org> +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. This file is offered as-is, +# without any warranty. + +# pulseaudio is trash and insists on using machine-id as a prefix for +# its database filenames under ~/.config/pulse. So, on systems with +# randomized machine-ids like Devuan GNU/Linux it shits the bed and +# can't find its own database files. So we do its job for it and +# rename its database files on each boot. Ditto for libcanberra's +# event sound cache database. + +cur_id_path=/var/lib/dbus/machine-id +prev_id_path="$XDG_CACHE_HOME/tmp-prevmid" +cur_id="$(cat $cur_id_path)" +prev_id="$(cat $prev_id_path)" + +for f in $XDG_CONFIG_HOME/pulse/$prev_id-* \ + $XDG_CACHE_HOME/event-sound-cache.tdb.$prev_id.*; do + fnew="$(echo $f | sed "s/$prev_id/$cur_id/")" + mv $f $fnew +done + +cp -p $cur_id_path $prev_id_path |