Skip to content
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

Caps word mode #711

Closed
lobre opened this issue Apr 4, 2024 · 2 comments
Closed

Caps word mode #711

lobre opened this issue Apr 4, 2024 · 2 comments

Comments

@lobre
Copy link

lobre commented Apr 4, 2024

QMK include a caps word mode in its implementation. It allows you to go into a shift-toggle layer, but only for the length of a word, and then automatically deactivate this layer so that only one word is capitalized.

We started taking about such a mode in the following issue:

#671

And here is the page pointing to the QMK documentation:

https://github.com/qmk/qmk_firmware/blob/master/docs/feature_caps_word.md

First, I want to note that using a regular shift modifier or enabling capslock are two different behaviors. I personally find that this feature is better when a proper capslock is used. As an example, when taking the AZERTY French keyboard layout, there is the number 2 key (in the number row) that is the accentuated é letter on normal tap, and the number 2 when shifted. However, when capslock is activated, it produces an uppercase É.

My current implementation of caps word mode in key is as follows.

[ids]
*

[main]
leftshift+rightshift = togglem(capslock, capslock)

[capslock]
capslock = togglem(capslock, capslock)
space = togglem(capslock, macro(capslock space))
enter = togglem(capslock, macro(capslock enter))
, = togglem(capslock, macro(capslock comma))
. = togglem(capslock, macro(capslock dot))

It poorly assumes that capslock is not active when keyd starts, and then tries to stay in sync with the state of capslock by activating or deactivating a layer named capslock using macros.

It is a bit hacky and maybe can be improved, especially if we could have a native capslock layer internally managed by keyd that would follow the state of capslock.

Also, this layer deactivates when enter, space, comma or dot is typed.

@rvaiya
Copy link
Owner

rvaiya commented Apr 7, 2024

It poorly assumes that capslock is not active when keyd starts

This does not seem like an unreasonable assumption. Most of the time capslock will be off when keyd is started (on boot or after typing a lower case terminal command).

It is a bit hacky and maybe can be improved, especially if we could have a native capslock layer internally managed by keyd that would follow the state of capslock.

Capslock itself is a stateful mechanism that the user has to keep track of in their mind. In the worst case the user can just toggle it themselves to ensure synchrony, so I do not think the initialization edge case warrants a dedicated feature.

Even if one wanted to do this, capslock state is a display server construct. There is no way to recover it in evdev. One could resort to hacks like scanning the capslock LED state (set by the display server), but then you are just tossing another fragile kludge onto the pile.

@lobre
Copy link
Author

lobre commented Apr 8, 2024

Even if one wanted to do this, capslock state is a display server construct. There is no way to recover it in evdev. One could resort to hacks like scanning the capslock LED state (set by the display server), but then you are just tossing another fragile kludge onto the pile.

This is unfortunate, but this makes sense. I will forget about trying to track the state of capslock then. It just means that "smart capslock" can hardly become a thing.

Apart from this, implementing caps word mode with shift can be done with the current implementation as follows (example that you gave me on another issue):

[main]
shift = oneshot(shift)

[shift]
shift = toggle(shift2)

[shift2:S]
space = togglem(shift2, space)
enter = togglem(shift2, enter)
, = togglem(shift2, comma)
capslock = togglem(shift2, esc)

I am not sure that there is other discussions to have about this, so I will close the issue. But this can be reopened if further comments are posted.

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