From 89e9aff700ceb257943bf99b77dafabb163e9a33 Mon Sep 17 00:00:00 2001 From: Lucas Chaim Date: Fri, 7 Jun 2024 13:13:43 -0300 Subject: [PATCH] feat: Basic Hypridle and Hyprlock configs, theme improvements Add hypridle and hyprlock settings Add transparency to theme, tweak rounding --- modules/home-manager/de/hyprland/default.nix | 106 +++++++++++------- .../de/hyprland/hypridle/default.nix | 23 ++++ .../de/hyprland/hyprlock/default.nix | 57 ++++++++++ 3 files changed, 143 insertions(+), 43 deletions(-) create mode 100644 modules/home-manager/de/hyprland/hypridle/default.nix create mode 100644 modules/home-manager/de/hyprland/hyprlock/default.nix diff --git a/modules/home-manager/de/hyprland/default.nix b/modules/home-manager/de/hyprland/default.nix index ae2e9d0..76d3d89 100644 --- a/modules/home-manager/de/hyprland/default.nix +++ b/modules/home-manager/de/hyprland/default.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, ... }: +{ config, lib, pkgs, ... }@args: with lib; let @@ -8,7 +8,7 @@ in { imports = [ ./bars - ./binds.nix + ./binds ./plugins ]; @@ -37,18 +37,23 @@ in }; }; - config = lib.mkIf cfg.enable ( - setAttrByPath namespace - { - plugins.enable = mkDefault false; - bars.ags.enable = mkDefault true; - bars.waybar.enable = mkDefault false; - } - // { + config = mkIf cfg.enable (mkMerge [ + (setAttrByPath namespace { + plugins.enable = mkDefault false; + bars.ags.enable = mkDefault true; + bars.waybar.enable = mkDefault false; + }) + { wayland.windowManager.hyprland = { enable = true; systemd.variables = [ "--all" ]; settings = { + exec-once = [ + "hypridle" + "hyprlock" + "hyprpaper" + "xwaylandvideobridge" + ]; general = { gaps_in = 5; gaps_out = 10; @@ -60,18 +65,25 @@ in layout = "dwindle"; }; decoration = { - rounding = 10; - active_opacity = 1.0; - inactive_opacity = 1.0; + rounding = 5; + active_opacity = 0.9; + inactive_opacity = 0.8; drop_shadow = true; shadow_range = 4; shadow_render_power = 3; "col.shadow" = mkDefault "rgba(1a1a1aee)"; blur = { enabled = true; - size = 3; - passes = 1; - vibrancy = 0.1696; + size = 8; + passes = 3; + noise = 0.2; + contrast = 0.9; + brightness = 0.8; + vibrancy = 0.2; + new_optimizations = true; + popups = true; + special = false; + xray = true; }; }; animations = { @@ -94,11 +106,11 @@ in pseudotile = true; smart_split = true; preserve_split = true; - no_gaps_when_only = true; + no_gaps_when_only = false; }; master = { new_is_master = true; - no_gaps_when_only = true; + no_gaps_when_only = false; }; misc = { disable_hyprland_logo = true; @@ -126,20 +138,18 @@ in monitor = [ ",preferred,auto,1" ]; opengl.nvidia_anti_flicker = true; windowrulev2 = [ - "opacity 0.0 override,class:^(xwaylandvideobridge)$" - "noanim,class:^(xwaylandvideobridge)$" - "noinitialfocus,class:^(xwaylandvideobridge)$" "maxsize 1 1,class:^(xwaylandvideobridge)$" + "noanim,class:^(xwaylandvideobridge)$" "noblur,class:^(xwaylandvideobridge)$" + "nofocus,class:^(xwaylandvideobridge)$" + "noinitialfocus,class:^(xwaylandvideobridge)$" + "opacity 0.0 override,class:^(xwaylandvideobridge)$" ]; }; }; programs = { - hyprlock = { - enable = false; - settings = { }; - }; + hyprlock = (import ./hyprlock args); kitty = { enable = true; font.name = config.stylix.fonts.monospace.name; @@ -152,10 +162,7 @@ in }; services = { - hypridle = { - enable = false; - settings = { }; - }; + hypridle = (import ./hypridle args); hyprpaper = { enable = true; settings = { @@ -167,20 +174,33 @@ in }; }; - home.file.".config/xdg-desktop-portal/hyprland-portals.conf".text = '' - [preferred] - default=hyprland;gtk - ''; - - home.packages = with pkgs; [ - grimblast - hyprpicker - xwaylandvideobridge - ]; + home = { + file.".config/xdg-desktop-portal/hyprland-portals.conf".text = '' + [preferred] + default=hyprland;gtk + ''; + packages = with pkgs; [ + grimblast + hyprcursor + hypridle + hyprlock + hyprpaper + hyprpicker + xwaylandvideobridge + ]; + }; - xdg.portal.extraPortals = with pkgs; [ - xdg-desktop-portal-hyprland - ]; + xdg.portal = { + enable = true; + config = { + preferred.default = [ "hyprland" "gtk" ]; + }; + extraPortals = with pkgs; [ + xdg-desktop-portal-hyprland + xdg-desktop-portal-gtk + ]; + xdgOpenUsePortal = true; + }; } - ); + ]); } diff --git a/modules/home-manager/de/hyprland/hypridle/default.nix b/modules/home-manager/de/hyprland/hypridle/default.nix new file mode 100644 index 0000000..4c6ff0f --- /dev/null +++ b/modules/home-manager/de/hyprland/hypridle/default.nix @@ -0,0 +1,23 @@ +{ pkgs, ... }: + +{ + enable = true; + settings = { + general = { + lock_cmd = "pidof hyprlock || hyprlock"; + before_sleep_cmd = "loginctl lock-session"; + after_sleep_cmd = "hyprctl dispatch dpms on"; + }; + listener = [ + { + timeout = "120"; + on-timeout = "brightnessctl -s set 10"; + on-resume = "brightnessctl -r"; + } + { + timeout = "300"; + on-timeout = "loginctl lock-session"; + } + ]; + }; +} diff --git a/modules/home-manager/de/hyprland/hyprlock/default.nix b/modules/home-manager/de/hyprland/hyprlock/default.nix new file mode 100644 index 0000000..32f995a --- /dev/null +++ b/modules/home-manager/de/hyprland/hyprlock/default.nix @@ -0,0 +1,57 @@ +{ config, pkgs, ... }: + +{ + enable = true; + settings = + let + colors = config.lib.stylix.colors; + makeRgb = colorIndex: + let + r = colors."base${colorIndex}-rgb-r"; + g = colors."base${colorIndex}-rgb-g"; + b = colors."base${colorIndex}-rgb-b"; + in + "rgb(${r},${g},${b})"; + in + { + background = { + path = "screenshot"; + blur_size = 3; + blur_passes = 2; + }; + input-field = [ + { + monitor = ""; + size = "300, 50"; + dots_size = 0.25; + dots_spacing = 0.15; + outline_thickness = 1; + dots_center = true; + fade_on_empty = false; + hide_input = false; + font_color = "rgb(0, 0, 0)"; + inner_color = "rgba(200, 200, 200, 0.5)"; + outer_color = "rgb(0, 0, 0)"; + placeholder_text = ""; + fail_text = "$FAIL ($ATTEMPTS)"; + position = "0, -120"; + halign = "center"; + valign = "center"; + } + ]; + label = [ + { + monitor = ""; + text = ''cmd[update:1000] echo "$(date +"%H:%M")"''; + color = ''rgba(255, 255, 255, 0.6)''; + font_size = "120"; + font_family = config.stylix.fonts.sansSerif.name; + outline_thickness = 2; + size = "250, 60"; + position = "0, -300"; + halign = "center"; + valign = "top"; + } + ]; + }; +}