Single-script builder (nosignal.sh) that turns a stock Arch Linux ISO into a fully-offline installer for a themed Hyprland + caelestia (Quickshell) desktop: matching SDDM greeter, Btrfs/Limine bootable snapshots, chwd-style GPU detection, and a curated "os updates" layer (keybind cheatsheet, settings panels, system polish, on-box management skill). See README.md. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
39 lines
1.7 KiB
Bash
Executable file
39 lines
1.7 KiB
Bash
Executable file
#!/bin/sh
|
|
# nosignal-app-theme-sync — make external apps follow Caelestia's light/dark mode.
|
|
#
|
|
# Reads Caelestia's current mode (`caelestia scheme get` -> "Mode: dark|light")
|
|
# and publishes it so toolkit apps follow:
|
|
# * gsettings color-scheme -> xdg-desktop-portal(-gtk) org.freedesktop.appearance
|
|
# => Chrome/Chromium, Electron, Firefox, GTK4/libadwaita, Qt6 all follow.
|
|
# * GTK3 prefer-dark flag in gtk-3.0/gtk-4.0 settings.ini for legacy GTK apps
|
|
# that don't read the portal.
|
|
# Idempotent; safe to run repeatedly. Invoked at login and on scheme change by
|
|
# the nosignal-app-theme .service/.path units.
|
|
set -u
|
|
|
|
mode=$(caelestia scheme get 2>/dev/null | awk -F': *' '/Mode:/{print tolower($2); exit}')
|
|
case "$mode" in
|
|
dark) cs=prefer-dark; pd=true ;;
|
|
light) cs=prefer-light; pd=false ;;
|
|
*) cs=default; pd=false ;; # unknown -> no preference
|
|
esac
|
|
|
|
# 1. master switch (portal): Chrome / Electron / Firefox / GTK4 / Qt6
|
|
if command -v gsettings >/dev/null 2>&1; then
|
|
gsettings set org.gnome.desktop.interface color-scheme "$cs" 2>/dev/null || true
|
|
fi
|
|
|
|
# 2. legacy GTK3 (+GTK4) prefer-dark flag for apps that ignore the portal
|
|
for v in 3.0 4.0; do
|
|
d="${XDG_CONFIG_HOME:-$HOME/.config}/gtk-$v"; f="$d/settings.ini"
|
|
mkdir -p "$d"
|
|
[ -f "$f" ] || printf '[Settings]\n' > "$f"
|
|
grep -q '^\[Settings\]' "$f" || printf '[Settings]\n' >> "$f"
|
|
if grep -q '^gtk-application-prefer-dark-theme' "$f"; then
|
|
sed -i "s/^gtk-application-prefer-dark-theme.*/gtk-application-prefer-dark-theme=$pd/" "$f"
|
|
else
|
|
printf 'gtk-application-prefer-dark-theme=%s\n' "$pd" >> "$f"
|
|
fi
|
|
done
|
|
|
|
echo "app-theme: caelestia mode=${mode:-unknown} -> color-scheme=$cs, gtk prefer-dark=$pd"
|