Search the Community
Showing results for tags 'traysetonevent'.
Found 1 result
I have a script that gets a list of visible windows and makes a tray item of each in the tray menu. I'd also want it to update every time I want to access that menu again, in case new windows have appeared or some would have been closed. I'm using TrayOnEventMode option and trying to get the update going with TraySetOnEvent($TRAY_EVENT_PRIMARYDOWN...) as in the snippet below. However, the list doesn't update until after the tray menu has been closed again. I think I could work around this by having the script update the list constantly in the background, but that feels like it'd take up unnecessary amount of resources since the script might be used rarely by the user anyway. I tried using TraySetOnEvent($TRAY_EVENT_MOUSEOVER...), and that kind of does it, but it actually still calls my function many times (since the mouse cursor moves quite a bit on the icon) before the tray menu is opened. I could put another menuitem to call the update function, but I'd much rather have just the minimal amount of user actions. Similarly I could have tray menu open with a double click (with TraySetClick()) and have the first click just call the update function, but can anyone tell me if there's a way to call the update once and then have the menu open without these gimmicks? Opt("TrayOnEventMode", 1) TraySetOnEvent($TRAY_EVENT_PRIMARYDOWN, "UpdateWindowsList")