Skip to content

[2/2] Keyboard Layout applet

Andrey Butirsky requested to merge (removed):keyboardlayout into master

FEATURE: 390079
P-W part: "[1/2] Keyboard Layout applet"

Inspired by @davidedmundson action plan:

We make a new applet

we put it in plasma-workspace/applets/keyboard-layout

It will consist of a

  • "compact representation" that shows a country code or a flag
  • "full representation" that shows a list view of all available layouts.
    We have a shortcut to the KCM.

All the layout indicator options from the KCM become a UI in a config here.
"Show for a single layout" option just changes the Plasmoid.status

./lookandfeel/contents/components/KeyboardLayoutButton.qml is a good code example of where to get data
Which in turn comes from ./components/keyboardlayout/

We kill all SNI code in kwin
We kill all SNI code in keyboard daemon
We kill all the "layout indicator" options from the KCM.

Some design corrections:
I don't think we need a "full representation" on this stage. In most of the cases, applet will be used for switching between 2 layouts available, so just cycling between them would be a best user experience, IMO.
Also, configuration UI will be probably skipped entirely, for the sake of simplicity.
All of those could be added later. The main design principle targeting here is KISS.

Emoji flags proposal:
frameworks/breeze-icons#1 (closed)
https://phabricator.kde.org/T13722

Good emoji candidates for the country flags are:
https://openmoji.org/library/#group=flags
https://github.com/eosrei/twemoji-color-font#examples (round corners)
https://www.google.com/get/noto/help/emoji/flags/ was suggested by @bshah but they are waving so not suits well for this particular task IMO
The main requirement would be to have non-waiving variants, as those look bad in small scale with 2-letter country code on top.
For comparison how flags could look like in different emoji vendors:
https://emojipedia.org/flag-russia/

For now, png flags will be just pulled from deprecated library kdelibs4support, if any.

2-letter country code proposal:
On panels we have lack of space, so plasmoid needs to be small.
Full layout names currently accessible are too wide for that ("English (US)").
Neither KWin nor libxkbcommon do "know" "short" layout name representations.
Here is the design proposal for KWin to address this:
https://github.com/xkbcommon/libxkbcommon/issues/192#issuecomment-705552165

Auto-load proposal:
Ideally, plasmoid should load on every layout reconfigure signal.
In case of only one layout is configured, plasmoid should deny the loading.
In the other cases, plasmoid should place itself to systray ("ActiveStatus") - there is no much sense to keep it hidden.

References by @apol:
https://phabricator.kde.org/T5331
https://phabricator.kde.org/D24503

Edited by Andrey Butirsky

Merge request reports