From eb2d312d9dc81f15cd4315c8a44a3c23c25ed0c4 Mon Sep 17 00:00:00 2001 From: appeasementPolitik <108810900+appeasementPolitik@users.noreply.github.com> Date: Sun, 23 Apr 2023 07:11:24 +0000 Subject: [PATCH] Update volume module on headphone (dis)connect --- .config/x11/xprofile | 2 +- .local/bin/volumed | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .local/bin/volumed diff --git a/.config/x11/xprofile b/.config/x11/xprofile index d6b88c5e..a71be93a 100755 --- a/.config/x11/xprofile +++ b/.config/x11/xprofile @@ -7,7 +7,7 @@ xrandr --dpi 96 # Set DPI. User may want to use a larger number for larger scre setbg & # set the background with the `setbg` script #xrdb ${XDG_CONFIG_HOME:-$HOME/.config}/x11/xresources & xrdbpid=$! # Uncomment to use Xresources colors/settings on startup -autostart="mpd xcompmgr dunst unclutter pipewire remapd" +autostart="mpd xcompmgr dunst unclutter pipewire remapd volumed" for program in $autostart; do pidof -sx "$program" || "$program" & diff --git a/.local/bin/volumed b/.local/bin/volumed new file mode 100644 index 00000000..31d39882 --- /dev/null +++ b/.local/bin/volumed @@ -0,0 +1,9 @@ +#!/bin/bash + +# Update the volume module in the statusbar whenever +# headphones are added or removed. + +while :; do + grep -qP -m1 '^jack\/headphone' <(acpi_listen) + pkill -RTMIN+10 "${STATUSBAR:-dwmblocks}" +done