Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
btag: remove untagged dup
check_headphones: don't switch to headphones if it's already connected (player.sh toggle glitch)
  • Loading branch information
neeasade committed Mar 2, 2023
1 parent c8bdb65 commit b96bbe3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bin/bin/btags
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
(defn get-state-untagged []
(set/difference
(set (sh "bspc query -N -n .leaf.window"))
(->> state :tags (map :wids) (apply set/union))))
(->> state :tags (mapcat :wids) (set))))

(defn action-untagged
"list untagged wids"
Expand Down
16 changes: 16 additions & 0 deletions bin/bin/check_headphones
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

want=${*:-WH-1000XM3}

sink_map=$(paste -d' ' \
<(pactl list short sinks) \
<(pacmd list-sinks | grep device.description | awk -F= '{print $2}' | sed 's/"//g'))

stopped=$(awk "/SUSPENDED.*${want}/{print $1}" <<< "$sink_map")

if [ ! -z "$stopped" ]; then
SWITCH="meta: sound switch $want" dmenu_switcher
exit 0
fi

exit 1
2 changes: 1 addition & 1 deletion wm/.config/sxhkd/sxhkdrc
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ super + grave
# workflow: turn on headphones, bt connect, walk around, toggle
# we never use these buttons from our keyboard anyway
XF86Audio{Prev,Next,Play,Pause}
check_headphones || player.sh {prev,next,toggle,toggle}
check_headphones; player.sh {prev,next,toggle,toggle}

XF86Audio{LowerVolume,RaiseVolume}
notify-send --urgency=low "Volume: $(ponymix {decrease,increase})"
Expand Down

0 comments on commit b96bbe3

Please sign in to comment.