This commit is contained in:
joygnu 2024-08-09 01:14:56 +02:00
parent c9ba959339
commit d5d0418f30
3 changed files with 55 additions and 3 deletions

View file

@ -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
View 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:"

View file

@ -26,6 +26,7 @@
mpv
cmus
obs-studio
pulseaudioFull
#gui stuff
keepassxc
vesktop