Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Show desktop launcher


  • Please log in to reply
2 replies to this topic
Learning one
  • Members
  • 1483 posts
  • Last active: Jan 02 2016 02:30 PM
  • Joined: 04 Apr 2009

If your desktop is full of icons (shortcuts) and you launch your applications/files by clicking on them,
this is a script for you.

Please read description in script. Change settings in "settings" section.
By default, script hides all your desktop icons. Don't be scared, icons will show again when you press & hold %ShowDeskHotkey% or ExitApp.
You can check/uncheck Hide desktop icons in tray menu.

For maximum efficiency;
1) place you desktop icons around center of desktop
2) set CenterMouseOnShow = 1 and ReturnMouseTo = Initial position

This script is Radial menu co-product. Similar goal realized on simpler way.
If you like it or have some suggestions post reply.


Show desktop launcher

#NoEnv
CoordMode, mouse, screen

;===Description=========================================================================
/*
Show desktop launcher by Learning one

Minimizes all windows when you press & hold defined mouse hotkey (RButton by default).
Release mouse button above desktop icon to launch it (and unminimize windows), or anywhere else to unminimize windows.
Hotkey can be any key, not just mouse button. Hotkey combinations are not supported!

Desktop will show after %ShowDeskDelay% miliseconds. To show it instantly, set 0. This delay gives you opportunity to send normal RButton click.
THE BEST THING TO DO is to change hotkey to XButton1 or XButton1 and use ShowDeskDelay = 0.

LICENCE:
Free for non-commercial, personal use.

Author: Learning one
Contact: http://learningone.ahk4.net/Learning one contact.png

*/



;===Settings============================================================================
ShowDeskHotkey = RButton ; Show desktop hotkey
ShowDeskDelay = 220 ; Show desktop delay

AutoHideIcons = 1 ; If 1, script hides all your desktop icons. Icons will be shown again when you press & hold %ShowDeskHotkey% or ExitApp
ClickCount = 2 ; If your computer is set to "double click to open item" (default) specify 2. If it is set to "single click to open item" specify 1.

CenterMouseOnShow = ; If 1, mouse will be moved to the center of screen after %ShowDeskHotkey%. Ahything else will not move mouse.
ReturnMouseTo = center ; Returns mouse to specified position when you release %ShowDeskHotkey%.
; Allowed values: "Initial position", "center", or anything else --> doesn't move mouse




;===Auto-execute end====================================================================
OnExit, ExitSub
XCenter := A_ScreenWidth/2, YCenter := A_ScreenHeight/2
ControlGet, hwnd, Hwnd,, SysListView321, ahk_class Progman

Menu, tray, add
Menu, tray, add, Hide desktop icons, HideIcons
if AutoHideIcons = 1
{
WinHide, ahk_id %hwnd%
Menu, tray, Check, Hide desktop icons
}

Hotkey, %ShowDeskHotkey%, ShowDeskHotkey
Return



;===ShowDeskHotkey Subroutine===========================================================
ShowDeskHotkey:
QuitShowDesk =
MouseGetPos, InitialX, InitialY, ActiveWin
SetTimer, QuitShowDesk, 20

While (A_TimeSinceThisHotkey < ShowDeskDelay or QuitShowDesk ! 1)
Sleep, 20
SetTimer, QuitShowDesk, off

if QuitShowDesk = 1
Return

if CenterMouseOnShow = 1
MouseMove, %XCenter%, %YCenter%

WinMinimizeAll

if AutoHideIcons = 1
WinShow, ahk_id %hwnd%

KeyWait, %ShowDeskHotkey%, u

BlockInput, MouseMove
MouseClick, Left,,, %ClickCount%
BlockInput, MouseMoveOff

if ReturnMouseTo = Initial position
MouseMove, %InitialX%, %InitialY%
else if ReturnMouseTo = center
MouseMove, %XCenter%, %YCenter%

if AutoHideIcons = 1
WinHide, ahk_id %hwnd%

WinMinimizeAllUndo

Return



;===Subroutines=========================================================================
QuitShowDesk:
if not (GetKeyState(ShowDeskHotkey,"p"))
{
SetTimer, QuitShowDesk, off
QuitShowDesk = 1
SendInput, {%ShowDeskHotkey%}
}
Return


HideIcons:
if AutoHideIcons = 1
{
Menu, tray, Uncheck, Hide desktop icons
AutoHideIcons =
WinShow, ahk_id %hwnd%
}
Else
{
Menu, tray, Check, Hide desktop icons
AutoHideIcons = 1
WinHide, ahk_id %hwnd%
}
Return


ExitSub:
WinShow, ahk_id %hwnd%
ExitApp


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Escape::ExitApp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


Merry Christmas!
happy.png

netfun81
  • Members
  • 58 posts
  • Last active: Feb 21 2010 09:32 AM
  • Joined: 28 Oct 2006
nice, I like it. I was doing something similar with this script:

mbutton::
WinGet, id, list,,, Program Manager
      Loop, %id%
      {
         StringTrimRight, this_id, id%a_index%, 0
         WinGetTitle, title, ahk_id %this_id%
         WinGetClass, class, ahk_id %this_id%
         WinHide, ahk_id %this_id%
         HWins = %HWins%||%this_id%
       }
      Return
   
mbutton & rbutton::
      Loop, Parse, HWins, ||
         WinShow, ahk_id %A_LoopField%
      Return

But I guess if one doesnt care about hiding windows this works too:
mbutton::WinMinimizeAll
mbutton & rbutton::WinMinimizeAllUndo


Learning one
  • Members
  • 1483 posts
  • Last active: Jan 02 2016 02:30 PM
  • Joined: 04 Apr 2009
@netfun81: :)