#!/bin/bash # pkill xpaint #Moves the mouse cursor to the top left corner. This will make Xpaint open here. xwit -root -warp 1 1 #Grabs desktop dimensions desktopHeight=`xwininfo -root | grep 'Height' | sed -e 's/.*:\ //g'` desktopWidth=`xwininfo -root | grep 'Width' | sed -e 's/.*:\ //g'` #Dimensions of the XPaint Window. These never change XPAINT_WIDTH=124 XPAINT_HEIGHT=406 #These dimensions are used to get the canvas to snap to the xpaint window and also fill the screen. canvasWidth=$(($desktopWidth-$XPAINT_WIDTH-10)) #Open XPaint in the background desired size xpaint -popped -size ${canvasWidth}x${desktopHeight} & sleep 3s #Grabs the XPaint widget Window ID xpaintWinID=`xwit -print -all | grep 'XPaint' | sed -e 's/:.*//g'` #Grabs the canvas Window ID canvasWinID=`xwit -print -all | grep 'Untitled' | sed -e 's/:.*//g'` desktopSize=`xwininfo -root | grep '\-geometry' | sed -e 's/^.*\ //g' | sed -e 's/+.*//g'` #This is where I want the canvas Window to move to canvasXPosition=$(($XPAINT_WIDTH+1)) canvasYPosition=1 #Snaps Xpaint Widget to the edge of the screen xwit -id $xpaintWinID -move 1 1 #Moves the canvas window so that it snaps to the XPaint window xwit -id $canvasWinID -move 125 1 sleep 0.5 xte 'mouseclick 1' #sleep 3s #These are the first drawable pixels on the canvas x=132 y=86 #Draws a series of diamonds on the canvas xwit -root -warp $x $y while [ $y -lt $(($desktopHeight-25)) ]; do while [ $x -lt $(($canvasWidth-25)) ]; do xte 'mousedown 1' let x=$x+100 let y=$y+100 xwit -root -warp $x $y let x=$x+100 let y=$y-100 xwit -root -warp $x $y xte 'mouseup 1' done let y=$y+200 xwit -root -warp $x $y while [ $x -gt $canvasXPosition ]; do xte 'mousedown 1' let x=$x-100 let y=$y-100 xwit -root -warp $x $y let x=$x-100 let y=$y+100 xwit -root -warp $x $y xte 'mouseup 1' done xwit -root -warp $x $y done #Selects the fill tool FILL_X=63 FILL_Y=420 xwit -root -warp $FILL_X $FILL_Y xte 'mousedown 1' sleep 3s; xte 'mouseup 1' #Selects colors and fills the diamonds row by row. It starts with grey and move #one color to the right row by row. function fill_function { colorX=190 #These are the start X and Y for changing color colorY=65 xwit -root -warp $colorX $colorY xte 'mousedown 1' sleep 3s; xte 'mouseup 1' x=150 y=200 while [ $y -lt $(($desktopHeight-24)) ]; do while [ $x -lt $(($canvasWidth-24)) ]; do xwit -root -warp $x $y xte 'mousedown 1' sleep 0.5s; xte 'mouseup 1' let x=$x+200 done let colorX=$colorX+10 xwit -root -warp $colorX $colorY xte 'mousedown 1' sleep 3s; xte 'mouseup 1' let x=$x-100 let y=$y+100 xwit -root -warp $x $y while [ $x -gt $canvasXPosition ]; do xte 'mousedown 1' sleep 0.5s; xte 'mouseup 1' let x=$x-200 xwit -root -warp $x $y done let colorX=$colorX+10 xwit -root -warp $colorX $colorY xte 'mousedown 1' sleep 3s; xte 'mouseup 1' let x=$x+100 let y=$y+100 done } fill_function