Other file managers have an option to load or focus their app by double-clicking an empty spot on the desktop. I checked XY settings and didn't find any such option or ability. Now, this isn't an option I even thought I would use, but I actually tried it out and found it useful (in some situations).
My XY is set as this :
Configuration | General | Startup & Exit | [ ] Allow multiple instances (unchecked)
This is super quick and dirty but is working. I was also experimenting with detecting if the XY process is already running and switch to it but XY is pretty smart and does that on the run command anyway. No idea how this runs when multiple instances are enabled.
The AutoHotkey script I cobbled together is here, link inside to where I got most of the code from :
Code: Select all
; https://www.autohotkey.com/board/topic/82196-solved-double-click-on-the-desktop/
; ahk_class ThunderRT6FormDC
; ahk_exe XYplorer.exe
; XY_Process = XYplorer.exe
~LButton::
If (A_PriorHotKey = A_ThisHotKey and A_TimeSincePriorHotkey < 500) {
WinGetClass, Class, A
if (Class = "WorkerW") or (Class = "Progman") {
if (_EmptyDesktopSpot()) {
run, C:\Program Files (x86)\XYplorer\XYplorer.exe
}
}
}
return
_EmptyDesktopSpot() {
LVM_GETSELECTEDCOUNT := 0x1000 + 50
GroupAdd, DeskGroup, ahk_class WorkerW
GroupAdd, DeskGroup, ahk_class Progman
handle := WinExist("ahk_group DeskGroup")
if (! handle) {
return false
}
handle := DllCall("GetWindow","Ptr",handle,"Uint",5,"Ptr")
if (! handle) {
return false
}
handle := DllCall("GetWindow","Ptr",handle,"Uint",5,"Ptr")
if (! handle) {
return false
}
SendMessage,%LVM_GETSELECTEDCOUNT%,0,0,,ahk_id %handle%
if (ErrorLevel = "FAIL") {
return false
}
if (! ErrorLevel) {
return true
}
return false
}
Code: Select all
"C:\Program Files\AutoHotkey\Compiler\Ahk2Exe.exe" /in "C:\Data\Projects\XYScripts\XYOpenFromDesktop\XYOpenFromDesktop.ahk" /out "C:\Data\Projects\XYScripts\XYOpenFromDesktop\XYOpenFromDesktop.exe" /icon "C:\Data\Projects\XYScripts\XYOpenFromDesktop\XYOpenFromDesktop.ico"
Maybe a future XY release can add this option already, again, apologize if it's already there, I couldn't find it.