mirror of
https://github.com/belsabbagh/dotfiles.git
synced 2026-04-11 17:47:09 +00:00
quickshell and hyprland additions
This commit is contained in:
37
.config/quickshell/nucleus-shell/scripts/interface/switchTheme.sh
Executable file
37
.config/quickshell/nucleus-shell/scripts/interface/switchTheme.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
THEME_NAME="${1:-}"
|
||||
|
||||
THEME_DIR="$HOME/.config/nucleus-shell/colorschemes"
|
||||
TARGET="$HOME/.config/nucleus-shell/config/colors.json"
|
||||
|
||||
if [[ -z "$THEME_NAME" ]]; then
|
||||
echo "Usage: switch-theme.sh <theme-name | auto>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# === AUTOGENERATED THEME ===
|
||||
if [[ "$THEME_NAME" == "auto" || "$THEME_NAME" == "autogen" ]]; then
|
||||
echo "Generating theme via Quickshell IPC…"
|
||||
|
||||
qs -c nucleus-shell ipc call global regenColors
|
||||
|
||||
echo "Autogenerated theme applied"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# === STATIC THEME ===
|
||||
SOURCE="$THEME_DIR/$THEME_NAME.json"
|
||||
|
||||
if [[ ! -f "$SOURCE" ]]; then
|
||||
echo "Theme not found: $THEME_NAME"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Atomic write
|
||||
tmp="$(mktemp)"
|
||||
cat "$SOURCE" > "$tmp"
|
||||
mv "$tmp" "$TARGET"
|
||||
|
||||
echo "Theme switched to: $THEME_NAME"
|
||||
Reference in New Issue
Block a user