feat(theme,display,wm,power,make): add Anodized theme, editors, multi-monitor arrangement, power timeouts, bar compaction, and replace state preservation
- Replace deprecated AnodeDefault with dark-silvery Anodized default theme - Add interactive theme editor, duplicator, and non-standard .xth importer to anode-themes (+ CLI --install) - Fix multi-monitor dwm/lock/vkbd/EDID edge cases and integrate monitor arrangement + 15s revert into anode-display and anode-apply-display - Gate anode-touchd behind WITH_TOUCHD=1 (keeping anode-vkbd unconditional) and add help/rebuild/install-touch/install-system targets to Makefile - Add idle screen dim, lock, suspend, and suspend-on-AC timeout controls to anode-power and anode-display backed by power.conf + SIGUSR1 - Prevent lockscreen subtitle overflow and progressively compact status bar segments so focused window titles remain visible - Preserve workspaces, active desktop, monitor state, floating/fullscreen states, and focus across anode-replace and restarts
This commit is contained in:
1 parent
bb81541b42
commit
4ec3f59e02
40 files changed
+5843
-768
No files matched your search
@@ -11,16 +11,84 @@ SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
|
||||
|
||||
if [ "${1:-}" = "-h" ] || [ "${1:-}" = "--help" ]; then
|
||||
cat <<'EOF'
|
||||
Usage: anode-apply-theme [THEME_NAME | /path/to/Theme.xth]
|
||||
Usage:
|
||||
anode-apply-theme [THEME_NAME | /path/to/Theme.xth]
|
||||
anode-apply-theme --install /path/to/Theme.xth [Name]
|
||||
EOF
|
||||
exit 0
|
||||
fi
|
||||
|
||||
REQ_THEME="${1:-}"
|
||||
sanitize_theme_name() {
|
||||
printf '%s' "$1" | tr -c 'A-Za-z0-9_-' '_' | sed 's/^_*//; s/_*$//'
|
||||
}
|
||||
|
||||
INSTALL_SRC=""
|
||||
INSTALL_NAME=""
|
||||
REQ_THEME=""
|
||||
if [ "${1:-}" = "--install" ]; then
|
||||
if [ $# -lt 2 ] || [ -z "${2:-}" ]; then
|
||||
printf 'anode-apply-theme: --install requires a .xth file path\n' >&2
|
||||
exit 1
|
||||
fi
|
||||
INSTALL_SRC="$2"
|
||||
INSTALL_NAME="${3:-}"
|
||||
else
|
||||
REQ_THEME="${1:-}"
|
||||
fi
|
||||
|
||||
if [ -n "$INSTALL_SRC" ]; then
|
||||
if [ ! -f "$INSTALL_SRC" ] || [ ! -r "$INSTALL_SRC" ]; then
|
||||
printf 'anode-apply-theme: cannot read theme file: %s\n' "$INSTALL_SRC" >&2
|
||||
exit 1
|
||||
fi
|
||||
if ! awk '
|
||||
{
|
||||
s = $0
|
||||
gsub(/^[ \t\r\n]+|[ \t\r\n]+$/, "", s)
|
||||
if (s == "" || substr(s, 1, 1) == "!" || substr(s, 1, 1) == "#") next
|
||||
if (index(s, ":") > 1) { ok = 1; exit }
|
||||
}
|
||||
END { exit(ok ? 0 : 1) }
|
||||
' "$INSTALL_SRC"; then
|
||||
printf 'anode-apply-theme: invalid .xth theme file: %s\n' "$INSTALL_SRC" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "$INSTALL_NAME" ]; then
|
||||
INSTALL_NAME="$(awk -F: '/^theme\.name[[:space:]]*:/ { sub(/^[[:space:]]+/, "", $2); sub(/[ \t\r\n]+$/, "", $2); print $2; exit }' "$INSTALL_SRC" || true)"
|
||||
fi
|
||||
if [ -z "$INSTALL_NAME" ]; then
|
||||
INSTALL_NAME="$(basename "$INSTALL_SRC" .xth)"
|
||||
fi
|
||||
SAFE_NAME="$(sanitize_theme_name "$INSTALL_NAME")"
|
||||
if [ -z "$SAFE_NAME" ] || [ "$SAFE_NAME" = "." ] || [ "$SAFE_NAME" = ".." ]; then
|
||||
printf 'anode-apply-theme: invalid target theme name\n' >&2
|
||||
exit 1
|
||||
fi
|
||||
mkdir -p "$CONF_DIR/themes"
|
||||
DEST_XTH="$CONF_DIR/themes/$SAFE_NAME.xth"
|
||||
TMP_INST="$DEST_XTH.tmp.$$"
|
||||
awk -v tname="$SAFE_NAME" '
|
||||
BEGIN { had_name = 0 }
|
||||
/^theme\.name[[:space:]]*:/ {
|
||||
if (!had_name) {
|
||||
printf "theme.name: %s\n", tname
|
||||
had_name = 1
|
||||
}
|
||||
next
|
||||
}
|
||||
{ print $0 }
|
||||
END {
|
||||
if (!had_name) printf "theme.name: %s\n", tname
|
||||
}
|
||||
' "$INSTALL_SRC" > "$TMP_INST"
|
||||
mv -f "$TMP_INST" "$DEST_XTH"
|
||||
REQ_THEME="$DEST_XTH"
|
||||
fi
|
||||
|
||||
if [ -z "$REQ_THEME" ] && [ -f "$THEME_CONF" ]; then
|
||||
REQ_THEME="$(awk -F= '/^THEME=/{ print $2; exit }' "$THEME_CONF" 2>/dev/null || true)"
|
||||
fi
|
||||
: "${REQ_THEME:=AnodeDefault}"
|
||||
: "${REQ_THEME:=Anodized}"
|
||||
|
||||
find_xth() {
|
||||
_q="$1"
|
||||
@@ -49,6 +117,13 @@ find_xth() {
|
||||
}
|
||||
|
||||
XTH_FILE="$(find_xth "$REQ_THEME" || true)"
|
||||
if [ -z "$XTH_FILE" ] || [ ! -r "$XTH_FILE" ]; then
|
||||
_req_base="$(basename "$REQ_THEME" .xth)"
|
||||
if [ "$_req_base" = "AnodeDefault" ]; then
|
||||
printf 'anode-apply-theme: warning: AnodeDefault is deprecated; using Anodized\n' >&2
|
||||
XTH_FILE="$(find_xth "Anodized" || true)"
|
||||
fi
|
||||
fi
|
||||
if [ -z "$XTH_FILE" ] || [ ! -r "$XTH_FILE" ]; then
|
||||
printf 'anode-apply-theme: theme not found: %s\n' "$REQ_THEME" >&2
|
||||
exit 1
|
||||
|
||||
Reference in new issue
Block a user