From 846a88475a13ae844e5f7573db6a369e14c0c808 Mon Sep 17 00:00:00 2001 From: m3tam3re Date: Tue, 2 Sep 2025 20:18:42 +0200 Subject: [PATCH] more nix-colors; nushell fzf fix --- home/features/cli/default.nix | 137 +++++++++++++++++++++++++++- home/features/cli/fish.nix | 37 ++++++++ home/features/cli/fzf.nix | 24 ++--- home/features/cli/nushell.nix | 41 ++++++++- home/features/cli/starship.nix | 50 ++++++++++ home/features/cli/zellij.nix | 16 ++++ home/features/desktop/default.nix | 2 +- home/features/desktop/rofi.nix | 147 +++++++++++++++++++++++++++++- 8 files changed, 437 insertions(+), 17 deletions(-) diff --git a/home/features/cli/default.nix b/home/features/cli/default.nix index 971884d..26f674b 100644 --- a/home/features/cli/default.nix +++ b/home/features/cli/default.nix @@ -1,4 +1,8 @@ -{pkgs, ...}: { +{ + config, + pkgs, + ... +}: { imports = [ ./fish.nix ./fzf.nix @@ -32,7 +36,136 @@ withPython3 = true; }; - programs.bat = {enable = true;}; + programs.bat = { + enable = true; + config = { + theme = "universal"; + }; + themes = { + universal = { + src = pkgs.writeText "universal.tmTheme" '' + + + + + name + Universal (nix-colors) + settings + + + settings + + background + #${config.colorScheme.palette.base00} + foreground + #${config.colorScheme.palette.base05} + caret + #${config.colorScheme.palette.base05} + selection + #${config.colorScheme.palette.base02} + selectionForeground + #${config.colorScheme.palette.base05} + lineHighlight + #${config.colorScheme.palette.base01} + + + + name + Comment + scope + comment + settings + + foreground + #${config.colorScheme.palette.base03} + fontStyle + italic + + + + name + String + scope + string + settings + + foreground + #${config.colorScheme.palette.base0A} + + + + name + Number + scope + constant.numeric + settings + + foreground + #${config.colorScheme.palette.base0E} + + + + name + Keyword + scope + keyword + settings + + foreground + #${config.colorScheme.palette.base08} + + + + name + Function + scope + entity.name.function + settings + + foreground + #${config.colorScheme.palette.base0B} + + + + name + Type + scope + entity.name.type, storage.type + settings + + foreground + #${config.colorScheme.palette.base0D} + + + + name + Variable + scope + variable + settings + + foreground + #${config.colorScheme.palette.base05} + + + + name + Constant + scope + constant + settings + + foreground + #${config.colorScheme.palette.base0E} + + + + + + ''; + }; + }; + }; programs.direnv = { enable = true; diff --git a/home/features/cli/fish.nix b/home/features/cli/fish.nix index fceaee6..819eb60 100644 --- a/home/features/cli/fish.nix +++ b/home/features/cli/fish.nix @@ -11,6 +11,43 @@ in { config = mkIf cfg.enable { programs.fish = { enable = true; + interactiveShellInit = '' + # Fish colors using universal nix-colors palette + # Text colors + set -g fish_color_normal ${config.colorScheme.palette.base05} # text + set -g fish_color_param ${config.colorScheme.palette.base05} # text + set -g fish_color_comment ${config.colorScheme.palette.base03} # muted + set -g fish_color_autosuggestion ${config.colorScheme.palette.base03} # muted + + # Command colors + set -g fish_color_command ${config.colorScheme.palette.base0D} # accent6 (blue) + set -g fish_color_quote ${config.colorScheme.palette.base0A} # accent3 (yellow) + set -g fish_color_redirection ${config.colorScheme.palette.base0E} # accent7 (purple) + set -g fish_color_end ${config.colorScheme.palette.base08} # accent1 (red) + set -g fish_color_error ${config.colorScheme.palette.base08} # accent1 (red) + set -g fish_color_operator ${config.colorScheme.palette.base0C} # accent5 (cyan) + set -g fish_color_escape ${config.colorScheme.palette.base09} # accent2 (orange) + + # Path colors + set -g fish_color_cwd ${config.colorScheme.palette.base0B} # accent4 (green) + set -g fish_color_cwd_root ${config.colorScheme.palette.base08} # accent1 (red) + set -g fish_color_valid_path --underline + + # Interactive colors + set -g fish_color_match ${config.colorScheme.palette.base0B} # accent4 (green) + set -g fish_color_selection --background=${config.colorScheme.palette.base02} # overlay + set -g fish_color_search_match --background=${config.colorScheme.palette.base02} # overlay + set -g fish_color_history_current --bold + set -g fish_color_user ${config.colorScheme.palette.base0B} # accent4 (green) + set -g fish_color_host ${config.colorScheme.palette.base0D} # accent6 (blue) + set -g fish_color_cancel -r + + # Pager colors + set -g fish_pager_color_completion normal + set -g fish_pager_color_description ${config.colorScheme.palette.base03} # muted + set -g fish_pager_color_prefix ${config.colorScheme.palette.base0E} # accent7 (purple) + set -g fish_pager_color_progress ${config.colorScheme.palette.base0B} # accent4 (green) + ''; loginShellInit = '' set -x NIX_PATH nixpkgs=channel:nixos-unstable set -x NIX_LOG info diff --git a/home/features/cli/fzf.nix b/home/features/cli/fzf.nix index 6219f4d..ce65606 100644 --- a/home/features/cli/fzf.nix +++ b/home/features/cli/fzf.nix @@ -13,18 +13,18 @@ in { enable = true; enableFishIntegration = true; colors = { - "fg" = "#f8f8f2"; - "bg" = "#282a36"; - "hl" = "#bd93f9"; - "fg+" = "#f8f8f2"; - "bg+" = "#44475a"; - "hl+" = "#bd93f9"; - "info" = "#ffb86c"; - "prompt" = "#50fa7b"; - "pointer" = "#ff79c6"; - "marker" = "#ff79c6"; - "spinner" = "#ffb86c"; - "header" = "#6272a4"; + "fg" = "#${config.colorScheme.palette.base05}"; + "bg" = "#${config.colorScheme.palette.base00}"; + "hl" = "#${config.colorScheme.palette.base0E}"; + "fg+" = "#${config.colorScheme.palette.base05}"; + "bg+" = "#${config.colorScheme.palette.base02}"; + "hl+" = "#${config.colorScheme.palette.base0E}"; + "info" = "#${config.colorScheme.palette.base09}"; + "prompt" = "#${config.colorScheme.palette.base0B}"; + "pointer" = "#${config.colorScheme.palette.base08}"; + "marker" = "#${config.colorScheme.palette.base08}"; + "spinner" = "#${config.colorScheme.palette.base09}"; + "header" = "#${config.colorScheme.palette.base03}"; }; defaultOptions = [ "--preview='bat --color=always -n {}'" diff --git a/home/features/cli/nushell.nix b/home/features/cli/nushell.nix index 9718d81..6929717 100644 --- a/home/features/cli/nushell.nix +++ b/home/features/cli/nushell.nix @@ -20,7 +20,7 @@ in { $env.EDITOR = "nvim" $env.VISUAL = "zed" $env.FZF_DEFAULT_COMMAND = "fd --type f --exclude .git --follow --hidden" - $env.FZF_DEFAULT_OPTS = "--preview='bat --color=always -n {}' --bind 'ctrl-/:toggle-preview' --header 'Press CTRL-Y to copy command into clipboard' --bind 'ctrl-/:toggle-preview' --bind 'ctrl-y:execute-silent(echo -n {2..} | wl-copy)+abort' --color bg:#282a36,bg+:#44475a,fg:#f8f8f2,fg+:#f8f8f2,header:#6272a4,hl:#bd93f9,hl+:#bd93f9,info:#ffb86c,marker:#ff79c6,pointer:#ff79c6,prompt:#50fa7b,spinner:#ffb86c" + $env.FZF_DEFAULT_OPTS = "--preview='bat --color=always --style=numbers --line-range=:500 {}' --bind 'ctrl-/:toggle-preview' --header 'Press CTRL-Y to copy to clipboard' --bind 'ctrl-y:execute-silent(echo {} | wl-copy)' --color bg:#${config.colorScheme.palette.base00},bg+:#${config.colorScheme.palette.base02},fg:#${config.colorScheme.palette.base05},fg+:#${config.colorScheme.palette.base05},header:#${config.colorScheme.palette.base03},hl:#${config.colorScheme.palette.base0E},hl+:#${config.colorScheme.palette.base0E},info:#${config.colorScheme.palette.base09},marker:#${config.colorScheme.palette.base08},pointer:#${config.colorScheme.palette.base08},prompt:#${config.colorScheme.palette.base0B},spinner:#${config.colorScheme.palette.base09}" $env.XDG_DATA_HOME = $"($env.HOME)/.local/share" $env.FZF_DEFAULT_COMMAND = "fd --type f --exclude .git --follow --hidden" $env.SSH_AUTH_SOCK = "/run/user/1000/gnupg/S.gpg-agent.ssh" @@ -28,6 +28,45 @@ in { source /run/agenix/${config.home.username}-secrets ''; configFile.text = '' + # FZF integration functions for nushell + def fzf-file [] { + fd --type f --exclude .git --follow --hidden | fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}' --bind 'ctrl-y:execute-silent(echo {} | wl-copy)' + } + + def fzf-dir [] { + fd --type d --exclude .git --follow --hidden | fzf --preview 'ls -la {}' + } + + def fzf-history [] { + history | get command | reverse | fzf --bind 'ctrl-y:execute-silent(echo {} | wl-copy)' + } + + # Key bindings for FZF + $env.config = { + keybindings: [ + { + name: fzf_file + modifier: control + keycode: char_t + mode: [emacs, vi_normal, vi_insert] + event: { + send: executehostcommand + cmd: "commandline edit --insert (fzf-file)" + } + } + { + name: fzf_history + modifier: control + keycode: char_r + mode: [emacs, vi_normal, vi_insert] + event: { + send: executehostcommand + cmd: "commandline edit --replace (fzf-history)" + } + } + ] + } + if (tty) == "/dev/tty1" { exec uwsm start -S -F /run/current-system/sw/bin/Hyprland } diff --git a/home/features/cli/starship.nix b/home/features/cli/starship.nix index 4a44694..0861293 100644 --- a/home/features/cli/starship.nix +++ b/home/features/cli/starship.nix @@ -13,6 +13,56 @@ in { enable = true; enableFishIntegration = true; enableNushellIntegration = true; + settings = { + format = "$all$character"; + palette = "universal"; + + palettes.universal = { + background = "#${config.colorScheme.palette.base00}"; + surface = "#${config.colorScheme.palette.base01}"; + muted = "#${config.colorScheme.palette.base03}"; + text = "#${config.colorScheme.palette.base05}"; + bright = "#${config.colorScheme.palette.base07}"; + accent1 = "#${config.colorScheme.palette.base08}"; + accent2 = "#${config.colorScheme.palette.base09}"; + accent3 = "#${config.colorScheme.palette.base0A}"; + accent4 = "#${config.colorScheme.palette.base0B}"; + accent5 = "#${config.colorScheme.palette.base0C}"; + accent6 = "#${config.colorScheme.palette.base0D}"; + accent7 = "#${config.colorScheme.palette.base0E}"; + }; + + character = { + success_symbol = "[❯](accent7)"; + error_symbol = "[❯](accent1)"; + }; + + directory = { + style = "accent6"; + truncation_length = 3; + truncate_to_repo = false; + }; + + git_branch = { + style = "accent7"; + }; + + git_status = { + style = "accent5"; + }; + + cmd_duration = { + style = "accent3"; + }; + + hostname = { + style = "accent4"; + }; + + username = { + style_user = "accent2"; + }; + }; }; }; } diff --git a/home/features/cli/zellij.nix b/home/features/cli/zellij.nix index 903ee04..bd38e5b 100644 --- a/home/features/cli/zellij.nix +++ b/home/features/cli/zellij.nix @@ -11,6 +11,22 @@ in { config = mkIf cfg.enable { programs.zellij = { enable = true; + settings = { + theme = "universal"; + themes.universal = { + bg = "#${config.colorScheme.palette.base00}"; + fg = "#${config.colorScheme.palette.base05}"; + black = "#${config.colorScheme.palette.base01}"; + red = "#${config.colorScheme.palette.base08}"; + green = "#${config.colorScheme.palette.base0B}"; + yellow = "#${config.colorScheme.palette.base0A}"; + blue = "#${config.colorScheme.palette.base0D}"; + magenta = "#${config.colorScheme.palette.base0E}"; + cyan = "#${config.colorScheme.palette.base0C}"; + white = "#${config.colorScheme.palette.base07}"; + orange = "#${config.colorScheme.palette.base09}"; + }; + }; }; }; } diff --git a/home/features/desktop/default.nix b/home/features/desktop/default.nix index 3394e78..7ac2abd 100644 --- a/home/features/desktop/default.nix +++ b/home/features/desktop/default.nix @@ -62,7 +62,7 @@ enableBashIntegration = true; }; font = {name = "Fira Code";}; - themeFile = "Dracula"; + settings = { copy_on_select = "yes"; diff --git a/home/features/desktop/rofi.nix b/home/features/desktop/rofi.nix index a5adc25..37cb349 100644 --- a/home/features/desktop/rofi.nix +++ b/home/features/desktop/rofi.nix @@ -32,7 +32,152 @@ in { kb-primary-paste = "Control+V,Shift+Insert"; kb-secondary-paste = "Control+v,Insert"; }; - theme = "dracula"; + theme = let + inherit (config.colorScheme) palette; + in + builtins.toString (pkgs.writeText "rofi-universal-theme.rasi" '' + * { + /* Universal theme colors from nix-colors */ + background: #${palette.base00}; + surface: #${palette.base01}; + overlay: #${palette.base02}; + muted: #${palette.base03}; + subtle: #${palette.base04}; + text: #${palette.base05}; + bright-text: #${palette.base06}; + highlight: #${palette.base07}; + accent1: #${palette.base08}; + accent2: #${palette.base09}; + accent3: #${palette.base0A}; + accent4: #${palette.base0B}; + accent5: #${palette.base0C}; + accent6: #${palette.base0D}; + accent7: #${palette.base0E}; + accent8: #${palette.base0F}; + + /* Global properties */ + background-color: @background; + text-color: @text; + font: "Fira Code 12"; + border: 0; + margin: 0; + padding: 0; + spacing: 0; + } + + window { + background-color: @background; + border: 1px; + border-color: @accent7; + border-radius: 6px; + width: 40%; + padding: 16px; + } + + inputbar { + children: [ prompt, entry ]; + spacing: 12px; + padding: 8px; + border-radius: 4px; + background-color: @surface; + } + + prompt { + text-color: @accent7; + background-color: transparent; + } + + entry { + placeholder: "Search..."; + placeholder-color: @subtle; + text-color: @text; + background-color: transparent; + cursor-color: @accent7; + } + + message { + background-color: @surface; + border-radius: 4px; + padding: 8px; + margin: 8px 0; + } + + textbox { + text-color: @text; + background-color: transparent; + } + + listview { + background-color: transparent; + margin: 8px 0 0; + lines: 10; + columns: 1; + fixed-height: false; + scrollbar: false; + } + + element { + background-color: transparent; + text-color: @text; + padding: 8px; + border-radius: 4px; + spacing: 8px; + } + + element normal.normal { + background-color: transparent; + text-color: @text; + } + + element selected.normal { + background-color: @accent7; + text-color: @background; + } + + element alternate.normal { + background-color: transparent; + text-color: @text; + } + + element-icon { + background-color: transparent; + size: 24px; + } + + element-text { + background-color: transparent; + text-color: inherit; + vertical-align: 0.5; + } + + mode-switcher { + spacing: 0; + background-color: @surface; + border-radius: 4px; + margin: 8px 0 0; + } + + button { + padding: 8px 16px; + background-color: transparent; + text-color: @text; + border-radius: 4px; + } + + button selected { + background-color: @accent7; + text-color: @background; + } + + /* Scrollbar */ + scrollbar { + width: 4px; + border: 0; + handle-color: @accent7; + handle-width: 4px; + padding: 0; + } + ''); }; }; }