feat(waybar): show muted
This commit is contained in:
parent
cedc2cc728
commit
52af6a81fe
2 changed files with 9 additions and 8 deletions
|
|
@ -152,7 +152,7 @@ in
|
||||||
wireplumber = {
|
wireplumber = {
|
||||||
format = "{icon}";
|
format = "{icon}";
|
||||||
format-muted = "";
|
format-muted = "";
|
||||||
format-icons = [ "" "" "" ];
|
format-icons = [ "" "" "" "" "" "" "" "" "" "" ];
|
||||||
node-type = "Audio/Sink";
|
node-type = "Audio/Sink";
|
||||||
max-volume = 100;
|
max-volume = 100;
|
||||||
scroll-step = 5;
|
scroll-step = 5;
|
||||||
|
|
@ -166,7 +166,7 @@ in
|
||||||
"wireplumber#source" = {
|
"wireplumber#source" = {
|
||||||
format = "{icon}";
|
format = "{icon}";
|
||||||
format-muted = "";
|
format-muted = "";
|
||||||
format-icons = [ "" ];
|
format-icons = [ "" "" "" "" "" "" "" "" "" "" ];
|
||||||
node-type = "Audio/Source";
|
node-type = "Audio/Source";
|
||||||
max-volume = 100;
|
max-volume = 100;
|
||||||
scroll-step = 5;
|
scroll-step = 5;
|
||||||
|
|
@ -352,6 +352,7 @@ in
|
||||||
exit-immediately-if-empty=no
|
exit-immediately-if-empty=no
|
||||||
|
|
||||||
[key-bindings]
|
[key-bindings]
|
||||||
|
delete-line-forward=none
|
||||||
custom-1=Control+r
|
custom-1=Control+r
|
||||||
custom-2=Control+k
|
custom-2=Control+k
|
||||||
custom-3=Control+j
|
custom-3=Control+j
|
||||||
|
|
|
||||||
12
scripts/ctl
12
scripts/ctl
|
|
@ -97,23 +97,23 @@ audio)
|
||||||
[ -z "$devices" ] && exit 0
|
[ -z "$devices" ] && exit 0
|
||||||
default_name=$(printf '%s' "$dump" | jq -r --arg key "$default_meta" \
|
default_name=$(printf '%s' "$dump" | jq -r --arg key "$default_meta" \
|
||||||
'.[] | select(.type == "PipeWire:Interface:Metadata" and .info.props."metadata.name" == "default") | .info.metadata[] | select(.key == $key) | .value | fromjson | .name')
|
'.[] | select(.type == "PipeWire:Interface:Metadata" and .info.props."metadata.name" == "default") | .info.metadata[] | select(.key == $key) | .value | fromjson | .name')
|
||||||
vol=$(wpctl get-volume "$node" | awk '{printf "%d", $2 * 100}')
|
|
||||||
rows=$(printf '%s\n' "$devices" | while IFS="$(printf '\t')" read -r id name node_name; do
|
rows=$(printf '%s\n' "$devices" | while IFS="$(printf '\t')" read -r id name node_name; do
|
||||||
active=$([ "$node_name" = "$default_name" ] && echo ">" || echo "")
|
active=$([ "$node_name" = "$default_name" ] && echo ">" || echo "")
|
||||||
printf '%s\t%s\t%s\n' "$id" "$name" "$active"
|
vol=$(wpctl get-volume "$id" 2>/dev/null | awk '{printf "%d", $2 * 100}')
|
||||||
|
printf '%s\t%s\t%s\t%s\n' "$id" "$name" "$active" "$vol"
|
||||||
done)
|
done)
|
||||||
[ -z "$rows" ] && exit 0
|
[ -z "$rows" ] && exit 0
|
||||||
w1=$(printf '%s\n' "$rows" | awk -F'\t' 'BEGIN{m=11}{l=length($2);if(l>m)m=l}END{print m}')
|
w1=$(printf '%s\n' "$rows" | awk -F'\t' 'BEGIN{m=11}{l=length($2);if(l>m)m=l}END{print m}')
|
||||||
fw=$((w1 + pad + 10))
|
fw=$((w1 + pad + 16))
|
||||||
sep=$(awk -v n="$w1" 'BEGIN{for(i=0;i<n;i++)printf "─";print ""}')
|
sep=$(awk -v n="$((w1 + 10))" 'BEGIN{for(i=0;i<n;i++)printf "─";print ""}')
|
||||||
indent=$(printf "%${pad}s" "")
|
indent=$(printf "%${pad}s" "")
|
||||||
active_prefix=$(printf " >%$((pad - 3))s" "")
|
active_prefix=$(printf " >%$((pad - 3))s" "")
|
||||||
header=$(printf "%s%s vol: %d%%\n%s%s" "$indent" "Device name" "$vol" "$indent" "$sep")
|
header=$(printf "%s%-*s %s\n%s%s" "$indent" "$w1" "Device name" "Volume" "$indent" "$sep")
|
||||||
count=$(printf '%s\n' "$rows" | wc -l)
|
count=$(printf '%s\n' "$rows" | wc -l)
|
||||||
choice=$(printf '%s\n' "$rows" |
|
choice=$(printf '%s\n' "$rows" |
|
||||||
awk -F'\t' -v w1="$w1" -v indent="$indent" -v active_prefix="$active_prefix" '{
|
awk -F'\t' -v w1="$w1" -v indent="$indent" -v active_prefix="$active_prefix" '{
|
||||||
prefix = ($3 == ">") ? active_prefix : indent
|
prefix = ($3 == ">") ? active_prefix : indent
|
||||||
printf "%s%-*s\t%s\n", prefix, w1, $2, $1
|
printf "%s%-*s %3d%%\t%s\n", prefix, w1, $2, $4, $1
|
||||||
}' |
|
}' |
|
||||||
fuzzel --dmenu --prompt="$prompt" --no-icons --lines="$count" \
|
fuzzel --dmenu --prompt="$prompt" --no-icons --lines="$count" \
|
||||||
--with-nth=1 --accept-nth=2 \
|
--with-nth=1 --accept-nth=2 \
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue