1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-06 05:25:41 -05:00
This commit is contained in:
bbedward
2025-10-21 23:13:54 -04:00
parent 90bc890190
commit 967b7d05de
43 changed files with 2203 additions and 7271 deletions

View File

@@ -1,14 +1,15 @@
#!/usr/bin/env bash
set -euo pipefail
if [ $# -lt 4 ]; then
echo "Usage: $0 STATE_DIR SHELL_DIR CONFIG_DIR --run" >&2
if [ $# -lt 5 ]; then
echo "Usage: $0 STATE_DIR SHELL_DIR CONFIG_DIR SYNC_MODE_WITH_PORTAL --run" >&2
exit 1
fi
STATE_DIR="$1"
SHELL_DIR="$2"
CONFIG_DIR="$3"
SYNC_MODE_WITH_PORTAL="$4"
if [ ! -d "$STATE_DIR" ]; then
echo "Error: STATE_DIR '$STATE_DIR' does not exist" >&2
@@ -25,10 +26,10 @@ if [ ! -d "$CONFIG_DIR" ]; then
exit 1
fi
shift 3 # Remove STATE_DIR, SHELL_DIR, and CONFIG_DIR from arguments
shift 4
if [[ "${1:-}" != "--run" ]]; then
echo "usage: $0 STATE_DIR SHELL_DIR CONFIG_DIR --run" >&2
echo "usage: $0 STATE_DIR SHELL_DIR CONFIG_DIR SYNC_MODE_WITH_PORTAL --run" >&2
exit 1
fi
@@ -62,6 +63,27 @@ key_of() {
echo "${kind}|${value}|${mode}|${icon}|${matugen_type}|${surface_base}|${run_user_templates}" | sha256sum | cut -d' ' -f1
}
set_system_color_scheme() {
local mode="$1"
if [[ "$SYNC_MODE_WITH_PORTAL" != "true" ]]; then
return 0
fi
local target_scheme
if [[ "$mode" == "light" ]]; then
target_scheme="default"
else
target_scheme="prefer-dark"
fi
if command -v gsettings >/dev/null 2>&1; then
gsettings set org.gnome.desktop.interface color-scheme "$target_scheme" >/dev/null 2>&1 || true
elif command -v dconf >/dev/null 2>&1; then
dconf write /org/gnome/desktop/interface/color-scheme "'$target_scheme'" >/dev/null 2>&1 || true
fi
}
build_once() {
local json="$1"
local kind value mode icon matugen_type surface_base run_user_templates
@@ -237,7 +259,7 @@ EOF
rm -f "$TMP_CONTENT_CFG"
popd >/dev/null
echo "$JSON" | grep -q '"primary"' || { echo "matugen JSON missing primary" >&2; return 2; }
echo "$JSON" | grep -q '"primary"' || { echo "matugen JSON missing primary" >&2; set_system_color_scheme "$mode"; return 2; }
printf "%s" "$JSON" > "$LAST_JSON"
GTK_CSS="$CONFIG_DIR/gtk-3.0/gtk.css"
@@ -289,6 +311,8 @@ EOF
mv "$TMP" "$CONFIG_DIR/kitty/dank-theme.conf"
fi
fi
set_system_color_scheme "$mode"
}
if command -v pywalfox >/dev/null 2>&1 && [[ -f "$HOME/.cache/wal/colors.json" ]]; then