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

Disable keyboard switching with a shortcut in boot.iso #6090

Merged

Conversation

jkonecny12
Copy link
Member

@jkonecny12 jkonecny12 commented Jan 13, 2025

The keyboard switching recently migrated to localed. However, there is a bug reported that the keyboard switching with a keyboard shortcut doesn't work. However, that is not completely true, the keyboard switching correctly works but is not propagated to localed so Anaconda is not aware of the layout switch.
This behavior is much more problematic. Even reporters of the bug assumed that the keyboard switching doesn't work at all. Users could easily drop into a trap of using different keyboard layout on passwords during the installation then what they think is used.

Manual keyboard switching from Anaconda still works as expected. This is workaround which should be removed when bugs on gnome-kiosk are resolved:

NOTE:
Part of this change is code re-factorization which splits the LocaledWrapper class based on the usage (compositor / installation). This change improves readability but also fixes potential bug when xkboptions from compositor are stored to the installed system instead of the user defined ones.

  • Test that installed system has keyboard options correctly set.

@pep8speaks
Copy link

pep8speaks commented Jan 13, 2025

Hello @jkonecny12! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2025-01-21 12:48:43 UTC

@github-actions github-actions bot added the f42 Fedora 42 label Jan 13, 2025
@jkonecny12 jkonecny12 force-pushed the main-block-compositor-keyboard-shortcut branch from 256665b to 9437cef Compare January 13, 2025 16:42
@jkonecny12 jkonecny12 marked this pull request as ready for review January 13, 2025 16:42
@jkonecny12
Copy link
Member Author

/kickstart-test --testtype smoke

@AdamWill
Copy link
Contributor

Would the disabling of keyboard switching persist beyond installation? If so, that'd be bad. (I don't know offhand if this is one of the cases where the config used by anaconda also gets 'persisted' into the installed system, or not).

The other note I have is that I don't think the check is strong enough, we have some lives that are still on X.org where presumably this still works? Not that I've actually tried it.

@jkonecny12
Copy link
Member Author

Would the disabling of keyboard switching persist beyond installation? If so, that'd be bad. (I don't know offhand if this is one of the cases where the config used by anaconda also gets 'persisted' into the installed system, or not).

The other note I have is that I don't think the check is strong enough, we have some lives that are still on X.org where presumably this still works? Not that I've actually tried it.

I will test it to make sure but it shouldn't. That is one of the main reasons why I split the code. This should touched only part solving compositor (current environment).

@jkonecny12
Copy link
Member Author

/kickstart-test --testtype smoke

@jkonecny12
Copy link
Member Author

It seems to be working correctly, it is just interesting to me that Gnome Shell doesn't look to react and still showing the en label even when the layout is apparently different. In any case localectl shows expected values so it should be configured correctly.
Could it be another bug in Gnome Shell? @AdamWill do you have a test for keyboard layout switching options are properly installed?

@AdamWill
Copy link
Contributor

uff, if it says 'en' even when we select a different keyboard, that's not great :/

The test we have assumes that switching actually works, it wouldn't intelligently notice that switching was disabled and adapt (openQA isn't great at that kind of thing). But I could test it manually I guess.

@jkonecny12
Copy link
Member Author

uff, if it says 'en' even when we select a different keyboard, that's not great :/

The test we have assumes that switching actually works, it wouldn't intelligently notice that switching was disabled and adapt (openQA isn't great at that kind of thing). But I could test it manually I guess.

So my main question still remains. Do we want to get this merged as temporary solution? I guess the en bug is Gnome Shell bug?

@AdamWill
Copy link
Contributor

sorry, I had not had chance to look at it yet. in theory I am OK with this as a bodge. In practice the "it doesn't tell you the right current keyboard if it's not english" thing sounds a bit worrying.

@jkonecny12
Copy link
Member Author

jkonecny12 commented Jan 16, 2025

sorry, I had not had chance to look at it yet. in theory I am OK with this as a bodge. In practice the "it doesn't tell you the right current keyboard if it's not english" thing sounds a bit worrying.

don't get me wrong, it works just fine in Anaconda. It doesn't in the installed system if you switch layouts with keyboard shortcut but that seems unrelated. With this patch Anaconda works as expected it just disable switching layouts by keyboard shortcut, you have to do that by clicking on an icon but the icon works correctly.

@jkonecny12
Copy link
Member Author

/build-image --boot.iso

@jkonecny12
Copy link
Member Author

@AdamWill I'm building you an ISO here in the PR so you can easily test it to understand what am I talking about.

Copy link

Images built based on commit 9437cef:

  • boot.iso: success

Download the images from the bottom of the job status page.

@AdamWill
Copy link
Contributor

thanks. I know how to build ISOs, I just had rather a lot else going on :D if it behaves as intended, I think that's good.

@@ -502,6 +503,10 @@ def _refresh_switching_info(self):
"supported when using RDP.\n"
"However the settings will be used "
"after the installation."))
elif not conf.system.supports_compositor_keyboard_layout_shortcut:
self._layoutSwitchLabel.set_text(_("Keyboard layouts switching by "
"keyboard shortcuts is not supported "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say is "not currently supported", but I don't really know, this would need en eye of someone with good english so feel free to ignore...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I'll ask Sagar for grammar review.


@property
def supports_compositor_keyboard_layout_shortcut(self):
"""Does the compositor supports keyboard layout options correctly?"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

supports -> support

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll change the comment but I'm leaving it in the method name as it is used in the method above the same way.

Copy link
Contributor

@rvykydal rvykydal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@jkonecny12 jkonecny12 force-pushed the main-block-compositor-keyboard-shortcut branch from 9437cef to 6352cff Compare January 20, 2025 16:46
Let's use inheritance to show which code is used for installation and
what for compositor control. It increases the readability and improve
modifications for the future use. To make it correct it is split into
Base class and two specific classes. That way it is crystal clear what
is used for what and there should not be constant fighting between
different usages and side effects.

As a side effect this change will fix a potential issue when installed
system which doesn't selected `options` during the installation will
use options from the running system. This is harder to achieve state but
it could happen.
@jkonecny12 jkonecny12 force-pushed the main-block-compositor-keyboard-shortcut branch from 6352cff to e5cde67 Compare January 20, 2025 16:47
@jkonecny12
Copy link
Member Author

/kickstart-test --testtype smoke

@jkonecny12
Copy link
Member Author

jkonecny12 commented Jan 20, 2025

Adding a screenshot of the changed UI.

2025-01-21T10:19:08,040746750+01:00

This is a workaround for https://issues.redhat.com/browse/RHEL-71880.

We need this workaround to avoid users confusion. Without this the
keyboard switching will work but it is not visible to users, so they
could easily switch layouts without noticing it and wrote passwords
wrong.
@jkonecny12 jkonecny12 force-pushed the main-block-compositor-keyboard-shortcut branch from e5cde67 to be32044 Compare January 21, 2025 12:48
@jkonecny12
Copy link
Member Author

Improved string after Sagar suggestion. Thanks!
2025-01-21T13:42:41,225240180+01:00

@jkonecny12
Copy link
Member Author

/kickstart-test --testtype smoke

@jkonecny12
Copy link
Member Author

/kickstart-test --testtype keyboard

@rvykydal
Copy link
Contributor

Looks great, thank you.

@jkonecny12 jkonecny12 merged commit 189a559 into rhinstaller:main Jan 22, 2025
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
f42 Fedora 42
Development

Successfully merging this pull request may close these issues.

4 participants