sb-volume now serves for micmute key too
This commit is contained in:
parent
7c405cc3d9
commit
1af7fd24f4
3 changed files with 28 additions and 16 deletions
|
@ -1,11 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
state=$(pactl get-source-mute @DEFAULT_SOURCE@ | awk -F': ' '{print $2}')
|
||||
case ${state} in
|
||||
yes)
|
||||
echo 0 | doas tee /sys/devices/platform/thinkpad_acpi/leds/platform::micmute/brightness
|
||||
pactl set-source-mute @DEFAULT_SOURCE@ 0 ;;
|
||||
no)
|
||||
echo 1 | doas tee /sys/devices/platform/thinkpad_acpi/leds/platform::micmute/brightness
|
||||
pactl set-source-mute @DEFAULT_SOURCE@ 1 ;;
|
||||
esac
|
|
@ -1,12 +1,35 @@
|
|||
#!/bin/bash
|
||||
|
||||
key_micmute() {
|
||||
state=$(pactl get-source-mute @DEFAULT_SOURCE@ | awk -F': ' '{print $2}')
|
||||
case ${state} in
|
||||
yes)
|
||||
echo 0 | doas tee /sys/devices/platform/thinkpad_acpi/leds/platform::micmute/brightness
|
||||
pactl set-source-mute @DEFAULT_SOURCE@ 0 ;;
|
||||
no)
|
||||
echo 1 | doas tee /sys/devices/platform/thinkpad_acpi/leds/platform::micmute/brightness
|
||||
pactl set-source-mute @DEFAULT_SOURCE@ 1 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
vol_decrease() {
|
||||
pactl set-sink-volume @DEFAULT_SINK@ -5%
|
||||
volume=$(pactl get-sink-volume @DEFAULT_SINK@ | head -n 1 | awk -F' / *' '{print $2}')
|
||||
notify-send -t 2000 -u low "volume: $volume"
|
||||
}
|
||||
|
||||
vol_increase() {
|
||||
pactl set-sink-volume @DEFAULT_SINK@ +5%
|
||||
volume=$(pactl get-sink-volume @DEFAULT_SINK@ | head -n 1 | awk -F' / *' '{print $2}')
|
||||
notify-send -t 2000 -u low "volume: $volume"
|
||||
}
|
||||
|
||||
if [ $1 ]; then
|
||||
case $1 in
|
||||
inc) pactl set-sink-volume @DEFAULT_SINK@ +5%;;
|
||||
dec) pactl set-sink-volume @DEFAULT_SINK@ -5%;;
|
||||
dec) vol_decrease ;;
|
||||
inc) vol_increase ;;
|
||||
key) key_micmute ;;
|
||||
esac
|
||||
volume=$(pactl get-sink-volume @DEFAULT_SINK@ | head -n 1 | awk -F' / *' '{print $2}')
|
||||
notify-send -t 2000 -u low "volume: $volume"
|
||||
else
|
||||
mic=$(pactl get-source-volume @DEFAULT_SOURCE@ | awk -F' / ' '{print $2}' | tr -d '%')
|
||||
[ $(pactl get-source-mute @DEFAULT_SOURCE@ | awk -F': ' '{print $2}') = yes ] || [ "$mic" -eq 0 ] && micmute="mic muted" || micmute=""
|
||||
|
|
|
@ -92,7 +92,7 @@ keys = [
|
|||
Key([mod], "r", lazy.reload_config()),
|
||||
# media keys
|
||||
Key([], "XF86AudioMute", lazy.spawn("pactl set-sink-mute @DEFAULT_SINK@ toggle")),
|
||||
Key([], "XF86AudioMicMute", lazy.spawn("key-micmute")),
|
||||
Key([], "XF86AudioMicMute", lazy.spawn("sb-volume key")),
|
||||
Key([], "XF86AudioRaiseVolume", lazy.spawn("sb-volume inc")),
|
||||
Key([], "XF86AudioLowerVolume", lazy.spawn("sb-volume dec")),
|
||||
Key([], "XF86MonBrightnessUp", lazy.spawn("xbacklight -inc 10")),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue