Provide unlock themeing (#5476)
@@ -204,8 +204,9 @@ show_hardware_menu() {
|
||||
}
|
||||
|
||||
show_style_menu() {
|
||||
case $(menu "Style" " Theme\n Font\n Background\n Hyprland\n Screensaver\n About") in
|
||||
case $(menu "Style" " Theme\n Unlock\n Font\n Background\n Hyprland\n Screensaver\n About") in
|
||||
*Theme*) show_theme_menu ;;
|
||||
*Unlock*) omarchy-launch-walker -m menus:omarchyunlocks --width 800 --minheight 400 ;;
|
||||
*Font*) show_font_menu ;;
|
||||
*Background*) show_background_menu ;;
|
||||
*Hyprland*) open_in_editor ~/.config/hypr/looknfeel.conf ;;
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Render a Plymouth login-screen preview PNG by compositing the staged omarchy
|
||||
# theme assets (recolored with the given text color) onto the background.
|
||||
|
||||
if [[ $# -ne 4 ]]; then
|
||||
echo "Usage: omarchy-plymouth-preview <background-hex> <text-hex> <path-to-logo.png> <output-path>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
bg_hex="${1#\#}"
|
||||
text_hex="${2#\#}"
|
||||
logo_path="$3"
|
||||
output_path="$4"
|
||||
|
||||
if ! [[ $bg_hex =~ ^[0-9a-fA-F]{6}$ ]]; then
|
||||
echo "Invalid background color: $1 (expected #RRGGBB)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! [[ $text_hex =~ ^[0-9a-fA-F]{6}$ ]]; then
|
||||
echo "Invalid text color: $2 (expected #RRGGBB)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f $logo_path ]]; then
|
||||
echo "Logo file not found: $logo_path" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
staging_dir=$(mktemp -d)
|
||||
trap 'rm -rf "$staging_dir"' EXIT
|
||||
|
||||
find ~/.local/share/omarchy/default/plymouth -maxdepth 1 -type f -exec cp -t "$staging_dir/" {} +
|
||||
cp "$logo_path" "$staging_dir/logo.png"
|
||||
|
||||
for asset in bullet.png entry.png lock.png; do
|
||||
magick "$staging_dir/$asset" -channel RGB +level-colors "#$text_hex","#$text_hex" "$staging_dir/$asset"
|
||||
done
|
||||
|
||||
canvas_w=1920
|
||||
canvas_h=1080
|
||||
|
||||
logo_w=$(magick identify -format '%w' "$staging_dir/logo.png")
|
||||
logo_h=$(magick identify -format '%h' "$staging_dir/logo.png")
|
||||
entry_w=$(magick identify -format '%w' "$staging_dir/entry.png")
|
||||
entry_h=$(magick identify -format '%h' "$staging_dir/entry.png")
|
||||
lock_h=$(awk "BEGIN{print int($entry_h * 0.8)}")
|
||||
lock_w=$(awk "BEGIN{print int(84 * $lock_h / 96)}")
|
||||
|
||||
logo_x=$(( (canvas_w - logo_w) / 2 ))
|
||||
logo_y=$(( (canvas_h - logo_h) / 2 ))
|
||||
entry_x=$(( (canvas_w - entry_w) / 2 ))
|
||||
entry_y=$(( logo_y + logo_h + 40 ))
|
||||
lock_x=$(( entry_x - lock_w - 15 ))
|
||||
lock_y=$(( entry_y + entry_h/2 - lock_h/2 ))
|
||||
bullet_y=$(( entry_y + entry_h/2 - 4 ))
|
||||
|
||||
bullet_args=()
|
||||
for i in 0 1 2 3; do
|
||||
bx=$(( entry_x + 20 + i * 12 ))
|
||||
bullet_args+=( '(' "$staging_dir/bullet.png" -resize 7x7 ')' -geometry +${bx}+${bullet_y} -composite )
|
||||
done
|
||||
|
||||
magick -size ${canvas_w}x${canvas_h} "xc:#$bg_hex" \
|
||||
"$staging_dir/logo.png" -geometry +${logo_x}+${logo_y} -composite \
|
||||
"$staging_dir/entry.png" -geometry +${entry_x}+${entry_y} -composite \
|
||||
\( "$staging_dir/lock.png" -resize ${lock_w}x${lock_h} \) -geometry +${lock_x}+${lock_y} -composite \
|
||||
"${bullet_args[@]}" \
|
||||
"$output_path"
|
||||
|
||||
imv -f "$output_path"
|
||||
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Restore the Plymouth boot theme to the omarchy default — copies the shipped
|
||||
# assets into /usr/share without recoloring, then rebuilds the initramfs.
|
||||
|
||||
theme_dir="/usr/share/plymouth/themes/omarchy"
|
||||
|
||||
sudo find ~/.local/share/omarchy/default/plymouth -maxdepth 1 -type f -exec cp -t "$theme_dir/" {} +
|
||||
sudo plymouth-set-default-theme omarchy
|
||||
|
||||
if omarchy-cmd-present limine-mkinitcpio; then
|
||||
sudo limine-mkinitcpio
|
||||
else
|
||||
sudo mkinitcpio -P
|
||||
fi
|
||||
@@ -0,0 +1,58 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Configure the Plymouth boot theme with a custom background color, text color, and logo.
|
||||
# Stages the change in a temp dir, then commits the staged files to /usr/share and
|
||||
# rebuilds the initramfs.
|
||||
|
||||
if [[ $# -ne 3 ]]; then
|
||||
echo "Usage: omarchy-plymouth-set <background-hex> <text-hex> <path-to-logo.png>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
bg_hex="${1#\#}"
|
||||
text_hex="${2#\#}"
|
||||
logo_path="$3"
|
||||
|
||||
if ! [[ $bg_hex =~ ^[0-9a-fA-F]{6}$ ]]; then
|
||||
echo "Invalid background color: $1 (expected #RRGGBB)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! [[ $text_hex =~ ^[0-9a-fA-F]{6}$ ]]; then
|
||||
echo "Invalid text color: $2 (expected #RRGGBB)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f $logo_path ]]; then
|
||||
echo "Logo file not found: $logo_path" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
bg_r=$(awk -v n=$((16#${bg_hex:0:2})) 'BEGIN{printf "%.3f", n/255}')
|
||||
bg_g=$(awk -v n=$((16#${bg_hex:2:2})) 'BEGIN{printf "%.3f", n/255}')
|
||||
bg_b=$(awk -v n=$((16#${bg_hex:4:2})) 'BEGIN{printf "%.3f", n/255}')
|
||||
|
||||
theme_dir="/usr/share/plymouth/themes/omarchy"
|
||||
staging_dir=$(mktemp -d)
|
||||
trap 'rm -rf "$staging_dir"' EXIT
|
||||
|
||||
find ~/.local/share/omarchy/default/plymouth -maxdepth 1 -type f -exec cp -t "$staging_dir/" {} +
|
||||
cp "$logo_path" "$staging_dir/logo.png"
|
||||
|
||||
sed -i \
|
||||
-e "s/^Window.SetBackgroundTopColor.*/Window.SetBackgroundTopColor($bg_r, $bg_g, $bg_b);/" \
|
||||
-e "s/^Window.SetBackgroundBottomColor.*/Window.SetBackgroundBottomColor($bg_r, $bg_g, $bg_b);/" \
|
||||
"$staging_dir/omarchy.script"
|
||||
|
||||
for asset in bullet.png entry.png lock.png progress_bar.png; do
|
||||
magick "$staging_dir/$asset" -channel RGB +level-colors "#$text_hex","#$text_hex" "$staging_dir/$asset"
|
||||
done
|
||||
|
||||
sudo cp -a "$staging_dir/." "$theme_dir/"
|
||||
sudo plymouth-set-default-theme omarchy
|
||||
|
||||
if omarchy-cmd-present limine-mkinitcpio; then
|
||||
sudo limine-mkinitcpio
|
||||
else
|
||||
sudo mkinitcpio -P
|
||||
fi
|
||||
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Resolve a theme by name and apply its unlock.png + colors.toml as the
|
||||
# Plymouth boot screen via omarchy-plymouth-set.
|
||||
|
||||
if [[ $# -ne 1 ]]; then
|
||||
echo "Usage: omarchy-plymouth-set-by-theme <theme-name>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
theme=$1
|
||||
|
||||
if [[ -d ~/.config/omarchy/themes/$theme ]]; then
|
||||
theme_dir=~/.config/omarchy/themes/$theme
|
||||
else
|
||||
theme_dir="$OMARCHY_PATH/themes/$theme"
|
||||
fi
|
||||
|
||||
bg=$(awk -F'"' '/^background/{print $2}' "$theme_dir/colors.toml")
|
||||
text=$(awk -F'"' '/^foreground/{print $2}' "$theme_dir/colors.toml")
|
||||
|
||||
exec omarchy-plymouth-set "$bg" "$text" "$theme_dir/unlock.png"
|
||||
@@ -1,96 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Configure the Plymouth boot theme with a custom background color, accent color, and logo.
|
||||
# Stages the change in a temp dir, previews it as a composited image, then optionally
|
||||
# commits the staged files to /usr/share and rebuilds the initramfs.
|
||||
|
||||
if [[ $# -ne 3 ]]; then
|
||||
echo "Usage: omarchy-theme-set-plymouth <background-hex> <accent-hex> <path-to-logo.png>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
bg_hex="${1#\#}"
|
||||
accent_hex="${2#\#}"
|
||||
logo_path="$3"
|
||||
|
||||
if ! [[ $bg_hex =~ ^[0-9a-fA-F]{6}$ ]]; then
|
||||
echo "Invalid background color: $1 (expected #RRGGBB)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! [[ $accent_hex =~ ^[0-9a-fA-F]{6}$ ]]; then
|
||||
echo "Invalid accent color: $2 (expected #RRGGBB)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f $logo_path ]]; then
|
||||
echo "Logo file not found: $logo_path" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
bg_r=$(awk -v n=$((16#${bg_hex:0:2})) 'BEGIN{printf "%.3f", n/255}')
|
||||
bg_g=$(awk -v n=$((16#${bg_hex:2:2})) 'BEGIN{printf "%.3f", n/255}')
|
||||
bg_b=$(awk -v n=$((16#${bg_hex:4:2})) 'BEGIN{printf "%.3f", n/255}')
|
||||
|
||||
theme_dir="/usr/share/plymouth/themes/omarchy"
|
||||
staging_dir=$(mktemp -d)
|
||||
preview_png=$(mktemp --suffix=.png)
|
||||
trap 'rm -rf "$staging_dir" "$preview_png"' EXIT
|
||||
|
||||
cp ~/.local/share/omarchy/default/plymouth/* "$staging_dir/"
|
||||
cp "$logo_path" "$staging_dir/logo.png"
|
||||
|
||||
sed -i \
|
||||
-e "s/^Window.SetBackgroundTopColor.*/Window.SetBackgroundTopColor($bg_r, $bg_g, $bg_b);/" \
|
||||
-e "s/^Window.SetBackgroundBottomColor.*/Window.SetBackgroundBottomColor($bg_r, $bg_g, $bg_b);/" \
|
||||
"$staging_dir/omarchy.script"
|
||||
|
||||
for asset in bullet.png entry.png lock.png progress_bar.png; do
|
||||
magick "$staging_dir/$asset" -channel RGB +level-colors "#$accent_hex","#$accent_hex" "$staging_dir/$asset"
|
||||
done
|
||||
|
||||
if gum confirm "Preview new login screen?"; then
|
||||
canvas_w=1920
|
||||
canvas_h=1080
|
||||
|
||||
logo_w=$(magick identify -format '%w' "$staging_dir/logo.png")
|
||||
logo_h=$(magick identify -format '%h' "$staging_dir/logo.png")
|
||||
entry_w=$(magick identify -format '%w' "$staging_dir/entry.png")
|
||||
entry_h=$(magick identify -format '%h' "$staging_dir/entry.png")
|
||||
lock_h=$(awk "BEGIN{print int($entry_h * 0.8)}")
|
||||
lock_w=$(awk "BEGIN{print int(84 * $lock_h / 96)}")
|
||||
|
||||
logo_x=$(( (canvas_w - logo_w) / 2 ))
|
||||
logo_y=$(( (canvas_h - logo_h) / 2 ))
|
||||
entry_x=$(( (canvas_w - entry_w) / 2 ))
|
||||
entry_y=$(( logo_y + logo_h + 40 ))
|
||||
lock_x=$(( entry_x - lock_w - 15 ))
|
||||
lock_y=$(( entry_y + entry_h/2 - lock_h/2 ))
|
||||
bullet_y=$(( entry_y + entry_h/2 - 4 ))
|
||||
|
||||
bullet_args=()
|
||||
for i in 0 1 2 3; do
|
||||
bx=$(( entry_x + 20 + i * 12 ))
|
||||
bullet_args+=( '(' "$staging_dir/bullet.png" -resize 7x7 ')' -geometry +${bx}+${bullet_y} -composite )
|
||||
done
|
||||
|
||||
magick -size ${canvas_w}x${canvas_h} "xc:#$bg_hex" \
|
||||
"$staging_dir/logo.png" -geometry +${logo_x}+${logo_y} -composite \
|
||||
"$staging_dir/entry.png" -geometry +${entry_x}+${entry_y} -composite \
|
||||
\( "$staging_dir/lock.png" -resize ${lock_w}x${lock_h} \) -geometry +${lock_x}+${lock_y} -composite \
|
||||
"${bullet_args[@]}" \
|
||||
"$preview_png"
|
||||
|
||||
imv -f "$preview_png"
|
||||
fi
|
||||
|
||||
if gum confirm "Apply new login screen?"; then
|
||||
sudo cp -a "$staging_dir/." "$theme_dir/"
|
||||
sudo plymouth-set-default-theme omarchy
|
||||
|
||||
if omarchy-cmd-present limine-mkinitcpio; then
|
||||
sudo limine-mkinitcpio
|
||||
else
|
||||
sudo mkinitcpio -P
|
||||
fi
|
||||
fi
|
||||
@@ -0,0 +1,92 @@
|
||||
--
|
||||
-- Dynamic Omarchy Unlocks Menu for Elephant/Walker
|
||||
--
|
||||
-- A "Default" entry restores the omarchy-shipped Plymouth via
|
||||
-- omarchy-plymouth-reset. After that, every theme that has a preview-unlock.png
|
||||
-- appears as a customised unlock; picking one runs omarchy-plymouth-set-by-theme
|
||||
-- <theme>. Both run in a floating terminal so sudo can prompt.
|
||||
--
|
||||
Name = "omarchyunlocks"
|
||||
NamePretty = "Omarchy Unlocks"
|
||||
HideFromProviderlist = true
|
||||
FixedOrder = true
|
||||
|
||||
local function file_exists(path)
|
||||
local f = io.open(path, "r")
|
||||
if f then
|
||||
f:close()
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function shell_escape(s)
|
||||
return "'" .. s:gsub("'", "'\\''") .. "'"
|
||||
end
|
||||
|
||||
function GetEntries()
|
||||
local entries = {}
|
||||
local home = os.getenv("HOME")
|
||||
local user_themes_dir = home .. "/.config/omarchy/themes"
|
||||
local omarchy_path = os.getenv("OMARCHY_PATH") or ""
|
||||
local default_themes_dir = omarchy_path .. "/themes"
|
||||
local default_preview = omarchy_path .. "/default/plymouth/preview-unlock.png"
|
||||
|
||||
local seen_themes = {}
|
||||
|
||||
local function process_themes_from_dir(themes_dir)
|
||||
local handle = io.popen("find -L '" .. themes_dir .. "' -mindepth 1 -maxdepth 1 -type d 2>/dev/null")
|
||||
if not handle then
|
||||
return
|
||||
end
|
||||
|
||||
for theme_path in handle:lines() do
|
||||
local theme_name = theme_path:match(".*/(.+)$")
|
||||
|
||||
if theme_name and not seen_themes[theme_name] then
|
||||
seen_themes[theme_name] = true
|
||||
|
||||
local preview_path = theme_path .. "/preview-unlock.png"
|
||||
|
||||
if file_exists(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-launch-floating-terminal-with-presentation "
|
||||
.. shell_escape("omarchy-plymouth-set-by-theme " .. shell_escape(theme_name)),
|
||||
},
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
handle:close()
|
||||
end
|
||||
|
||||
process_themes_from_dir(user_themes_dir)
|
||||
process_themes_from_dir(default_themes_dir)
|
||||
|
||||
-- Default entry last — restores the shipped Plymouth.
|
||||
local default_entry = {
|
||||
Text = "Default ",
|
||||
Actions = {
|
||||
activate = "omarchy-launch-floating-terminal-with-presentation "
|
||||
.. shell_escape("omarchy-plymouth-reset"),
|
||||
},
|
||||
}
|
||||
if file_exists(default_preview) then
|
||||
default_entry.Preview = default_preview
|
||||
default_entry.PreviewType = "file"
|
||||
end
|
||||
table.insert(entries, default_entry)
|
||||
|
||||
return entries
|
||||
end
|
||||
|
After Width: | Height: | Size: 22 KiB |
@@ -28,3 +28,4 @@ EOF
|
||||
mkdir -p ~/.config/elephant/menus
|
||||
ln -snf $OMARCHY_PATH/default/elephant/omarchy_themes.lua ~/.config/elephant/menus/omarchy_themes.lua
|
||||
ln -snf $OMARCHY_PATH/default/elephant/omarchy_background_selector.lua ~/.config/elephant/menus/omarchy_background_selector.lua
|
||||
ln -snf $OMARCHY_PATH/default/elephant/omarchy_unlocks.lua ~/.config/elephant/menus/omarchy_unlocks.lua
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
echo "Use interactive unlock (Plymouth) selector menu"
|
||||
|
||||
mkdir -p ~/.config/elephant/menus
|
||||
ln -snf $OMARCHY_PATH/default/elephant/omarchy_unlocks.lua ~/.config/elephant/menus/omarchy_unlocks.lua
|
||||
omarchy-restart-walker
|
||||
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 148 KiB |
|
After Width: | Height: | Size: 107 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 662 KiB |
|
After Width: | Height: | Size: 402 KiB |
|
After Width: | Height: | Size: 264 KiB |
|
After Width: | Height: | Size: 133 KiB |
|
After Width: | Height: | Size: 271 KiB |
|
After Width: | Height: | Size: 133 KiB |