summary refs log tree commit diff
path: root/bin/oguri-cycle
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2022-11-18 18:17:23 +0100
committerRobert Günzler <r@gnzler.io>2022-11-18 18:38:22 +0100
commit15627167bb42468ac04d23c85aea335b2d3093fa (patch)
tree4c85e213c6f68c2780e72c391bd152dcc059bee6 /bin/oguri-cycle
parent9d75f7330ad7743defd8f2b0284f85299fcd8156 (diff)
bin/oguri-cycle: update
Diffstat (limited to 'bin/oguri-cycle')
-rwxr-xr-xbin/oguri-cycle20
1 files changed, 13 insertions, 7 deletions
diff --git a/bin/oguri-cycle b/bin/oguri-cycle
index 66e9b5c..36394b2 100755
--- a/bin/oguri-cycle
+++ b/bin/oguri-cycle
@@ -18,7 +18,11 @@ fi
 change_bg() {
 	for o in "${OUTPUTS[@]}"; do
 		idx=$((0 + RANDOM % ${#BGS[@]}))
-		ogurictl output "${o}" --image "${BGS[${idx}]}" --filter best $@
+		ogurictl output "${o}" \
+			--image "${BGS[${idx}]}" \
+			--filter best \
+			--scaling-mode fill \
+			--anchor center
 	done
 }
 
@@ -26,14 +30,16 @@ logger 'oguri-cycle: changing background(s)' || true
 
 BGS_DIR=$HOME/Pictures/wallp/oguri-cycle
 
-OUTPUTS=( $(swq list output | jq -r '..|select(.transform?=="normal")|.name') )
-readarray -d '' BGS < <(find ${BGS_DIR}/horizontal/ -print0 2>/dev/null)
-readarray -d '' BGS < <(find ${BGS_DIR}/landscape/ -print0 2>/dev/null)
+# OUTPUTS=("$(swq list output | jq -r '..|select(.transform?=="normal")|.name')")
+readarray OUTPUTS < <(wlr-randr | awk 'BEGIN{name=""} /^\S/{name=$1} /Transform: normal/{printf name}')
+readarray -d '' BGS < <(find "${BGS_DIR}"/horizontal/ -print0 2>/dev/null)
+readarray -d '' BGS < <(find "${BGS_DIR}"/landscape/ -print0 2>/dev/null)
 
 change_bg
 
-OUTPUTS=( $(swq list output | jq -r '..|select((.transform?=="270")or(.transform?=="90"))|.name') )
-readarray -d '' BGS < <(find ${BGS_DIR}/vertical/ -print0 2>/dev/null)
-readarray -d '' BGS < <(find ${BGS_DIR}/portrait/ -print0 2>/dev/null)
+# OUTPUTS=("$(swq list output | jq -r '..|select((.transform?=="270")or(.transform?=="90"))|.name')")
+readarray OUTPUTS < <(wlr-randr | awk 'BEGIN{name=""} /^\S/{name=$1} /Transform: 90/{printf name}')
+readarray -d '' BGS < <(find "${BGS_DIR}"/vertical/ -print0 2>/dev/null)
+readarray -d '' BGS < <(find "${BGS_DIR}"/portrait/ -print0 2>/dev/null)
 
 change_bg --anchor=left