diff --git a/modules/desktop/desktop.nix b/modules/desktop/desktop.nix index 6cbe1adc2..d3b8fd0af 100644 --- a/modules/desktop/desktop.nix +++ b/modules/desktop/desktop.nix @@ -7,24 +7,22 @@ }: let cfg = config.programs.illogical-impulse; in { - imports = [ - ../options.nix - ]; + imports = + [ + ../options.nix + ] + ++ lib.optionals (cfg.enable && cfg.settings.hyprland.useNixForConf) [ + ./hyprland/default.nix + ]; config = lib.mkIf cfg.enable { - wayland.windowManager.hyprland = lib.mkIf cfg.settings.hyprland.useNixForConf { - enable = true; - xwayland.enable = true; - systemd.enable = true; - }; - - imports = lib.optionals cfg.settings.hyprland.useNixForConf [ - ./hyprland/hypr/keybinds.nix - ./hyprland/hypr/execs.nix - ./hyprland/hypr/rules.nix - ./hyprland/hypr/env.nix - ./hyprland/hypr/colours.nix - ]; + # imports = lib.optionals cfg.settings.hyprland.useNixForConf [ + # ./hyprland/hypr/keybinds.nix + # ./hyprland/hypr/execs.nix + # ./hyprland/hypr/rules.nix + # ./hyprland/hypr/env.nix + # ./hyprland/hypr/colours.nix + # ]; home.file = { ".config/quickshell".source = builtins.path {path = ../../.config/quickshell;}; diff --git a/modules/desktop/hyprland/default.nix b/modules/desktop/hyprland/default.nix index 488dbc3cb..62075ac01 100644 --- a/modules/desktop/hyprland/default.nix +++ b/modules/desktop/hyprland/default.nix @@ -3,13 +3,23 @@ config, lib, ... -}: { +}: let + cfg = config.programs.illogical-impulse; +in { + wayland.windowManager.hyprland = { + enable = true; + xwayland.enable = true; + systemd.enable = true; + }; + imports = [ ./hypr/keybinds.nix ./hypr/execs.nix ./hypr/rules.nix ./hypr/env.nix ./hypr/colours.nix + ./hyprlock.nix + ./hypridle.nix ]; home.file = { @@ -21,9 +31,9 @@ }; }; - wayland.windowManager.hyprland = { - enable = true; - xwayland.enable = true; - systemd.enable = true; - }; + # wayland.windowManager.hyprland = { + # enable = true; + # xwayland.enable = true; + # systemd.enable = true; + # }; } diff --git a/modules/desktop/hyprland/hypridle.nix b/modules/desktop/hyprland/hypridle.nix new file mode 100644 index 000000000..805704825 --- /dev/null +++ b/modules/desktop/hyprland/hypridle.nix @@ -0,0 +1,37 @@ +{ + config, + pkgs, + ... +}: { + programs.hypridle = { + enable = true; + settings = { + general = { + lock_cmd = "pidof hyprlock || hyprlock"; + before_sleep_cmd = "loginctl lock-session"; + after_sleep_cmd = "hyprctl dispatch global quickshell:lockFocus"; + inhibit_sleep = 3; + }; + listener = [ + { + timeout = 300; + on-timeout = "loginctl lock-session"; + } + { + timeout = 600; + on-timeout = "hyprctl dispatch dpms off"; + on-resume = "hyprctl dispatch dpms on"; + } + { + timeout = 900; + on-timeout = "systemctl suspend || loginctl suspend"; + } + ]; + }; + }; + + # Make sure the hypridle package is installed + home.packages = [ + pkgs.hypridle + ]; +} diff --git a/modules/desktop/hyprland/hyprlock.nix b/modules/desktop/hyprland/hyprlock.nix new file mode 100644 index 000000000..e08775b2d --- /dev/null +++ b/modules/desktop/hyprland/hyprlock.nix @@ -0,0 +1,110 @@ +{ + config, + pkgs, + lib, + ... +}: let + # Your variables + text_color = "rgba(FFDAD6FF)"; + entry_background_color = "rgba(41000311)"; + entry_border_color = "rgba(896E6C55)"; + entry_color = "rgba(FFDAD6FF)"; + font_family = "Rubik Light"; + font_family_clock = "Rubik Light"; + font_material_symbols = "Material Symbols Rounded"; +in { + programs.hyprlock = { + enable = true; + settings = { + background = { + color = "rgba(181818FF)"; + }; + "input-field" = { + size = "250, 50"; + outline_thickness = 2; + dots_size = 0.1; + dots_spacing = 0.3; + outer_color = entry_border_color; + inner_color = entry_background_color; + font_color = entry_color; + fade_on_empty = true; + position = "0, 20"; + halign = "center"; + valign = "center"; + }; + label = [ + { + text = "$LAYOUT"; + color = text_color; + font_size = 14; + font_family = font_family; + position = "-30, 30"; + halign = "right"; + valign = "bottom"; + } + { + text = lib.strings.escapeNixString "cmd[update:250] ${config.xdg.configHome}/hypr/hyprlock/check-capslock.sh"; + color = text_color; + font_size = 13; + font_family = font_family; + position = "0, -25"; + halign = "center"; + valign = "center"; + } + { + text = "$TIME"; + color = text_color; + font_size = 65; + font_family = font_family_clock; + position = "0, 300"; + halign = "center"; + valign = "center"; + } + { + text = lib.strings.escapeNixString "cmd[update:5000] date +\"%A, %B %d\""; + color = text_color; + font_size = 17; + font_family = font_family_clock; + position = "0, 240"; + halign = "center"; + valign = "center"; + } + { + text = " $USER"; + color = text_color; + outline_thickness = 2; + dots_size = 0.2; + dots_spacing = 0.2; + dots_center = true; + font_size = 20; + font_family = font_family; + position = "0, 50"; + halign = "center"; + valign = "bottom"; + } + { + text = lib.strings.escapeNixString "cmd[update:5000] ${config.xdg.configHome}/hypr/hyprlock/status.sh"; + color = text_color; + font_size = 14; + font_family = font_family; + position = "30, -30"; + halign = "left"; + valign = "top"; + } + ]; + }; + }; + home.packages = [ + pkgs.hyprlock + ]; + home.file = { + ".config/hypr/hyprlock/check-capslock.sh".source = builtins.path { + path = ./check-capslock.sh; + executable = true; # This line ensures the file is executable + }; + ".config/hypr/hyprlock/status.sh".source = builtins.path { + path = ./status.sh; + executable = true; # This line ensures the file is executable + }; + }; +}