Bug 452759 - OSD of keyboard layout unnecessarily appears when I start to type on Wayland
Summary: OSD of keyboard layout unnecessarily appears when I start to type on Wayland
Status: RESOLVED INTENTIONAL
Alias: None
Product: plasmashell
Classification: Plasma
Component: Keyboard Layout (show other bugs)
Version: master
Platform: Other Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: wayland
Depends on:
Blocks:
 
Reported: 2022-04-19 11:25 UTC by Patrick Silva
Modified: 2024-03-08 17:47 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Silva 2022-04-19 11:25:22 UTC
STEPS TO REPRODUCE
1. use Wayland session
2. make sure 'When logging on: Restore last session' option is enabled in Desktop Session KCM
3. add two keyboard layouts in 'Layouts' tab of Keyboard KCM. I added these:
first: English (US)
second: Portuguese (Brazil)
4. select the second keyboard layout via Keyboard Layout applet in the system tray
5. logout
6. login to Wayland session (notice that the second keyboard layout selected in the step 4 is already active accordng to the Keyboard Layout applet in the system tray)
7. open Kate and type any word

OBSERVED RESULT
OSD of the keyboard layout unnecessarily appears when you type the word in Kate

EXPECTED RESULT
OSD should not appear

SOFTWARE/OS VERSIONS
Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.24.80
KDE Frameworks Version: 5.94.0
Qt Version: 5.15.3
Graphics Platform: Wayland
Comment 1 Andrey 2022-04-19 16:52:59 UTC
What is your Layout switching policy - is it Global or per App/Window?
IIRC, the logic behind that behavior with App/Window policy is following:
- on login, last used layout is restored, but for the window currently active only (which might be Desktop itself or so), as if you had changed it yourself
- when you open a new app (Kate), it has internally saved "last used" layout initialized to a first layout which is  US in your list
- when the app got activated, the current layout is compared to a saved one for this app/window. If they differ, OSD happens which you got here
The same logic will probably take place with App/Window policy even without logout/login.

Can we perceive it as a feature as a logic behind is pretty solid? I'm afraid we would need hacks to suppress it.
Comment 2 Patrick Silva 2022-04-19 17:25:49 UTC
My Layout switching policy is Global.
Comment 3 Andrey 2022-04-19 18:24:46 UTC
Ok. Then it's side-effect of the implementation.
Do you think it can't be considered as a "feature", still?
Comment 4 Patrick Silva 2022-04-19 19:29:12 UTC
I don't think unexpected and pointless behavior like this can be considered a feature.
Comment 5 Andrey 2022-04-19 19:35:29 UTC
There is still point - it reminds you the layout has changed implicitly
Comment 6 Nate Graham 2022-04-19 19:37:17 UTC
But the reminder is shown at an unexpected time. If we want to make this a feature, it should show the OSD at the moment of login, or the first time the user types something.

If that's not possible, we should suppress the OSD in this case.
Comment 7 Andrey 2022-04-19 19:41:33 UTC
That suppression might be a hacky as we don't have an easy way to handle this situation, AFAIK.
But yes I remember I faced something like this when I implemented all this stuff, so thank you for the catch anyway.
Comment 8 cantabile 2022-06-02 13:25:12 UTC
This only happens in the Wayland session. The X11 session doesn't do this.
Comment 9 Andrey 2022-06-02 20:20:01 UTC
(In reply to cantabile from comment #8)
> This only happens in the Wayland session. The X11 session doesn't do this.

Right, that OSD for X11 is not implemented for X11 at all AFAIK.
Comment 10 cantabile 2022-06-03 09:30:14 UTC
I do get the same OSD when I switch the layout with the keyboard shortcut in X11. It just doesn't appear when I go from Firefox (Romanian layout) to Konsole (US layout) and start typing, for example, even though the layout switches automatically. When I do the same thing in the Wayland session the OSD appears when I start typing.
Comment 11 Patrick Silva 2023-11-12 12:44:45 UTC
*** Bug 476832 has been marked as a duplicate of this bug. ***
Comment 12 Silver Salonen 2024-02-03 21:34:18 UTC
I've now noticed that sometimes the displayed OSD even manages to steal focus from the application. For example, when switching quickly with ALT+TAB from browser to editor with a different keyboard layout and starting typing right away, you may notice a few seconds later that the text cursor focus is not in the editor.
Comment 13 Andrey 2024-02-03 21:50:30 UTC
(In reply to cantabile from comment #10)
> When I do the same thing in the Wayland session the
> OSD appears when I start typing.

What is your layout switching policy?
The behavior you describe is specific to Wayland, at least for the App/Window switching policy (I'm not sure about Global one).
If you don't like it, you can disable the OSD in Keyboard KCM.

So I would say the bug is described confusingly. If it's problem with some corner case it should be clear from the heading.
The OSD when you start typing in window with another layout is expected feature for Wayland.
Comment 14 Denis Lisov 2024-02-04 08:29:48 UTC
(In reply to Andrey from comment #13)
> The OSD when you start typing in window with another layout is expected
> feature for Wayland.

Would it make more sense to show the layout indicator right after switching windows, without waiting for the next keystroke?

I can say for myself that I had to disable the indicator due to this bug. The indicator appearing on changing language felt like a nice confirmation; the indicator appearing on window switch would feel like a reminder too.
The indicator appearing when I start typing felt different, more like an error of some kind, and kicked me out of the "composing text" context into the "reacting to events" one. Especially annoying when it did this every time when switching between text-operated windows with different layouts (think editor where I was writing text in English and a related chat I was having in a different language). If it happened on window switch it'd be perfectly okay for me as it'd overlap my context switch, but happening on the first keystroke it roughly doubled the context switch time for me and created an extra useless distraction.

Trying to think about this some more I'd say that the problem is that for me it introduces a new and totally unneeded concept of "previous global layout". If I switch to a different window, then get slightly distracted and don't keep in mind that I came here from WINDOW, I don't remember what the keyboard layout was before switch, and have no way to guess whether the OSD will appear or not when I start typing. Especially given that the layout indicator (correctly) shows the new layout, not the old one.

As yet another view on this problem, an indicator on the first keystroke is useless because it's too late. If I'm not looking at the screen I won't notice it at all. If I'm looking at the screen and the layout matches my intention it feels like an annoying "yeah, you're right" reminder. If I'm looking at the screen and the layout does not match my intention it comes at the same time I'd notice I'm typing wrong characters. In both latter cases it steals my personal attention focus without giving anything in return. Oh, and if I start with doing some interactive task like moving the cursor to the correct place it just breaks me out of the flow of this task.

As a conclusion, I'd personally say that the minimal fix would be to show the indicator on window switch without delaying it to the first keystroke. I can also imagine some neat options that would be more invasive (like a language indicator for a window titlebar and making the notification into an animation of/around that indicator).
Comment 15 Silver Salonen 2024-02-04 09:03:31 UTC
(In reply to Andrey from comment #13)
> If you don't like it, you can disable the OSD in Keyboard KCM.

Where exactly is that setting? Sorry, I can't find it (in Plasma 5).
Comment 16 Denis Lisov 2024-02-04 13:28:55 UTC
(In reply to Silver Salonen from comment #15)
> (In reply to Andrey from comment #13)
> > If you don't like it, you can disable the OSD in Keyboard KCM.
> 
> Where exactly is that setting? Sorry, I can't find it (in Plasma 5).

For me there's a checkbox "OSD on layout change" in Settings - Keyboard - Layouts tab, in the "Shortcuts for switching layouts" group.
Comment 17 Silver Salonen 2024-02-04 13:30:44 UTC
(In reply to Denis Lisov from comment #16)
> (In reply to Silver Salonen from comment #15)
> > (In reply to Andrey from comment #13)
> > > If you don't like it, you can disable the OSD in Keyboard KCM.
> > 
> > Where exactly is that setting? Sorry, I can't find it (in Plasma 5).
> 
> For me there's a checkbox "OSD on layout change" in Settings - Keyboard -
> Layouts tab, in the "Shortcuts for switching layouts" group.

For me there's not. Are you on Plasma 6 perhaps?
Comment 18 Andrey 2024-02-05 09:25:51 UTC
(In reply to Denis Lisov from comment #14)
> (In reply to Andrey from comment #13)
> > The OSD when you start typing in window with another layout is expected
> > feature for Wayland.
> 
> Would it make more sense to show the layout indicator right after switching
> windows, without waiting for the next keystroke?
That would unnecessary show OSD if you switch windows without typing.
Anyway, the feature implementation details should go to another report, thanks.
Comment 19 Silver Salonen 2024-02-05 10:37:14 UTC
(In reply to Andrey from comment #18)
> (In reply to Denis Lisov from comment #14)
> > (In reply to Andrey from comment #13)
> > > The OSD when you start typing in window with another layout is expected
> > > feature for Wayland.
> > 
> > Would it make more sense to show the layout indicator right after switching
> > windows, without waiting for the next keystroke?
> That would unnecessary show OSD if you switch windows without typing.
> Anyway, the feature implementation details should go to another report,
> thanks.

I actually just recently noticed this happening in Plasma 5 with X11 on Ubuntu, so this seems to be implemented already. Or is it only with X11 and not with Wayland?
Comment 20 Bug Janitor Service 2024-02-20 03:46:06 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 21 Bug Janitor Service 2024-03-06 03:46:53 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!
Comment 22 Patrick Silva 2024-03-06 09:32:50 UTC
This bug persists.

Operating System: KDE neon Unstable Edition
KDE Plasma Version: 6.0.80
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Graphics Platform: Wayland
Comment 23 Andrey 2024-03-08 17:47:54 UTC
(In reply to Andrey from comment #13)
> The OSD when you start typing in window with another layout is expected
> feature for Wayland.

If we want it to be actionable, let's please create another report, thanks.