bin: add xaos-render script
This commit is contained in:
parent
1f24a4e37f
commit
eab3b67c3d
1 changed files with 41 additions and 0 deletions
41
.local/bin/xaos-render.sh
Executable file
41
.local/bin/xaos-render.sh
Executable file
|
@ -0,0 +1,41 @@
|
||||||
|
#!/bin/bash
|
||||||
|
##
|
||||||
|
# This will render an image of a fractal in XaoS
|
||||||
|
##
|
||||||
|
# Assumptions made:
|
||||||
|
# 1. XaoS is in the foreground when you run the script (launch it from a hotkey or like this `$ script.sh true`)
|
||||||
|
# 2. XaoS is fullscreen
|
||||||
|
##
|
||||||
|
# Dependencies: ydotool
|
||||||
|
##
|
||||||
|
# Usage: xaos-render.sh [press alt tab (true or false)] [save path] [x_resolution] [y_resolution]
|
||||||
|
# defaults to 4k
|
||||||
|
##
|
||||||
|
SAVE_PATH="${2:-/home/blake/Pictures/fractiles/xaos-render-$RANDOM-}" # needs to be absolute
|
||||||
|
X_RESOLUTION="${3:-3840}"
|
||||||
|
Y_RESOLUTION="${4:-2160}"
|
||||||
|
|
||||||
|
# must be run as root for ydotool to work
|
||||||
|
if [[ $(id -u) -ne 0 ]] ; then echo "Please run as root" ; exit 1 ; fi
|
||||||
|
ydotoold &
|
||||||
|
sleep 0.2
|
||||||
|
YDOTOOLD_PID=$!
|
||||||
|
|
||||||
|
"${1:-false}" && ydotool key alt+tab && sleep 0.1
|
||||||
|
# ydotool mousemove --absolute 0 0
|
||||||
|
ydotool key --key-delay 4 alt+s
|
||||||
|
ydotool key --key-delay 4 8
|
||||||
|
# ydotool click --buttons left
|
||||||
|
# ydotool key --key-delay 4 d{o,o}{w,w}{n,n} enter
|
||||||
|
# sleep 0.1
|
||||||
|
|
||||||
|
ydotool key ctrl+a
|
||||||
|
ydotool type "$SAVE_PATH"
|
||||||
|
ydotool key tab tab
|
||||||
|
ydotool type "$X_RESOLUTION"
|
||||||
|
ydotool key tab
|
||||||
|
ydotool type "$Y_RESOLUTION"
|
||||||
|
ydotool key enter
|
||||||
|
|
||||||
|
kill -SIGTERM $YDOTOOLD_PID
|
||||||
|
|
Loading…
Add table
Reference in a new issue