Skip to content

Instantly share code, notes, and snippets.

@G33kDude
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save G33kDude/6f0c3739fce55e30ddc1 to your computer and use it in GitHub Desktop.
Save G33kDude/6f0c3739fce55e30ddc1 to your computer and use it in GitHub Desktop.
#Persistent
Small := 32
Medium := 48
Large := 96
IconSize := Small
hDesktop := GetDesktop()
HalfW := A_ScreenWidth/2
HalfH := A_ScreenHeight/2
Mult2 := HalfH - 48 ;Mult1 + 25
Mult1 := Mult2 - 25
Size := 0.01
Loop, 12
{
Ang := A_Index/12*6.28
Out .= Sin(Ang-Size)*Mult1+HalfW "-" Cos(Ang-Size)*Mult1+HalfH " "
Out .= Sin(Ang-Size)*Mult2+HalfW "-" Cos(Ang-Size)*Mult2+HalfH " "
Out .= Sin(Ang+Size)*Mult2+HalfW "-" Cos(Ang+Size)*Mult2+HalfH " "
Out .= Sin(Ang+Size)*Mult1+HalfW "-" Cos(Ang+Size)*Mult1+HalfH " "
Out .= Sin(Ang-Size)*Mult1+HalfW "-" Cos(Ang-Size)*Mult1+HalfH " "
Out .= HalfW "-" HalfH " "
}
Gui, -Caption +ToolWindow +hWndhWnd
Gui, Color, Black
Gui, Show, x0 y0 w%A_ScreenWidth% h%A_ScreenHeight%
WinSet, Region, %Out%, ahk_id %hWnd%
DllCall("SetParent", "UPtr", hWnd, "UPtr", hDesktop)
xOffset := HalfW - IconSize/2
yOffset := HalfH - IconSize/2 - 6
ControlGet, Count, List, Count,, ahk_id %hDesktop%
Third := Count // 3
Remainder := Mod(Count, 3)
;Len := (A_ScreenHeight/2 - IconSize/2 - 35) * 0.75
Len := Mult1 - Sqrt((IconSize/2)**2*2)
SetTimer, Tick, 1000
return
Tick:
PlaceLine(xOffset, yOffset, 0, 0, Third*3, Remainder)
Sec := (A_Sec/60)
PlaceLine(xOffset, yOffset, Sec * 6.28, Len, 0, Third)
Min := (A_Min/60) + Sec/60
PlaceLine(xOffset, yOffset, Min * 6.28, Len*0.75, Third, Third)
Hour := (Mod(A_Hour, 12)/12) + Min/12
PlaceLine(xOffset, yOffset, Hour * 6.28, Len*0.5, Third*2, Third)
return
PlaceLine(xOff,yOff,Ang,Len,i,m)
{
Loop, % m
{
x := Sin(Ang) * Len * (A_Index/m)
y := Cos(Ang) * -Len * (A_Index/m)
PlaceIcon(i++, x+xOff, y+yOff)
}
}
PlaceIcon(i, x, y)
{
global hDesktop
PostMessage, 0x100f, %i%, % (y << 16) | (x & 0xffff),, ahk_id %hDesktop%
}
GetDesktop()
{
static hDesktop
if !hDesktop
ControlGet, hDesktop, HWND,, SysListView321, ahk_class Progman
if !hDesktop
ControlGet, hDesktop, HWND,, SysListView321, ahk_class WorkerW
if !hDesktop
ControlGet, hDesktop, HWND,, SysListView321, A
if !hDesktop
throw Exception("Desktop not found")
return hDesktop
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment