linux - Bash Script Positioning -
i'm new bash scripting, don't know much. want open on 100k xclocks , scatter them randomly across screen (it's fun, not malicious intent). have xclock commands inserted, open in 1 spot on screen.
so, how 100k clocks randomly disperse screen?
code far (really basic):
#! \bin\bash xclock &
this goes on 100k lines.
this use xrandr
or xdpyinfo
detect screen resolution:
#!/bin/bash if [[ -x $(which xrandr) ]]; res=$(xrandr | awk '/\*/ {print $1}') else if [[ -x $(which xdpyinfo) ]]; res=$(xdpyinfo | awk '/dimensions/ {print $2}') else echo "can not detect screen resolution" exit 1 fi fi x=${res%x*}; y=${res#*x} in {1..100}; xclock -geometry 120x120+$(($random%$x-120))+$(($random%$y-120)) & done
Comments
Post a Comment