Change volume keybindings and monitoring
This commit is contained in:
parent
07a708f369
commit
a9e6391d22
2 changed files with 15 additions and 5 deletions
|
|
@ -68,9 +68,13 @@ def clock_update(_):
|
|||
|
||||
|
||||
def volume_update(_):
|
||||
info = subprocess.check_output(['pulseaudio-ctl', 'full-status'])
|
||||
info = info[:-1].decode('utf-8')
|
||||
volume, mute, _ = info.split(' ')
|
||||
info = subprocess.check_output(['pactl', 'list', 'sinks']).decode('utf-8')
|
||||
info = (line.strip() for line in info[:-1].split('\n'))
|
||||
for line in info:
|
||||
if line.startswith('Volume:'):
|
||||
volume = line.split('/')[1].strip()[:-1]
|
||||
elif line.startswith('Mute:'):
|
||||
mute = line.split(' ')[1].strip()
|
||||
volume = int(volume)
|
||||
muted = mute == 'yes'
|
||||
mute_icon = "-" if muted else "%"
|
||||
|
|
|
|||
|
|
@ -19,8 +19,14 @@ super + shift + semicolon
|
|||
i3lock -e -i ~/images/lockscreen.png
|
||||
|
||||
# volume keys
|
||||
XF86Audio{Mute,LowerVolume,RaiseVolume}
|
||||
pulseaudio-ctl {mute,down,up}
|
||||
XF86AudioMute
|
||||
pactl set-sink-mute @DEFAULT_SINK@ toggle
|
||||
|
||||
XF86Audio{LowerVolume,RaiseVolume}
|
||||
pactl set-sink-volume @DEFAULT_SINK@ {-,+}5%
|
||||
|
||||
XF86AudioMicMute
|
||||
pactl set-source-mute @DEFAULT_SOURCE@ toggle
|
||||
|
||||
|
||||
#
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue