Use walker to highlight current selection
This commit is contained in:
parent
3566ecfc89
commit
c97de217b3
@ -3,7 +3,22 @@
|
|||||||
OMARCHY_BIN_PATH=~/.local/share/omarchy/bin
|
OMARCHY_BIN_PATH=~/.local/share/omarchy/bin
|
||||||
|
|
||||||
menu() {
|
menu() {
|
||||||
echo -e "$2" | walker --dmenu --theme dmenu_250 -p "$1…" $3
|
local prompt="$1"
|
||||||
|
local options="$2"
|
||||||
|
local extra="$3"
|
||||||
|
local preselect="$4"
|
||||||
|
|
||||||
|
read -r -a args <<<"$extra"
|
||||||
|
|
||||||
|
if [[ -n "$preselect" ]]; then
|
||||||
|
local index
|
||||||
|
index=$(echo -e "$options" | grep -nxF "$preselect" | cut -d: -f1)
|
||||||
|
if [[ -n "$index" ]]; then
|
||||||
|
args+=("-a" "$index")
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "$options" | walker --dmenu --theme dmenu_250 -p "$prompt…" "${args[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
terminal() {
|
terminal() {
|
||||||
@ -57,7 +72,7 @@ show_style_menu() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
show_theme_menu() {
|
show_theme_menu() {
|
||||||
theme=$(menu "Theme" "$($OMARCHY_BIN_PATH/omarchy-theme-list)")
|
theme=$(menu "Theme" "$($OMARCHY_BIN_PATH/omarchy-theme-list)" "" "$($OMARCHY_BIN_PATH/omarchy-theme-current)")
|
||||||
if [[ "$theme" == "CNCLD" || -z "$theme" ]]; then
|
if [[ "$theme" == "CNCLD" || -z "$theme" ]]; then
|
||||||
show_main_menu
|
show_main_menu
|
||||||
else
|
else
|
||||||
|
3
bin/omarchy-theme-current
Executable file
3
bin/omarchy-theme-current
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
basename "$(realpath "$HOME/.config/omarchy/current/theme")" | sed -E 's/(^|-)([a-z])/\1\u\2/g; s/-/ /g'
|
@ -1,21 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
THEMES_DIR="$HOME/.config/omarchy/themes/"
|
find ~/.config/omarchy/themes/ -mindepth 1 -maxdepth 1 \( -type d -o -type l \) | sort | while read -r path; do
|
||||||
CURRENT_THEME_DIR="$HOME/.config/omarchy/current/theme"
|
echo "$(basename "$path" | sed -E 's/(^|-)([a-z])/\1\u\2/g; s/-/ /g')"
|
||||||
CURRENT_THEME_NAME=$(basename "$(realpath "$CURRENT_THEME_DIR")")
|
done
|
||||||
|
|
||||||
# Build themes list with pretty display names
|
|
||||||
mapfile -t themes < <(
|
|
||||||
find "$THEMES_DIR" -mindepth 1 -maxdepth 1 \( -type d -o -type l \) | sort | while read -r path; do
|
|
||||||
filename=$(basename "$path")
|
|
||||||
display_name=$(echo "$filename" | sed -E 's/(^|-)([a-z])/\1\u\2/g; s/-/ /g')
|
|
||||||
|
|
||||||
if [[ "$filename" == "$CURRENT_THEME_NAME" ]]; then
|
|
||||||
echo "<i>$display_name</i>"
|
|
||||||
else
|
|
||||||
echo "$display_name"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
)
|
|
||||||
|
|
||||||
printf '%s\n' "${themes[@]}"
|
|
||||||
|
@ -123,6 +123,10 @@ child:hover #label {
|
|||||||
color: @selected-text;
|
color: @selected-text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#item.active {
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
/* Hide sub text */
|
/* Hide sub text */
|
||||||
#sub {
|
#sub {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user