D12069: Implement a keyboard selector plasmoid

2018-04-09 Thread Aleix Pol Gonzalez
apol created this revision.
apol added a reviewer: Plasma.
Restricted Application added a project: Plasma.
Restricted Application added a subscriber: plasma-devel.
apol requested review of this revision.

REVISION SUMMARY
  Mimics the behavior of the status notifier item

REPOSITORY
  R120 Plasma Workspace

BRANCH
  master

REVISION DETAIL
  https://phabricator.kde.org/D12069

AFFECTED FILES
  applets/CMakeLists.txt
  applets/keyboardselector/Messages.sh
  applets/keyboardselector/contents/ui/main.qml
  applets/keyboardselector/metadata.desktop

To: apol, #plasma
Cc: plasma-devel, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, 
jensreuterberg, abetts, sebas, apol, mart


D12069: Implement a keyboard selector plasmoid

2018-04-09 Thread David Edmundson
davidedmundson added a comment.


  > Mimics the behavior of the status notifier item
  
  The keyboard kded module when it's used on X has one more option for its SNI
  
  - show flag
  - show label
  - show label on flag
  
  "show layout indicator" and "show for single layout" become just normal 
plasmoid management.

INLINE COMMENTS

> main.qml:40
> +fontSizeMode: Text.Fit
> +minimumPixelSize: 10
> +font.pixelSize: 72

can you use smallestReadableFont?

> main.qml:42
> +font.pixelSize: 72
> +text: layout.currentLayout.substr(0, 2).toLowerCase()
> +verticalAlignment: Qt.AlignVCenter

"apl" and "mao" are 3 letters.
No idea what either of those mean, it's just in the list.

REPOSITORY
  R120 Plasma Workspace

REVISION DETAIL
  https://phabricator.kde.org/D12069

To: apol, #plasma
Cc: davidedmundson, plasma-devel, ragreen, Pitel, ZrenBot, lesliezhai, 
ali-mohamed, jensreuterberg, abetts, sebas, apol, mart


D12069: Implement a keyboard selector plasmoid

2018-04-09 Thread Kai Uwe Broulik
broulik added inline comments.

INLINE COMMENTS

> main.qml:38
> +Plasmoid.preferredRepresentation: Plasmoid.compactRepresentation
> +Plasmoid.compactRepresentation: PlasmaComponents.Label {
> +fontSizeMode: Text.Fit

Also set `height: undefined`, I've seen issues where `Text.Fit` fails to shrink 
fully due to `PlasmaComponents.Label` default height

> davidedmundson wrote in main.qml:40
> can you use smallestReadableFont?

`theme.smallestFont` that is

> main.qml:48
> +anchors.fill: parent
> +hoverEnabled: true
> +

Unused

> main.qml:54
> +
> +Plasmoid.status: layout.layouts.length>1 ? PlasmaCore.Types.ActiveStatus 
> : PlasmaCore.Types.PassiveStatus
> +Plasmoid.toolTipMainText: i18n("Keyboard Layout")

Coding style, spaces

REPOSITORY
  R120 Plasma Workspace

REVISION DETAIL
  https://phabricator.kde.org/D12069

To: apol, #plasma
Cc: broulik, davidedmundson, plasma-devel, ragreen, Pitel, ZrenBot, lesliezhai, 
ali-mohamed, jensreuterberg, abetts, sebas, apol, mart


D12069: Implement a keyboard selector plasmoid

2018-04-09 Thread Martin Flöser
graesslin added inline comments.

INLINE COMMENTS

> davidedmundson wrote in main.qml:42
> "apl" and "mao" are 3 letters.
> No idea what either of those mean, it's just in the list.

I'm not sure whether a substring is the correct solution anyhow. On Wayland we 
get a proper name like German, but that doesn't match the short name which 
would be de.

That's also the reason why the sni doesn't support flags: I didn't find a 
trivial solution to map to iso codes.

REPOSITORY
  R120 Plasma Workspace

REVISION DETAIL
  https://phabricator.kde.org/D12069

To: apol, #plasma
Cc: graesslin, broulik, davidedmundson, plasma-devel, ragreen, Pitel, ZrenBot, 
lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart


D12069: Implement a keyboard selector plasmoid

2018-04-09 Thread Eike Hein
hein added a comment.


  It's long been known that the keyboard layout switcher SNI is legacy stuff 
and will eventually become redundant with the Input Method Panel widget once we 
switch to a proper model of managing input languages vs. just keyboard layouts 
in the workspace.
  
  I suggest this be discarded and instead keyboard layout switching be added to 
the IMP widget as a fallback when an IM daemon is not running (when one is 
running it effectively takes over keyboard layout management at least on X11, 
and so the SNI always became completely useless to IM users). This would have 
the benefits of:
  
  - ... putting us on a path towards the proper unification we need
  - ... getting more of the core Plasma devs to review and work on the IMP 
code, which we need to be of prime quality (it's in p-d, it's on the default 
panel in many locales, and soon likely will be for all of them for emoji input)
  
  This is also important for our plans for the Virtual Keyboard down the road, 
where we want to embed the IMP widget to do the language/layout switching and 
reuse important toggles (like full/half-width character modes).
  
  This request as-is is new work that reimplements a known-to-be-broken thing, 
which is not great because new work should always go towards planned 
improvements.

REPOSITORY
  R120 Plasma Workspace

REVISION DETAIL
  https://phabricator.kde.org/D12069

To: apol, #plasma
Cc: hein, graesslin, broulik, davidedmundson, plasma-devel, ragreen, Pitel, 
ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart


D12069: Implement a keyboard selector plasmoid

2018-04-09 Thread David Edmundson
davidedmundson added a comment.


  > once we switch to a proper model of managing input languages vs. just 
keyboard layouts in the workspace.
  
  Is that something that can happen now?

REPOSITORY
  R120 Plasma Workspace

REVISION DETAIL
  https://phabricator.kde.org/D12069

To: apol, #plasma
Cc: hein, graesslin, broulik, davidedmundson, plasma-devel, ragreen, Pitel, 
ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart


D12069: Implement a keyboard selector plasmoid

2018-04-09 Thread Eike Hein
hein added a comment.


  In D12069#243315 , @davidedmundson 
wrote:
  
  > Is that something that can happen now?
  
  
  We have a GSoC project in the Ideas list this year that's aimed at it, and 
there are other Linux desktops that prove it's possible (e.g. Gnome has this).
  
  The goal is to evolve the keyboard settings in System Settings towards 
managing input languages, the way it's done in the products of most of our 
competitors (both free and proprietary). The general workflow is to add an 
input language, then select the keyboard layout for it. This is incidentally 
exactly how the config UI for something like ibus/fcitx works. In Plasma, 
currently you need to reach this via the panel widget. Via the GSoC project, we 
want to bring it to System Settings instead. kimpanel can then run kcmshell. 
Life will be good.
  
  Since not all systems have an IM daemon running (although increasingly Linux 
systems run one by default, e.g. Gnome does for globally available emoji 
input), the KCM will need to have modes where it either backchannels to the IM 
daemon for configuration or uses xkb as before. On Wayland the situation is a 
little bit different since the compositor is always in charge of the layout, so 
it will need to talk both to KWin and the IM daemon. The details of this are 
still up on the air: That's why it's a multi-month project.
  
  Just like the KCM will fall back to xkb on IM daemon-less systems, it makes 
sense to pursue this architecture as far as the panel indicators are concerned. 
It's long been known that the redundancy/conflict between kimpanel and the 
keyboard layout indicator will eventually need to be resolved/collapsed. The 
problems we're having:
  
  - We have support for automagically adding the keyboard layout indicator when 
needed, but we lack this for kimpanel. We currently add kimpanel to the default 
panel on first logon based on a locale white list. But if you do first logon on 
an English-language system and later add, say, Chinese input (which in lieu of 
the GSoC project you currently need to do painfully in a manual sysadmin 
fashion), you need to manually add the widget. It's a TODO to make this 
automatic.
  
  - When an IM daemon is in use, the keyboard layout indicator currently 
becomes useless on X11 (because the IM daemon takes over keyboard layout 
management). But when the IM daemon goes away, it becomes useful again. 
Currently the user needs to do lots of manual steps to switch between them. 
Add/remove/hide one or the other, etc.
  
  It therefore IMHO makes sense to put the layout indicator into kimpanel as a 
fallback codepath (and on Wayland we'd currently always use this fallback until 
we figure out IM there properly). If the reaction to this is "eww, I don't 
understand kimpanel and I don't want to touch it", then that's exactly the 
problem: We need more core devs to review and improve kimpanel and integrate it 
properly into the core offering. It does things we need (our users rely on it), 
but it's currently developed largely in isolation and poorly integrated. That 
this is one of the few areas where we still ship two redundant/overlapping UI 
solutions is telling.

REPOSITORY
  R120 Plasma Workspace

REVISION DETAIL
  https://phabricator.kde.org/D12069

To: apol, #plasma
Cc: hein, graesslin, broulik, davidedmundson, plasma-devel, ragreen, Pitel, 
ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart


D12069: Implement a keyboard selector plasmoid

2018-04-09 Thread Eike Hein
hein added a comment.


  Dated shots but relevant: 
https://blogs.gnome.org/mclasen/2012/09/21/input-sources-in-gnome/

REPOSITORY
  R120 Plasma Workspace

REVISION DETAIL
  https://phabricator.kde.org/D12069

To: apol, #plasma
Cc: hein, graesslin, broulik, davidedmundson, plasma-devel, ragreen, Pitel, 
ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart


D12069: Implement a keyboard selector plasmoid

2018-04-21 Thread Martin Flöser
graesslin added a comment.


  I don't think that there's any reason to discard this. It's a start and 
improvement over the current situation and a fallback is needed anyway. So we 
start with the fallback instead of adding it later on.

REPOSITORY
  R120 Plasma Workspace

REVISION DETAIL
  https://phabricator.kde.org/D12069

To: apol, #plasma
Cc: hein, graesslin, broulik, davidedmundson, plasma-devel, ragreen, Pitel, 
ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart