Use ALSA for audio control and status
This commit is contained in:
parent
09144d2792
commit
71d4005a8a
3 changed files with 9 additions and 7 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
#! /usr/bin/sh
|
#! /usr/bin/sh
|
||||||
|
|
||||||
DEB_PKGS="\
|
DEB_PKGS="\
|
||||||
|
alsa-utils \
|
||||||
audacity \
|
audacity \
|
||||||
borgbackup \
|
borgbackup \
|
||||||
curl \
|
curl \
|
||||||
|
|
|
||||||
|
|
@ -232,9 +232,9 @@ bindsym Mod4+4 exec fcitx5-remote -s keyboard-fr
|
||||||
#
|
#
|
||||||
|
|
||||||
bindsym XF86TouchpadToggle exec swaymsg input type:touchpad events toggle enabled disabled
|
bindsym XF86TouchpadToggle exec swaymsg input type:touchpad events toggle enabled disabled
|
||||||
bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle
|
bindsym XF86AudioMute exec amixer set Master toggle
|
||||||
bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5%
|
bindsym XF86AudioLowerVolume exec amixer set Master 5%-
|
||||||
bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5%
|
bindsym XF86AudioRaiseVolume exec amixer set Master 5%+
|
||||||
|
|
||||||
#
|
#
|
||||||
# Start a password manager in the scratchpad
|
# Start a password manager in the scratchpad
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,13 @@
|
||||||
today=$(date +'%Y-%m-%d')
|
today=$(date +'%Y-%m-%d')
|
||||||
now=$(date +'%H:%M:%S')
|
now=$(date +'%H:%M:%S')
|
||||||
|
|
||||||
audio_mute=$(pactl get-sink-mute @DEFAULT_SINK@ | awk '{print $2}')
|
audio_state=$(amixer get Master | tail -n 1)
|
||||||
audio_volume=$(pactl get-sink-volume @DEFAULT_SINK@ | grep -o '[0-9]\+%' | head -n 1 | tr -d %)
|
audio_volume=$(echo "$audio_state" | grep -o '[0-9]*%' | tr -d %)
|
||||||
|
audio_mute=$(echo "$audio_state" | grep -o '\[o.*\]' | tr -d \[\])
|
||||||
audio_symbol="❔"
|
audio_symbol="❔"
|
||||||
if [ "${audio_mute}" = "yes" ]; then
|
if [ "${audio_mute}" = "off" ]; then
|
||||||
audio_symbol="🔇"
|
audio_symbol="🔇"
|
||||||
elif [ "${audio_mute}" = "no" ]; then
|
elif [ "${audio_mute}" = "on" ]; then
|
||||||
if [ "${audio_volume}" = "0" ]; then
|
if [ "${audio_volume}" = "0" ]; then
|
||||||
audio_symbol="🔈"
|
audio_symbol="🔈"
|
||||||
elif [ "${audio_volume}" -lt 50 ]; then
|
elif [ "${audio_volume}" -lt 50 ]; then
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue