diff --git a/bin/omarchy-menu b/bin/omarchy-menu index cf4bdbed..79ec3feb 100755 --- a/bin/omarchy-menu +++ b/bin/omarchy-menu @@ -154,12 +154,7 @@ show_style_menu() { } show_theme_menu() { - theme=$(menu "Theme" "$(omarchy-theme-list)" "" "$(omarchy-theme-current)") - if [[ "$theme" == "CNCLD" || -z "$theme" ]]; then - back_to show_style_menu - else - omarchy-theme-set "$theme" - fi + omarchy-launch-walker -m menus:omarchythemes --width 800 --minheight 400 } show_font_menu() { diff --git a/default/elephant/omarchy_themes.lua b/default/elephant/omarchy_themes.lua new file mode 100644 index 00000000..1f21d847 --- /dev/null +++ b/default/elephant/omarchy_themes.lua @@ -0,0 +1,70 @@ +-- +-- Dynamic Omarchy Theme Menu for Elephant/Walker +-- +Name = "omarchythemes" +NamePretty = "Omarchy Themes" + +-- The main function elephant will call +function GetEntries() + local entries = {} + local theme_dir = os.getenv("HOME") .. "/.config/omarchy/themes" + + -- First, get all theme directories + local find_dirs_cmd = "find -L '" .. theme_dir .. "' -mindepth 1 -maxdepth 1 -type d 2>/dev/null" + + local handle = io.popen(find_dirs_cmd) + if not handle then + return entries + end + + for theme_path in handle:lines() do + local theme_name = theme_path:match(".*/(.+)$") + + if theme_name then + -- find preview image + local find_preview_cmd = "find -L '" + .. theme_path + .. "' -maxdepth 1 -type f \\( -name 'preview.png' -o -name 'preview.jpg' \\) 2>/dev/null | head -n 1" + local preview_handle = io.popen(find_preview_cmd) + local preview_path = nil + + if preview_handle then + preview_path = preview_handle:read("*l") + preview_handle:close() + end + + -- If no preview found, use first image from backgrounds folder + if not preview_path or preview_path == "" then + local bg_cmd = "find -L '" + .. theme_path + .. "/backgrounds' -maxdepth 1 -type f \\( -iname '*.png' -o -iname '*.jpg' -o -iname '*.jpeg' \\) 2>/dev/null | head -n 1" + local bg_handle = io.popen(bg_cmd) + if bg_handle then + preview_path = bg_handle:read("*l") + bg_handle:close() + end + end + + if preview_path and preview_path ~= "" then + local display_name = theme_name:gsub("_", " "):gsub("%-", " ") + display_name = display_name:gsub("(%a)([%w_']*)", function(first, rest) + return first:upper() .. rest:lower() + end) + display_name = display_name .. " " + + table.insert(entries, { + Text = display_name, + Preview = preview_path, + PreviewType = "file", + Actions = { + activate = "omarchy-theme-set " .. theme_name, + }, + }) + end + end + end + + handle:close() + return entries +end + diff --git a/default/walker/themes/omarchy-default/style.css b/default/walker/themes/omarchy-default/style.css index f4bbd082..0dc824fb 100644 --- a/default/walker/themes/omarchy-default/style.css +++ b/default/walker/themes/omarchy-default/style.css @@ -113,5 +113,4 @@ child:selected .item-box * { } .preview { - background: @background; } diff --git a/migrations/1763393133.sh b/migrations/1763393133.sh new file mode 100644 index 00000000..26aea76f --- /dev/null +++ b/migrations/1763393133.sh @@ -0,0 +1,5 @@ +echo "Link new theme picker config" + +mkdir -p ~/.config/elephant/menus +ln -snf $OMARCHY_PATH/default/elephant/omarchy_themes.lua ~/.config/elephant/menus/omarchy_themes.lua +omarchy-restart-walker diff --git a/themes/catppuccin-latte/preview.png b/themes/catppuccin-latte/preview.png index 4c594da8..8befd6f4 100644 Binary files a/themes/catppuccin-latte/preview.png and b/themes/catppuccin-latte/preview.png differ diff --git a/themes/catppuccin/preview.png b/themes/catppuccin/preview.png index 019de1d8..25c40d51 100644 Binary files a/themes/catppuccin/preview.png and b/themes/catppuccin/preview.png differ diff --git a/themes/everforest/preview.png b/themes/everforest/preview.png index 113396cc..3124f21e 100644 Binary files a/themes/everforest/preview.png and b/themes/everforest/preview.png differ diff --git a/themes/flexoki-light/preview.png b/themes/flexoki-light/preview.png index 558b6c55..dce1c542 100644 Binary files a/themes/flexoki-light/preview.png and b/themes/flexoki-light/preview.png differ diff --git a/themes/gruvbox/preview.png b/themes/gruvbox/preview.png index 61d13c3f..f934bafa 100644 Binary files a/themes/gruvbox/preview.png and b/themes/gruvbox/preview.png differ diff --git a/themes/kanagawa/preview.png b/themes/kanagawa/preview.png index e75e1189..db3ab75a 100644 Binary files a/themes/kanagawa/preview.png and b/themes/kanagawa/preview.png differ diff --git a/themes/matte-black/preview.png b/themes/matte-black/preview.png index 63a7ceaf..3aff6390 100644 Binary files a/themes/matte-black/preview.png and b/themes/matte-black/preview.png differ diff --git a/themes/nord/preview.png b/themes/nord/preview.png index 4e36427f..07a1692b 100644 Binary files a/themes/nord/preview.png and b/themes/nord/preview.png differ diff --git a/themes/osaka-jade/preview.png b/themes/osaka-jade/preview.png index bd99eed0..4b446055 100644 Binary files a/themes/osaka-jade/preview.png and b/themes/osaka-jade/preview.png differ diff --git a/themes/ristretto/preview.png b/themes/ristretto/preview.png index d4ab5ca8..e138d51e 100644 Binary files a/themes/ristretto/preview.png and b/themes/ristretto/preview.png differ diff --git a/themes/rose-pine/preview.png b/themes/rose-pine/preview.png index 02d85d08..70392181 100644 Binary files a/themes/rose-pine/preview.png and b/themes/rose-pine/preview.png differ diff --git a/themes/tokyo-night/preview.png b/themes/tokyo-night/preview.png index 2c0eb4fa..8dab01d4 100644 Binary files a/themes/tokyo-night/preview.png and b/themes/tokyo-night/preview.png differ