diff options
author | Que Quotion | 2022-02-27 03:41:35 +0900 |
---|---|---|
committer | Que Quotion | 2022-02-27 03:41:35 +0900 |
commit | 0957e1845c8dff26a3d5ea7f03c451056030072a (patch) | |
tree | 05199b776d61d822b4f3e51361b4c992fff76666 /compiz-cube-screensaver | |
download | aur-0957e1845c8dff26a3d5ea7f03c451056030072a.tar.gz |
initial commit
Diffstat (limited to 'compiz-cube-screensaver')
-rwxr-xr-x | compiz-cube-screensaver | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/compiz-cube-screensaver b/compiz-cube-screensaver new file mode 100755 index 000000000000..dc6bbc4590bb --- /dev/null +++ b/compiz-cube-screensaver @@ -0,0 +1,36 @@ +#!/bin/bash + +#Xorg display to control +DISPLAY=:0.0 +#Pointer, check `xinput --list` +pointer=12 +#Compiz rotate plugin's "initiate" button +INITIATE="$(dconf read /org/compiz/profiles/Default/plugins/rotate/initiate-button)"; [[ -z "${INITIATE}" ]] && exit +#Start rotation left or right at random +direction="${RANDOM}"; let "direction >>= 14"; [[ "${direction}" -eq 1 ]] && direction=90 || direction=270 +#Pixels to move XTEST mouse (rotation speed) +step=1 + +#Disable input devices other than pointer and XTEST +for i in $(xinput list --id-only); do \ + [[ "${i}" -gt "5" ]] && [[ "${i}" -ne "${pointer}" ]] && \ + enabled="$(xinput list-props ${i} | grep "Device Enabled")" && \ + [[ "${enabled: -1}" -eq "1" ]] && \ + xinput disable "${i}" && \ + disabled+=("${i}"); \ +done + +xdotool mousedown "${INITIATE//[!0-9]/}" & + +#Rotate Cube +while [ $(xprintidle) -gt 0 ]; do \ + xdotool mousemove_relative --polar "${direction}" "${step}" & \ + sleep 0.0166; \ +done + +xdotool mouseup "${INITIATE//[!0-9]/}" & + +#Re-enable input devices +for i in "${disabled[@]}"; do \ + xinput enable "${i}" & \ +done & |