06-19-2021, 10:13 PM
This should cover it
Function TotalCommanderHideShowWithTrayIcon
Trigger Cs
Function TotalCommanderHideShowWithTrayIcon
Trigger Cs
;On Keypress Ctrl+s adds tray icon and stays running. If Total Commander if not running runs and exits.
;Sub-function TrayProc is called on mouse events.
int w=win("Total Commander" "TTOTAL_CMD")
if(!w)
,run "C:\Program Files\totalcmd\TOTALCMD64.EXE";; change to location on your pc if not this
,ret
int h=hid(w)
if(!h)
,hid w
,Tray t.AddIcon("C:\Program Files\totalcmd\TOTALCMD64.EXE" "Show Total Commander" 0 &sub.TrayProc)
,MessageLoop
else
,EndThread +getopt(itemid)
,act w
,ret
#sub TrayProc v
function Tray&tray msg
sel msg
,case WM_LBUTTONUP
,sel GetMod
,,case 0 ;;left click on icon
,,act w
,,shutdown -7
,,case 2 ;;control +left click on icon
,,act w
,,shutdown -7