summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmin Bandali <bandali@kelar.org>2024-02-25 14:04:25 -0500
committerAmin Bandali <bandali@kelar.org>2024-02-25 14:05:45 -0500
commitb8a7310d32bb6a7eba1c8a1213c7dd42f0428f0c (patch)
tree375be1a3af987371d8e1bb798d6a2cfa1c9340fe
parent89840581fbcc9228f99ca6c448a29d1cd5da2627 (diff)
downloadconfigs-b8a7310d32bb6a7eba1c8a1213c7dd42f0428f0c.tar.gz
configs-b8a7310d32bb6a7eba1c8a1213c7dd42f0428f0c.tar.xz
configs-b8a7310d32bb6a7eba1c8a1213c7dd42f0428f0c.zip
Pacify pulseaudio and libcanberra to cope with randomized machine-id
Diffstat (limited to '')
-rw-r--r--.config/sway/config1
-rwxr-xr-x.local/bin/pacify-pulseaudio28
-rw-r--r--.profile1
3 files changed, 30 insertions, 0 deletions
diff --git a/.config/sway/config b/.config/sway/config
index a077c5b..165509e 100644
--- a/.config/sway/config
+++ b/.config/sway/config
@@ -168,5 +168,6 @@ for_window [app_id="pavucontrol"] floating enable
include ~/.config/sway/`hostname`
exec dbus-update-activation-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK
+exec pacify-pulseaudio
exec [ -x "$(command -v nm-applet)" ] && nm-applet
exec sleep 1 && xrdb -merge ~/.Xresources
diff --git a/.local/bin/pacify-pulseaudio b/.local/bin/pacify-pulseaudio
new file mode 100755
index 0000000..18d6ee5
--- /dev/null
+++ b/.local/bin/pacify-pulseaudio
@@ -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
diff --git a/.profile b/.profile
index ea83795..b83fc4f 100644
--- a/.profile
+++ b/.profile
@@ -31,6 +31,7 @@ export MY_GUIX_PROFILES="$HOME/.config/guix/profile"
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"
+export XDG_CACHE_HOME="$HOME/.cache"
if [ -f "$HOME/.config/user-dirs.dirs" ]; then
set -a