refactor: migrate to template-based theme system, clean up old per-theme configs
- Remove per-theme app configs (alacritty, foot, ghostty, hyprland, hyprlock, mako, rofi, swayosd, tmux, walker, waybar, etc.) now handled by default/themed/ templates - Update omarchy scripts (bg-next, list, set) for new template flow - Update configs: bootstrap, nvim, rofi, tmux, mako - Tweak installers (02-install-base.sh, btop, desktop, goose, nvim, obsidian, theme, tmux) - Remove obsolete hyprland-rofi-* and hyprland-walker-* scripts - Update neovim.lua across remaining themes
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
#!/bin/sh
|
||||
workspace=$(hyprctl activeworkspace -j | jq -r '.id')
|
||||
selected=$(hyprctl clients -j | jq -r 'to_entries | .[] | select(.value.hidden == false) | "\(.key). w\(.value.workspace.name): m\(.value.monitor): \(.value.class)\t \(.value.title)\t: |\(.value.address)"' | rofi -i -dmenu -tokenize -matching prefix -p 'Client to Fetch')
|
||||
address=$(echo $selected | awk -F'|' '{ print $NF }')
|
||||
hyprctl dispatch movetoworkspace "$workspace,address:$address"
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/bin/sh
|
||||
selected=$(hyprctl clients -j | jq -r 'to_entries | .[] | select(.value.hidden == false) | "\(.key). w\(.value.workspace.name): m\(.value.monitor): \(.value.class)\t \(.value.title)\t |\(.value.address)"' | rofi -i -dmenu -tokenize -matching prefix -p 'Client to Fetch')
|
||||
addr=$(echo $selected | awk -F'|' '{ print $NF }')
|
||||
json=$(hyprctl clients -j | jq -r ".[] | select(.address == \"$addr\")")
|
||||
client=$(echo $json | jq -r '.address')
|
||||
workspace=$(echo $json | jq -r '.workspace.id')
|
||||
hyprctl dispatch focusworkspaceoncurrentmonitor "$workspace"
|
||||
hyprctl dispatch focuswindow "address:$client"
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/bin/sh
|
||||
chooser="walker -d -V 2 -t '|'"
|
||||
workspace=$(hyprctl activeworkspace -j | jq -r '.id')
|
||||
selected=$(hyprctl clients -j | jq -r 'to_entries | .[] | select(.value.hidden == false) | "\(.key). w\(.value.workspace.name): m\(.value.monitor): \(.value.class)\t \(.value.title)\t: |\(.value.address)"' | $chooser -p 'Client to Fetch')
|
||||
address=$(echo $selected | awk -F'|' '{ print $NF }')
|
||||
hyprctl dispatch movetoworkspace "$workspace,address:$address"
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/bin/sh
|
||||
chooser="walker -d -V 2 -t '|'"
|
||||
selected=$(hyprctl clients -j | jq -r 'to_entries | .[] | select(.value.hidden == false) | "\(.key). w\(.value.workspace.name): m\(.value.monitor): \(.value.class)\t \(.value.title)\t |\(.value.address)"' | $chooser -p 'Client to Focus')
|
||||
addr=$(echo $selected | awk -F'|' '{ print $NF }')
|
||||
json=$(hyprctl clients -j | jq -r ".[] | select(.address == \"$addr\")")
|
||||
client=$(echo $json | jq -r '.address')
|
||||
workspace=$(echo $json | jq -r '.workspace.id')
|
||||
hyprctl dispatch focusworkspaceoncurrentmonitor "$workspace"
|
||||
hyprctl dispatch focuswindow "address:$client"
|
||||
@@ -1,20 +1,22 @@
|
||||
#!/bin/sh -e
|
||||
#!/bin/bash
|
||||
|
||||
# Cycles through the background images available
|
||||
# omarchy:summary=Cycle to the next background for the current theme
|
||||
# omarchy:examples=omarchy theme bg next
|
||||
|
||||
THEMES_DIR="$HOME/.local/share/themes"
|
||||
BACKGROUNDS_DIR="${THEMES_DIR}/current/theme/backgrounds/"
|
||||
CURRENT_BACKGROUND_LINK="${THEMES_DIR}/current/background"
|
||||
THEME_NAME=$(cat "$HOME/.config/omarchy/current/theme.name" 2>/dev/null)
|
||||
THEME_BACKGROUNDS_PATH="$HOME/.config/omarchy/current/theme/backgrounds/"
|
||||
USER_BACKGROUNDS_PATH="$HOME/.config/omarchy/backgrounds/$THEME_NAME/"
|
||||
CURRENT_BACKGROUND_LINK="$HOME/.config/omarchy/current/background"
|
||||
|
||||
mapfile -d '' -t BACKGROUNDS < <(find "$BACKGROUNDS_DIR" -type f -print0 | sort -z)
|
||||
mapfile -d '' -t BACKGROUNDS < <(find -L "$USER_BACKGROUNDS_PATH" "$THEME_BACKGROUNDS_PATH" -maxdepth 1 -type f -print0 2>/dev/null | sort -z)
|
||||
TOTAL=${#BACKGROUNDS[@]}
|
||||
|
||||
if [[ $TOTAL -eq 0 ]]; then
|
||||
if (( TOTAL == 0 )); then
|
||||
notify-send "No background was found for theme" -t 2000
|
||||
setsid uwsm app -- awww clear >/dev/null 2>&1 &
|
||||
else
|
||||
# Get current background from symlink
|
||||
if [[ -L "$CURRENT_BACKGROUND_LINK" ]]; then
|
||||
if [[ -L $CURRENT_BACKGROUND_LINK ]]; then
|
||||
CURRENT_BACKGROUND=$(readlink "$CURRENT_BACKGROUND_LINK")
|
||||
else
|
||||
# Default to first background if no symlink exists
|
||||
@@ -24,14 +26,14 @@ else
|
||||
# Find current background index
|
||||
INDEX=-1
|
||||
for i in "${!BACKGROUNDS[@]}"; do
|
||||
if [[ "${BACKGROUNDS[$i]}" == "$CURRENT_BACKGROUND" ]]; then
|
||||
if [[ ${BACKGROUNDS[$i]} == $CURRENT_BACKGROUND ]]; then
|
||||
INDEX=$i
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# Get next background (wrap around)
|
||||
if [[ $INDEX -eq -1 ]]; then
|
||||
if (( INDEX == -1 )); then
|
||||
# Use the first background when no match was found
|
||||
NEW_BACKGROUND="${BACKGROUNDS[0]}"
|
||||
else
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
THEMES_DIR="$HOME/.local/share/themes"
|
||||
find ${THEMES_DIR}/available/ -mindepth 1 -maxdepth 1 \( -type d -o -type l \) | sort | while read -r path; do
|
||||
echo "$(basename "$path" | sed -E 's/(^|-)([a-z])/\1\u\2/g; s/-/ /g')"
|
||||
# omarchy:summary=List available themes
|
||||
# omarchy:examples=omarchy theme list | omarchy theme set "Tokyo Night"
|
||||
|
||||
{
|
||||
find ~/.config/omarchy/themes/ -mindepth 1 -maxdepth 1 \( -type d -o -type l \) -printf '%f\n'
|
||||
find "${DOTFILES_DIR}/themes/" -mindepth 1 -maxdepth 1 -type d -printf '%f\n'
|
||||
} | sort -u | while read -r name; do
|
||||
echo "$name" | sed -E 's/(^|-)([a-z])/\1\u\2/g; s/-/ /g'
|
||||
done
|
||||
|
||||
+57
-60
@@ -1,77 +1,74 @@
|
||||
#!/bin/sh -e
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy-theme-set: Set a theme, specified by its name.
|
||||
# Usage: omarchy-theme-set <theme-name>
|
||||
# omarchy:summary=Apply an Omarchy theme
|
||||
# omarchy:args=<theme-name>
|
||||
# omarchy:examples=omarchy theme list | omarchy theme set "Tokyo Night"
|
||||
|
||||
if [[ -z "$1" && "$1" != "CNCLD" ]]; then
|
||||
echo "Usage: omarchy-theme-set <theme-name>" >&2
|
||||
if [[ -z $1 ]]; then
|
||||
echo "Usage: omarchy-theme-set <theme-name>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
THEMES_DIR="$HOME/.local/share/themes"
|
||||
CURRENT_THEME_DIR="${THEMES_DIR}/current/theme"
|
||||
CURRENT_THEME_PATH="$HOME/.config/omarchy/current/theme"
|
||||
NEXT_THEME_PATH="$HOME/.config/omarchy/current/next-theme"
|
||||
USER_THEMES_PATH="$HOME/.config/omarchy/themes"
|
||||
OMARCHY_THEMES_PATH="${DOTFILES_DIR}/themes"
|
||||
|
||||
THEME_NAME=$(echo "$1" | sed -E 's/<[^>]+>//g' | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
|
||||
THEME_PATH="$THEMES_DIR/available/$THEME_NAME"
|
||||
|
||||
base_theme_dir=$(dirname "$CURRENT_THEME_DIR")
|
||||
if [[ ! -d "$base_theme_dir" ]]; then
|
||||
mkdir -p $base_theme_dir
|
||||
if [[ ! -d $OMARCHY_THEMES_PATH/$THEME_NAME ]] && [[ ! -d $USER_THEMES_PATH/$THEME_NAME ]]; then
|
||||
echo "Theme '$THEME_NAME' does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if the theme entered exists
|
||||
if [[ ! -d "$THEME_PATH" ]]; then
|
||||
echo "Theme '$THEME_NAME' does not exist in $THEMES_DIR" >&2
|
||||
exit 2
|
||||
# Setup clean next theme directory (for atomic theme config swapping)
|
||||
rm -rf "$NEXT_THEME_PATH"
|
||||
mkdir -p "$NEXT_THEME_PATH"
|
||||
|
||||
# Copy official theme first, then overlay user customizations on top
|
||||
cp -r "$OMARCHY_THEMES_PATH/$THEME_NAME/"* "$NEXT_THEME_PATH/" 2>/dev/null
|
||||
cp -r "$USER_THEMES_PATH/$THEME_NAME/"* "$NEXT_THEME_PATH/" 2>/dev/null
|
||||
|
||||
# Generate colors.toml from alacritty.toml if theme is missing colors.toml
|
||||
if [[ ! -f $NEXT_THEME_PATH/colors.toml && -f $NEXT_THEME_PATH/alacritty.toml ]]; then
|
||||
omarchy-theme-colors-from-alacritty "$NEXT_THEME_PATH"
|
||||
fi
|
||||
|
||||
# Update theme symlinks
|
||||
ln -nsf "$THEME_PATH" "$CURRENT_THEME_DIR"
|
||||
# Generate dynamic configs
|
||||
omarchy-theme-set-templates
|
||||
|
||||
# Change gnome modes
|
||||
if [[ -f "$CURRENT_THEME_DIR/light.mode" ]]; then
|
||||
gsettings set org.gnome.desktop.interface color-scheme "prefer-light"
|
||||
gsettings set org.gnome.desktop.interface gtk-theme "Adwaita"
|
||||
else
|
||||
gsettings set org.gnome.desktop.interface color-scheme "prefer-dark"
|
||||
gsettings set org.gnome.desktop.interface gtk-theme "Adwaita-dark"
|
||||
# Swap next theme in as current
|
||||
rm -rf "$CURRENT_THEME_PATH"
|
||||
mv "$NEXT_THEME_PATH" "$CURRENT_THEME_PATH"
|
||||
|
||||
# Store theme name for reference
|
||||
echo "$THEME_NAME" >"$HOME/.config/omarchy/current/theme.name"
|
||||
|
||||
# Change background with theme
|
||||
if [[ $OMARCHY_THEME_SKIP_BACKGROUND != "1" ]]; then
|
||||
omarchy-theme-bg-next
|
||||
fi
|
||||
|
||||
# Change gnome icon theme color
|
||||
if [[ -f "$CURRENT_THEME_DIR/icons.theme" ]]; then
|
||||
gsettings set org.gnome.desktop.interface icon-theme "$(<$CURRENT_THEME_DIR/icons.theme)"
|
||||
else
|
||||
gsettings set org.gnome.desktop.interface icon-theme "Yaru-blue"
|
||||
fi
|
||||
# # Restart components to apply new theme
|
||||
# if pgrep -x waybar >/dev/null; then
|
||||
# omarchy-restart-waybar
|
||||
# fi
|
||||
# omarchy-restart-swayosd
|
||||
# omarchy-restart-terminal
|
||||
omarchy-restart-hyprctl
|
||||
omarchy-restart-btop
|
||||
# omarchy-restart-opencode
|
||||
omarchy-restart-mako
|
||||
omarchy-restart-tmux
|
||||
# omarchy-restart-helix
|
||||
|
||||
# Change Chromium colors
|
||||
if command -v chromium &>/dev/null; then
|
||||
if [[ -f "$CURRENT_THEME_DIR/light.mode" ]]; then
|
||||
chromium --no-startup-window --set-color-scheme="light"
|
||||
else
|
||||
chromium --no-startup-window --set-color-scheme="dark"
|
||||
fi
|
||||
|
||||
if [[ -f "$CURRENT_THEME_DIR/chromium.theme" ]]; then
|
||||
chromium --no-startup-window --set-theme-color="$(<$CURRENT_THEME_DIR/chromium.theme)"
|
||||
else
|
||||
# Use a default, neutral grey if theme doesn't have a color
|
||||
chromium --no-startup-window --set-theme-color="28,32,39"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ! -f "$CURRENT_THEME_DIR/ghostty" ]]; then
|
||||
touch "$CURRENT_THEME_DIR/ghostty"
|
||||
fi
|
||||
|
||||
if [[ ! -f "$CURRENT_THEME_DIR/tmux" ]]; then
|
||||
touch "$CURRENT_THEME_DIR/tmux"
|
||||
fi
|
||||
|
||||
omarchy-theme-bg-next
|
||||
|
||||
# Restart components to apply new theme
|
||||
pkill -SIGUSR2 btop
|
||||
makoctl reload
|
||||
hyprctl reload
|
||||
# Change app-specific themes
|
||||
omarchy-theme-set-foot
|
||||
omarchy-theme-set-gnome
|
||||
omarchy-theme-set-browser
|
||||
#omarchy-theme-set-vscode
|
||||
omarchy-theme-set-obsidian
|
||||
#omarchy-theme-set-keyboard
|
||||
|
||||
# Call hook on theme set
|
||||
omarchy-hook theme-set "$THEME_NAME" >/dev/null
|
||||
|
||||
Reference in New Issue
Block a user