Add audio output controls to polybar
This commit is contained in:
parent
4fce81eff6
commit
bd6fe43b4a
4 changed files with 24 additions and 5 deletions
|
@ -73,6 +73,9 @@ bindsym $mod+Shift+o exec --no-startup-id "passmenu-otp -combi-modi window,drun,
|
|||
# .desktop file. It is a wrapper around dmenu, so you need that installed.
|
||||
# bindcode $mod+40 exec --no-startup-id i3-dmenu-desktop
|
||||
|
||||
bindsym $mod+Shift+F11 exec --no-startup-id "pactl set-default-sink 3 && sh ~/.scripts/audio/get-sink-name.sh > ~/.cache/scripts/get-sink-name.txt"
|
||||
bindsym $mod+Shift+F12 exec --no-startup-id "pactl set-default-sink 76 && sh ~/.scripts/audio/get-sink-name.sh > ~/.cache/scripts/get-sink-name.txt"
|
||||
|
||||
# change focus
|
||||
bindsym $mod+h focus left
|
||||
bindsym $mod+j focus down
|
||||
|
|
|
@ -52,7 +52,7 @@ font-0 = Hack;2
|
|||
font-1 = Font Awesome
|
||||
|
||||
modules-left = xworkspaces xwindow
|
||||
modules-right = filesystem pulseaudio xkeyboard memory cpu eth date
|
||||
modules-right = filesystem audiooutput pulseaudio xkeyboard memory cpu eth date
|
||||
|
||||
cursor-click = pointer
|
||||
cursor-scroll = ns-resize
|
||||
|
@ -113,6 +113,15 @@ label-volume = %percentage%%
|
|||
label-muted = muted
|
||||
label-muted-foreground = ${colors.disabled}
|
||||
|
||||
[module/audiooutput]
|
||||
type = custom/script
|
||||
exec = cat ~/.cache/scripts/get-sink-name.txt
|
||||
interval = 1
|
||||
format = <label>
|
||||
format-prefix = "OUT "
|
||||
format-prefix-foreground = ${colors.primary}
|
||||
label = %output%
|
||||
|
||||
[module/xkeyboard]
|
||||
type = internal/xkeyboard
|
||||
blacklist-0 = num lock
|
||||
|
|
11
home/vylpes/.scripts/audio/get-sink-name.sh
Normal file
11
home/vylpes/.scripts/audio/get-sink-name.sh
Normal file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
SINK=$(pactl get-default-sink)
|
||||
|
||||
if [ $SINK = "alsa_output.pci-0000_1f_00.3.analog-stereo" ]; then
|
||||
echo "Speakers"
|
||||
elif [ $SINK = "alsa_output.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-stereo" ]; then
|
||||
echo "Headphones"
|
||||
else
|
||||
echo "-"
|
||||
fi
|
|
@ -1,4 +0,0 @@
|
|||
if [ -d /sys/class/power_supply/BAT0 ]
|
||||
then
|
||||
echo $(acpi -V | grep 'Battery 0' | head -n 1 | cut -f2 -d, | sed 's/ //')
|
||||
fi
|
Loading…
Reference in a new issue