From 1afa1d9a11238d5ed6b025a863a3eb08f860cbb9 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Sat, 7 Feb 2026 17:13:36 +0100 Subject: [PATCH] Added sound scripts --- .../home-manager/{ => Hyprland}/hyprland.nix | 7 +++-- modules/home-manager/Hyprland/scripts.nix | 26 +++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) rename modules/home-manager/{ => Hyprland}/hyprland.nix (92%) create mode 100644 modules/home-manager/Hyprland/scripts.nix diff --git a/modules/home-manager/hyprland.nix b/modules/home-manager/Hyprland/hyprland.nix similarity index 92% rename from modules/home-manager/hyprland.nix rename to modules/home-manager/Hyprland/hyprland.nix index 21c6237..36aadde 100644 --- a/modules/home-manager/hyprland.nix +++ b/modules/home-manager/Hyprland/hyprland.nix @@ -94,14 +94,17 @@ in bindl = [ ", XF86AudioPause, exec, playerctl play-pause" ", XF86AudioPlay, exec, playerctl play-pause" - ", XF86AudioRaiseVolume, exec, wpctl set-sink volume @DEFAULT_SINK@ +5%" - ", XF86AudioLowerVolume, exec, wpctl set-sink volume @DEFAULT_SINK@ -5%" + ", XF86AudioRaiseVolume, exec, VolumeManager up" + ", XF86AudioLowerVolume, exec, VolumeManager down" + ", XF866AudioMute, exec, VolumeManager mute" ]; }; }; home.packages = with pkgs; [ + # Custom scripts + (import ./scripts.nix { inherit pkgs; }) # Hyprland related (rice, etc...) wofi alacritty diff --git a/modules/home-manager/Hyprland/scripts.nix b/modules/home-manager/Hyprland/scripts.nix new file mode 100644 index 0000000..373f3a1 --- /dev/null +++ b/modules/home-manager/Hyprland/scripts.nix @@ -0,0 +1,26 @@ +{pkgs, ...}: + +pkgs.writeShellApplication { + name = "VolumeManager"; + runtinmeInputs = [ + pkgs.wireplumber + ]; + + text = '' + case "$1" in + up) + wpctl set-volume @DEFAULT_SINK@ 0.05+ + ;; + down) + wpctl set-volume @DEFAULT_SINK@ 0.05- + ;; + mute) + wpctl set-mute @DEFAULT_SINK@ toggle + ;; + *) + echo "Usage: volume {up|down\mute}" + exit 1 + ;; + esac + ''; +}