From 1ebae52b65413694c82627dc53cf311f91e09532 Mon Sep 17 00:00:00 2001 From: endotrizine Date: Thu, 21 Nov 2024 06:23:46 +0500 Subject: [PATCH] Added script and keybind to adjust volume --- .config/ags/scripts/music/adjust-volume.sh | 15 +++++++++++++++ .config/hypr/hyprland/keybinds.conf | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100755 .config/ags/scripts/music/adjust-volume.sh diff --git a/.config/ags/scripts/music/adjust-volume.sh b/.config/ags/scripts/music/adjust-volume.sh new file mode 100755 index 000000000..dce141997 --- /dev/null +++ b/.config/ags/scripts/music/adjust-volume.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +change=$1 + +current_volume=$(playerctl volume) + +new_volume=$(echo "$current_volume + $change" | bc) + +if (( $(echo "$new_volume > 1.0" | bc -l) )); then + new_volume=1.0 +elif (( $(echo "$new_volume < 0.0" | bc -l) )); then + new_volume=0.0 +fi + +playerctl volume "$new_volume" diff --git a/.config/hypr/hyprland/keybinds.conf b/.config/hypr/hyprland/keybinds.conf index 005bf09bb..e7a7d32c9 100644 --- a/.config/hypr/hyprland/keybinds.conf +++ b/.config/hypr/hyprland/keybinds.conf @@ -177,9 +177,10 @@ bind = Super+Alt, f12, exec, notify-send 'Test notification' "Here's a really lo bind = Super+Alt, Equal, exec, notify-send "Urgent notification" "Ah hell no" -u critical -a 'Hyprland keybind' # [hidden] ##! Media -bindl= Super+Shift, N, exec, playerctl next || playerctl position `bc <<< "100 * $(playerctl metadata mpris:length) / 1000000 / 100"` # Next track bindl= ,XF86AudioNext, exec, playerctl next || playerctl position `bc <<< "100 * $(playerctl metadata mpris:length) / 1000000 / 100"` # [hidden] bindl= ,XF86AudioPrev, exec, playerctl previous # [hidden] +bindl = Super+Shift, Comma, exec, ~/.config/ags/scripts/music/adjust-volume.sh -0.03 # Raise music volume +bindl = Super+Shift, Period, exec, ~/.config/ags/scripts/music/adjust-volume.sh 0.03 # Lower music volume bind = Super+Shift+Alt, mouse:275, exec, playerctl previous # [hidden] bind = Super+Shift+Alt, mouse:276, exec, playerctl next || playerctl position `bc <<< "100 * $(playerctl metadata mpris:length) / 1000000 / 100"` # [hidden] bindl= Super+Shift, B, exec, playerctl previous # Previous track