From 1f2d97d85ca7af79a13f10c56de4eca46086b963 Mon Sep 17 00:00:00 2001 From: Yuka Date: Wed, 1 Apr 2026 15:54:44 +0800 Subject: [PATCH 1/6] nvim support --- scripts/colors/modules/30-editors.sh | 125 ++++++++++++++++++++++++++- scripts/colors/targets/editors.json | 4 +- 2 files changed, 126 insertions(+), 3 deletions(-) diff --git a/scripts/colors/modules/30-editors.sh b/scripts/colors/modules/30-editors.sh index e331f97a9..c7f148d67 100755 --- a/scripts/colors/modules/30-editors.sh +++ b/scripts/colors/modules/30-editors.sh @@ -12,6 +12,9 @@ REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" VSCODE_THEMEGEN_BIN="$STATE_DIR/user/generated/bin/inir-vscode-themegen" OPENCODE_THEMEGEN_BIN="$STATE_DIR/user/generated/bin/inir-opencode-themegen" ZED_THEMEGEN_BIN="$STATE_DIR/user/generated/bin/inir-zed-themegen" +NEOVIM_CONFIG_DIR="$XDG_CONFIG_HOME/nvim" +NEOVIM_PLUGIN_DIR="$NEOVIM_CONFIG_DIR/lua/plugins" +NEOVIM_THEME_FILE="$NEOVIM_PLUGIN_DIR/neovim.lua" ensure_vscode_themegen() { command -v go &>/dev/null || return 1 @@ -40,6 +43,121 @@ ensure_zed_themegen() { [[ -x "$ZED_THEMEGEN_BIN" ]] } +json_color() { + local file_path="$1" + local key="$2" + local fallback="$3" + if [[ -f "$file_path" ]]; then + jq -r --arg key "$key" --arg fallback "$fallback" '.[$key] // $fallback' "$file_path" 2>/dev/null || printf '%s\n' "$fallback" + else + printf '%s\n' "$fallback" + fi +} + +generate_neovim_spec() { + local colors_file="$1" + local terminal_file="$2" + local background fg dark_bg darker_bg lighter_bg + local dark_fg light_fg bright_fg muted + local red yellow orange green cyan blue purple brown + local bright_red bright_yellow bright_green bright_cyan bright_blue bright_purple + local accent selection selection_fg + + background=$(json_color "$colors_file" background "#151311") + fg=$(json_color "$colors_file" on_background "#E8E1DE") + dark_bg=$(json_color "$colors_file" surface_container_low "#1E1B19") + darker_bg=$(json_color "$colors_file" surface_container_lowest "#100D0C") + lighter_bg=$(json_color "$colors_file" surface_container_highest "#383432") + + dark_fg=$(json_color "$colors_file" on_surface_variant "#CFC4BD") + light_fg=$(json_color "$terminal_file" term15 "$fg") + bright_fg=$(json_color "$colors_file" inverse_surface "$light_fg") + muted=$(json_color "$colors_file" outline "#998F88") + + red=$(json_color "$terminal_file" term1 "#CA917F") + yellow=$(json_color "$terminal_file" term11 "#E2CBB5") + orange=$(json_color "$colors_file" primary "#F3D9C5") + green=$(json_color "$terminal_file" term2 "#BBBB97") + cyan=$(json_color "$terminal_file" term6 "#B5C8AA") + blue=$(json_color "$terminal_file" term4 "#B19FB6") + purple=$(json_color "$terminal_file" term5 "#BF9EA4") + brown=$(json_color "$colors_file" secondary_container "#50443B") + + bright_red=$(json_color "$terminal_file" term9 "#DDB2A6") + bright_yellow=$(json_color "$terminal_file" term11 "$yellow") + bright_green=$(json_color "$terminal_file" term10 "#D4D4B0") + bright_cyan=$(json_color "$terminal_file" term14 "#D6E9CA") + bright_blue=$(json_color "$terminal_file" term12 "#D2C0D9") + bright_purple=$(json_color "$terminal_file" term13 "#E0BFC6") + + accent=$(json_color "$colors_file" primary "$blue") + selection=$(json_color "$colors_file" surface_container_high "#2D2928") + selection_fg="$fg" + + mkdir -p "$NEOVIM_PLUGIN_DIR" + local tmp_file="${NEOVIM_THEME_FILE}.tmp" + cat > "$tmp_file" </dev/null)" ]]; then + generate_neovim_spec "$colors_file" "$TERMINAL_FILE" + fi if [[ "$enable_zed" == 'true' ]] && { command -v zed &>/dev/null || command -v zeditor &>/dev/null; }; then if ensure_zed_themegen; then diff --git a/scripts/colors/targets/editors.json b/scripts/colors/targets/editors.json index b88c1b032..6dd3a87d1 100644 --- a/scripts/colors/targets/editors.json +++ b/scripts/colors/targets/editors.json @@ -4,6 +4,6 @@ "module": "30-editors.sh", "category": "editor", "inputs": ["palette.json", "terminal.json", "material_colors.scss"], - "description": "Apply themes for VSCode forks, Zed, and OpenCode using generated shell and terminal palettes.", - "configKey": "appearance.wallpaperTheming.enableVSCode" + "description": "Apply themes for VSCode forks, Zed, OpenCode, and Neovim/LazyVim using generated shell and terminal palettes.", + "configKey": "appearance.wallpaperTheming.enableAppsAndShell" } From 5938e1f02a3ca7c8f825dceeab6bba96d3f8a033 Mon Sep 17 00:00:00 2001 From: Yuka Date: Wed, 1 Apr 2026 15:56:09 +0800 Subject: [PATCH 2/6] renamed to inir --- scripts/colors/modules/30-editors.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/colors/modules/30-editors.sh b/scripts/colors/modules/30-editors.sh index c7f148d67..88796e6d4 100755 --- a/scripts/colors/modules/30-editors.sh +++ b/scripts/colors/modules/30-editors.sh @@ -101,7 +101,7 @@ return { { "bjarneo/aether.nvim", branch = "v3", - name = "aether", + name = "Inir", priority = 1000, opts = { colors = { From 41a41d549e28b821438587873fc653747423abaa Mon Sep 17 00:00:00 2001 From: Yuka Date: Wed, 1 Apr 2026 16:00:34 +0800 Subject: [PATCH 3/6] Add hot-reload for Inir colorscheme --- scripts/colors/modules/30-editors.sh | 55 +++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 2 deletions(-) diff --git a/scripts/colors/modules/30-editors.sh b/scripts/colors/modules/30-editors.sh index 88796e6d4..51162f895 100755 --- a/scripts/colors/modules/30-editors.sh +++ b/scripts/colors/modules/30-editors.sh @@ -142,9 +142,60 @@ return { }, }, config = function(_, opts) - require("aether").setup(opts) - vim.cmd.colorscheme("aether") + local theme_file = vim.fn.stdpath("config") .. "/lua/plugins/neovim.lua" + local theme_dir = vim.fn.fnamemodify(theme_file, ":h") + local theme_name = vim.fn.fnamemodify(theme_file, ":t") + local uv = vim.uv or vim.loop + + local function apply_inir_theme(next_opts) + require("aether").setup(next_opts) + vim.cmd.colorscheme("aether") + end + + local function reload_inir_theme() + if vim.g.colors_name ~= "aether" then + return + end + + local ok, spec = pcall(dofile, theme_file) + if not ok or type(spec) ~= "table" or type(spec[1]) ~= "table" then + return + end + + apply_inir_theme(spec[1].opts or {}) + vim.cmd("redraw!") + end + + apply_inir_theme(opts) require("aether.hotreload").setup() + + if vim.g.inir_aether_watch_started == 1 or not uv then + return + end + + local fs_event = uv.new_fs_event() + if not fs_event then + return + end + + local reload_pending = false + fs_event:start(theme_dir, {}, function(err, fname) + if err or reload_pending then + return + end + if fname and fname ~= theme_name then + return + end + + reload_pending = true + vim.schedule(function() + reload_pending = false + reload_inir_theme() + end) + end) + + vim.g.inir_aether_watch_started = 1 + vim.__inir_aether_fs_event = fs_event end, }, { From a6a8aa600d0a9b573cfa3af655945a1fd7d39a2c Mon Sep 17 00:00:00 2001 From: Yuka Date: Wed, 1 Apr 2026 16:06:32 +0800 Subject: [PATCH 4/6] Update 30-editors.sh --- scripts/colors/modules/30-editors.sh | 49 ++++++++++++++++++---------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/scripts/colors/modules/30-editors.sh b/scripts/colors/modules/30-editors.sh index 51162f895..5391783ef 100755 --- a/scripts/colors/modules/30-editors.sh +++ b/scripts/colors/modules/30-editors.sh @@ -101,7 +101,7 @@ return { { "bjarneo/aether.nvim", branch = "v3", - name = "Inir", + name = "inir-neovim", priority = 1000, opts = { colors = { @@ -143,9 +143,13 @@ return { }, config = function(_, opts) local theme_file = vim.fn.stdpath("config") .. "/lua/plugins/neovim.lua" - local theme_dir = vim.fn.fnamemodify(theme_file, ":h") - local theme_name = vim.fn.fnamemodify(theme_file, ":t") + local generated_dir = vim.fn.expand("~/.local/state/quickshell/user/generated") local uv = vim.uv or vim.loop + local watched_files = { + [generated_dir .. "/palette.json"] = true, + [generated_dir .. "/terminal.json"] = true, + [generated_dir .. "/colors.json"] = true, + } local function apply_inir_theme(next_opts) require("aether").setup(next_opts) @@ -173,29 +177,40 @@ return { return end - local fs_event = uv.new_fs_event() - if not fs_event then - return - end - local reload_pending = false - fs_event:start(theme_dir, {}, function(err, fname) - if err or reload_pending then - return - end - if fname and fname ~= theme_name then + local watchers = {} + + local function schedule_reload() + if reload_pending then return end reload_pending = true - vim.schedule(function() + vim.defer_fn(function() reload_pending = false reload_inir_theme() - end) - end) + end, 120) + end + + for path in pairs(watched_files) do + local fs_event = uv.new_fs_event() + if fs_event then + fs_event:start(path, {}, function(err) + if err then + return + end + schedule_reload() + end) + watchers[#watchers + 1] = fs_event + end + end + + if #watchers == 0 then + return + end vim.g.inir_aether_watch_started = 1 - vim.__inir_aether_fs_event = fs_event + vim.__inir_aether_fs_events = watchers end, }, { From 5ad83c2ddb1d16c8c863c0d7cecdb59c6c28e4d6 Mon Sep 17 00:00:00 2001 From: Yuka Date: Wed, 1 Apr 2026 16:10:27 +0800 Subject: [PATCH 5/6] Update 30-editors.sh --- scripts/colors/modules/30-editors.sh | 167 +++++++++++++-------------- 1 file changed, 81 insertions(+), 86 deletions(-) diff --git a/scripts/colors/modules/30-editors.sh b/scripts/colors/modules/30-editors.sh index 5391783ef..2dad90434 100755 --- a/scripts/colors/modules/30-editors.sh +++ b/scripts/colors/modules/30-editors.sh @@ -55,48 +55,82 @@ json_color() { } generate_neovim_spec() { - local colors_file="$1" - local terminal_file="$2" - local background fg dark_bg darker_bg lighter_bg - local dark_fg light_fg bright_fg muted - local red yellow orange green cyan blue purple brown - local bright_red bright_yellow bright_green bright_cyan bright_blue bright_purple - local accent selection selection_fg - - background=$(json_color "$colors_file" background "#151311") - fg=$(json_color "$colors_file" on_background "#E8E1DE") - dark_bg=$(json_color "$colors_file" surface_container_low "#1E1B19") - darker_bg=$(json_color "$colors_file" surface_container_lowest "#100D0C") - lighter_bg=$(json_color "$colors_file" surface_container_highest "#383432") - - dark_fg=$(json_color "$colors_file" on_surface_variant "#CFC4BD") - light_fg=$(json_color "$terminal_file" term15 "$fg") - bright_fg=$(json_color "$colors_file" inverse_surface "$light_fg") - muted=$(json_color "$colors_file" outline "#998F88") - - red=$(json_color "$terminal_file" term1 "#CA917F") - yellow=$(json_color "$terminal_file" term11 "#E2CBB5") - orange=$(json_color "$colors_file" primary "#F3D9C5") - green=$(json_color "$terminal_file" term2 "#BBBB97") - cyan=$(json_color "$terminal_file" term6 "#B5C8AA") - blue=$(json_color "$terminal_file" term4 "#B19FB6") - purple=$(json_color "$terminal_file" term5 "#BF9EA4") - brown=$(json_color "$colors_file" secondary_container "#50443B") - - bright_red=$(json_color "$terminal_file" term9 "#DDB2A6") - bright_yellow=$(json_color "$terminal_file" term11 "$yellow") - bright_green=$(json_color "$terminal_file" term10 "#D4D4B0") - bright_cyan=$(json_color "$terminal_file" term14 "#D6E9CA") - bright_blue=$(json_color "$terminal_file" term12 "#D2C0D9") - bright_purple=$(json_color "$terminal_file" term13 "#E0BFC6") - - accent=$(json_color "$colors_file" primary "$blue") - selection=$(json_color "$colors_file" surface_container_high "#2D2928") - selection_fg="$fg" - mkdir -p "$NEOVIM_PLUGIN_DIR" local tmp_file="${NEOVIM_THEME_FILE}.tmp" cat > "$tmp_file" < Date: Wed, 1 Apr 2026 16:19:17 +0800 Subject: [PATCH 6/6] Update 30-editors.sh --- scripts/colors/modules/30-editors.sh | 34 ++++++++++++++++------------ 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/scripts/colors/modules/30-editors.sh b/scripts/colors/modules/30-editors.sh index 2dad90434..6d9807a0b 100755 --- a/scripts/colors/modules/30-editors.sh +++ b/scripts/colors/modules/30-editors.sh @@ -143,9 +143,9 @@ return { config = function(_, opts) local uv = vim.uv or vim.loop local watched_files = { - [palette_file] = true, - [terminal_file] = true, - [legacy_colors_file] = true, + ["palette.json"] = true, + ["terminal.json"] = true, + ["colors.json"] = true, } local function apply_inir_theme(next_opts) @@ -187,17 +187,18 @@ return { end, 120) end - for path in pairs(watched_files) do - local fs_event = uv.new_fs_event() - if fs_event then - fs_event:start(path, {}, function(err) - if err then - return - end - schedule_reload() - end) - watchers[#watchers + 1] = fs_event - end + local fs_event = uv.new_fs_event() + if fs_event then + fs_event:start(generated_dir, {}, function(err, fname) + if err then + return + end + if fname and not watched_files[fname] then + return + end + schedule_reload() + end) + watchers[#watchers + 1] = fs_event end if #watchers == 0 then @@ -216,6 +217,11 @@ return { }, } EOF + if [[ -f "$NEOVIM_THEME_FILE" ]] && cmp -s "$tmp_file" "$NEOVIM_THEME_FILE"; then + rm -f "$tmp_file" + return 0 + fi + mv "$tmp_file" "$NEOVIM_THEME_FILE" }