From 9d11eefc53441e1f5688545b4b827f7c8dd5090d Mon Sep 17 00:00:00 2001 From: seraphim <18ycm9tx@anonaddy.me> Date: Sun, 23 Aug 2026 19:31:22 +0700 Subject: reorganize directories, so everything in .config --- .config/mako/config | 14 ++++ .config/niri/apply-colors.sh | 1 + .config/niri/config.kdl | 4 +- .config/niri/mako-start.sh | 20 +++++ .config/niri/theme-switcher.sh | 144 +++++++++++++++++--------------- .config/nvim/init.lua | 4 + .config/nvim/lua/caelus/init.lua | 9 ++ .config/tmux/tmux.conf | 71 ++++++++++++++++ .config/vis/visrc.lua | 12 +++ .config/wallust/templates/mako | 19 +++++ .config/wallust/templates/vis-theme.lua | 38 +++++++++ .config/wallust/wallust.toml | 2 + .config/waybar/config.jsonc | 7 +- .config/waybar/style.css | 2 +- 14 files changed, 272 insertions(+), 75 deletions(-) create mode 100644 .config/mako/config create mode 100755 .config/niri/mako-start.sh create mode 100644 .config/tmux/tmux.conf create mode 100644 .config/vis/visrc.lua create mode 100644 .config/wallust/templates/mako create mode 100644 .config/wallust/templates/vis-theme.lua (limited to '.config') diff --git a/.config/mako/config b/.config/mako/config new file mode 100644 index 0000000..0e3f649 --- /dev/null +++ b/.config/mako/config @@ -0,0 +1,14 @@ +# mako - notification daemon +# Colors are auto-generated by wallust (palette from the wallpaper) into: +# ~/.cache/wallust/mako +# and pulled in via the include below. Layout/behavior stays here. + +include=/home/seraphim/.cache/wallust/mako + +font=Monospace 10 +border-size=2 +border-radius=8 +margin=12 +padding=8 +default-timeout=10000 +max-visible=5 diff --git a/.config/niri/apply-colors.sh b/.config/niri/apply-colors.sh index 505578c..aebf509 100755 --- a/.config/niri/apply-colors.sh +++ b/.config/niri/apply-colors.sh @@ -80,5 +80,6 @@ esac || log "matugen FAILED ($IMG, mode=$MODE) — continuing without matugen co killall -SIGUSR2 waybar 2>/dev/null || true killall -USR1 foot 2>/dev/null || true niri msg action load-config-file 2>/dev/null || true +makoctl reload 2>/dev/null || true log "apply-colors OK ($IMG, $MODE)" diff --git a/.config/niri/config.kdl b/.config/niri/config.kdl index 9d7db14..b71b8ed 100644 --- a/.config/niri/config.kdl +++ b/.config/niri/config.kdl @@ -1,5 +1,5 @@ include optional=true "/home/seraphim/.cache/matugen/theme.kdl" -spawn-at-startup "mako" +spawn-at-startup "/home/seraphim/dotfiles-gentoo/niri/.config/niri/mako-start.sh" spawn-at-startup "xrdb" "-merge" "/home/seraphim/.Xresources" spawn-at-startup "vicinae" "server" spawn-at-startup "gentoo-pipewire-launcher" @@ -10,7 +10,7 @@ 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" -spawn-at-startup "/home/seraphim/dotfiles-gentoo/niri/.config/niri/theme-switcher.sh" "night" +spawn-at-startup "/home/seraphim/dotfiles-gentoo/.config/niri/theme-switcher.sh" "--last" spawn-at-startup "sh" "-c" "NO_AT_BRIDGE=1 waybar" spawn-at-startup "/usr/bin/Throne" spawn-at-startup "mpd" diff --git a/.config/niri/mako-start.sh b/.config/niri/mako-start.sh new file mode 100755 index 0000000..aceaa3b --- /dev/null +++ b/.config/niri/mako-start.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# Start mako after making sure the wallust-generated color file exists. +# mako's config uses `include=~/.cache/wallust/mako`; if that file is missing +# (e.g. on first login before wallust has run) mako would fail to start, so we +# seed a neutral default here. apply-colors.sh regenerates it and runs +# `makoctl reload` once the real palette is ready. +set -e + +CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/wallust/mako" +if [ ! -f "$CACHE" ]; then + mkdir -p "$(dirname "$CACHE")" + cat > "$CACHE" <<'EOF' +background-color=#1e1e1e +text-color=#e0e0e0 +border-color=#3a3a3a +progress-color=over #4f4f4f +EOF +fi + +exec mako "$@" diff --git a/.config/niri/theme-switcher.sh b/.config/niri/theme-switcher.sh index 6d1f548..01786d8 100755 --- a/.config/niri/theme-switcher.sh +++ b/.config/niri/theme-switcher.sh @@ -1,19 +1,18 @@ #!/bin/bash -# Day/night theme switcher + wallpaper/color applier. -# Two wallpapers: day.jpg (9:00-18:00) and night.jpg (18:00-9:00). +# Manual theme switcher + wallpaper/color applier. +# No time-based switching: you pick the wallpaper and mode explicitly. # # Usage: -# ./theme-switcher.sh one-shot: apply based on current time, then exit -# ./theme-switcher.sh day|light force light theme, then exit -# ./theme-switcher.sh night|dark force dark theme, then exit -# ./theme-switcher.sh --daemon continuous time-based loop (used at login) +# ./theme-switcher.sh apply in light/dark mode, remember it +# ./theme-switcher.sh --last apply the last manually-set wallpaper+mode +# ./theme-switcher.sh -h | --help show this help WALLPAPERS="$HOME/Pictures/wallpapers" STATE_FILE="/tmp/current_theme_state" WALLPAPER_STATE_FILE="/tmp/current_wallpaper_state" BACKDROP_STATE_FILE="/tmp/current_backdrop_state" -PID_FILE="/tmp/theme-switcher.daemon.pid" +LAST_FILE="${XDG_STATE_HOME:-$HOME/.local/state}/theme-switcher/last" LOG="/tmp/theme-switcher.log" SCRIPT_DIR="$(cd "$(dirname "$(realpath "$0")")" && pwd)" SET_BACKDROP="$SCRIPT_DIR/set-backdrop.sh" @@ -22,33 +21,42 @@ log() { printf '%s %s\n' "$(date '+%Y-%m-%d %H:%M:%S')" "$*" >>"$LOG" } -# Resolve TARGET_STATE / MODE / WALLPAPER. Optional $1 forces day|night. -resolve_target() { - local force="${1:-}" - if [ "$force" = "day" ] || [ "$force" = "light" ]; then - TARGET_STATE="light" - MODE="light" - WALLPAPER="$WALLPAPERS/day.jpg" - elif [ "$force" = "night" ] || [ "$force" = "dark" ]; then +# Persist the last manually-chosen wallpaper + mode so --last survives reboots. +save_last() { + mkdir -p "$(dirname "$LAST_FILE")" + printf '%s\n%s\n' "$WALLPAPER" "$MODE" >"$LAST_FILE" +} + +# Load the last chosen wallpaper + mode. Falls back to the old default so a +# fresh boot (nothing saved yet) never lands on a blank wallpaper. +load_last() { + if [ -f "$LAST_FILE" ]; then + WALLPAPER=$(sed -n '1p' "$LAST_FILE") + MODE=$(sed -n '2p' "$LAST_FILE") + case "$MODE" in + light) TARGET_STATE="light" ;; + *) TARGET_STATE="dark"; MODE="dark" ;; + esac + else + WALLPAPER="$WALLPAPERS/night.jpg" TARGET_STATE="dark" MODE="dark" - WALLPAPER="$WALLPAPERS/night.jpg" - else - local HOUR - HOUR=$(date +%H) - HOUR=$((10#$HOUR)) - 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 fi } +# Resolve TARGET_STATE / MODE from an explicit mode argument. +resolve_explicit() { + local mode="$1" + case "$mode" in + day | light) TARGET_STATE="light"; MODE="light" ;; + night | dark) TARGET_STATE="dark"; MODE="dark" ;; + *) + echo "mode must be day|night (got: $mode)" >&2 + exit 1 + ;; + esac +} + # Apply the resolved target once. Returns 0 on success. apply_target() { if [ ! -f "$WALLPAPER" ]; then @@ -59,16 +67,6 @@ apply_target() { local CURRENT_THEME CURRENT_WALLPAPER EXPECTED_BACKDROP ACTUAL_BACKDROP CURRENT_THEME=$(cat "$STATE_FILE" 2>/dev/null || true) - # Already in the correct theme: don't re-run wallust/matugen every loop tick. - # Still self-heal a drifted backdrop below, then bail out. - if [ "$CURRENT_THEME" = "$TARGET_STATE" ]; then - 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 - return 0 - fi CURRENT_WALLPAPER=$(cat "$WALLPAPER_STATE_FILE" 2>/dev/null || true) # Self-heal the Overview backdrop if it drifted from the expected image. @@ -78,6 +76,11 @@ apply_target() { "$SET_BACKDROP" "$WALLPAPER" fi + # Already in this exact theme AND wallpaper: skip the heavy color work. + if [ "$CURRENT_THEME" = "$TARGET_STATE" ] && [ "$CURRENT_WALLPAPER" = "$WALLPAPER" ]; then + return 0 + fi + log "switching to $TARGET_STATE ($WALLPAPER)" if sh "$SCRIPT_DIR/apply-colors.sh" "$WALLPAPER" "$MODE"; then if [ "$CURRENT_THEME" != "$TARGET_STATE" ]; then @@ -86,14 +89,15 @@ apply_target() { ln -sf \ "theme-${TARGET_STATE}.css" \ - "$HOME/dotfiles-gentoo/waybar/.config/waybar/theme.css" + "$HOME/dotfiles-gentoo/.config/waybar/theme.css" ln -sf \ "settings-${TARGET_STATE}.ini" \ - "$HOME/dotfiles-gentoo/gtk/.config/gtk-3.0/settings.ini" + "$HOME/dotfiles-gentoo/.config/gtk-3.0/settings.ini" echo "$TARGET_STATE" >"$STATE_FILE" echo "$WALLPAPER" >"$WALLPAPER_STATE_FILE" + save_last log "switched to $TARGET_STATE ($WALLPAPER)" return 0 else @@ -102,34 +106,38 @@ apply_target() { fi } -daemon_loop() { - # Refuse to run a second daemon instance (e.g. manual run while one is alive). - if [ -f "$PID_FILE" ] && kill -0 "$(cat "$PID_FILE" 2>/dev/null)" 2>/dev/null; then - log "daemon already running (pid $(cat "$PID_FILE")), exiting" - exit 0 - fi - echo $$ >"$PID_FILE" - - while true; do - resolve_target - apply_target || true # failure is retried on the next loop, state is left untouched - sleep 60 - done +usage() { + cat >&2 < | --last + apply in light/dark mode and remember it + --last apply the last manually-set wallpaper + mode +EOF } case "${1:-}" in ---daemon | -d) daemon_loop ;; -"" | day | light | night | dark) - resolve_target "${1:-}" - apply_target - exit $? - ;; --h | --help) - echo "usage: $0 [day|night|--daemon]" >&2 - exit 0 - ;; -*) - echo "usage: $0 [day|night|--daemon]" >&2 - exit 1 - ;; + --last) + load_last + apply_target + exit $? + ;; + -h | --help) + usage + exit 0 + ;; + "") + usage + exit 1 + ;; + *) + WALLPAPER="${1:-}" + MODEARG="${2:-}" + if [ -z "$MODEARG" ]; then + echo "missing mode (day|night)" >&2 + usage + exit 1 + fi + resolve_explicit "$MODEARG" + apply_target + exit $? + ;; esac diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 6bf6f8e..e0ef470 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1,4 +1,8 @@ require("caelus.init").colorscheme() +-- Re-apply wallust colors when returning to nvim after a theme switch. +vim.api.nvim_create_autocmd("FocusGained", { + callback = function() require("caelus.init").colorscheme() end, +}) require("config.keymaps") require("config.options") require("config.plugins") diff --git a/.config/nvim/lua/caelus/init.lua b/.config/nvim/lua/caelus/init.lua index dec0a41..2507bea 100644 --- a/.config/nvim/lua/caelus/init.lua +++ b/.config/nvim/lua/caelus/init.lua @@ -29,6 +29,15 @@ local colors = { } function M.colorscheme() + -- Prefer wallust-generated colors (auto-themed from the wallpaper). + local wallust = (os.getenv("HOME") or "") .. "/.cache/wallust/colors/wallust.lua" + if vim.loop.fs_stat(wallust) and pcall(dofile, wallust) then + if package.loaded['lualine'] then + require('lualine').setup({ options = { theme = 'auto' } }) + end + return + end + vim.cmd("highlight clear") vim.cmd("syntax reset") diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf new file mode 100644 index 0000000..0b070f8 --- /dev/null +++ b/.config/tmux/tmux.conf @@ -0,0 +1,71 @@ +# Enable 256 color support +set -g default-terminal "tmux-256color" +set -ga terminal-overrides ",*:RGB" + +# Enable mouse support +set -g mouse on + +# Enable clipboard +set -g set-clipboard on +# Change prefix from Ctrl-b to Ctrl-a +unbind C-b +set -g prefix C-a +bind-key C-a send-prefix + +# Vim-style pane navigation +bind h select-pane -L +bind j select-pane -D +bind k select-pane -U +bind l select-pane -R + +# Split windows (opens in same directory) +unbind % +bind | split-window -h -c "#{pane_current_path}" + +unbind '"' +bind - split-window -v -c "#{pane_current_path}" + +# Reload config +unbind r +bind r source-file $HOME/.config/tmux/tmux.conf + +# Alt+hjkl to switch panes without prefix +bind -n M-h select-pane -L +bind -n M-j select-pane -D +bind -n M-k select-pane -U +bind -n M-l select-pane -R + +# Alt+number to select window +bind -n M-1 select-window -t 1 +bind -n M-2 select-window -t 2 +bind -n M-3 select-window -t 3 +bind -n M-4 select-window -t 4 +bind -n M-5 select-window -t 5 +bind -n M-6 select-window -t 6 +bind -n M-7 select-window -t 7 +bind -n M-8 select-window -t 8 +bind -n M-9 select-window -t 9 +# Statusline - current window +set -g window-status-current-format "#[fg=${thm_blue},bg=${thm_bg}] #I: #[fg=${thm_magenta},bg=${thm_bg}](✓) #[fg=${thm_cyan},bg=${thm_bg}]#(echo '#{pane_current_path}' | rev | cut -d'/' -f-2 | rev) #[fg=${thm_magenta},bg=${thm_bg}]" + +# Statusline - other windows +set -g window-status-format "#[fg=${thm_blue},bg=${thm_bg}] #I: #[fg=${thm_fg},bg=${thm_bg}]#W" + +# Statusline - right side +set -g status-right "#[fg=${thm_blue},bg=${thm_bg},nobold,nounderscore,noitalics]#[fg=${thm_bg},bg=${thm_blue},nobold,nounderscore,noitalics] #[fg=${thm_fg},bg=${thm_gray}] #W #{?client_prefix,#[fg=${thm_magenta}],#[fg=${thm_cyan}]}#[bg=${thm_gray}]#{?client_prefix,#[bg=${thm_magenta}],#[bg=${thm_cyan}]}#[fg=${thm_bg}] #[fg=${thm_fg},bg=${thm_gray}] #S " + +# Statusline - left side (empty) +set -g status-left "" + +# Change from 0 based to 1 based because keyboard layout +set -g base-index 1 +set -g pane-base-index 1 +set-window-option -g pane-base-index 1 +set-option -g renumber-windows on + +# Vim-like copy/paste +set-window-option -g mode-keys vi +bind-key -T copy-mode-vi v send-keys -X begin-selection +bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle +bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel +unbind -T copy-mode-vi MouseDragEnd1Pane diff --git a/.config/vis/visrc.lua b/.config/vis/visrc.lua new file mode 100644 index 0000000..2c78715 --- /dev/null +++ b/.config/vis/visrc.lua @@ -0,0 +1,12 @@ +require('vis') + +-- Auto-themed colors from wallust (palette derived from the wallpaper). +-- Falls back to a built-in theme if wallust hasn't generated one yet. +local wallust = os.getenv('HOME') .. '/.cache/wallust/vis-theme.lua' +if not pcall(dofile, wallust) then + pcall(require, 'themes.solarized') +end + +vis.events.subscribe(vis.events.WIN_OPEN, function(win) + vis:command('set number') +end) diff --git a/.config/wallust/templates/mako b/.config/wallust/templates/mako new file mode 100644 index 0000000..390b1c1 --- /dev/null +++ b/.config/wallust/templates/mako @@ -0,0 +1,19 @@ +# Generated by wallust from your system color scheme. Do not edit by hand. +# Source of truth: wallust/.config/wallust/templates/mako + +background-color={{background}} +text-color={{foreground}} +border-color={{color4}} +progress-color=over {{color6}} + +[urgency=low] +border-color={{color4}} + +[urgency=normal] +border-color={{color4}} + +[urgency=critical] +background-color={{color1}} +text-color={{foreground}} +border-color={{color1}} +progress-color=over {{color1}} diff --git a/.config/wallust/templates/vis-theme.lua b/.config/wallust/templates/vis-theme.lua new file mode 100644 index 0000000..9fc9900 --- /dev/null +++ b/.config/wallust/templates/vis-theme.lua @@ -0,0 +1,38 @@ +-- Generated by wallust from your system color scheme. Do not edit by hand. +-- Source of truth: wallust/.config/wallust/templates/vis-theme.lua +local lexers = vis.lexers + +lexers.STYLE_DEFAULT = 'fore:{{foreground}},back:{{background}}' +lexers.STYLE_NOTHING = '' +lexers.STYLE_CLASS = 'fore:{{color6}}' +lexers.STYLE_COMMENT = 'fore:{{color8}},italics' +lexers.STYLE_CONSTANT = 'fore:{{color13}}' +lexers.STYLE_DEFINITION = 'fore:{{color3}}' +lexers.STYLE_ERROR = 'fore:{{color1}},bold' +lexers.STYLE_FUNCTION = 'fore:{{color4}}' +lexers.STYLE_KEYWORD = 'fore:{{color5}},bold' +lexers.STYLE_LABEL = 'fore:{{color4}}' +lexers.STYLE_NUMBER = 'fore:{{color1}}' +lexers.STYLE_OPERATOR = 'fore:{{color6}}' +lexers.STYLE_REGEX = 'fore:{{color2}}' +lexers.STYLE_STRING = 'fore:{{color2}}' +lexers.STYLE_PREPROCESSOR = 'fore:{{color5}},bold' +lexers.STYLE_TAG = 'fore:{{color1}},bold' +lexers.STYLE_TYPE = 'fore:{{color3}},bold' +lexers.STYLE_VARIABLE = 'fore:{{foreground}}' +lexers.STYLE_WHITESPACE = '' +lexers.STYLE_EMBEDDED = 'fore:{{color13}}' +lexers.STYLE_IDENTIFIER = '' + +lexers.STYLE_LINENUMBER = 'fore:{{color8}}' +lexers.STYLE_LINENUMBER_CURSOR = 'fore:{{color8}}' +lexers.STYLE_CURSOR = 'back:{{color4}}' +lexers.STYLE_CURSOR_PRIMARY = 'fore:{{background}},back:{{color6}},bold' +lexers.STYLE_CURSOR_LINE = 'back:{{color0}}' +lexers.STYLE_COLOR_COLUMN = 'back:{{color0}}' +lexers.STYLE_SELECTION = 'back:{{color4}}' +lexers.STYLE_STATUS = 'back:{{color0}},fore:{{foreground}}' +lexers.STYLE_STATUS_FOCUSED = 'back:{{color0}},fore:{{color6}},bold' +lexers.STYLE_SEPARATOR = '' +lexers.STYLE_INFO = 'bold' +lexers.STYLE_EOF = 'fore:{{color8}}' diff --git a/.config/wallust/wallust.toml b/.config/wallust/wallust.toml index d1e8925..2d8d618 100644 --- a/.config/wallust/wallust.toml +++ b/.config/wallust/wallust.toml @@ -5,6 +5,8 @@ nvim = { template = "nvim.lua", target = "~/.cache/wallust/colors/wallust.lua" } foottheme = { template = "foot-colors-custom.ini", target = "~/.cache/wallust/foot-theme.ini" } vicinae_dark = { template = "vicinae-dark.toml", target = "~/.cache/wallust/vicinae-dark.toml" } vicinae_light = { template = "vicinae-light.toml", target = "~/.cache/wallust/vicinae-light.toml" } +mako = { template = "mako", target = "~/.cache/wallust/mako" } +vis = { template = "vis-theme.lua", target = "~/.cache/wallust/vis-theme.lua" } [hooks] strip_foot_hash = "sed -i '/^[^#]/s/#//g' ~/.cache/wallust/foot-theme.ini" diff --git a/.config/waybar/config.jsonc b/.config/waybar/config.jsonc index c20a95c..3ee4c2c 100644 --- a/.config/waybar/config.jsonc +++ b/.config/waybar/config.jsonc @@ -65,7 +65,7 @@ } }, "custom/kbd": { - "exec": "/home/seraphim/dotfiles-gentoo/waybar/.config/waybar/kbd-layout.sh", + "exec": "/home/seraphim/dotfiles-gentoo/.config/waybar/kbd-layout.sh", "tooltip": false }, "custom/clock": { @@ -102,11 +102,10 @@ "spacing": 3 }, "custom/analyze-theme": { - "exec": "node /home/seraphim/dotfiles-gentoo/waybar/.config/waybar/custom/analyze-theme.js", + "exec": "node /home/seraphim/dotfiles-gentoo/.config/waybar/custom/analyze-theme.js", "interval": 5, "tooltip": true, "format": "{}", - "return-type": "json", - "on-click": "sh -c '~/.config/niri/apply-colors.sh \"$(find ~/Pictures/wallpapers -type f | shuf -n 1)\"'" + "return-type": "json" } } diff --git a/.config/waybar/style.css b/.config/waybar/style.css index cf8dbee..ac5d447 100644 --- a/.config/waybar/style.css +++ b/.config/waybar/style.css @@ -1,4 +1,4 @@ -@import "/home/seraphim/dotfiles-gentoo/waybar/.config/waybar/theme.css"; +@import "/home/seraphim/dotfiles-gentoo/.config/waybar/theme.css"; @define-color bg @background; @define-color fg @foreground; -- cgit v1.2.3