-
Notifications
You must be signed in to change notification settings - Fork 44
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 installer keymap #917
Conversation
d1d85d5
to
784b46f
Compare
784b46f
to
6e46d40
Compare
The `localectl status` returns `X11 Layout: (unset)` until the layout is changed by `localectl set-x11-keymap`.
const sort = (keymaps) => { | ||
// sort the keymap names using the current locale | ||
const lang = cockpit.language || "en"; | ||
return keymaps.sort((k1, k2) => k1.name.localeCompare(k2.name, lang)); |
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.
Keymaps should come already translated from D-Bus.
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.
I guess you meant "sorted" here...
Yes, they are sorted. But are they sorted using the current locale? I mean in some languages the sorting might be a bit different than in English...
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.
I mean, why do we need #localeCompare
? Isn't comparison of keymap.name
values enough?
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.
Some languages have special rules for sorting, for example in Estonian the letter Z
is not the last letter. It is between S
and T
. See https://en.wikipedia.org/wiki/Estonian_orthography
We even had some "fun" with that in [a-z]
regular expressions, see bug #177560.
I'm not sure if localectl
output is locale sorted or not, this is just to be really sure.
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.
You can even try that in browser console:
["t", "a", "z"].sort((k1, k2) => k1.localeCompare(k2, "et"))
returns ['a', 'z', 't']
{options} | ||
</FormSelect>) || | ||
// TRANSLATORS: | ||
_("Keyboard layout cannot be changed in remote installation") } |
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.
As suggested by @dgdavid during the review, I would show the current keymap as disabled for remote installation.
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.
As suggested by @dgdavid during the review, I would show the current keymap as disabled for remote installation.
Just displaying it in plain text is enough along with the proper explanation in the popover @lslezak is working on. I mean, not needed to put a disabled selector there IMHO.
That said, at this moment I do not have an strong opinion for choosing between these two options.
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.
I tried that and I didn't like it. There are several problems:
- We would need to describe why the keyboard layout selector is disabled. It is not obvious and that could be frustrating for the users.
- It does not display your current local keyboard layout, which will be very likely different than the "English US" default.
- You do not care what's the keyboard layout on the remote machine, the current value is irrelevant, it does not provide any information for the remote user. It is actually the opposite, it creates some confusion.
See the screenshot:
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.
IMHO, one of the problem you found it's because using a disable selector for something that will be not be a selector. That's why I proposed using plain text and moving the explanation to a popover as we're doing now with the Language explanation.
But let's move on, we can re-evaluate at any time.
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.
As I understood it, the idea was to show the local keymap instead of the keymap in the remote system running Agama. But I guess that is not possible, right?
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.
Unfortunately that's not possible, you cannot get the local keyboard layout name in Javascript running in browser.
There is some experimental Keyboard API, but it does not provide the functionality we need.
You can get the name of a physical key to get a specified character, e.g. you can find which button produces letter Y
. On the usual keyboard it is Y
, but if you use QWERTZ layout you should get Z
. (BTW I tested that with Chrome in KDE and it does not work properly with CZ QWERTZ layout.)
With that we could possibly only distinguish between QWERTY/QWERTZ/AZERTY variants, but we cannot get the full layout name like "Czech QWERTY".
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.
LGTM, but I cannot approve it.
So, I'm going to approve it for you. |
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.
Approving it based on #917 (review)
Problem
Solution
Testing
Screenshots
1) Local connection using the loopback device or or forced via
LOCAL_CONNECTION=1
environment variable.