diff options
| -rw-r--r-- | tests/wallp.bats | 14 | ||||
| -rw-r--r-- | wallp | 22 |
2 files changed, 36 insertions, 0 deletions
diff --git a/tests/wallp.bats b/tests/wallp.bats index f8ea2d7..11c319d 100644 --- a/tests/wallp.bats +++ b/tests/wallp.bats @@ -179,3 +179,17 @@ teardown() { apply_output V "$HOME/v.png" [ "$(cat "$HOME/.cache/wallp/H.pid")" = "99999" ] } + +@test "update_wpaper symlinks to H image" { + : > "$HOME/h.png"; mkdir -p "$HOME/.config/wallp" + echo "$HOME/h.png" > "$HOME/.config/wallp/wall_h" + update_wpaper + [ "$(readlink "$HOME/.cache/wal/wpaper")" = "$HOME/h.png" ] +} + +@test "apply_theme runs wal and persists theme" { + apply_theme "mytheme" + [ "$(cat "$HOME/.config/wallp/theme")" = "mytheme" ] + grep -q "wal --backend colorz -nq --theme mytheme -o $HOME/bin/wal.sh" "$HOME/calls.log" + grep -q "notify-send" "$HOME/calls.log" +} @@ -163,6 +163,28 @@ apply_output() { return 0 } +update_wpaper() { + local wf img link; wf="$(wall_file_for H)" + [ -s "$wf" ] || return 0 + img="$(cat "$wf")" + link="$HOME/.cache/wal/wpaper" + mkdir -p "$(dirname "$link")" + ln -sf "$img" "$link" +} + +apply_theme() { + local theme="$1" + persist_theme "$theme" + wal --backend colorz -nq --theme "$theme" -o "$HOME/bin/wal.sh" + command -v notify-send >/dev/null 2>&1 && \ + notify-send -u normal -t 5000 "color theme update" "setting color theme to: $theme" +} + +finalize() { + update_wpaper + apply_theme "$1" +} + main() { return 0 } |
