Skip to content

Add tray icon and user-customizable language order #14

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
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

eugenesvk
Copy link

@eugenesvk eugenesvk commented Apr 3, 2025

Currently testing if I could replace another language indicator app with this one by changing AHK the icon for the main script whenever a change is detected

Currently only tested with 2 languages. If language icon doesn't exist, the default AHK is used. If no user languages are configured, then as before the currently active language is used as the first one

Noticed that it's slower vs a dedicated app, would you know if that's just because AHK is slow or due to the poll frequency (though see below, chaning from 100 to 10 doesn't seem to affect it) or maybe there is some other reason (maybe this check should be decoupled from anything caret-related in case there is some expensive operation there?)

see from 4 to 6 sec, left icon is app - changing immediately on layout change, right is current script, skipping some changes
https://github.com/user-attachments/assets/bbe6bd32-6ff9-40a1-8a67-d911d416303a

I've changed updatePeriod: 100, to 10, but it doesn't seem to make much of a difference

LangIndic.10.mp4

Addresses #15

@eugenesvk eugenesvk changed the title Add tray icon Add tray icon and user-customizable language order Apr 4, 2025
@yakunins
Copy link
Owner

yakunins commented Apr 5, 2025

I am looking over 👽

@eugenesvk
Copy link
Author

eugenesvk commented Apr 5, 2025

By the way, maybe there should be a single timer that detects layout change instead of 2 separate ones - checking for layout change?

FYI I've added such a single timer CheckLangCapsChange()
that checks whether any of the relevant conditions changed (language / caps status / caret position (for caret cursor only)) and then call updates to caret/pointer/tray only if needed (e.g., tray doesn't update on caps change, pointer doesn't update on caret position change).

Though that fork is all transitioned to modules (so require the latest 2.1 alpha) so that I could import it in my main script (instead of running a separate tray icon) and avoid conflicts with the various libraries this repo uses, but that might be too high of a requirement for the main repo

@yakunins
Copy link
Owner

yakunins commented Apr 7, 2025

maybe there should be a single timer that detects layout change instead of 2 separate ones - checking for layout change?

It wouldn't make any noticable difference.
Because checkin layout change with GetInputLocaleId took only 1/200 of millisecond of CPU time (1 core).
So, checking layout every 40ms (25 fps) will result in utilization of 1/8000 of one core = 0.01%

There's no need to optimize anything here.

@eugenesvk
Copy link
Author

And maybe having separate timers might be better since you could than make the "buggier" caret timer less frequent vs the tray/mouse one? (though sadly that might also not help)

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

Successfully merging this pull request may close these issues.

2 participants