pactl
This commit is contained in:
parent
10948c34fb
commit
e3dc5a6aca
|
@ -2,7 +2,7 @@
|
|||
|
||||
home.packages = with pkgs; [
|
||||
rofi-wayland
|
||||
pavucontrol
|
||||
pwvucontrol
|
||||
swww
|
||||
wl-clipboard
|
||||
cliphist
|
||||
|
@ -144,8 +144,8 @@
|
|||
bindl = [
|
||||
", XF86MonBrightnessUp, exec, brightnessctl set +10%"
|
||||
", XF86MonBrightnessDown, exec, brightnessctl set 10%-"
|
||||
", XF86AudioRaiseVolume, exec, amixer set Master 10%+"
|
||||
", XF86AudioLowerVolume, exec, amixer set Master 10%-"
|
||||
", XF86AudioRaiseVolume, exec, sh volume.sh -i"
|
||||
", XF86AudioLowerVolume, exec, sh volume.sh -d"
|
||||
];
|
||||
|
||||
general = {
|
||||
|
|
51
home/hyprland/volume.sh
Executable file
51
home/hyprland/volume.sh
Executable file
|
@ -0,0 +1,51 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Function to display usage
|
||||
usage() {
|
||||
echo "Usage: $0 [-d|-i|-m]"
|
||||
echo " -d Decrease volume by 10%"
|
||||
echo " -i Increase volume by 10%"
|
||||
echo " -m Toggle mute/unmute"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Get the default sink
|
||||
sink=$(pactl info | grep "Default Sink" | awk '{print $3}')
|
||||
|
||||
# Check if a sink was found
|
||||
if [ -z "$sink" ]; then
|
||||
echo "No default sink found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Process command-line options
|
||||
while getopts "dim" opt; do
|
||||
case $opt in
|
||||
d)
|
||||
# Decrease volume by 10%
|
||||
pactl set-sink-volume "$sink" -10%
|
||||
;;
|
||||
i)
|
||||
# Increase volume by 10%
|
||||
pactl set-sink-volume "$sink" +10%
|
||||
;;
|
||||
m)
|
||||
# Toggle mute/unmute
|
||||
current_mute=$(pactl get-sink-mute "$sink" | awk '{print $2}')
|
||||
if [ "$current_mute" = "yes" ]; then
|
||||
pactl set-sink-mute "$sink" 0
|
||||
echo "Unmuted"
|
||||
else
|
||||
pactl set-sink-mute "$sink" 1
|
||||
echo "Muted"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Display current volume level
|
||||
echo "Current volume:"
|
||||
pactl list sinks | grep -A 15 "$sink" | grep "Volume:"
|
|
@ -26,6 +26,7 @@
|
|||
mpv
|
||||
cmus
|
||||
obs-studio
|
||||
pulseaudioFull
|
||||
#gui stuff
|
||||
keepassxc
|
||||
vesktop
|
||||
|
|
Loading…
Reference in a new issue