-
-
Notifications
You must be signed in to change notification settings - Fork 950
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
Reloading the config resets the keyboard layout #8941
Comments
When should it reset? or in other words, when is it expected to reset. Because after reloading configuration. It is expected to load first configured layout, isn't it? |
I expect that reloading config shouldn't reset layout at all. For the other question — I switch between layouts via Shift+Alt, yes, that's |
I've meant to add this with #7486, but seems to have missed that it only works when In the meantime you could use Trying to figure it out, I did some things: Testing This patch
diff --git a/src/devices/IKeyboard.cpp b/src/devices/IKeyboard.cpp
index d1119772..bfa2406f 100644
--- a/src/devices/IKeyboard.cpp
+++ b/src/devices/IKeyboard.cpp
@@ -118,11 +118,12 @@ void IKeyboard::setKeymap(const SStringRuleNames& rules) {
if (IDX != XKB_MOD_INVALID)
modifiersState.locked |= (uint32_t)1 << IDX;
-
- // 0 to avoid mods getting stuck if depressed during reload
- updateModifiers(0, 0, modifiersState.locked, modifiersState.group);
}
+ // 0 to avoid mods getting stuck if depressed during reload;
+ // keep current keyboard *locks state and layout during the reload
+ updateModifiers(0, 0, modifiersState.locked, modifiersState.group);
+
for (size_t i = 0; i < LEDNAMES.size(); ++i) {
ledIndexes.at(i) = xkb_map_led_get_index(xkbKeymap, LEDNAMES.at(i));
Debug::log(LOG, "xkb: LED index {} (name {}) got index {}", i, LEDNAMES.at(i), ledIndexes.at(i));
It works for me on latest git. Tested and so far:
I remember seeing issue like that, with numlock, but it was fixed. And there shouldn't be a difference between the patch and the current behavior when Let's check a few things:
The numlock issue, at least after some preliminary testing, is fixed by modifying the patch like so patch 2
diff --git a/src/devices/IKeyboard.cpp b/src/devices/IKeyboard.cpp
index d1119772..326d8325 100644
--- a/src/devices/IKeyboard.cpp
+++ b/src/devices/IKeyboard.cpp
@@ -112,17 +112,20 @@ void IKeyboard::setKeymap(const SStringRuleNames& rules) {
const auto NUMLOCKON = g_pConfigManager->getDeviceInt(hlName, "numlock_by_default", "input:numlock_by_default");
+ auto locked = modifiersState.locked;
if (NUMLOCKON == 1) {
// lock numlock
const auto IDX = xkb_map_mod_get_index(xkbKeymap, XKB_MOD_NAME_NUM);
if (IDX != XKB_MOD_INVALID)
- modifiersState.locked |= (uint32_t)1 << IDX;
-
- // 0 to avoid mods getting stuck if depressed during reload
- updateModifiers(0, 0, modifiersState.locked, modifiersState.group);
+ // indirect modification so we always emit event
+ locked |= (uint32_t)1 << IDX;
}
+ // 0 to avoid mods getting stuck if depressed during reload;
+ // keeps keyboard's current *locks state and layout during the reload
+ updateModifiers(0, 0, locked, modifiersState.group);
+
for (size_t i = 0; i < LEDNAMES.size(); ++i) {
ledIndexes.at(i) = xkb_map_led_get_index(xkbKeymap, LEDNAMES.at(i));
Debug::log(LOG, "xkb: LED index {} (name {}) got index {}", i, LEDNAMES.at(i), ledIndexes.at(i)); This, however, is almost the same as here, which didn't change anything for the issue, but it was in fact some other PR that fixed it, at least for me. Anyway, for the current issue patch 2 seems to work and not break anything (?). Needs more testing. This is all with
|
Well, I have tried this option (I have TKL keyboard, so no NumLock), and it works for me, layouts are preserved. For my case it's good to go, won't close since I guess patches above should be tested (by someone with actual numlock) |
Already reported ? *
Regression?
I don't know, I started using Hyprland only recently
System Info and Hyprland Version
System/Version info
Description
I have three keyboard layouts with this setup:
I'm using wpaperd (wallpaper manager) with wallpapers changing randomly every N minutes (around 20-30, not important)
Then a script takes the accent color and uses it to color the window border, changing the file I import in config via
source
.Then the current layout resets to English.
And a few times every day I happen to write something in non-English layout at that point in time and some word turns into a garbled mess.
How to reproduce
Attach not paste
Checklist of files to include below
hyprctl systeminfo -c
(always include)Additional info & File uploads
hyprctl_systeminfo_c.txt
The text was updated successfully, but these errors were encountered: