From 059ab48a51b969421b08e592dc48a460a356a4bd Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Fri, 18 Apr 2025 23:20:05 -0700 Subject: [PATCH] feat: steal and overhaul rofi rice --- .../hyprland/utilities.nix | 67 ++++++++++++++++--- hm/modules/linux/theming/stylix.nix | 1 + modules/linux/stylix/default.nix | 1 + 3 files changed, 59 insertions(+), 10 deletions(-) diff --git a/hm/modules/linux/desktop-environment/hyprland/utilities.nix b/hm/modules/linux/desktop-environment/hyprland/utilities.nix index eb93acc..40b3fff 100644 --- a/hm/modules/linux/desktop-environment/hyprland/utilities.nix +++ b/hm/modules/linux/desktop-environment/hyprland/utilities.nix @@ -35,17 +35,64 @@ in programs.rofi = { enable = true; package = pkgs.rofi-wayland; - # theme = "gruvbox-dark"; terminal = "${pkgs.kitty}/bin/kitty"; - extraConfig = { - modi = "window,drun,ssh,combi,filebrowser,recursivebrowser"; - display-drun = " 󰘧 "; - combi-modi = "window,drun,ssh"; - run-shell-command = "{terminal} -e {cmd}"; - sidebar-mode = true; - background-color = "transparent"; - sorting = "fuzzy"; - }; + theme = + let + inherit (config.lib.formats.rasi) mkLiteral; + mkRgba = + opacity: color: + let + c = config.lib.stylix.colors; + r = c."${color}-rgb-r"; + g = c."${color}-rgb-g"; + b = c."${color}-rgb-b"; + in + mkLiteral "rgba ( ${r}, ${g}, ${b}, ${opacity} % )"; + mkRgb = mkRgba "100"; + rofiOpacity = builtins.toString (builtins.ceil (config.stylix.opacity.popups * 100)); + in + { + "*" = { + font = "${config.stylix.fonts.monospace.name} ${toString config.stylix.fonts.sizes.popups}"; + text-color = mkRgb "base05"; + background-color = mkRgba rofiOpacity "base00"; + }; + "window" = { + height = mkLiteral "20em"; + width = mkLiteral "30em"; + border-radius = mkLiteral "8px"; + border-width = mkLiteral "2px"; + padding = mkLiteral "1.5em"; + }; + "mainbox" = { + background-color = mkRgba rofiOpacity "base01"; + }; + "inputbar" = { + margin = mkLiteral "0 0 1em 0"; + }; + "prompt" = { + enabled = false; + }; + "entry" = { + placeholder = "Search..."; + padding = mkLiteral "1em 1em"; + text-color = mkRgb "base05"; + background-color = mkRgba rofiOpacity "base00"; + border-radius = mkLiteral "8px"; + }; + "element-text" = { + padding = mkLiteral "0.5em 1em"; + margin = mkLiteral "0 0.5em"; + }; + "element-icon" = { + size = mkLiteral "3ch"; + }; + "element-text selected" = { + background-color = mkRgba rofiOpacity "base0A"; + text-color = mkRgb "base01"; + border-radius = mkLiteral "8px"; + }; + }; }; services.swayosd.enable = true; diff --git a/hm/modules/linux/theming/stylix.nix b/hm/modules/linux/theming/stylix.nix index 87cef65..0b717f0 100644 --- a/hm/modules/linux/theming/stylix.nix +++ b/hm/modules/linux/theming/stylix.nix @@ -11,6 +11,7 @@ hyprlock.enable = false; hyprland.enable = false; starship.enable = false; + rofi.enable = false; }; }; } diff --git a/modules/linux/stylix/default.nix b/modules/linux/stylix/default.nix index b5bac30..ae1045e 100644 --- a/modules/linux/stylix/default.nix +++ b/modules/linux/stylix/default.nix @@ -58,6 +58,7 @@ in image = lib.mkIf (cfg.wallpaper != null) cfg.wallpaper; base16Scheme = lib.mkIf (cfg.base16Scheme != null) cfg.base16Scheme; polarity = lib.mkIf (cfg.polarity != null) cfg.polarity; + opacity.popups = 0.8; fonts = { serif = {