feat(system): comprehensive branding, styling, and system feature update
- Relocate themes to assets/themes/ and update all references. - Implement custom SDDM theme and Plymouth theme enhancements. - Add themed templates for Alacritty, Hyprland, Waybar, and other apps. - Introduce Makima key remapper module and configuration. - Add Voxtype and Walker configurations. - Implement systemd power management and timeout optimizations. - Add Nautilus-python extensions for LocalSend. - Update branding assets and ASCII art integration.
This commit is contained in:
6
bin/appearance/nomarchy-font-current
Executable file
6
bin/appearance/nomarchy-font-current
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Returns the name of the current monospace font being used by extracting it from the Waybar stylesheet.
|
||||
# This can be changed using nnomarchy-font-set.
|
||||
|
||||
grep -oP 'font-family:\s*["'\'']?\K[^;"'\'']+' ~/.config/waybar/style.css | head -n1
|
||||
5
bin/appearance/nomarchy-font-list
Executable file
5
bin/appearance/nomarchy-font-list
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Returns a list of all the monospace fonts available on the system that can be set using nnomarchy-font-set.
|
||||
|
||||
fc-list :spacing=100 -f "%{family[0]}\n" | grep -v -i -E 'emoji|signwriting|nnomarchy' | sort -u
|
||||
38
bin/appearance/nomarchy-font-set
Executable file
38
bin/appearance/nomarchy-font-set
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Set the system-wide monospace font that should be used by the terminal, hyprlock, waybar, swayosd, etc.
|
||||
# Declarative version for Nnomarchy NixOS.
|
||||
|
||||
font_name="$1"
|
||||
|
||||
if [[ -z $font_name ]]; then
|
||||
echo "Usage: nnomarchy-font-set <font-name>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
STATE_DIR="$HOME/.config/home-manager"
|
||||
STATE_FILE="$STATE_DIR/state.json"
|
||||
|
||||
mkdir -p "$STATE_DIR"
|
||||
[[ ! -f $STATE_FILE ]] && echo "{}" > "$STATE_FILE"
|
||||
|
||||
if fc-list | grep -iq "$font_name"; then
|
||||
TMP_JSON=$(mktemp)
|
||||
jq ".font = \"$font_name\"" "$STATE_FILE" > "$TMP_JSON" && mv "$TMP_JSON" "$STATE_FILE"
|
||||
echo "Font set to $font_name declaratively. Applying changes..."
|
||||
env-update
|
||||
|
||||
# Instant feedback for certain apps via IPC
|
||||
if pgrep -x kitty; then
|
||||
pkill -USR1 kitty
|
||||
fi
|
||||
if pgrep -x ghostty; then
|
||||
pkill -SIGUSR2 ghostty
|
||||
notify-send -u low " You must restart Ghostty to see font change"
|
||||
fi
|
||||
|
||||
nnomarchy-hook font-set "$font_name"
|
||||
else
|
||||
echo "Font '$font_name' not found."
|
||||
exit 1
|
||||
fi
|
||||
7
bin/appearance/nomarchy-show-done
Executable file
7
bin/appearance/nomarchy-show-done
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Display a "Done!" message with a spinner and wait for user to press any key.
|
||||
# Used by various install scripts to indicate completion.
|
||||
|
||||
echo
|
||||
gum spin --spinner "globe" --title "Done! Press any key to close..." -- bash -c 'read -n 1 -s'
|
||||
10
bin/appearance/nomarchy-show-logo
Executable file
10
bin/appearance/nomarchy-show-logo
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Display the Nnomarchy logo in the terminal using green color.
|
||||
# Used by various presentation scripts to show branding.
|
||||
|
||||
clear
|
||||
echo -e "\033[32m"
|
||||
cat < ~/.config/nnomarchy/branding/logo.txt
|
||||
echo -e "\033[0m"
|
||||
echo
|
||||
7
bin/appearance/nomarchy-theme-bg-install
Executable file
7
bin/appearance/nomarchy-theme-bg-install
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
CURRENT_THEME_NAME=$(cat "$HOME/.config/nnomarchy/current/theme.name")
|
||||
THEME_USER_BACKGROUNDS="$HOME/.config/nnomarchy/backgrounds/$CURRENT_THEME_NAME"
|
||||
|
||||
mkdir -p "$THEME_USER_BACKGROUNDS"
|
||||
nautilus "$THEME_USER_BACKGROUNDS"
|
||||
57
bin/appearance/nomarchy-theme-bg-next
Executable file
57
bin/appearance/nomarchy-theme-bg-next
Executable file
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Cycles through the background images available for the current theme.
|
||||
# Declarative + Hybrid (instant swww) for Nnomarchy NixOS.
|
||||
|
||||
STATE_DIR="$HOME/.config/home-manager"
|
||||
STATE_FILE="$STATE_DIR/state.json"
|
||||
mkdir -p "$STATE_DIR"
|
||||
[[ ! -f $STATE_FILE ]] && echo "{}" > "$STATE_FILE"
|
||||
|
||||
THEME_NAME=$(jq -r '.theme // "nord"' "$STATE_FILE")
|
||||
|
||||
# Resolve themes directory (Built-in from Nix store via Home Manager, or user extra)
|
||||
if [ -d "$HOME/.config/nnomarchy/themes/$THEME_NAME" ]; then
|
||||
THEMES_DIR="$HOME/.config/nnomarchy/themes"
|
||||
else
|
||||
THEMES_DIR="$HOME/.local/share/nnomarchy/themes"
|
||||
fi
|
||||
|
||||
BG_DIR="$THEMES_DIR/$THEME_NAME/backgrounds"
|
||||
|
||||
if [ ! -d "$BG_DIR" ]; then
|
||||
notify-send "No background directory found for theme $THEME_NAME"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mapfile -t BACKGROUNDS < <(ls "$BG_DIR" | sort)
|
||||
TOTAL=${#BACKGROUNDS[@]}
|
||||
|
||||
if (( TOTAL == 0 )); then
|
||||
notify-send "No backgrounds found in $BG_DIR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CURRENT_BG=$(jq -r '.wallpaper' "$STATE_FILE")
|
||||
INDEX=-1
|
||||
for i in "${!BACKGROUNDS[@]}"; do
|
||||
if [[ "$BG_DIR/${BACKGROUNDS[$i]}" == "$CURRENT_BG" ]]; then
|
||||
INDEX=$i
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
NEXT_INDEX=$(((INDEX + 1) % TOTAL))
|
||||
NEW_BG="$BG_DIR/${BACKGROUNDS[$NEXT_INDEX]}"
|
||||
|
||||
TMP_JSON=$(mktemp)
|
||||
jq ".wallpaper = \"$NEW_BG\"" "$STATE_FILE" > "$TMP_JSON" && mv "$TMP_JSON" "$STATE_FILE"
|
||||
|
||||
# Instant feedback via swww
|
||||
if pgrep -x swww-daemon >/dev/null; then
|
||||
swww img "$NEW_BG" --transition-type outer --transition-pos 0.85,0.97 --transition-step 90
|
||||
else
|
||||
swww init && swww img "$NEW_BG"
|
||||
fi
|
||||
|
||||
echo "Background set to $NEW_BG declaratively."
|
||||
18
bin/appearance/nomarchy-theme-bg-set
Executable file
18
bin/appearance/nomarchy-theme-bg-set
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Sets the specified image as the current background
|
||||
|
||||
if [[ -z $1 ]]; then
|
||||
echo "Usage: nnomarchy-theme-bg-set <path-to-image>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
BACKGROUND="$1"
|
||||
CURRENT_BACKGROUND_LINK="$HOME/.config/nnomarchy/current/background"
|
||||
|
||||
# Create symlink to the new background
|
||||
ln -nsf "$BACKGROUND" "$CURRENT_BACKGROUND_LINK"
|
||||
|
||||
# Kill existing swaybg and start new one
|
||||
pkill -x swaybg
|
||||
setsid uwsm-app -- swaybg -i "$CURRENT_BACKGROUND_LINK" -m fill >/dev/null 2>&1 &
|
||||
9
bin/appearance/nomarchy-theme-current
Executable file
9
bin/appearance/nomarchy-theme-current
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
THEME_NAME_PATH="$HOME/.config/nnomarchy/current/theme.name"
|
||||
|
||||
if [[ -f $THEME_NAME_PATH ]]; then
|
||||
cat $THEME_NAME_PATH | sed -E 's/(^|-)([a-z])/\1\u\2/g; s/-/ /g'
|
||||
else
|
||||
echo "Unknown"
|
||||
fi
|
||||
33
bin/appearance/nomarchy-theme-install
Executable file
33
bin/appearance/nomarchy-theme-install
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
# nnomarchy-theme-install: Install a new theme from a git repo for Nnomarchy
|
||||
# Usage: nnomarchy-theme-install <git-repo-url>
|
||||
|
||||
if [[ -z $1 ]]; then
|
||||
echo -e "\e[32mSee https://manuals.omamix.org/2/the-nnomarchy-manual/90/extra-themes\n\e[0m"
|
||||
REPO_URL=$(gum input --placeholder="Git repo URL for theme" --header="")
|
||||
else
|
||||
REPO_URL="$1"
|
||||
fi
|
||||
|
||||
if [[ -z $REPO_URL ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
THEMES_DIR="$HOME/.config/nnomarchy/themes"
|
||||
THEME_NAME=$(basename "$REPO_URL" .git | sed -E 's/^nnomarchy-//; s/-theme$//')
|
||||
THEME_PATH="$THEMES_DIR/$THEME_NAME"
|
||||
|
||||
# Remove existing theme if present
|
||||
if [[ -d $THEME_PATH ]]; then
|
||||
rm -rf "$THEME_PATH"
|
||||
fi
|
||||
|
||||
# Clone the repo directly to ~/.config/nnomarchy/themes
|
||||
if ! git clone "$REPO_URL" "$THEME_PATH"; then
|
||||
echo "Error: Failed to clone theme repo."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Apply the new theme with nnomarchy-theme-set
|
||||
nnomarchy-theme-set $THEME_NAME
|
||||
8
bin/appearance/nomarchy-theme-list
Executable file
8
bin/appearance/nomarchy-theme-list
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
{
|
||||
find ~/.config/nnomarchy/themes/ -mindepth 1 -maxdepth 1 \( -type d -o -type l \) -printf '%f\n'
|
||||
find "$NOMARCHY_PATH/assets/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
|
||||
9
bin/appearance/nomarchy-theme-refresh
Executable file
9
bin/appearance/nomarchy-theme-refresh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Refresh the current theme from its templates.
|
||||
|
||||
THEME_NAME_PATH="$HOME/.config/nnomarchy/current/theme.name"
|
||||
|
||||
if [[ -f $THEME_NAME_PATH ]]; then
|
||||
nnomarchy-theme-set "$(cat $THEME_NAME_PATH)"
|
||||
fi
|
||||
35
bin/appearance/nomarchy-theme-remove
Executable file
35
bin/appearance/nomarchy-theme-remove
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
|
||||
# nnomarchy-theme-remove: Remove a theme from Nnomarchy by name
|
||||
# Usage: nnomarchy-theme-remove <theme-name>
|
||||
|
||||
if [[ -z $1 ]]; then
|
||||
mapfile -t extra_themes < <(find ~/.config/nnomarchy/themes -mindepth 1 -maxdepth 1 -type d ! -xtype l -printf '%f\n')
|
||||
|
||||
if (( ${#extra_themes[@]} > 0 )); then
|
||||
THEME_NAME=$(printf '%s\n' "${extra_themes[@]}" | sort | gum choose --header="Remove extra theme")
|
||||
else
|
||||
echo "No extra themes installed."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
THEME_NAME="$1"
|
||||
fi
|
||||
|
||||
THEMES_DIR="$HOME/.config/nnomarchy/themes"
|
||||
CURRENT_DIR="$HOME/.config/nnomarchy/current"
|
||||
THEME_PATH="$THEMES_DIR/$THEME_NAME"
|
||||
|
||||
# Ensure a theme was set
|
||||
if [[ -z $THEME_NAME ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if theme exists before attempting removal
|
||||
if [[ ! -d $THEME_PATH ]]; then
|
||||
echo "Error: Theme '$THEME_NAME' not found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Now remove the theme directory for THEME_NAME
|
||||
rm -rf "$THEME_PATH"
|
||||
57
bin/appearance/nomarchy-theme-set
Executable file
57
bin/appearance/nomarchy-theme-set
Executable file
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Set the system theme declaratively.
|
||||
# Usage: nnomarchy-theme-set <theme-name>
|
||||
|
||||
THEME_NAME="$1"
|
||||
|
||||
if [[ -z $THEME_NAME ]]; then
|
||||
echo "Usage: nnomarchy-theme-set <theme-name>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
STATE_DIR="$HOME/.config/home-manager"
|
||||
STATE_FILE="$STATE_DIR/state.json"
|
||||
|
||||
# Resolve themes directory (Built-in from Nix store via Home Manager, or user extra)
|
||||
if [ -d "$HOME/.config/nnomarchy/themes/$THEME_NAME" ]; then
|
||||
THEMES_DIR="$HOME/.config/nnomarchy/themes"
|
||||
else
|
||||
THEMES_DIR="$HOME/.local/share/nnomarchy/themes"
|
||||
fi
|
||||
|
||||
mkdir -p "$STATE_DIR"
|
||||
[[ ! -f $STATE_FILE ]] && echo "{}" > "$STATE_FILE"
|
||||
|
||||
if [ ! -d "$THEMES_DIR/$THEME_NAME" ] && ! [[ "$THEME_NAME" == "nord" ]]; then
|
||||
echo "Theme '$THEME_NAME' not found in $THEMES_DIR"
|
||||
# Check if it exists in the palettes file
|
||||
# (Assuming nnomarchy-palettes.nix is imported in Nix)
|
||||
fi
|
||||
|
||||
TMP_JSON=$(mktemp)
|
||||
jq ".theme = \"$THEME_NAME\"" "$STATE_FILE" > "$TMP_JSON" && mv "$TMP_JSON" "$STATE_FILE"
|
||||
|
||||
# Sync to system state if we have permissions (for system-level theming like browser policies)
|
||||
SYSTEM_STATE_FILE="/etc/nixos/state.json"
|
||||
if [ -w "$SYSTEM_STATE_FILE" ] || [ -w "/etc/nixos" ]; then
|
||||
sudo jq ".theme = \"$THEME_NAME\"" "$SYSTEM_STATE_FILE" > /tmp/system-state.json 2>/dev/null && sudo mv /tmp/system-state.json "$SYSTEM_STATE_FILE" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# Try to find a background for this theme
|
||||
BG_DIR="$THEMES_DIR/$THEME_NAME/backgrounds"
|
||||
if [ -d "$BG_DIR" ]; then
|
||||
BG=$(ls "$BG_DIR" | head -n 1)
|
||||
if [ -n "$BG" ]; then
|
||||
TMP_JSON=$(mktemp)
|
||||
jq ".wallpaper = \"$BG_DIR/$BG\"" "$STATE_FILE" > "$TMP_JSON" && mv "$TMP_JSON" "$STATE_FILE"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Theme set to $THEME_NAME. Applying changes with env-update..."
|
||||
rm -rf "$HOME/.config/nnomarchy/current/theme"
|
||||
env-update
|
||||
|
||||
nnomarchy-theme-set-templates
|
||||
|
||||
nnomarchy-hook theme-set "$THEME_NAME"
|
||||
4
bin/appearance/nomarchy-theme-set-keyboard
Executable file
4
bin/appearance/nomarchy-theme-set-keyboard
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
nnomarchy-theme-set-keyboard-asus-rog
|
||||
nnomarchy-theme-set-keyboard-f16
|
||||
7
bin/appearance/nomarchy-theme-set-keyboard-asus-rog
Executable file
7
bin/appearance/nomarchy-theme-set-keyboard-asus-rog
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
ASUSCTL_THEME=~/.config/nnomarchy/current/theme/keyboard.rgb
|
||||
|
||||
if nnomarchy-cmd-present asusctl; then
|
||||
asusctl aura effect static -c $(sed 's/^#//' $ASUSCTL_THEME)
|
||||
fi
|
||||
22
bin/appearance/nomarchy-theme-set-keyboard-f16
Executable file
22
bin/appearance/nomarchy-theme-set-keyboard-f16
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
FRAMEWORK16_THEME=~/.config/nnomarchy/current/theme/keyboard.rgb
|
||||
|
||||
if nnomarchy-cmd-present qmk_hid && [[ -f $FRAMEWORK16_THEME ]]; then
|
||||
hex=$(cat "$FRAMEWORK16_THEME")
|
||||
hex="${hex#\#}"
|
||||
|
||||
# Convert hex to QMK HSV (0-255 scale) using Python's colorsys
|
||||
read -r h s <<< $(python3 -c "
|
||||
import colorsys
|
||||
r, g, b = int('$hex'[:2],16)/255, int('$hex'[2:4],16)/255, int('$hex'[4:6],16)/255
|
||||
h, s, v = colorsys.rgb_to_hsv(r, g, b)
|
||||
print(int(h * 255), int(s * 255))
|
||||
")
|
||||
|
||||
qmk_hid via --rgb-effect 1 2>/dev/null
|
||||
qmk_hid via --rgb-hue "$h" 2>/dev/null
|
||||
qmk_hid via --rgb-saturation "$s" 2>/dev/null
|
||||
qmk_hid via --rgb-brightness 100 2>/dev/null
|
||||
qmk_hid via --save 2>/dev/null
|
||||
fi
|
||||
27
bin/appearance/nomarchy-theme-set-obsidian
Executable file
27
bin/appearance/nomarchy-theme-set-obsidian
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Sync Nnomarchy theme to all Obsidian vaults
|
||||
|
||||
CURRENT_THEME_DIR="$HOME/.config/nnomarchy/current/theme"
|
||||
|
||||
[[ -f $CURRENT_THEME_DIR/obsidian.css ]] || exit 0
|
||||
|
||||
jq -r '.vaults | values[].path' ~/.config/obsidian/obsidian.json 2>/dev/null | while read -r vault_path; do
|
||||
[[ -d $vault_path/.obsidian ]] || continue
|
||||
|
||||
theme_dir="$vault_path/.obsidian/themes/Nnomarchy"
|
||||
mkdir -p "$theme_dir"
|
||||
|
||||
[[ -f $theme_dir/manifest.json ]] || cat >"$theme_dir/manifest.json" <<'EOF'
|
||||
{
|
||||
"name": "Nnomarchy",
|
||||
"version": "1.0.0",
|
||||
"minAppVersion": "0.16.0",
|
||||
"description": "Automatically syncs with your current Nnomarchy system theme colors and fonts",
|
||||
"author": "Nnomarchy",
|
||||
"authorUrl": "https://nnomarchy.org"
|
||||
}
|
||||
EOF
|
||||
|
||||
cp "$CURRENT_THEME_DIR/obsidian.css" "$theme_dir/theme.css"
|
||||
done
|
||||
46
bin/appearance/nomarchy-theme-set-templates
Executable file
46
bin/appearance/nomarchy-theme-set-templates
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
|
||||
TEMPLATES_DIR="$NOMARCHY_PATH/assets/themed"
|
||||
USER_TEMPLATES_DIR="$HOME/.config/nnomarchy/themed"
|
||||
NEXT_THEME_DIR="$HOME/.config/nnomarchy/current/theme"
|
||||
COLORS_FILE="$NEXT_THEME_DIR/colors.toml"
|
||||
|
||||
# Convert hex color to decimal RGB (e.g., "#1e1e2e" -> "30,30,46")
|
||||
hex_to_rgb() {
|
||||
local hex="${1#\#}"
|
||||
printf "%d,%d,%d" "0x${hex:0:2}" "0x${hex:2:2}" "0x${hex:4:2}"
|
||||
}
|
||||
|
||||
# Only generate dynamic templates for themes with a colors.toml definition
|
||||
if [[ -f $COLORS_FILE ]]; then
|
||||
sed_script=$(mktemp)
|
||||
|
||||
while IFS='=' read -r key value; do
|
||||
key="${key//[\"\' ]/}" # strip quotes and spaces from key
|
||||
[[ $key && $key != \#* ]] || continue # skip empty lines and comments
|
||||
value="${value#*[\"\']}"
|
||||
value="${value%%[\"\']*}" # extract value between quotes (ignores inline comments)
|
||||
|
||||
printf 's|{{ %s }}|%s|g\n' "$key" "$value" # {{ key }} -> value
|
||||
printf 's|{{ %s_strip }}|%s|g\n' "$key" "${value#\#}" # {{ key_strip }} -> value without leading #
|
||||
if [[ $value =~ ^# ]]; then
|
||||
rgb=$(hex_to_rgb "$value")
|
||||
echo "s|{{ ${key}_rgb }}|${rgb}|g"
|
||||
fi
|
||||
done <"$COLORS_FILE" >"$sed_script"
|
||||
|
||||
shopt -s nullglob
|
||||
|
||||
# Process user templates first, then built-in templates (user overrides built-in)
|
||||
for tpl in "$USER_TEMPLATES_DIR"/*.tpl "$TEMPLATES_DIR"/*.tpl; do
|
||||
filename=$(basename "$tpl" .tpl)
|
||||
output_path="$NEXT_THEME_DIR/$filename"
|
||||
|
||||
# Don't overwrite configs already exists in the output directory (copied from theme specific folder)
|
||||
if [[ ! -f $output_path ]]; then
|
||||
sed -f "$sed_script" "$tpl" >"$output_path"
|
||||
fi
|
||||
done
|
||||
|
||||
rm "$sed_script"
|
||||
fi
|
||||
39
bin/appearance/nomarchy-theme-set-vscode
Executable file
39
bin/appearance/nomarchy-theme-set-vscode
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Sync Nnomarchy theme to VS Code, VSCodium, and Cursor
|
||||
|
||||
VS_CODE_THEME="$HOME/.config/nnomarchy/current/theme/vscode.json"
|
||||
|
||||
set_theme() {
|
||||
local editor_cmd="$1"
|
||||
local settings_path="$2"
|
||||
|
||||
nnomarchy-cmd-present "$editor_cmd" && [[ $NNOMARCHY_TOGGLE_SKIP_VSCODE_THEME != "true" ]] || return 0
|
||||
|
||||
if [[ -f $VS_CODE_THEME ]]; then
|
||||
theme_name=$(jq -r '.name' "$VS_CODE_THEME")
|
||||
extension=$(jq -r '.extension' "$VS_CODE_THEME")
|
||||
|
||||
if [[ -n $extension ]] && ! "$editor_cmd" --list-extensions | grep -Fxq "$extension"; then
|
||||
"$editor_cmd" --install-extension "$extension" >/dev/null
|
||||
fi
|
||||
|
||||
mkdir -p "$(dirname "$settings_path")"
|
||||
[[ -f $settings_path ]] || printf '{\n}\n' >"$settings_path"
|
||||
|
||||
if ! grep -q '"workbench.colorTheme"' "$settings_path"; then
|
||||
sed -i --follow-symlinks -E '0,/\{/{s/\{/{\ "workbench.colorTheme": "",/}' "$settings_path"
|
||||
fi
|
||||
|
||||
sed -i --follow-symlinks -E \
|
||||
"s/(\"workbench.colorTheme\"[[:space:]]*:[[:space:]]*\")[^\"]*(\")/\1$theme_name\2/" \
|
||||
"$settings_path"
|
||||
elif [[ -f $settings_path ]]; then
|
||||
sed -i --follow-symlinks -E 's/\"workbench\.colorTheme\"[[:space:]]*:[^,}]*,?//' "$settings_path"
|
||||
fi
|
||||
}
|
||||
|
||||
set_theme "code" "$HOME/.config/Code/User/settings.json"
|
||||
set_theme "code-insiders" "$HOME/.config/Code - Insiders/User/settings.json"
|
||||
set_theme "codium" "$HOME/.config/VSCodium/User/settings.json"
|
||||
set_theme "cursor" "$HOME/.config/Cursor/User/settings.json"
|
||||
8
bin/appearance/nomarchy-theme-update
Executable file
8
bin/appearance/nomarchy-theme-update
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
for dir in ~/.config/nnomarchy/themes/*/; do
|
||||
if [[ -d $dir ]] && [[ ! -L ${dir%/} ]] && [[ -d $dir/.git ]]; then
|
||||
echo "Updating: $(basename "$dir")"
|
||||
git -C "$dir" pull
|
||||
fi
|
||||
done
|
||||
25
bin/appearance/nomarchy-toggle-nightlight
Executable file
25
bin/appearance/nomarchy-toggle-nightlight
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Toggles the nightlight (hyprsunset).
|
||||
# Hybrid: updates state.json and provides instant feedback.
|
||||
|
||||
STATE_FILE="$HOME/.config/home-manager/state.json"
|
||||
mkdir -p "$(dirname "$STATE_FILE")"
|
||||
|
||||
# Initialize if doesn't exist
|
||||
[[ ! -f $STATE_FILE ]] && echo "{}" > "$STATE_FILE"
|
||||
|
||||
if [[ $NNOMARCHY_TOGGLE_NIGHTLIGHT == "false" ]]; then
|
||||
NEW_VALUE="true"
|
||||
hyprctl dispatch exec hyprsunset --temperature 4000
|
||||
notify-send -u low " Nightlight enabled"
|
||||
else
|
||||
NEW_VALUE="false"
|
||||
pkill hyprsunset
|
||||
notify-send -u low " Nightlight disabled"
|
||||
fi
|
||||
|
||||
TMP_JSON=$(mktemp)
|
||||
jq ".nightlight = $NEW_VALUE" "$STATE_FILE" > "$TMP_JSON" && mv "$TMP_JSON" "$STATE_FILE"
|
||||
|
||||
echo "Nightlight state set to $NEW_VALUE. Environment will be fully updated on next rebuild."
|
||||
Reference in New Issue
Block a user