From e09569b921de80edc0355ee0645d99dc7617ad3c Mon Sep 17 00:00:00 2001 From: Anthony Rodriguez Date: Fri, 17 Jan 2025 11:55:05 +0100 Subject: [PATCH] treewide: move hyprland styling out of module --- modules/hm/programs/hypr/land/default.nix | 175 ++++++++++-------- modules/hm/services/default.nix | 1 + .../style/modules => hm/services}/gtk.nix | 16 +- modules/nix/style/modules/hyprland.nix | 27 --- 4 files changed, 106 insertions(+), 113 deletions(-) rename modules/{nix/style/modules => hm/services}/gtk.nix (62%) delete mode 100644 modules/nix/style/modules/hyprland.nix diff --git a/modules/hm/programs/hypr/land/default.nix b/modules/hm/programs/hypr/land/default.nix index e6d9c0e..02d4a77 100644 --- a/modules/hm/programs/hypr/land/default.nix +++ b/modules/hm/programs/hypr/land/default.nix @@ -4,7 +4,10 @@ pkgs, osConfig, ... -}: { +}: let + inherit (builtins) toString; + styleCfg = osConfig.local.style; +in { imports = [./binds.nix]; config = lib.mkIf osConfig.local.modules.hyprland.enable { @@ -35,85 +38,103 @@ systemd.enable = false; - settings = { - xwayland = { - force_zero_scaling = true; - }; - - env = [ - "GDK_SCALE,1" - ]; - - cursor = { - no_hardware_cursors = 1; - }; - - monitor = [ - "eDP-1, preferred, auto, 1.33" - ]; - workspace = [ - "special:terminal, on-created-empty:foot" - "special:mixer_gui, on-created-empty:pavucontrol" - "special:file_manager_gui, on-created-empty:nautilus" - "special:file_manager_tui, on-created-empty:foot -- yazi" - ]; - - windowrulev2 = [ - # fixes fullscreen windows (mostly games) - "stayfocused, initialtitle:^()$, initialclass:^(steam)$" - "minsize 1 1, initialtitle:^()$, initialclass:^(steam)$" - "maximize, initialtitle:^(\S+)$, initialclass:^(steamwebhelper)$" - - "immediate, initialclass:^(steam_app_)(.*)$" - "fullscreen, initialclass:^(steam_app_)(.*)$" - - # inhibit idle on every fullscreen app except games - "idleinhibit always, fullscreen:1,!initialclass:^(steam_app_)(.*)$" - ]; - - render = { - explicit_sync = 1; - explicit_sync_kms = 1; - expand_undersized_textures = false; - }; - - animations = { - enabled = true; - bezier = "myBezier, 0.05, 0.9, 0.1, 1.1"; - animation = [ - "windows, 1, 5, myBezier" - "windowsOut, 1, 5, default, popin 80%" - "windowsMove, 1, 5, default, popin 80%" - "fade, 1, 5, default" - "border, 1, 5, default" - "borderangle, 0, 8, default" - "workspaces, 0" - "specialWorkspace, 0" - ]; - }; - - input = { - kb_options = "compose:ralt"; - touchpad = { - natural_scroll = true; - scroll_factor = 0.8; - tap-to-click = true; - clickfinger_behavior = true; + settings = lib.mkMerge [ + { + xwayland = { + force_zero_scaling = true; }; - }; - gestures = { - workspace_swipe = true; - workspace_swipe_direction_lock = false; - workspace_swipe_cancel_ratio = 0.15; - }; + env = [ + "GDK_SCALE,1" + ]; - misc = { - force_default_wallpaper = 0; - disable_hyprland_logo = true; - middle_click_paste = false; - }; - }; + cursor = { + no_hardware_cursors = 1; + }; + + monitor = [ + "eDP-1, preferred, auto, 1.33" + ]; + workspace = [ + "special:terminal, on-created-empty:foot" + "special:mixer_gui, on-created-empty:pavucontrol" + "special:file_manager_gui, on-created-empty:nautilus" + "special:file_manager_tui, on-created-empty:foot -- yazi" + ]; + + windowrulev2 = [ + # fixes fullscreen windows (mostly games) + "stayfocused, initialtitle:^()$, initialclass:^(steam)$" + "minsize 1 1, initialtitle:^()$, initialclass:^(steam)$" + "maximize, initialtitle:^(\S+)$, initialclass:^(steamwebhelper)$" + + "immediate, initialclass:^(steam_app_)(.*)$" + "fullscreen, initialclass:^(steam_app_)(.*)$" + + # inhibit idle on every fullscreen app except games + "idleinhibit always, fullscreen:1,!initialclass:^(steam_app_)(.*)$" + ]; + + render = { + explicit_sync = 1; + explicit_sync_kms = 1; + expand_undersized_textures = false; + }; + + animations = { + enabled = true; + bezier = "myBezier, 0.05, 0.9, 0.1, 1.1"; + animation = [ + "windows, 1, 5, myBezier" + "windowsOut, 1, 5, default, popin 80%" + "windowsMove, 1, 5, default, popin 80%" + "fade, 1, 5, default" + "border, 1, 5, default" + "borderangle, 0, 8, default" + "workspaces, 0" + "specialWorkspace, 0" + ]; + }; + + input = { + kb_options = "compose:ralt"; + touchpad = { + natural_scroll = true; + scroll_factor = 0.8; + tap-to-click = true; + clickfinger_behavior = true; + }; + }; + + gestures = { + workspace_swipe = true; + workspace_swipe_direction_lock = false; + workspace_swipe_cancel_ratio = 0.15; + }; + + misc = { + force_default_wallpaper = 0; + disable_hyprland_logo = true; + middle_click_paste = false; + }; + } + + (lib.mkIf styleCfg.enable { + env = [ + "HYPRCURSOR_THEME,${styleCfg.cursorTheme.name}" + "HYPRCURSOR_SIZE,${toString styleCfg.cursorTheme.size}" + "XCURSOR_SIZE,${toString styleCfg.cursorTheme.size}" + ]; + general = { + border_size = 4; + "col.active_border" = "rgb(${lib.removePrefix "#" styleCfg.scheme.palette.base0E})"; + }; + decoration = { + rounding = 10; + blur.enabled = true; + }; + }) + ]; }; }; } diff --git a/modules/hm/services/default.nix b/modules/hm/services/default.nix index 39128e4..6bff764 100644 --- a/modules/hm/services/default.nix +++ b/modules/hm/services/default.nix @@ -1,6 +1,7 @@ { imports = [ ./gammastep.nix + ./gtk.nix ./syncthing.nix ./swaync ./udiskie.nix diff --git a/modules/nix/style/modules/gtk.nix b/modules/hm/services/gtk.nix similarity index 62% rename from modules/nix/style/modules/gtk.nix rename to modules/hm/services/gtk.nix index 7320c3c..f8c184e 100644 --- a/modules/nix/style/modules/gtk.nix +++ b/modules/hm/services/gtk.nix @@ -1,20 +1,19 @@ { lib, - config, + osConfig, ... }: let - cfg = config.local.style; - inherit (cfg) scheme; + styleCfg = osConfig.local.style; in { - home-manager.sharedModules = lib.mkIf cfg.enable [ - { + config = with styleCfg; + lib.mkIf styleCfg.enable { gtk = rec { enable = true; iconTheme = { - inherit (cfg.gtk.iconTheme) name package; + inherit (gtk.iconTheme) name package; }; theme = { - inherit (cfg.gtk.theme) name package; + inherit (gtk.theme) name package; }; gtk3.extraConfig = { @@ -24,6 +23,5 @@ in { }; dconf.settings."org/gnome/desktop/interface".color-scheme = "prefer-${scheme.variant}"; - } - ]; + }; } diff --git a/modules/nix/style/modules/hyprland.nix b/modules/nix/style/modules/hyprland.nix deleted file mode 100644 index d0a21bd..0000000 --- a/modules/nix/style/modules/hyprland.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ - lib, - config, - ... -}: let - cfg = config.local.style; -in { - config.home-manager.sharedModules = lib.mkIf cfg.enable [ - { - wayland.windowManager.hyprland.settings = { - env = [ - "HYPRCURSOR_THEME,phinger-cursors-light" - "HYPRCURSOR_SIZE,32" - "XCURSOR_SIZE,32" - ]; - general = { - border_size = 4; - "col.active_border" = "rgb(${lib.removePrefix "#" cfg.scheme.palette.base0E})"; - }; - decoration = { - rounding = 10; - blur.enabled = true; - }; - }; - } - ]; -}