diff options
| author | seraphim <18ycm9tx@anonaddy.me> | 2026-08-19 12:36:44 +0700 |
|---|---|---|
| committer | seraphim <18ycm9tx@anonaddy.me> | 2026-08-19 12:36:44 +0700 |
| commit | e1212c3e65485bfd68273ed0c7be2ac289b32c5a (patch) | |
| tree | 5c5018a02ec68741cbbca54b9d87844a69ebc41e /niri/.config | |
| parent | 71ae5f34e91fce3d3f42cd843ccc4bca2bc5c85d (diff) | |
simplify theme-switcher to day.jpg/night.jpg, add backdrop, clean up configs
- theme-switcher: remove wallpaper rotation/pools, use only day.jpg and night.jpg
- add set-backdrop.sh for niri Overview blurred backdrop
- niri config: add blur settings, awww-daemon backdrop, matugen focus-ring colors
- apply-colors.sh: add backdrop generation, formatting cleanup
- wallust: add vicinae theme templates and hooks
- zshrc: clean up comments, add aliases
- ghostty: remove config (moved elsewhere)
- portage: add tmux, evince, imv, bibata-xcursors; replace librewolf/mullvad with waterfox
Diffstat (limited to 'niri/.config')
| -rwxr-xr-x | niri/.config/niri/apply-colors.sh | 20 | ||||
| -rw-r--r-- | niri/.config/niri/config.kdl | 19 | ||||
| -rwxr-xr-x | niri/.config/niri/set-backdrop.sh | 29 | ||||
| -rwxr-xr-x | niri/.config/niri/theme-switcher.sh | 56 |
4 files changed, 88 insertions, 36 deletions
diff --git a/niri/.config/niri/apply-colors.sh b/niri/.config/niri/apply-colors.sh index 0c779a8..d5113c6 100755 --- a/niri/.config/niri/apply-colors.sh +++ b/niri/.config/niri/apply-colors.sh @@ -5,19 +5,20 @@ set -euo pipefail +SCRIPT_DIR="$(cd "$(dirname "$(realpath "$0")")" && pwd)" IMG="${1:-}" MODE="${2:-auto}" if [ -z "$IMG" ] || [ ! -f "$IMG" ]; then - echo "usage: $0 <image> [light|dark]" >&2 - exit 1 + echo "usage: $0 <image> [light|dark]" >&2 + exit 1 fi # wallust: classic 16-color palette (foot, btop, ...) case "$MODE" in - light) wallust run --palette light "$IMG" ;; - dark) wallust run --palette dark "$IMG" ;; - *) wallust run "$IMG" ;; +light) wallust run --palette light "$IMG" ;; +dark) wallust run --palette dark "$IMG" ;; +*) wallust run "$IMG" ;; esac # foot needs bare RRGGBB, not #RRGGBB — strip the leading '#' @@ -26,14 +27,17 @@ sed -i 's/#\([0-9a-fA-F]\)/\1/g' ~/.cache/wallust/foot-theme.ini 2>/dev/null || # matugen: Material You / M3 colors (niri focus ring, ...) # --prefer is required for non-interactive runs (multiple source colors). case "$MODE" in - light) matugen image "$IMG" -m "light" --prefer saturation ;; - dark) matugen image "$IMG" -m "dark" --prefer saturation ;; - *) matugen image "$IMG" --prefer saturation ;; +light) matugen image "$IMG" -m "light" --prefer saturation ;; +dark) matugen image "$IMG" -m "dark" --prefer saturation ;; +*) matugen image "$IMG" --prefer saturation ;; esac # set the wallpaper awww img "$IMG" +# blurred copy for the Overview backdrop (sibling or on-the-fly generation) +"$SCRIPT_DIR/set-backdrop.sh" "$IMG" + # reload consumers killall -SIGUSR2 waybar 2>/dev/null || true killall -USR1 foot 2>/dev/null || true diff --git a/niri/.config/niri/config.kdl b/niri/.config/niri/config.kdl index 552dbdd..d45e58d 100644 --- a/niri/.config/niri/config.kdl +++ b/niri/.config/niri/config.kdl @@ -7,6 +7,7 @@ spawn-at-startup "gentoo-pipewire-launcher" spawn-at-startup "telegram-desktop" "-autostart" "--minimized" spawn-at-startup "keepassxc" "--minimized" spawn-at-startup "awww-daemon" +spawn-at-startup "awww-daemon" "--namespace" "backdrop" spawn-at-startup "/usr/libexec/hyprpolkitagent" spawn-at-startup "dbus-update-activation-environment" "WAYLAND_DISPLAY" "DISPLAY" "XDG_CURRENT_DESKTOP" spawn-at-startup "darkman" "run" @@ -22,7 +23,19 @@ environment { ELECTRON_OZONE_PLATFORM_HINT "auto" XDG_CURRENT_DESKTOP "niri" } +blur { + passes 4 + offset 5.0 + noise 0.02 + saturation 1.1 +} +// awww-daemon --namespace backdrop: pre-blurred wallpaper shown in the +// Overview backdrop. niri cannot blur a backdrop surface itself. +layer-rule { + match namespace="^awww-daemonbackdrop$" + place-within-backdrop true +} input { // focus-follows-mouse max-scroll-amount="30%" @@ -67,8 +80,6 @@ layout { focus-ring { width 2 - active-color "#7fc8ff" - inactive-color "#505050" } border { @@ -164,10 +175,6 @@ overview { //color "#00000080" } } -layer-rule { - match namespace="^backdrop$" - place-within-backdrop true -} debug { honor-xdg-activation-with-invalid-serial } diff --git a/niri/.config/niri/set-backdrop.sh b/niri/.config/niri/set-backdrop.sh new file mode 100755 index 0000000..efd02b3 --- /dev/null +++ b/niri/.config/niri/set-backdrop.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# Push a blurred copy of a wallpaper to the awww-daemon backdrop namespace. +# Prefers a pre-made <name>-blur.<ext> sibling; otherwise generates one into the cache. +# Used by theme-switcher.sh and apply-colors.sh for the niri Overview backdrop. + +set -euo pipefail + +IMG="${1:-}" +if [ -z "$IMG" ] || [ ! -f "$IMG" ]; then + echo "usage: $0 <image>" >&2 + exit 1 +fi + +EXT="${IMG##*.}" +SIBLING="${IMG%.*}-blur.${EXT}" +if [ -f "$SIBLING" ]; then + BLURRED="$SIBLING" +else + CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/niri-backdrop" + mkdir -p "$CACHE_DIR" + BASE=$(basename "${IMG%.*}") + BLURRED="$CACHE_DIR/${BASE}-blur.jpg" + if [ ! -f "$BLURRED" ] || [ "$IMG" -nt "$BLURRED" ]; then + magick "$IMG" -blur 0x16 -quality 90 "$BLURRED" + fi +fi + +awww img "$BLURRED" -n backdrop +echo "$BLURRED" >/tmp/current_backdrop_state
\ No newline at end of file diff --git a/niri/.config/niri/theme-switcher.sh b/niri/.config/niri/theme-switcher.sh index 6eed888..0f9b415 100755 --- a/niri/.config/niri/theme-switcher.sh +++ b/niri/.config/niri/theme-switcher.sh @@ -1,15 +1,14 @@ #!/bin/bash -# paths to pics -LIGHT_WALLPAPER="$HOME/Pictures/wallpapers/day.jpg" -DARK_WALLPAPER="$HOME/Pictures/wallpapers/night.jpg" - -# paths to blurred pics for overview backdrop -LIGHT_BLUR_WALLPAPER="$HOME/Pictures/wallpapers/day-blur.jpg" -DARK_BLUR_WALLPAPER="$HOME/Pictures/wallpapers/night-blur.jpg" +# Two wallpapers: day.jpg (9:00-18:00) and night.jpg (18:00-9:00). +# To switch, just rename the files in ~/Pictures/wallpapers/. +WALLPAPERS="$HOME/Pictures/wallpapers" STATE_FILE="/tmp/current_theme_state" +WALLPAPER_STATE_FILE="/tmp/current_wallpaper_state" +BACKDROP_STATE_FILE="/tmp/current_backdrop_state" SCRIPT_DIR="$(cd "$(dirname "$(realpath "$0")")" && pwd)" +SET_BACKDROP="$SCRIPT_DIR/set-backdrop.sh" while true; do HOUR=$(date +%H) @@ -17,33 +16,46 @@ while true; do if [ "$HOUR" -ge 9 ] && [ "$HOUR" -lt 18 ]; then TARGET_STATE="light" + MODE="light" + WALLPAPER="$WALLPAPERS/day.jpg" else TARGET_STATE="dark" + MODE="dark" + WALLPAPER="$WALLPAPERS/night.jpg" + fi + + if [ ! -f "$WALLPAPER" ]; then + sleep 60 + continue fi - CURRENT_STATE=$(cat "$STATE_FILE" 2>/dev/null) + CURRENT_THEME=$(cat "$STATE_FILE" 2>/dev/null || true) + CURRENT_WALLPAPER=$(cat "$WALLPAPER_STATE_FILE" 2>/dev/null || true) - if [ "$CURRENT_STATE" != "$TARGET_STATE" ]; then - if [ "$TARGET_STATE" = "light" ]; then - sh "$SCRIPT_DIR/apply-colors.sh" "$LIGHT_WALLPAPER" light - awww -n backdrop img "$LIGHT_BLUR_WALLPAPER" + # Self-heal the Overview backdrop + EXPECTED_BACKDROP=$(cat "$BACKDROP_STATE_FILE" 2>/dev/null || true) + ACTUAL_BACKDROP=$(awww query -n backdrop -j 2>/dev/null | jq -r '.["backdrop"][0].displaying.image // empty') + if [ -n "$EXPECTED_BACKDROP" ] && [ "$ACTUAL_BACKDROP" != "$EXPECTED_BACKDROP" ]; then + "$SET_BACKDROP" "$WALLPAPER" + fi - # Сообщаем системе, что включилась светлая тема - darkman set light - else - sh "$SCRIPT_DIR/apply-colors.sh" "$DARK_WALLPAPER" dark - awww -n backdrop img "$DARK_BLUR_WALLPAPER" + if [ "$CURRENT_WALLPAPER" != "$WALLPAPER" ] || [ "$CURRENT_THEME" != "$TARGET_STATE" ]; then + sh "$SCRIPT_DIR/apply-colors.sh" "$WALLPAPER" "$MODE" - # Сообщаем системе, что включилась тёмная тема - darkman set dark + 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" - # GTK3 apps don't read the portal; flip the preference via settings.ini - 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" fi sleep 60 |
