From e857b06c6b242c5faff99fd70241c35fba67da1f Mon Sep 17 00:00:00 2001 From: seraphim <18ycm9tx@anonaddy.me> Date: Thu, 20 Aug 2026 21:14:06 +0700 Subject: - --- gtk/.config/gtk-3.0/settings.ini | 2 +- niri/.config/niri/apply-colors.sh | 33 ++++++++++++++++++-- niri/.config/niri/config.kdl | 2 +- niri/.config/niri/theme-switcher.sh | 36 ++++++++++++++-------- portage/var/lib/portage/world | 10 ++++++ waybar/.config/waybar/config.jsonc | 3 +- waybar/.config/waybar/theme.css | 2 +- .../.config/xdg-desktop-portal/portals.conf | 5 ++- zshrc/.zshrc | 1 + 9 files changed, 72 insertions(+), 22 deletions(-) diff --git a/gtk/.config/gtk-3.0/settings.ini b/gtk/.config/gtk-3.0/settings.ini index 4e1634f..ef98ebb 120000 --- a/gtk/.config/gtk-3.0/settings.ini +++ b/gtk/.config/gtk-3.0/settings.ini @@ -1 +1 @@ -settings-light.ini \ No newline at end of file +settings-dark.ini \ No newline at end of file diff --git a/niri/.config/niri/apply-colors.sh b/niri/.config/niri/apply-colors.sh index d5113c6..339e134 100755 --- a/niri/.config/niri/apply-colors.sh +++ b/niri/.config/niri/apply-colors.sh @@ -8,6 +8,14 @@ set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "$(realpath "$0")")" && pwd)" IMG="${1:-}" MODE="${2:-auto}" +LOG="${THEME_LOG:-/tmp/theme-switcher.log}" + +log() { + printf '%s %s\n' "$(date '+%Y-%m-%d %H:%M:%S')" "$*" >>"$LOG" +} + +# Record the exact failing command + line on any error. +trap 'log "apply-colors FAILED (exit $?) in ${BASH_SOURCE[0]}:$LINENO: $BASH_COMMAND"' ERR if [ -z "$IMG" ] || [ ! -f "$IMG" ]; then echo "usage: $0 [light|dark]" >&2 @@ -15,23 +23,40 @@ if [ -z "$IMG" ] || [ ! -f "$IMG" ]; then fi # wallust: classic 16-color palette (foot, btop, ...) +# fastresize (the config default) is flaky on some images — always use resized. +# A single attempt with honest error handling: the old retry loop swallowed +# failures (case && break defeats set -e) and kept the stale light theme. +log "wallust palette=$MODE $IMG" case "$MODE" in -light) wallust run --palette light "$IMG" ;; -dark) wallust run --palette dark "$IMG" ;; -*) wallust run "$IMG" ;; +light|dark) WALLUST_PALETTE=("--palette" "$MODE") ;; +*) WALLUST_PALETTE=() ;; esac +if ! wallust run -b resized "${WALLUST_PALETTE[@]}" "$IMG"; then + log "wallust FAILED ($IMG, mode=$MODE)" + exit 1 +fi # foot needs bare RRGGBB, not #RRGGBB — strip the leading '#' sed -i 's/#\([0-9a-fA-F]\)/\1/g' ~/.cache/wallust/foot-theme.ini 2>/dev/null || true # matugen: Material You / M3 colors (niri focus ring, ...) # --prefer is required for non-interactive runs (multiple source colors). +log "matugen mode=$MODE $IMG" case "$MODE" in light) matugen image "$IMG" -m "light" --prefer saturation ;; dark) matugen image "$IMG" -m "dark" --prefer saturation ;; *) matugen image "$IMG" --prefer saturation ;; esac +# wait for the awww daemon to be ready (it is spawned next to this script at login) +log "awww img $IMG" +for _ in $(seq 1 10); do + if awww query >/dev/null 2>&1; then + break + fi + sleep 1 +done + # set the wallpaper awww img "$IMG" @@ -42,3 +67,5 @@ awww img "$IMG" killall -SIGUSR2 waybar 2>/dev/null || true killall -USR1 foot 2>/dev/null || true niri msg action load-config-file 2>/dev/null || true + +log "apply-colors OK ($IMG, $MODE)" diff --git a/niri/.config/niri/config.kdl b/niri/.config/niri/config.kdl index f30607a..05b2240 100644 --- a/niri/.config/niri/config.kdl +++ b/niri/.config/niri/config.kdl @@ -1,6 +1,6 @@ // Material You / Material Design 3 colors, generated by matugen (see theme-switcher.sh / apply-colors.sh) include optional=true "/home/seraphim/.cache/matugen/theme.kdl" - +spawn-at-startup "mako" spawn-at-startup "xrdb" "-merge" "/home/seraphim/.Xresources" spawn-at-startup "vicinae" "server" spawn-at-startup "gentoo-pipewire-launcher" diff --git a/niri/.config/niri/theme-switcher.sh b/niri/.config/niri/theme-switcher.sh index 0f9b415..6b3b6e9 100755 --- a/niri/.config/niri/theme-switcher.sh +++ b/niri/.config/niri/theme-switcher.sh @@ -7,9 +7,14 @@ WALLPAPERS="$HOME/Pictures/wallpapers" STATE_FILE="/tmp/current_theme_state" WALLPAPER_STATE_FILE="/tmp/current_wallpaper_state" BACKDROP_STATE_FILE="/tmp/current_backdrop_state" +LOG="/tmp/theme-switcher.log" SCRIPT_DIR="$(cd "$(dirname "$(realpath "$0")")" && pwd)" SET_BACKDROP="$SCRIPT_DIR/set-backdrop.sh" +log() { + printf '%s %s\n' "$(date '+%Y-%m-%d %H:%M:%S')" "$*" >>"$LOG" +} + while true; do HOUR=$(date +%H) HOUR=$((10#$HOUR)) @@ -40,22 +45,27 @@ while true; do fi if [ "$CURRENT_WALLPAPER" != "$WALLPAPER" ] || [ "$CURRENT_THEME" != "$TARGET_STATE" ]; then - sh "$SCRIPT_DIR/apply-colors.sh" "$WALLPAPER" "$MODE" - - if [ "$CURRENT_THEME" != "$TARGET_STATE" ]; then - darkman set "$TARGET_STATE" - fi + log "switching to $TARGET_STATE ($WALLPAPER)" + if sh "$SCRIPT_DIR/apply-colors.sh" "$WALLPAPER" "$MODE"; then + if [ "$CURRENT_THEME" != "$TARGET_STATE" ]; then + darkman set "$TARGET_STATE" + fi - ln -sf \ - "theme-${TARGET_STATE}.css" \ - "$HOME/dotfiles-gentoo/waybar/.config/waybar/theme.css" + ln -sf \ + "theme-${TARGET_STATE}.css" \ + "$HOME/dotfiles-gentoo/waybar/.config/waybar/theme.css" - ln -sf \ - "settings-${TARGET_STATE}.ini" \ - "$HOME/dotfiles-gentoo/gtk/.config/gtk-3.0/settings.ini" + ln -sf \ + "settings-${TARGET_STATE}.ini" \ + "$HOME/dotfiles-gentoo/gtk/.config/gtk-3.0/settings.ini" - echo "$TARGET_STATE" >"$STATE_FILE" - echo "$WALLPAPER" >"$WALLPAPER_STATE_FILE" + echo "$TARGET_STATE" >"$STATE_FILE" + echo "$WALLPAPER" >"$WALLPAPER_STATE_FILE" + log "switched to $TARGET_STATE ($WALLPAPER)" + else + # State is intentionally NOT written so the next loop iteration retries. + log "FAILED to apply $TARGET_STATE ($WALLPAPER), will retry" + fi fi sleep 60 diff --git a/portage/var/lib/portage/world b/portage/var/lib/portage/world index fb640da..8c665fd 100644 --- a/portage/var/lib/portage/world +++ b/portage/var/lib/portage/world @@ -5,6 +5,7 @@ app-admin/keepassxc app-admin/stow app-admin/sudo app-admin/testdisk +app-crypt/gcr app-editors/emacs app-editors/fresh app-editors/micro @@ -28,18 +29,23 @@ app-shells/zoxide app-shells/zsh app-shells/zsh-autocomplete app-text/evince +dev-debug/strace dev-util/android-tools dev-util/opencode-bin dev-vcs/git games-action/prismlauncher games-util/steam-launcher +gnome-base/gvfs gnome-base/nautilus gnome-extra/polkit-gnome gui-apps/awww gui-apps/darkman gui-apps/foot +gui-apps/mako +gui-apps/slurp gui-apps/swaybg gui-apps/tuigreet +gui-apps/vicinae gui-apps/waybar gui-apps/wl-clipboard gui-apps/wlogout @@ -47,6 +53,7 @@ gui-apps/wtype gui-apps/xwayland-satellite gui-libs/display-manager-init gui-libs/greetd +gui-libs/xdg-desktop-portal-wlr gui-wm/niri kde-apps/dolphin kde-apps/kio-extras @@ -60,6 +67,7 @@ media-fonts/noto-emoji media-fonts/unifont media-gfx/imagemagick media-gfx/imv +media-libs/libmtp media-libs/mesa media-sound/mpc media-sound/mpd @@ -81,6 +89,7 @@ net-p2p/syncthing net-proxy/Throne net-wireless/blueman sys-apps/eza +sys-apps/usbutils sys-auth/hyprpolkitagent sys-auth/polkit sys-auth/seatd @@ -94,6 +103,7 @@ www-client/helium-bin www-client/waterfox-bin x11-apps/xrdb x11-drivers/nvidia-drivers +x11-misc/dunst x11-misc/matugen x11-misc/sddm x11-misc/silent-sddm-theme diff --git a/waybar/.config/waybar/config.jsonc b/waybar/.config/waybar/config.jsonc index eedc711..c20a95c 100644 --- a/waybar/.config/waybar/config.jsonc +++ b/waybar/.config/waybar/config.jsonc @@ -66,12 +66,11 @@ }, "custom/kbd": { "exec": "/home/seraphim/dotfiles-gentoo/waybar/.config/waybar/kbd-layout.sh", - "restart-interval": 5, "tooltip": false }, "custom/clock": { "exec": "date +'%H:%M %p - %A, %b %d' | tr '[:upper:]' '[:lower:]'", - "interval": 60, + "interval": 1, "tooltip": false }, "pulseaudio": { diff --git a/waybar/.config/waybar/theme.css b/waybar/.config/waybar/theme.css index 1882049..aea3c67 120000 --- a/waybar/.config/waybar/theme.css +++ b/waybar/.config/waybar/theme.css @@ -1 +1 @@ -theme-light.css \ No newline at end of file +theme-dark.css \ No newline at end of file diff --git a/xdg-desktop-portal/.config/xdg-desktop-portal/portals.conf b/xdg-desktop-portal/.config/xdg-desktop-portal/portals.conf index 3d399f5..c651895 100644 --- a/xdg-desktop-portal/.config/xdg-desktop-portal/portals.conf +++ b/xdg-desktop-portal/.config/xdg-desktop-portal/portals.conf @@ -1,2 +1,5 @@ [preferred] -org.freedesktop.impl.portal.Settings=darkman \ No newline at end of file +default=gtk +org.freedesktop.impl.portal.Settings=darkman +org.freedesktop.impl.portal.Screencast=wlr +org.freedesktop.impl.portal.Screenshot=wlr diff --git a/zshrc/.zshrc b/zshrc/.zshrc index 589c3a3..44cf283 100644 --- a/zshrc/.zshrc +++ b/zshrc/.zshrc @@ -17,6 +17,7 @@ alias ls="eza -lha --icons" alias ll="eza -lh --icons" alias la="eza -lha --icons" alias tree="eza --tree --icons" +alias musmnt="sudo mount /dev/sdb1 /mnt/giga && nohup swingmusic >/tmp/swingmusic.log 2>&1 & disown" # Theme wallust() { command wallust run "$@" -- cgit v1.2.3