Author Topic: [QMK] Input language switching "on the fly", bounce ideas with me?  (Read 5595 times)

0 Members and 1 Guest are viewing this topic.

Offline ojrask

  • Thread Starter
  • Posts: 354
  • juuh elikkäs
I currently use US ANSI (en_US) as my main typing layout when using a keyboard. I live in Finland so I often need to use ÖÄÅ when writing. My current setup is as follows:

1. OS (Ubuntu and Windows) has two input languages configured: en_US and fi_FI.
2. OS quick switch between input languages is setup (Shift-Alt on Windows, Gui-Space on Ubuntu).
3. Everything defaults to en_US.
4. When I need to type ÖÄÅ I use the language quick-switch key and type using "FI ANSI".
5. I revert to en_US with the quick-switch key again.

This is somewhat OK but I have been thinking about making it a tad simpler on my QMK powered boards.

What I'm currently looking at are macros and leader keys. The idea is that when I press down RAlt the board automagically sends Shift-Alt and Gui-Space combos to switch language in my OS, and when I release RAlt the same combos are sent again to revert the input language change.

I wonder how the keyboard and OS interact if I send _both_ the Windows and Ubuntu quick-switch combos at the same time. I wonder if there is a way to sniff the current OS inside QMK and determine the combo that way?

Would this be possible? I presume with leader key I'm restricted to sending a single character at a time and I would need to spam the leader key in order to type something like "hyvää yötä", which is kinda worse than just using the quick-switch normally. From the looks of the documentation, macros are more aimed towards inputting characters in sequence instead of using a "layer" of sorts.

Would there be any way of making this a layer thing? As in when a layer is enabled QMK sends the language switch combo and then resends it when the layer is disabled?

So instead of doing

Gui-Space, then, ;'[ (to get öäå)
and/or
Shift-Alt, then, ;'[

I would want to do

RAlt + ; (for ö)
RAlt + ' (for ä)
RAlt + [ (for å)

all while "being inside" en_US input language.

Any pointers would be appreciated.
Current:
    Ducky DK9008P [MX Blues] | WASD V2 TKL [MX Blues] | r63 (Satan 60% DIY) [Gateron Browns] | BananaSplit 60% [Gateron Greens] | UK78 [67g Zealios] | Infinity ErgoDox [MX Clears] | Pearl 40% [78g Zealios] | G81-3000
Coming up:
    DZ60/SKB60-WKL [100g MX Silent Blacks] | G81-3000 [Box Navies] Handwire
IC/GB:
    GMK Strogg | G81/80-3000 MX metal plate

Offline mkozlows

  • Posts: 6
Re: [QMK] Input language switching "on the fly", bounce ideas with me?
« Reply #1 on: Tue, 03 April 2018, 14:16:45 »
I think you could just use process_record_user() with a custom keycode to get that effect. On  record->event.pressed, send the keys you need to switch to the language, and on keyup, send the keys to switch back.

Offline ojrask

  • Thread Starter
  • Posts: 354
  • juuh elikkäs
Re: [QMK] Input language switching "on the fly", bounce ideas with me?
« Reply #2 on: Tue, 03 April 2018, 14:29:57 »
I think you could just use process_record_user() with a custom keycode to get that effect. On  record->event.pressed, send the keys you need to switch to the language, and on keyup, send the keys to switch back.

Hmm somehow that part of the documentation flew right by me. Will read up, many thanks!
Current:
    Ducky DK9008P [MX Blues] | WASD V2 TKL [MX Blues] | r63 (Satan 60% DIY) [Gateron Browns] | BananaSplit 60% [Gateron Greens] | UK78 [67g Zealios] | Infinity ErgoDox [MX Clears] | Pearl 40% [78g Zealios] | G81-3000
Coming up:
    DZ60/SKB60-WKL [100g MX Silent Blacks] | G81-3000 [Box Navies] Handwire
IC/GB:
    GMK Strogg | G81/80-3000 MX metal plate

Offline jeb

  • Posts: 21
Re: [QMK] Input language switching "on the fly", bounce ideas with me?
« Reply #3 on: Tue, 03 April 2018, 16:00:54 »
Do you have a reason to require a firmware solution? The best solution would probably be a custom layout set in the OS. Otherwise, maybe some hybrid solution using a stock layout (say, US International) and having your particular RAlt combos set in the keyboard to trigger the keys to type the desired characters. E.g., RAlt+' would be a macro for an umlaut dead key and then A. Or something to that effect. US International may not be great because of the dead keys.

I'm suggesting this because, especially in Windows, I've found layout switching to be at least occasionally problematic, and switching layouts at least seems "expensive" to do to enter in a single character. One minor issue you could have is if the layout gets out of sync, you'll have to change it back manually. (I have found in the past that Windows will just randomly switch to a different layout for no reason at all on occasion.) Unless you have it set to use the key combination to use a specific layout rather than the toggle.

Offline ojrask

  • Thread Starter
  • Posts: 354
  • juuh elikkäs
Re: [QMK] Input language switching "on the fly", bounce ideas with me?
« Reply #4 on: Tue, 03 April 2018, 18:12:46 »
Do you have a reason to require a firmware solution? The best solution would probably be a custom layout set in the OS. Otherwise, maybe some hybrid solution using a stock layout (say, US International) and having your particular RAlt combos set in the keyboard to trigger the keys to type the desired characters. E.g., RAlt+' would be a macro for an umlaut dead key and then A. Or something to that effect. US International may not be great because of the dead keys.

I'm suggesting this because, especially in Windows, I've found layout switching to be at least occasionally problematic, and switching layouts at least seems "expensive" to do to enter in a single character. One minor issue you could have is if the layout gets out of sync, you'll have to change it back manually. (I have found in the past that Windows will just randomly switch to a different layout for no reason at all on occasion.) Unless you have it set to use the key combination to use a specific layout rather than the toggle.

US International or any other general dead keys setup is not an option for me as a programmer, too many keys I use require direct access, such as ', `, ~, etc.. SWERTY layouts and the like also pose problems as I like to keep my legends aligned and rarely I would be ready to invest 50 bucks for international sets (I know where ÖÄÅ, €, and similar are located on SWEFI).

On Windows I have had no problems with the OS language lagging or switching randomly (I had until I realized the default input language is enabled every time you open the start menu and similar). Though sometimes I get some issues with missing presses that would be fixed with a single key to press.

I will see about setting the RAlt to be the dead key trigger key if that would be of any help on US International and such. :)
Current:
    Ducky DK9008P [MX Blues] | WASD V2 TKL [MX Blues] | r63 (Satan 60% DIY) [Gateron Browns] | BananaSplit 60% [Gateron Greens] | UK78 [67g Zealios] | Infinity ErgoDox [MX Clears] | Pearl 40% [78g Zealios] | G81-3000
Coming up:
    DZ60/SKB60-WKL [100g MX Silent Blacks] | G81-3000 [Box Navies] Handwire
IC/GB:
    GMK Strogg | G81/80-3000 MX metal plate

Offline jeb

  • Posts: 21
Re: [QMK] Input language switching "on the fly", bounce ideas with me?
« Reply #5 on: Thu, 05 April 2018, 13:39:04 »
Yeah, dead keys are generally annoying, and probably too much trouble to work around.

You did not answer, though, whether there's a reason you couldn't create and your own custom layout in the OS. There is the Keyboard Layout Creator on Windows, and for Linux I don't remember but you just edit some config file or another. You could start from the US layout, then change what you need in the RAlt layer. It is reasonably straightforward, as I recall.

Offline KHAANNN

  • Posts: 1660
Re: [QMK] Input language switching "on the fly", bounce ideas with me?
« Reply #6 on: Fri, 06 April 2018, 08:28:30 »
Here's my layout for TMK: https://gist.github.com/kaansoral/e6b92d067d97c752b86f1e9b09324d17

Basically, I extended/overwrote the Alt layer for Turkish characters, Alt+I becomes ı, Alt+U becomes ü etc.

It's OS+config dependent tho, a bit more work and I could add Windows logic too, but it's not a big deal, as I switch to my Windows system only for gaming

Endgame | 1.25 Cmd for GMK Sets Please | Or Just 1.25 Blanks Like The Good Old Days

Offline ojrask

  • Thread Starter
  • Posts: 354
  • juuh elikkäs
Re: [QMK] Input language switching "on the fly", bounce ideas with me?
« Reply #7 on: Mon, 09 April 2018, 15:47:16 »
Here's my layout for TMK: https://gist.github.com/kaansoral/e6b92d067d97c752b86f1e9b09324d17

Basically, I extended/overwrote the Alt layer for Turkish characters, Alt+I becomes ı, Alt+U becomes ü etc.

It's OS+config dependent tho, a bit more work and I could add Windows logic too, but it's not a big deal, as I switch to my Windows system only for gaming

Hey that looks useful, will check it out. Thanks!
Current:
    Ducky DK9008P [MX Blues] | WASD V2 TKL [MX Blues] | r63 (Satan 60% DIY) [Gateron Browns] | BananaSplit 60% [Gateron Greens] | UK78 [67g Zealios] | Infinity ErgoDox [MX Clears] | Pearl 40% [78g Zealios] | G81-3000
Coming up:
    DZ60/SKB60-WKL [100g MX Silent Blacks] | G81-3000 [Box Navies] Handwire
IC/GB:
    GMK Strogg | G81/80-3000 MX metal plate