Nikeev / LangSwitch

LangSwitch - is a super-simple MacOS app that switches your keyboard languages one by one by pressing Fn/🌐 button. No popups, no delay.
MIT License
84 stars 5 forks source link

Language is switched when key combinations like fn+f are pressed. #7

Closed pawnhearts closed 2 months ago

pawnhearts commented 5 months ago

Maybe that can be avoided if language switching would be triggered on key release instead of keydown and we would also monitor if some other keys were pressed between keydown and keyrelease events?

In some cases that could is annoying - for example when using midnight commander and pressing fn+f5 to copy would also switch the language.

P.S. thanks for the app it's really helpful, other solution I've found relied on issw which doesn't work in recent macos versions.

Nikeev commented 5 months ago

Hello, thanks! Yes, I see what the problem is. I'll think about what I can do about it

pawnhearts commented 5 months ago

That would be great! This is kinda annoying because language is switched when I press fn+left/right for home/end ;_;

pawnhearts commented 4 months ago

Привет, есть какой-нибудь прогресс? В итоге пока что вернулся на дефолтную переключалку, но эта синяя штука в полях ввода и дилэй подбешивают =/ Я думал сам попробовать пофиксить, но у меня даже xcode не стоит. Если была бы какая-то консольная команда для переключения языка, например, я мог бы повесить её на hotkey через https://pynput.readthedocs.io/en/latest/ например, но та которую я нашел сегфолтится на новый macos

Nikeev commented 4 months ago

Привет, к сожалению, пока руки не добрались. Разработка под MacOS не моя специализация, поэтому времени много уходит разобраться, как там это работает)

pioner92 commented 4 months ago

it would be great to have it fixed

Nikeev commented 4 months ago

(English below)

Привет! В общем, возникли сложности с фиксом этой проблемы. У меня не получилось перехватывать нажатия других клавиш, помимо shift, control, option, command. Возможно, в целях безопасности, возможно, просто я не знаю как это сделать правильно.

Что в итоге сделал, вышеперечисленные клавиши в сочетании с fn не переключают язык. А для остальных я добавил таймер нажатия. Если нажатие длится дольше 0,2 сек, то считается уже, что это не просто "клик", а долгое нажатие и язык также не переключается.

В релиз я пока не выпускаю, т.к. не уверен в стабильности. Прикладываю сюда сборку, буду признателен обратной связи.

https://drive.google.com/file/d/10TUmLJM3D2n140PMfY-rSjqO2XkNi5jU/view?usp=share_link

Hi, I'm having trouble fixing this problem. I have not been able to capture keystrokes other than shift, control, option, command. Maybe for security reasons, maybe I just don't know how to do it properly.

What I ended up doing, the above keys in combination with fn don't switch the language. For the others, I added a press timer. If the press lasts longer than 0,2 sec, it is considered that it is not just a "click", but a long press and the language is also not switched.

I'm not releasing it yet as I'm not sure of the stability. I am attaching the build here, I would appreciate feedback.

https://drive.google.com/file/d/10TUmLJM3D2n140PMfY-rSjqO2XkNi5jU/view?usp=share_link