Skip to content

Commit

Permalink
Merge pull request #58 from erictossell/develop
Browse files Browse the repository at this point in the history
Small config Hyprland changes, vol.sh
  • Loading branch information
erictossell authored Nov 23, 2023
2 parents c7f3eb8 + 3004296 commit 32c0854
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 3 deletions.
4 changes: 2 additions & 2 deletions modules/hardware/sound/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ username, ... }:
{ pkgs, username, ... }:
{
users.users.${username} = {
extraGroups = [ "audio" ];
Expand All @@ -7,7 +7,7 @@
security.rtkit.enable = true;
sound.enable = true;
hardware.pulseaudio.enable = false;

environment.systemPackages = with pkgs; [ pulseaudio ];
services.pipewire = {
enable = true;
alsa.enable = true;
Expand Down
14 changes: 13 additions & 1 deletion modules/hyprland/config/desktop.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ preload = ~/.config/backgrounds/1A1C23.png
preload = ~/.config/backgrounds/keyboard.png
preload = ~/.config/backgrounds/storage.jpg
wallpaper = DP-1, ~/.config/backgrounds/232136.png
wallpaper = DP-2, ~/.config/backgrounds/232136.png
wallpaper = HDMI-A-1, ~/.config/backgrounds/232136.png
'';

".config/hypr/vol.sh" = {
source = ../../../sh/vol.sh;
executable = true;
};

".config/hypr/hyprland.conf".text = ''
monitor=DP-2,preferred,1080x400,1
monitor=HDMI-A-1,preferred,3640x0,1
Expand Down Expand Up @@ -54,6 +58,14 @@ bind = $mainMod, j, togglesplit, # dwindle
bind = $mainMod, 0, exec, swaylock
bind = $mainMod, s, exec, grim -g "$(slurp)" ~/Pictures/Screenshots/$(date +'%Y%m%d_%H%M%S').png
bind = ,XF86AudioMute, exec, ~/.config/hypr/vol.sh --mute
bind = ,XF86AudioLowerVolume, exec, ~/.config/hypr/vol.sh --down
bind = ,XF86AudioRaiseVolume, exec, ~/.config/hypr/vol.sh --up
bind = ,xF86AudioPlay, exec, playerctl play-pause
bind = ,xF86AudioNext, exec, playerctl next
bind = ,xF86AudioPrev, exec, playerctl previous
$w2 = hyprctl hyprpaper wallpaper "DP-2, ~/.config/backgrounds/232136.png"
$w4 = hyprctl hyprpaper wallpaper "DP-2, ~/.config/backgrounds/1A1C23.png"
$w5 = hyprctl hyprpaper wallpaper "DP-2, ~/.config/backgrounds/storage.jpg"
Expand Down
13 changes: 13 additions & 0 deletions modules/hyprland/config/laptop.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ preload = ~/.config/backgrounds/232136.png
preload = ~/.config/backgrounds/1A1C23.png
wallpaper = eDP-1, ~/.config/backgrounds/232136.png
'';

".config/hypr/vol.sh" = {
source = ../../../sh/vol.sh;
executable = true;
};

".config/hypr/hyprland.conf".text = ''
#monitor=edp-1,3840 x 2160,auto,auto
Expand Down Expand Up @@ -39,6 +44,14 @@ bind = $mainMod, j, togglesplit, # dwindle
bind = $mainMod, 0, exec, swaylock
bind = $mainMod, s, exec, grim -g "$(slurp)" ~/Pictures/Screenshots/$(date +'%Y%m%d_%H%M%S').png
bind = ,XF86AudioMute, exec, ~/.config/hypr/vol.sh --mute
bind = ,XF86AudioLowerVolume, exec, ~/.config/hypr/vol.sh --down
bind = ,XF86AudioRaiseVolume, exec, ~/.config/hypr/vol.sh --up
bind = ,xF86AudioPlay, exec, playerctl play-pause
bind = ,xF86AudioNext, exec, playerctl next
bind = ,xF86AudioPrev, exec, playerctl previous
$w1 = hyprctl hyprpaper wallpaper "eDP-1, ~/.config/backgrounds/232136.png"
$w2 = hyprctl hyprpaper wallpaper "eDP-1, ~/.config/backgrounds/1A1C23.png"
$w3 = hyprctl hyprpaper wallpaper "eDP-1, ~/.config/backgrounds/232136.png"
Expand Down
35 changes: 35 additions & 0 deletions sh/vol.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/run/current-system/sw/bin/bash

volume_up() {
pactl set-sink-volume "$1" +2%
}
volume_down() {
pactl set-sink-volume "$1" -2%
}
volume_mute() {
pactl set-sink-mute "$1" toggle
}

# Get the currently active sink
CURRENT_SINK=$(pactl list short sinks | grep RUNNING | awk '{print $1}')

if [ -z "$CURRENT_SINK" ]; then
echo "No active sink found."
exit 1
fi

case "$1" in
--up)
volume_up "$CURRENT_SINK"
;;
--down)
volume_down "$CURRENT_SINK"
;;
--mute)
volume_mute "$CURRENT_SINK"
;;
*)
echo "Usage: $0 --up | --down | --mute"
exit 1
;;
esac

0 comments on commit 32c0854

Please sign in to comment.