-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Configure initial state for numlock/capslock #2330
Conversation
Can you update the man page and address the build failure? |
11bb96c
to
351122d
Compare
(still missing man page updates) |
Now everything should be there. I had to clean up my local clone first. |
sway/sway-input.5.scd
Outdated
|
||
*input* <identifier> xkb\_numlock enabled|disabled | ||
Enables or disables NumLock on sway startup, the default is enabled. | ||
Only meaningful if sway controls the keyboard. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line can probably be removed from both.
Since the implementation is not restricted to startup, you could change the man page to |
I can do that. Should I somehow document that changing the value for NumLock resets CapsLock to the value stored in xkb_capslock as well? Maybe a general note that changing one xkb_ value applies all stored xkb_ values again. |
Can't we get the current state of the modifiers and OR/AND them with only the bits we want to flip? |
The flags are currently set in the keyboard configuration and then applied with
|
I see. Let's take the easy way out for now and just make it effective in the config file (not at runtime)? |
Is there a way to do that? I think I could create a status flag in the input config that the next call should only update the marked modifier, but that feels like dirty code. There shouldn't be status information in a configuration structure. |
Just add it to the appropriate list of commands in commands.c. |
I think the runtime portion of this can be added to the keyboard part of #1779 |
Aye. |
Somehow I missed that list, it is so short. Should this stay an individual setting for each keyboard then or simply a global option for all keyboards? I think I'd prefer the global option then. |
I like it individual, if you want global do |
I can't add a subcommand of input to the config_commands list. I'll mark this as WIP and keep on thinking, maybe I'll get a good idea. |
See https:/swaywm/sway/blob/master/sway/commands/bar.c#L38 and |
I had another idea. What do you think about allowing the swaymsg command and just storing the new value? It will be applied only after hotplugging the keyboard or changing its layout. |
Do whatever you want, just get something mergable. This feature is not that complicated. |
After setting the keymap, try to enable NumLock and disable CapsLock. This only works if sway has the xkb master state and controls the keyboard. Prepare configuration settings for later use as well.
8ae987f
to
76ece57
Compare
@SirCmpwn, @RedSoxFan, the pull request is ready for review. I kept it restricted to the configuration file for now. Sometimes I try to perfect and polish too much. PS: I had to rebase it against the current master. |
Thanks! |
Set numlock state to enabled by default, keep capslock disabled and make this configurable.
The initial state of numlock and capslock can be set with
input ... xkb_numlock|xkb_capslock disable|enable
Implements #2311
Note: This relies
wlr_keyboard_notify_modifiers
which is not meant to be called by the compositor, but I found no other option to reliably set the modifiers.I used the xkb_ prefix to indicate that setting the state will reload the keyboard configuration.
The commands use enabled/disabled instead of off/on to match the other boolean input commands.