Here is are two versions of updated scripts.
Note that in both versions, the command to initiate a nudge has been changed to:
/nudge <target>
The -1 was unnecessary, so I removed it.
on *:TEXT:$($me):*:nudge $target
;/nudge 'shakes' the target window when target is minimized, maximized or normal
alias nudge {
var %nsound = sounds/nudge.wav
;-----------------------------------------------------
;1=target, 2=count, 3=x, 4=y, 5=ticks, 6=msec, 7=state, 8=astate, 9-=active
if ($2 == $null) {
var %x = $iif($window($1).x < 0,0,$v1)
var %y = $iif($window($1).y < 0,0,$v1)
var %s = $window($1).state
if (max isin %s) %s = -x
elseif (nor isin %s) %s = -r
else %s = -
var %a = $window($active).state
if (max isin %a) %a = -ax
elseif (min isin %a) %a = -an
elseif (nor isin %a) %a = -ar
else %a = -
.timer -m 1 1 nudge $1 0 %x %y $ticks 750 %s %a $active
if ($exists(%nsound)) splay $qt(%nsound)
return
}
if ((!$window($1)) || ($7 == $null)) return
var %x = $3, %y = $4, %o = 4
if ($calc($ticks - $5) > $6) {
window $1 %x %y
if (($9- != $1) && ($9- != $null)) window $8 $qt($9-)
if ($7) window $7 $1
return
}
elseif ($2 == 0) { inc %x %o | inc %y %o }
elseif ($2 == 1) { dec %x %o | inc %y %o }
elseif ($2 == 2) { inc %x %o | dec %y %o }
elseif ($2 == 3) { dec %x %o | dec %y %o }
elseif ($2 == 4) { dec %x %o | inc %y %o }
elseif ($2 == 5) { inc %x %o | dec %y %o }
$+(.timer.nudge.,$1) -m 1 30 nudge $1 $calc(($2 + 1) % 6) $3-
window -ar $1
window $1 %x %y
}
This version will shake the target window regardless of the target or active windows' states. The active window is restored to its previous state after shaking is complete.
--------------------------------------------
on *:TEXT:$($me):*:nudge $target
;/nudge 'shakes' the target window when target is minimized or normal only
alias nudge {
var %nsound = sounds/nudge.wav
;-----------------------------------------------------
;1=target, 2=count, 3=x, 4=y, 5=ticks, 6=msec, 7=state, 8=astate, 9-=active
if ($2 == $null) {
var %x = $iif($window($1).x < 0,0,$v1)
var %y = $iif($window($1).y < 0,0,$v1)
var %a = $window($active).state
if (max isin %a) return
elseif (min isin %a) %a = -an
elseif (nor isin %a) %a = -ar
else %a = -
var %s = $window($1).state
if (max isin %s) return
if (nor isin %s) %s = -r
else %s = -
.timer -m 1 1 nudge $1 0 %x %y $ticks 750 %s %a $active
if ($exists(%nsound)) splay $qt(%nsound)
return
}
if ((!$window($1)) || ($7 == $null)) return
var %x = $3, %y = $4, %o = 4
if ($calc($ticks - $5) > $6) {
window $1 %x %y
if (($9- != $1) && ($9- != $null)) window $8 $qt($9-)
if ($7) window $7 $1
return
}
elseif ($2 == 0) { inc %x %o | inc %y %o }
elseif ($2 == 1) { dec %x %o | inc %y %o }
elseif ($2 == 2) { inc %x %o | dec %y %o }
elseif ($2 == 3) { dec %x %o | dec %y %o }
elseif ($2 == 4) { dec %x %o | inc %y %o }
elseif ($2 == 5) { inc %x %o | dec %y %o }
$+(.timer.nudge.,$1) -m 1 30 nudge $1 $calc(($2 + 1) % 6) $3-
window -ar $1
window $1 %x %y
}
This version shakes the target window only when neither the target nor active windows are maximized. This version is meant to shake when the user has their windows tiled/cascaded/unmaximized. If the active or target window (all windows) are maximized, the /nudge alias exits without shaking. Personally, this is the version I would use if I were to use this script myself.
--------------------------------------
-genius_at_work