Single namespace is fine

This commit is contained in:
David Heinemeier Hansson
2026-05-11 15:28:52 -04:00
committed by Ryan Hughes
parent 008f0cf7dd
commit 5487c17d19
5 changed files with 68 additions and 15 deletions
+2 -1
View File
@@ -322,7 +322,8 @@ show_screensaver_menu() {
}
show_theme_menu() {
omarchy-launch-walker -m menus:omarchythemes --width 800 --minheight 400
theme=$(omarchy-theme-switcher)
[[ -n $theme ]] && omarchy-theme-set "$theme"
}
show_background_menu() {
+3 -11
View File
@@ -1,14 +1,11 @@
#!/bin/bash
# omarchy:summary=Open a generic image selector menu
# omarchy:group=menu
# omarchy:name=images
# omarchy:args=[--selected <image>] [--namespace <namespace>] [--colors-file <path>] <image-dir>...
# omarchy:args=[--selected <image>] [--colors-file <path>] <image-dir>...
OMARCHY_PATH=${OMARCHY_PATH:-$HOME/.local/share/omarchy}
selected_image=""
namespace="omarchy-image-selector"
colors_file=""
image_dirs=()
@@ -18,16 +15,12 @@ while [[ $# -gt 0 ]]; do
selected_image="$2"
shift 2
;;
--namespace)
namespace="$2"
shift 2
;;
--colors-file)
colors_file="$2"
shift 2
;;
--help|-h)
echo "Usage: omarchy-menu-images [--selected <image>] [--namespace <namespace>] [--colors-file <path>] <image-dir>..."
echo "Usage: omarchy-menu-images [--selected <image>] [--colors-file <path>] <image-dir>..."
exit 0
;;
*)
@@ -38,7 +31,7 @@ while [[ $# -gt 0 ]]; do
done
if (( ${#image_dirs[@]} == 0 )); then
echo "Usage: omarchy-menu-images [--selected <image>] [--namespace <namespace>] [--colors-file <path>] <image-dir>..." >&2
echo "Usage: omarchy-menu-images [--selected <image>] [--colors-file <path>] <image-dir>..." >&2
exit 1
fi
@@ -85,7 +78,6 @@ done
OMARCHY_IMAGE_SELECTOR_SELECTION_FILE=$selection_file \
OMARCHY_IMAGE_SELECTOR_DIRS="$image_dirs_env" \
OMARCHY_IMAGE_SELECTOR_SELECTED="$selected_list_image" \
OMARCHY_IMAGE_SELECTOR_NAMESPACE="$namespace" \
OMARCHY_IMAGE_SELECTOR_COLORS_FILE="$colors_file" \
quickshell -p "$OMARCHY_PATH/default/quickshell/wallpaper-switcher.qml" >/dev/null
-1
View File
@@ -11,6 +11,5 @@ current_background=$(readlink -f "$HOME/.config/omarchy/current/background" 2>/d
omarchy-menu-images \
--selected "$current_background" \
--namespace "omarchy-wallpaper-switcher" \
"$HOME/.config/omarchy/current/theme/backgrounds" \
"$HOME/.config/omarchy/backgrounds/$theme_name"
+62
View File
@@ -0,0 +1,62 @@
#!/bin/bash
# omarchy:summary=Open the Omarchy theme switcher
OMARCHY_PATH=${OMARCHY_PATH:-$HOME/.local/share/omarchy}
USER_THEMES_PATH="$HOME/.config/omarchy/themes"
OMARCHY_THEMES_PATH="$OMARCHY_PATH/themes"
preview_dir=$(mktemp -d)
trap 'rm -rf "$preview_dir"' EXIT
find_preview() {
local theme_path="$1"
if [[ -f $theme_path/preview.png ]]; then
printf '%s\n' "$theme_path/preview.png"
elif [[ -f $theme_path/preview.jpg ]]; then
printf '%s\n' "$theme_path/preview.jpg"
elif [[ -d $theme_path/backgrounds ]]; then
find -L "$theme_path/backgrounds" -maxdepth 1 -type f \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' -o -iname '*.webp' \) -print -quit 2>/dev/null
fi
}
add_theme_preview() {
local theme_name="$1"
local preview="$2"
local extension="${preview##*.}"
[[ -n $preview ]] || return
[[ -e $preview_dir/$theme_name.$extension ]] && return
ln -s "$preview" "$preview_dir/$theme_name.$extension"
}
while IFS= read -r theme_path; do
theme_name=${theme_path##*/}
preview=$(find_preview "$theme_path")
if [[ -z $preview ]]; then
preview=$(find_preview "$OMARCHY_THEMES_PATH/$theme_name")
fi
add_theme_preview "$theme_name" "$preview"
done < <(find -L "$USER_THEMES_PATH" -mindepth 1 -maxdepth 1 \( -type d -o -type l \) -print 2>/dev/null | sort)
while IFS= read -r theme_path; do
theme_name=${theme_path##*/}
preview=$(find_preview "$theme_path")
add_theme_preview "$theme_name" "$preview"
done < <(find -L "$OMARCHY_THEMES_PATH" -mindepth 1 -maxdepth 1 -type d -print 2>/dev/null | sort)
current_theme=$(cat "$HOME/.config/omarchy/current/theme.name" 2>/dev/null)
selected_preview=$(find -L "$preview_dir" -maxdepth 1 -type f -name "$current_theme.*" -print -quit 2>/dev/null)
selected_preview=$(omarchy-menu-images \
--selected "$selected_preview" \
"$preview_dir")
if [[ -n $selected_preview ]]; then
selected_theme=${selected_preview##*/}
selected_theme=${selected_theme%.*}
printf '%s\n' "$selected_theme"
fi
+1 -2
View File
@@ -12,7 +12,6 @@ ShellRoot {
property string selectionFile: Quickshell.env("OMARCHY_IMAGE_SELECTOR_SELECTION_FILE") || Quickshell.env("OMARCHY_WALLPAPER_SELECTION_FILE")
property string selectedImage: Quickshell.env("OMARCHY_IMAGE_SELECTOR_SELECTED")
property string colorsFile: Quickshell.env("OMARCHY_IMAGE_SELECTOR_COLORS_FILE") || (Quickshell.env("HOME") + "/.config/omarchy/current/theme/wallpaper-switcher-colors.json")
property string layerNamespace: Quickshell.env("OMARCHY_IMAGE_SELECTOR_NAMESPACE") || "omarchy-image-selector"
property int selectedIndex: 0
property bool imagesLoaded: false
property color accent: "#798186"
@@ -134,7 +133,7 @@ ShellRoot {
visible: root.imagesLoaded
anchors { top: true; bottom: true; left: true; right: true }
color: "transparent"
WlrLayershell.namespace: root.layerNamespace
WlrLayershell.namespace: "omarchy-image-selector"
WlrLayershell.layer: WlrLayer.Overlay
WlrLayershell.keyboardFocus: WlrKeyboardFocus.Exclusive
exclusionMode: ExclusionMode.Ignore