Skip to content

Caret indicator breaks Escape on left-click tray menu #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
eugenesvk opened this issue Apr 5, 2025 · 2 comments
Open

Caret indicator breaks Escape on left-click tray menu #17

eugenesvk opened this issue Apr 5, 2025 · 2 comments

Comments

@eugenesvk
Copy link

eugenesvk commented Apr 5, 2025

For convenience of tray icon menu you can assign it to a left mouse click in addition to the default right click

OnMessage 0x404, Received_AHK_NOTIFYICON
Received_AHK_NOTIFYICON(wParam, lParam, nMsg, hwnd) {
  if lParam = 0x202 { ; WM_LBUTTONUP
    A_TrayMenu.Show
    return 1
  }
}

However, when used with LanguageIndicatorCaret (but not with LanguageIndicatorCursor) you can't close the left-clicked tray menu anymore (the 1st Escape seems to always work, but 2nd/3rd+ always fail)
The right click menu continues to work fine on Escape

Do you know what LanguageIndicatorCaret does that can cause this and how to fix it?

Disabling capslock status check state.capslock := GetCapslockState() fixes it, but still don't understand why that happens in the first place

Interestingly enough, it only fails when you check for a Toggle state, so phyiscal state like GetKeyState("Capslock", "P") doesn't bug (though useless)

By the way, why does it check on every tick? As a workaround I've hidden the checks to only happen if layout changes, seems to work

@yakunins
Copy link
Owner

Thank you for reporting. Can't quite get what is going wrong.
Would you please describe the issue with numbered steps to perform, so we may troubleshoot it?

For example:

  1. add some script to caret-indicator.ahk
  2. run caret-indicator.ahk
  3. use LMB over its tray icon
  4. press escape button
  5. use LMB one more time over tray icon
  6. ...

@eugenesvk
Copy link
Author

eugenesvk commented May 29, 2025

Your steps are correct! Just repeat step 4!

  1. Add the code lines from the top post to caret-indicator.ahk which simply show the default AHK menu on left click
  2. run caret-indicator.ahk
  3. use LMB over its tray icon, see the script menu appear
  4. press escape button
  5. see the menu disappear as expected the 1st time
  6. (optional) turn the sound on
  7. repeat step 3
  8. repeat step 4
  9. see the menu doesn't disappear the 2nd time and instead hear some error sound

I've since "fixed" it by doing a complete reimplementation of the left click menu to only leave the language changing commands, not the full default menu, and also make its content depend on the current language so that accelerator keys keep working (which is commonly bugged not to be the case as the shortcuts are not based on physical keys and fail if the curent layout doesn't have the old letters defined in the tray menu original layout)

But don't remember whether I've found the solution got to the bottom of the original issue or not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants