diff --git a/home-manager/common/desktops/hyprland/common/hyprland/hyprland-conf.nix b/home-manager/common/desktops/hyprland/common/hyprland/hyprland-conf.nix index bfd847b1..5305579a 100644 --- a/home-manager/common/desktops/hyprland/common/hyprland/hyprland-conf.nix +++ b/home-manager/common/desktops/hyprland/common/hyprland/hyprland-conf.nix @@ -165,14 +165,6 @@ # Lock the screen, send to swaylock and pause music bind = $mainMod, L, exec, swaylock && playerctl pause - # Lid closure: - # trigger when the switch is toggled - # bindl=,switch:[switch name],exec,swaylock - # trigger when the switch is turning on - bindl=,switch:on:1241ec0,exec,hyprctl keyword monitor "eDP-1, 2560x1600, 0x0, 1" - # trigger when the switch is turning off - bindl=,switch:off:1241ec0,exec,hyprctl keyword monitor "eDP-1, disable" - # Resize bind = $mainMod, R, exec, notify-send "Entered resize mode. Press ESC to quit." bind = $mainMod, R, submap, resize diff --git a/home-manager/hosts/nixos-laptop/desktops/hyprland/default.nix b/home-manager/hosts/nixos-laptop/desktops/hyprland/default.nix index 843f88cf..1550d2bb 100644 --- a/home-manager/hosts/nixos-laptop/desktops/hyprland/default.nix +++ b/home-manager/hosts/nixos-laptop/desktops/hyprland/default.nix @@ -54,6 +54,14 @@ # Use rofi as an alt-tab switcher # bind = ALT, TAB, exec, rofi -show window + # Lid closure: + # trigger when the switch is toggled + # bindl=,switch:[switch name],exec,swaylock + # trigger when the switch is turning on + bindl=,switch:on:1241ec0,exec,hyprctl keyword monitor "eDP-1, 2560x1600, 0x0, 1" + # trigger when the switch is turning off + bindl=,switch:off:1241ec0,exec,hyprctl keyword monitor "eDP-1, disable" + # Start the config: exec-once=bash ~/.config/hypr/start.sh ''; diff --git a/home-manager/hosts/nixos-vm-02/desktops/hyprland/default.nix b/home-manager/hosts/nixos-vm-02/desktops/hyprland/default.nix index 544b7b4d..c0568b48 100644 --- a/home-manager/hosts/nixos-vm-02/desktops/hyprland/default.nix +++ b/home-manager/hosts/nixos-vm-02/desktops/hyprland/default.nix @@ -1,3 +1,52 @@ { -} \ No newline at end of file +}{ theme, ... }: { + home.file = { + ".config/hypr/hyprland.conf" = { + enable = true; + text = '' + + # Monitor specific: + monitor=,2560x1440,auto,1 + + # Start the config: + exec-once=bash ~/.config/hypr/start.sh + ''; + }; + # Set the custom launcher script + ".config/hypr/start.sh" = { + enable = true; + executable = true; + text = '' + #!/usr/bin/env bash + # https://wiki.hyprland.org/FAQ/#some-of-my-apps-take-a-really-long-time-to-open + dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP & + + # Set the wallpaper + swww init + + # Waybar + waybar & + + # Set up the idle management daemon + swayidle -w \ + timeout 120 'swaylock -f && playerctl pause' \ + timeout 180 'hyprctl dispatch dpms off' \ + timeout 300 'systemctl suspend-then-hibernate' \ + resume 'hyprctl dispatch dpms on' \ + before-sleep 'swaylock -f' \ + before-sleep 'playerctl pause' & + + # Automatic device mounting + udiskie & + + DIR=/etc/nixos/git/wallpapers/${theme} + IMG=`ls $DIR | shuf -n 1` + swww img $DIR/$IMG -t random & + + # Notification listener + mako + ''; + }; + }; +}