diff options
| author | Alec Goncharow <alec@goncharow.dev> | 2024-01-16 08:51:19 -0500 |
|---|---|---|
| committer | Alec Goncharow <alec@goncharow.dev> | 2024-01-16 08:51:19 -0500 |
| commit | eca35d6d822acba9bddec526ba95041880e20b67 (patch) | |
| tree | 6979442096ff7c7dea64e947563067931a5db0ba /bin/wallpaper-shuffle | |
| parent | 128eec2ebf2b206b072463cd4c792cdd93664ca2 (diff) | |
nushell churn is too much
bash gets it
Diffstat (limited to 'bin/wallpaper-shuffle')
| -rwxr-xr-x | bin/wallpaper-shuffle | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/bin/wallpaper-shuffle b/bin/wallpaper-shuffle index 820bfeb..9f55e0c 100755 --- a/bin/wallpaper-shuffle +++ b/bin/wallpaper-shuffle @@ -1,12 +1,17 @@ -#!/bin/nu -let wallpapers_path = "~/wallpapers/low-poly" -swaymsg -t get_outputs | - rg name | - str trim -a | - split row "," | - split column ":" | - get column2 | - str trim | str trim -c '"' | - each {|output| - swaymsg $"output ($output) bg `find ($wallpapers_path) -type f | shuf -n 1` fill" - } +#!/usr/bin/env bash + +set -o errexit +set -o nounset +set -o pipefail +if [[ "${TRACE-0}" == "1" ]]; then + set -o xtrace +fi + +OUTPUTS=$(swaymsg -t get_outputs | jq -r '.[] | .name') +export WALLPAPERS="$HOME/wallpapers/low-poly" + +main() { + echo "$OUTPUTS" | xargs -I{} sh -c "swaymsg output {} bg $(find "$WALLPAPERS" -type f | shuf -n 1) fill" +} + +main "$@" |
