Created
December 30, 2017 02:00
-
-
Save WA9ACE/bdd086ac14dac4a0659e512aeb4bceb3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#NoTrayIcon | |
#Persistent | |
global hWSL | |
/* Setup Tray icon and add item that will handle | |
* double click events | |
*/ | |
Menu Tray, Icon | |
Menu Tray, Icon, C:\Program Files\WindowsApps\CanonicalGroupLimited.UbuntuonWindows_1604.2017.922.0_x64__79rhkp1fndgsc\images\icon.ico | |
Menu Tray, Add, Show / Hide WSL, TrayClick | |
Menu Tray, Default, Show / Hide WSL | |
;// Run notepad hidden | |
DetectHiddenWindows On | |
Run WSL,, Hide, PID | |
WinWait ahk_pid %PID% | |
hWSL := WinExist() | |
DetectHiddenWindows Off | |
return | |
TrayClick: | |
OnTrayClick() | |
return | |
;// Show / hide notepad on double click | |
OnTrayClick() { | |
if DllCall("IsWindowVisible", "Ptr", hWSL) { | |
WinHide ahk_id %hWSL% | |
} else { | |
WinShow ahk_id %hWSL% | |
WinActivate ahk_id %hWSL% | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment