diff options
Diffstat (limited to 'ar/.local/bin')
| -rwxr-xr-x | ar/.local/bin/bookmarks | 16 | ||||
| -rwxr-xr-x | ar/.local/bin/statusbar/sb-audioup | 18 | ||||
| -rwxr-xr-x | ar/.local/bin/statusbar/sb-mic | 2 | ||||
| -rwxr-xr-x | ar/.local/bin/statusbar/sb-micup | 12 | ||||
| -rwxr-xr-x | ar/.local/bin/statusbar/sb-volume | 2 |
5 files changed, 32 insertions, 18 deletions
diff --git a/ar/.local/bin/bookmarks b/ar/.local/bin/bookmarks index a892a33..15b5fa6 100755 --- a/ar/.local/bin/bookmarks +++ b/ar/.local/bin/bookmarks @@ -82,18 +82,24 @@ openwindow() { } openinbrowser() { - # Extract only the default part of the profile name + # Resolve the default profile dir from the [Install] section of profiles.ini case $BROWSER in *firefox*) profiles_ini_path="$HOME/.mozilla/firefox/profiles.ini" - profile=$(awk '/\[Install/ {found=1} found && /^Default=/ {split($0, arr, "."); print arr[2]; exit}' "$profiles_ini_path") - profile_dir=$(find ~/.mozilla/firefox -type d -name "*.$profile*" | head -n 1) + profile=$(awk -F= '/^\[Install/ {found=1} found && /^Default=/ {print $2; exit}' "$profiles_ini_path") + case "$profile" in + /*) profile_dir="$profile" ;; + *) profile_dir="$HOME/.mozilla/firefox/$profile" ;; + esac db_path="$profile_dir/places.sqlite" ;; *librewolf*) profiles_ini_path="$HOME/.librewolf/profiles.ini" - profile=$(awk '/\[Install/ {found=1} found && /^Default=/ {split($0, arr, "."); print arr[2]; exit}' "$profiles_ini_path") - profile_dir=$(find ~/.librewolf -type d -name "*.$profile*" | head -n 1) + profile=$(awk -F= '/^\[Install/ {found=1} found && /^Default=/ {print $2; exit}' "$profiles_ini_path") + case "$profile" in + /*) profile_dir="$profile" ;; + *) profile_dir="$HOME/.librewolf/$profile" ;; + esac db_path="$profile_dir/places.sqlite" ;; *qutebrowser*) diff --git a/ar/.local/bin/statusbar/sb-audioup b/ar/.local/bin/statusbar/sb-audioup new file mode 100755 index 0000000..e03a113 --- /dev/null +++ b/ar/.local/bin/statusbar/sb-audioup @@ -0,0 +1,18 @@ +#!/bin/sh + +# Updates the volume and mic statusbar modules when audio devices change +# (e.g. bluetooth/usb device connect/disconnect, volume/mute changed outside dwm) + +volume() { pkill -RTMIN+4 "${STATUSBAR:-dwmblocks}" 2>/dev/null; } +mic() { pkill -RTMIN+5 "${STATUSBAR:-dwmblocks}" 2>/dev/null; } + +pactl subscribe 2>/dev/null | while read -r line; do + case "$line" in + *" on sink #"*) volume ;; + *" on source #"*) mic ;; + *" on card #"* | *" on server"*) + volume + mic + ;; + esac +done diff --git a/ar/.local/bin/statusbar/sb-mic b/ar/.local/bin/statusbar/sb-mic index faa618a..486917e 100755 --- a/ar/.local/bin/statusbar/sb-mic +++ b/ar/.local/bin/statusbar/sb-mic @@ -45,7 +45,7 @@ case $BLOCK_BUTTON in 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; esac -pidof -x sb-micup >/dev/null 2>&1 || sb-micup >/dev/null 2>&1 & +pidof -x sb-audioup >/dev/null 2>&1 || sb-audioup >/dev/null 2>&1 & mic="$(wpctl get-volume @DEFAULT_AUDIO_SOURCE@)" diff --git a/ar/.local/bin/statusbar/sb-micup b/ar/.local/bin/statusbar/sb-micup deleted file mode 100755 index 35807a0..0000000 --- a/ar/.local/bin/statusbar/sb-micup +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -# Updates the mic statusbar module when audio sources change -# (e.g. bluetooth/usb device connect/disconnect, mute changed outside dwm) - -signal() { pkill -RTMIN+5 "${STATUSBAR:-dwmblocks}" 2>/dev/null; } - -pactl subscribe 2>/dev/null | while read -r line; do - case "$line" in - *" on source #"* | *" on card #"* | *" on server"*) signal ;; - esac -done diff --git a/ar/.local/bin/statusbar/sb-volume b/ar/.local/bin/statusbar/sb-volume index 291e78d..19efcb1 100755 --- a/ar/.local/bin/statusbar/sb-volume +++ b/ar/.local/bin/statusbar/sb-volume @@ -16,6 +16,8 @@ case $BLOCK_BUTTON in 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; esac +pidof -x sb-audioup >/dev/null 2>&1 || sb-audioup >/dev/null 2>&1 & + vol="$(wpctl get-volume @DEFAULT_AUDIO_SINK@)" # If muted, print 🔇 and exit. |
