From 4b75906de2487ada0b8fd7a51ff8af9a8e2263fb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 21 May 2026 05:38:36 +0000 Subject: [PATCH 1/8] Initial plan From 0555002eb25f34d3cb040eb74bd9979af0cfc2b0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 21 May 2026 05:42:05 +0000 Subject: [PATCH 2/8] feat: add tracked YSH config support Agent-Logs-Url: https://github.com/Uliboooo/dotfiles/sessions/be73646f-ea8f-47bc-97de-9452cb105027 Co-authored-by: Uliboooo <190558756+Uliboooo@users.noreply.github.com> --- .config/oils/yshrc | 89 ++++++++++++++++++++++++++++++++++++++++++++++ README.md | 10 ++++-- home/alice.nix | 4 +++ setup/links.sh | 2 +- setup/setup.sh | 2 +- 5 files changed, 103 insertions(+), 4 deletions(-) create mode 100644 .config/oils/yshrc diff --git a/.config/oils/yshrc b/.config/oils/yshrc new file mode 100644 index 0000000..22cb58e --- /dev/null +++ b/.config/oils/yshrc @@ -0,0 +1,89 @@ +#!/usr/bin/env ysh +# shellcheck shell=bash + +export HISTFILE="$HOME/.local/share/oils/ysh_history" +export PATH="$HOME/.cargo/bin:$PATH" +export PATH="$HOME/Library/Android/sdk/platform-tools:$PATH" +export PATH="$HOME/my_tools/bin:$HOME/my_apps/bin:$PATH" +export PATH="$HOME/.moon/bin:$PATH" +export PATH="$HOME/.bun/bin:$PATH" +export PATH="$HOME/.local/bin:$PATH" + +if command -v go >/dev/null 2>&1; then + GOPATH_BIN="$(go env GOPATH)/bin" + export PATH="$PATH:$GOPATH_BIN" +fi + +if [[ "$(uname -s)" == "Darwin" ]]; then + if [[ -x /opt/homebrew/bin/brew ]]; then + eval "$(/opt/homebrew/bin/brew shellenv)" + fi + if command -v brew >/dev/null 2>&1; then + BREW_COREUTILS_PREFIX="$(brew --prefix coreutils)" + BREW_ZIP_PREFIX="$(brew --prefix zip)" + BREW_UNZIP_PREFIX="$(brew --prefix unzip)" + BREW_GNU_SED_PREFIX="$(brew --prefix gnu-sed)" + export PATH="$BREW_COREUTILS_PREFIX/libexec/gnubin:$PATH" + export PATH="$BREW_ZIP_PREFIX/bin:$PATH" + export PATH="$BREW_UNZIP_PREFIX/bin:$PATH" + export PATH="$BREW_GNU_SED_PREFIX/libexec/gnubin:$PATH" + fi + export PATH="/opt/homebrew/opt/llvm/bin:$PATH" + export PATH="/opt/homebrew/bin:$PATH" + export PATH="/opt/homebrew/opt/llvm@20/bin:$PATH" + export PATH="/Library/TeX/texbin:$PATH" +else + export PATH="/opt/rocm/bin:$PATH" + export PATH="$HOME/.local/bin/lap_tap:$PATH" + export PATH="$HOME/.npm-global/bin:$PATH" + export PATH="/home/alice/.cache/.bun/bin:$PATH" + export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:-}:/opt/rocm/lib" + export ROCM_PATH=/opt/rocm + export OLLAMA_DEBUG=1 + export OLLAMA_HOST=0.0.0.0:11434 + export LIBVIRT_DEFAULT_URI=qemu:///system + + if [[ -n "${XDG_RUNTIME_DIR:-}" ]]; then + export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket" + fi + + export SSH_ASKPASS=/usr/bin/ksshaskpass + export SSH_ASKPASS_REQUIRE=prefer + + if [[ -n "${SSH_CONNECTION:-}" ]]; then + export TERM=xterm-256color + fi + + alias copy='wl-copy' +fi + +export GTK_IM_MODULE=fcitx +export QT_IM_MODULE=fcitx +export XMODIFIERS=@im=fcitx +export HYPRSHOT_DIR="$HOME/Pictures/Screenshots" +export EDITOR=nvim + +gc() { + git add . + git commit -m "$1" +} + +hist() { + history | grep -- "$1" +} + +ta() { + if [[ -n "${1:-}" ]]; then + tmux new-session -A -s "$1" + else + tmux + fi +} + +ff() { + if [[ "${TERM_BACKGROUND:-}" == "light" ]]; then + fastfetch --config ~/dotfiles/.config/fastfetch/light.jsonc + else + fastfetch --config ~/dotfiles/.config/fastfetch/config.jsonc + fi +} diff --git a/README.md b/README.md index 393498b..539142b 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ | :---: | :---: | | Terminal | Kitty, Ghostty | | Editor | Neovim, Vim| -| Shell | zsh, fish | +| Shell | YSH, zsh, fish | | Launcher | rofi, fuzzel | | VCS | git | | DE/WM | Hyprland | @@ -16,11 +16,17 @@ | Bar | Waybar | | Wallpaper | awww(swww) | | Filer | yazi | -| Scripts | Bash, Python | +| Scripts | YSH, Bash, Python | Catppuccin, and rose-pine are used mainly themes of my tools. and many of these scripts are dependent on my personal environment, it might not work as-is in your environment... +## YSH + +YSH config now lives in `~/.config/oils/yshrc` (tracked in the repo as `.config/oils/yshrc`). + +The current setup keeps the existing zsh login-shell flow intact, but the shared shell environment now also has a first-class YSH config so it can be tried incrementally. + ## Requires of Hyprland - hyprshot: take screenshots diff --git a/home/alice.nix b/home/alice.nix index bdea14d..c8ec5ff 100644 --- a/home/alice.nix +++ b/home/alice.nix @@ -120,6 +120,10 @@ in source = mkConfigLink "ghostty"; recursive = false; }; + "oils" = { + source = mkConfigLink "oils"; + recursive = false; + }; "hypr" = { source = mkConfigLink "hypr"; recursive = false; diff --git a/setup/links.sh b/setup/links.sh index e503831..8a99b89 100644 --- a/setup/links.sh +++ b/setup/links.sh @@ -38,7 +38,7 @@ link_or_ovr() { config_names=( "fastfetch" "fish" "fontconfig" "fuzzel" "ghostty" "git" "helix" "hypr" "hypr-presto" "karukan-im" "kitty" "niri" "nwg-drawer" - "nvim" "rofi" "sheldon" "stylua" "swaync" "systemd" + "nvim" "oils" "rofi" "sheldon" "stylua" "swaync" "systemd" "voime" "waybar" "vim" "xdg-desktop-portal" "yazi" "zsh-abbr" ) diff --git a/setup/setup.sh b/setup/setup.sh index 78caef0..6f70ac1 100644 --- a/setup/setup.sh +++ b/setup/setup.sh @@ -132,7 +132,7 @@ DOTFILES_DIR="$HOME/dotfiles" configs=( "fastfetch" "fish" "fontconfig" "fuzzel" "ghostty" "git" "helix" "hypr" "hypr-presto" "karukan-im" "kitty" "niri" "nwg-drawer" - "nvim" "rofi" "sheldon" "stylua" "swaync" "systemd" + "nvim" "oils" "rofi" "sheldon" "stylua" "swaync" "systemd" "voime" "waybar" "vim" "xdg-desktop-portal" "yazi" "zsh-abbr" ) From db51b288197369635ad6728af065117632a2b569 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 21 May 2026 05:42:47 +0000 Subject: [PATCH 3/8] fix: make ysh fastfetch helper portable Agent-Logs-Url: https://github.com/Uliboooo/dotfiles/sessions/be73646f-ea8f-47bc-97de-9452cb105027 Co-authored-by: Uliboooo <190558756+Uliboooo@users.noreply.github.com> --- .config/oils/yshrc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.config/oils/yshrc b/.config/oils/yshrc index 22cb58e..10cacb0 100644 --- a/.config/oils/yshrc +++ b/.config/oils/yshrc @@ -2,6 +2,7 @@ # shellcheck shell=bash export HISTFILE="$HOME/.local/share/oils/ysh_history" +export DOTFILES_DIR="${DOTFILES_DIR:-$HOME/dotfiles}" export PATH="$HOME/.cargo/bin:$PATH" export PATH="$HOME/Library/Android/sdk/platform-tools:$PATH" export PATH="$HOME/my_tools/bin:$HOME/my_apps/bin:$PATH" @@ -82,8 +83,8 @@ ta() { ff() { if [[ "${TERM_BACKGROUND:-}" == "light" ]]; then - fastfetch --config ~/dotfiles/.config/fastfetch/light.jsonc + fastfetch --config "$DOTFILES_DIR/.config/fastfetch/light.jsonc" else - fastfetch --config ~/dotfiles/.config/fastfetch/config.jsonc + fastfetch --config "$DOTFILES_DIR/.config/fastfetch/config.jsonc" fi } From f6fd2583a482f76b0f74269559088cafc97ab586 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 21 May 2026 05:43:20 +0000 Subject: [PATCH 4/8] fix: use HOME in ysh bun path Agent-Logs-Url: https://github.com/Uliboooo/dotfiles/sessions/be73646f-ea8f-47bc-97de-9452cb105027 Co-authored-by: Uliboooo <190558756+Uliboooo@users.noreply.github.com> --- .config/oils/yshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/oils/yshrc b/.config/oils/yshrc index 10cacb0..aa40843 100644 --- a/.config/oils/yshrc +++ b/.config/oils/yshrc @@ -37,7 +37,7 @@ else export PATH="/opt/rocm/bin:$PATH" export PATH="$HOME/.local/bin/lap_tap:$PATH" export PATH="$HOME/.npm-global/bin:$PATH" - export PATH="/home/alice/.cache/.bun/bin:$PATH" + export PATH="$HOME/.cache/.bun/bin:$PATH" export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:-}:/opt/rocm/lib" export ROCM_PATH=/opt/rocm export OLLAMA_DEBUG=1 From b13275a48706148c0ffd2ba8cd46212e5fdd72e8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 21 May 2026 05:59:39 +0000 Subject: [PATCH 5/8] fix: narrow YSH changes to script rewrite Agent-Logs-Url: https://github.com/Uliboooo/dotfiles/sessions/b4fef7b4-c8d6-40d2-ac7e-38750eeb6b3f Co-authored-by: Uliboooo <190558756+Uliboooo@users.noreply.github.com> --- .config/oils/yshrc | 90 --------------------------- README.md | 10 +-- home/alice.nix | 5 +- script/cycle_wallpaper.ysh | 124 +++++++++++++++++++++++++++++++++++++ setup/links.sh | 2 +- setup/setup.sh | 2 +- 6 files changed, 129 insertions(+), 104 deletions(-) delete mode 100644 .config/oils/yshrc create mode 100755 script/cycle_wallpaper.ysh diff --git a/.config/oils/yshrc b/.config/oils/yshrc deleted file mode 100644 index aa40843..0000000 --- a/.config/oils/yshrc +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/env ysh -# shellcheck shell=bash - -export HISTFILE="$HOME/.local/share/oils/ysh_history" -export DOTFILES_DIR="${DOTFILES_DIR:-$HOME/dotfiles}" -export PATH="$HOME/.cargo/bin:$PATH" -export PATH="$HOME/Library/Android/sdk/platform-tools:$PATH" -export PATH="$HOME/my_tools/bin:$HOME/my_apps/bin:$PATH" -export PATH="$HOME/.moon/bin:$PATH" -export PATH="$HOME/.bun/bin:$PATH" -export PATH="$HOME/.local/bin:$PATH" - -if command -v go >/dev/null 2>&1; then - GOPATH_BIN="$(go env GOPATH)/bin" - export PATH="$PATH:$GOPATH_BIN" -fi - -if [[ "$(uname -s)" == "Darwin" ]]; then - if [[ -x /opt/homebrew/bin/brew ]]; then - eval "$(/opt/homebrew/bin/brew shellenv)" - fi - if command -v brew >/dev/null 2>&1; then - BREW_COREUTILS_PREFIX="$(brew --prefix coreutils)" - BREW_ZIP_PREFIX="$(brew --prefix zip)" - BREW_UNZIP_PREFIX="$(brew --prefix unzip)" - BREW_GNU_SED_PREFIX="$(brew --prefix gnu-sed)" - export PATH="$BREW_COREUTILS_PREFIX/libexec/gnubin:$PATH" - export PATH="$BREW_ZIP_PREFIX/bin:$PATH" - export PATH="$BREW_UNZIP_PREFIX/bin:$PATH" - export PATH="$BREW_GNU_SED_PREFIX/libexec/gnubin:$PATH" - fi - export PATH="/opt/homebrew/opt/llvm/bin:$PATH" - export PATH="/opt/homebrew/bin:$PATH" - export PATH="/opt/homebrew/opt/llvm@20/bin:$PATH" - export PATH="/Library/TeX/texbin:$PATH" -else - export PATH="/opt/rocm/bin:$PATH" - export PATH="$HOME/.local/bin/lap_tap:$PATH" - export PATH="$HOME/.npm-global/bin:$PATH" - export PATH="$HOME/.cache/.bun/bin:$PATH" - export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:-}:/opt/rocm/lib" - export ROCM_PATH=/opt/rocm - export OLLAMA_DEBUG=1 - export OLLAMA_HOST=0.0.0.0:11434 - export LIBVIRT_DEFAULT_URI=qemu:///system - - if [[ -n "${XDG_RUNTIME_DIR:-}" ]]; then - export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket" - fi - - export SSH_ASKPASS=/usr/bin/ksshaskpass - export SSH_ASKPASS_REQUIRE=prefer - - if [[ -n "${SSH_CONNECTION:-}" ]]; then - export TERM=xterm-256color - fi - - alias copy='wl-copy' -fi - -export GTK_IM_MODULE=fcitx -export QT_IM_MODULE=fcitx -export XMODIFIERS=@im=fcitx -export HYPRSHOT_DIR="$HOME/Pictures/Screenshots" -export EDITOR=nvim - -gc() { - git add . - git commit -m "$1" -} - -hist() { - history | grep -- "$1" -} - -ta() { - if [[ -n "${1:-}" ]]; then - tmux new-session -A -s "$1" - else - tmux - fi -} - -ff() { - if [[ "${TERM_BACKGROUND:-}" == "light" ]]; then - fastfetch --config "$DOTFILES_DIR/.config/fastfetch/light.jsonc" - else - fastfetch --config "$DOTFILES_DIR/.config/fastfetch/config.jsonc" - fi -} diff --git a/README.md b/README.md index 539142b..393498b 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ | :---: | :---: | | Terminal | Kitty, Ghostty | | Editor | Neovim, Vim| -| Shell | YSH, zsh, fish | +| Shell | zsh, fish | | Launcher | rofi, fuzzel | | VCS | git | | DE/WM | Hyprland | @@ -16,17 +16,11 @@ | Bar | Waybar | | Wallpaper | awww(swww) | | Filer | yazi | -| Scripts | YSH, Bash, Python | +| Scripts | Bash, Python | Catppuccin, and rose-pine are used mainly themes of my tools. and many of these scripts are dependent on my personal environment, it might not work as-is in your environment... -## YSH - -YSH config now lives in `~/.config/oils/yshrc` (tracked in the repo as `.config/oils/yshrc`). - -The current setup keeps the existing zsh login-shell flow intact, but the shared shell environment now also has a first-class YSH config so it can be tried incrementally. - ## Requires of Hyprland - hyprshot: take screenshots diff --git a/home/alice.nix b/home/alice.nix index c8ec5ff..e91af17 100644 --- a/home/alice.nix +++ b/home/alice.nix @@ -35,6 +35,7 @@ in fzf fastfetch bun + oils-for-unix sheldon zsh-abbr lazygit @@ -120,10 +121,6 @@ in source = mkConfigLink "ghostty"; recursive = false; }; - "oils" = { - source = mkConfigLink "oils"; - recursive = false; - }; "hypr" = { source = mkConfigLink "hypr"; recursive = false; diff --git a/script/cycle_wallpaper.ysh b/script/cycle_wallpaper.ysh new file mode 100755 index 0000000..ebf9085 --- /dev/null +++ b/script/cycle_wallpaper.ysh @@ -0,0 +1,124 @@ +#!/usr/bin/env ysh +# shellcheck shell=bash + +get_all() { + find "$1" -maxdepth 1 -type f | sort +} + +get_first_path() { + get_all "$1" | head -n 1 +} + +get_next_path() { + local current_path="$1" + local listed_paths="$2" + local rev_mode="$3" + local matched + + if (( rev_mode == 0 )); then + matched="$(printf '%s\n' "$listed_paths" | grep -Fx "$current_path" -A 1)" + else + matched="$(printf '%s\n' "$listed_paths" | grep -Fx "$current_path" -B 1)" + fi + + local matched_lines + matched_lines="$(printf '%s\n' "$matched" | wc -l | tr -d ' ')" + + if (( matched_lines != 2 )); then + if (( rev_mode == 0 )); then + printf '%s\n' "$listed_paths" | head -n 1 + else + printf '%s\n' "$listed_paths" | tail -n 1 + fi + else + if (( rev_mode == 0 )); then + printf '%s\n' "$matched" | tail -n 1 + else + printf '%s\n' "$matched" | head -n 1 + fi + fi +} + +seq_or_rev() { + local rev_mode="$1" + local wallpaper_dir="$2" + local current_paper_path="$HOME/dotfiles/.config/hypr/env/CURRENT_PAPER" + local next + + if [[ -s "$current_paper_path" ]]; then + local current_paper + current_paper="$(cat "$current_paper_path")" + if [[ -f "$current_paper" ]]; then + local list + list="$(get_all "$wallpaper_dir")" + next="$(get_next_path "$current_paper" "$list" "$rev_mode")" + else + next="$(get_first_path "$wallpaper_dir")" + fi + else + next="$(get_first_path "$wallpaper_dir")" + fi + + printf '%s\n' "$next" >"$current_paper_path" + printf '%s\n' "$next" +} + +random_paper() { + local wallpaper_dir="$1" + local current_paper_path="$HOME/dotfiles/.config/hypr/env/CURRENT_PAPER" + local randomed_path + + randomed_path="$(find "$wallpaper_dir" -type f | shuf -n 1)" + printf '%s\n' "$randomed_path" >"$current_paper_path" + printf '%s\n' "$randomed_path" +} + +toggle_systemtimer() { + if systemctl --user is-active --quiet cycle_wallpaper.timer; then + if systemctl --user stop cycle_wallpaper.timer; then + notify-send "stop slideshow" + else + notify-send "failed stop slideshow" + fi + else + if systemctl --user start cycle_wallpaper.timer; then + notify-send "start slideshow" + else + notify-send "failed start slideshow" + fi + fi +} + +toggle_video() { + local v_pid + v_pid="$(pgrep mpvpaper || true)" + + if [[ -n "$v_pid" ]]; then + if pkill mpvpaper; then + notify-send "stop wallvideo" + else + notify-send "failed stop slideshow" + fi + else + if mpvpaper '*' "$HOME/Pictures/wallvideo/ok_geek_eyes_24.mp4" -o "no-audio loop" --fork --mpv-args="--hwdec=auto-safe --vo=gpu"; then + notify-send "start wallvideo" + else + notify-send "failed start wallvideo" + fi + fi +} + +wallpaper_dir="$HOME/Pictures/wallpapers/" + +case "${1:-}" in + seq) wall_path="$(seq_or_rev 0 "$wallpaper_dir")" ;; + rev) wall_path="$(seq_or_rev 1 "$wallpaper_dir")" ;; + rnd) wall_path="$(random_paper "$wallpaper_dir")" ;; + vdo) toggle_video && exit 0 || exit 1 ;; + pse) toggle_systemtimer && exit 0 || exit 1 ;; + *) wall_path="${2:-}" ;; +esac + +mkdir -p "$HOME/dotfiles/.config/hypr/env" + +awww img "$wall_path" --transition-type center --transition-duration 0.5 diff --git a/setup/links.sh b/setup/links.sh index 8a99b89..e503831 100644 --- a/setup/links.sh +++ b/setup/links.sh @@ -38,7 +38,7 @@ link_or_ovr() { config_names=( "fastfetch" "fish" "fontconfig" "fuzzel" "ghostty" "git" "helix" "hypr" "hypr-presto" "karukan-im" "kitty" "niri" "nwg-drawer" - "nvim" "oils" "rofi" "sheldon" "stylua" "swaync" "systemd" + "nvim" "rofi" "sheldon" "stylua" "swaync" "systemd" "voime" "waybar" "vim" "xdg-desktop-portal" "yazi" "zsh-abbr" ) diff --git a/setup/setup.sh b/setup/setup.sh index 6f70ac1..78caef0 100644 --- a/setup/setup.sh +++ b/setup/setup.sh @@ -132,7 +132,7 @@ DOTFILES_DIR="$HOME/dotfiles" configs=( "fastfetch" "fish" "fontconfig" "fuzzel" "ghostty" "git" "helix" "hypr" "hypr-presto" "karukan-im" "kitty" "niri" "nwg-drawer" - "nvim" "oils" "rofi" "sheldon" "stylua" "swaync" "systemd" + "nvim" "rofi" "sheldon" "stylua" "swaync" "systemd" "voime" "waybar" "vim" "xdg-desktop-portal" "yazi" "zsh-abbr" ) From fcd8b7d445bfae4a3186593fee5b531ac4cee6e4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 21 May 2026 06:00:20 +0000 Subject: [PATCH 6/8] fix: correct ysh wallvideo error message Agent-Logs-Url: https://github.com/Uliboooo/dotfiles/sessions/b4fef7b4-c8d6-40d2-ac7e-38750eeb6b3f Co-authored-by: Uliboooo <190558756+Uliboooo@users.noreply.github.com> --- script/cycle_wallpaper.ysh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/cycle_wallpaper.ysh b/script/cycle_wallpaper.ysh index ebf9085..f3ad6de 100755 --- a/script/cycle_wallpaper.ysh +++ b/script/cycle_wallpaper.ysh @@ -97,7 +97,7 @@ toggle_video() { if pkill mpvpaper; then notify-send "stop wallvideo" else - notify-send "failed stop slideshow" + notify-send "failed stop wallvideo" fi else if mpvpaper '*' "$HOME/Pictures/wallvideo/ok_geek_eyes_24.mp4" -o "no-audio loop" --fork --mpv-args="--hwdec=auto-safe --vo=gpu"; then From 4a1308aa9ffba259460f261be81be75671aec6cc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 21 May 2026 06:01:14 +0000 Subject: [PATCH 7/8] fix: clean up ysh wallpaper script Agent-Logs-Url: https://github.com/Uliboooo/dotfiles/sessions/b4fef7b4-c8d6-40d2-ac7e-38750eeb6b3f Co-authored-by: Uliboooo <190558756+Uliboooo@users.noreply.github.com> --- script/cycle_wallpaper.ysh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/cycle_wallpaper.ysh b/script/cycle_wallpaper.ysh index f3ad6de..d98b1df 100755 --- a/script/cycle_wallpaper.ysh +++ b/script/cycle_wallpaper.ysh @@ -1,5 +1,4 @@ #!/usr/bin/env ysh -# shellcheck shell=bash get_all() { find "$1" -maxdepth 1 -type f | sort @@ -100,7 +99,7 @@ toggle_video() { notify-send "failed stop wallvideo" fi else - if mpvpaper '*' "$HOME/Pictures/wallvideo/ok_geek_eyes_24.mp4" -o "no-audio loop" --fork --mpv-args="--hwdec=auto-safe --vo=gpu"; then + if mpvpaper '*' "$wallvideo_path" -o "no-audio loop" --fork --mpv-args="--hwdec=auto-safe --vo=gpu"; then notify-send "start wallvideo" else notify-send "failed start wallvideo" @@ -109,6 +108,7 @@ toggle_video() { } wallpaper_dir="$HOME/Pictures/wallpapers/" +wallvideo_path="$HOME/Pictures/wallvideo/ok_geek_eyes_24.mp4" case "${1:-}" in seq) wall_path="$(seq_or_rev 0 "$wallpaper_dir")" ;; From 6537e39da73c64c0534389b5ac825d56ca91b063 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 21 May 2026 06:02:34 +0000 Subject: [PATCH 8/8] fix: refine ysh wallpaper script constants Agent-Logs-Url: https://github.com/Uliboooo/dotfiles/sessions/b4fef7b4-c8d6-40d2-ac7e-38750eeb6b3f Co-authored-by: Uliboooo <190558756+Uliboooo@users.noreply.github.com> --- script/cycle_wallpaper.ysh | 40 ++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/script/cycle_wallpaper.ysh b/script/cycle_wallpaper.ysh index d98b1df..83e15cb 100755 --- a/script/cycle_wallpaper.ysh +++ b/script/cycle_wallpaper.ysh @@ -1,5 +1,12 @@ #!/usr/bin/env ysh +forward_mode=0 +reverse_mode=1 +current_paper_path="$HOME/dotfiles/.config/hypr/env/CURRENT_PAPER" +wallpaper_dir="$HOME/Pictures/wallpapers/" +wallvideo_path="$HOME/Pictures/wallvideo/ok_geek_eyes_24.mp4" +mpvpaper_args="--hwdec=auto-safe --vo=gpu" + get_all() { find "$1" -maxdepth 1 -type f | sort } @@ -14,7 +21,7 @@ get_next_path() { local rev_mode="$3" local matched - if (( rev_mode == 0 )); then + if (( rev_mode == forward_mode )); then matched="$(printf '%s\n' "$listed_paths" | grep -Fx "$current_path" -A 1)" else matched="$(printf '%s\n' "$listed_paths" | grep -Fx "$current_path" -B 1)" @@ -24,13 +31,13 @@ get_next_path() { matched_lines="$(printf '%s\n' "$matched" | wc -l | tr -d ' ')" if (( matched_lines != 2 )); then - if (( rev_mode == 0 )); then + if (( rev_mode == forward_mode )); then printf '%s\n' "$listed_paths" | head -n 1 else printf '%s\n' "$listed_paths" | tail -n 1 fi else - if (( rev_mode == 0 )); then + if (( rev_mode == forward_mode )); then printf '%s\n' "$matched" | tail -n 1 else printf '%s\n' "$matched" | head -n 1 @@ -41,7 +48,6 @@ get_next_path() { seq_or_rev() { local rev_mode="$1" local wallpaper_dir="$2" - local current_paper_path="$HOME/dotfiles/.config/hypr/env/CURRENT_PAPER" local next if [[ -s "$current_paper_path" ]]; then @@ -64,7 +70,6 @@ seq_or_rev() { random_paper() { local wallpaper_dir="$1" - local current_paper_path="$HOME/dotfiles/.config/hypr/env/CURRENT_PAPER" local randomed_path randomed_path="$(find "$wallpaper_dir" -type f | shuf -n 1)" @@ -75,15 +80,15 @@ random_paper() { toggle_systemtimer() { if systemctl --user is-active --quiet cycle_wallpaper.timer; then if systemctl --user stop cycle_wallpaper.timer; then - notify-send "stop slideshow" + notify-send "Stop slideshow" else - notify-send "failed stop slideshow" + notify-send "Failed stop slideshow" fi else if systemctl --user start cycle_wallpaper.timer; then - notify-send "start slideshow" + notify-send "Start slideshow" else - notify-send "failed start slideshow" + notify-send "Failed start slideshow" fi fi } @@ -94,25 +99,22 @@ toggle_video() { if [[ -n "$v_pid" ]]; then if pkill mpvpaper; then - notify-send "stop wallvideo" + notify-send "Stop wallvideo" else - notify-send "failed stop wallvideo" + notify-send "Failed stop wallvideo" fi else - if mpvpaper '*' "$wallvideo_path" -o "no-audio loop" --fork --mpv-args="--hwdec=auto-safe --vo=gpu"; then - notify-send "start wallvideo" + if mpvpaper '*' "$wallvideo_path" -o "no-audio loop" --fork --mpv-args="$mpvpaper_args"; then + notify-send "Start wallvideo" else - notify-send "failed start wallvideo" + notify-send "Failed start wallvideo" fi fi } -wallpaper_dir="$HOME/Pictures/wallpapers/" -wallvideo_path="$HOME/Pictures/wallvideo/ok_geek_eyes_24.mp4" - case "${1:-}" in - seq) wall_path="$(seq_or_rev 0 "$wallpaper_dir")" ;; - rev) wall_path="$(seq_or_rev 1 "$wallpaper_dir")" ;; + seq) wall_path="$(seq_or_rev "$forward_mode" "$wallpaper_dir")" ;; + rev) wall_path="$(seq_or_rev "$reverse_mode" "$wallpaper_dir")" ;; rnd) wall_path="$(random_paper "$wallpaper_dir")" ;; vdo) toggle_video && exit 0 || exit 1 ;; pse) toggle_systemtimer && exit 0 || exit 1 ;;