refactor(hyprland): change to structure of hyprland configuration

- move bind scripts to standalone shell applications
- split configuration into more modules
- still more work to be done
This commit is contained in:
ooks-io 2024-03-08 17:29:54 +13:00
parent 24e19d3c63
commit 2130903850
16 changed files with 216 additions and 189 deletions

View file

@ -0,0 +1,11 @@
{ pkgs, ... }:
let
packages = {
hyprvolume = pkgs.callPackage ./hyprvolume.nix {};
hyprbrightness = pkgs.callPackage ./hyprbrightness.nix {};
# Script to help Hyprland quit https://github.com/hyprwm/Hyprland/issues/3558#issuecomment-1848768654
hyprkillsession = pkgs.callPackage ./hyprkillsession.nix {};
};
in
packages

View file

@ -0,0 +1,20 @@
{ pkgs, ... }:
pkgs.writeShellApplication {
name = "hyprbrightness";
runtimeInputs = with pkgs; [brillo libnotify];
text = ''
if [ "$1" == "up" ]; then
brillo -q -u 30000 -A 5
elif [ "$1" == "down" ]; then
brillo -q -u 30000 -U 5
else
echo "Invalid argument"
exit 1
fi
BRIGHTNESS=$(brillo -G | awk -F'.' '{print$1}')
notify-send --app-name="system-notify" -h string:x-canonical-private-synchronous:sys-notify "󰃠 $BRIGHTNESS%"
'';
}

View file

@ -0,0 +1,16 @@
{ pkgs, ... }:
pkgs.writeShellApplication {
name = "hyprkillsession";
text = ''
if pgrep -x .Hyprland-wrapp >/dev/null; then
hyprctl dispatch exit 0
sleep 2
if pgrep -x .Hyprland-wrapp >/dev/null; then
killall -9 .Hyprland-wrapp
fi
fi
'';
}

View file

@ -0,0 +1,19 @@
{ pkgs, ... }:
pkgs.writeShellApplication {
name = "hyprvolume";
runtimeInputs = with pkgs; [pamixer libnotify];
text = ''
if [ "$1" == "up" ]; then
pamixer --increase 5
elif [ "$1" == "down" ]; then
pamixer --decrease 5
elif [ "$1" == "mute" ]; then
pamixer --toggle-mute
fi
VOLUME=$(pamixer --get-volume-human)
notify-send --app-name="system-notify" -h string:x-canonical-private-synchronous:sys-notify " $VOLUME"
'';
}