Bug 434713 - Nothing happens when I press the keyboard shortcut of Keyboard Layout applet by the first time
Summary: Nothing happens when I press the keyboard shortcut of Keyboard Layout applet ...
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Keyboard Layout (show other bugs)
Version: master
Platform: Neon Linux
: NOR normal
Target Milestone: 1.0
Assignee: Andrey
URL: https://zren.github.io/2018/11/25/hid...
Keywords:
: 451993 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-03-21 12:01 UTC by Patrick Silva
Modified: 2022-08-01 22:29 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.26


Attachments
screenshot (33.55 KB, image/png)
2021-03-21 12:01 UTC, Patrick Silva
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Silva 2021-03-21 12:01:08 UTC
Created attachment 136912 [details]
screenshot

STEPS TO REPRODUCE
1. start Wayland session
2, enable Keyboard Layout applet in system tray
3. enable flag and assign a keyboard shortcut in the settings of Keyboard Layout applet
4. press the assigned keyboard shortcut: nothing happens
5. press the assigned keyboard shortcut again: as we can see in the attached screenshot, keyboard layout popup opens with blurry flag and the flag disappears from system tray

EXPECTED RESULT
I'm not sure what is the purpose of the keyboard shortcut of Keyboard Layout
applet, but clearly the current behavior is not correct.

SOFTWARE/OS VERSIONS
Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.21.80
KDE Frameworks Version: 5.81.0
Qt Version: 5.15.2
Graphics Platform: Wayland
Comment 1 Andrey 2021-03-21 12:53:34 UTC
Currently the shortcut is not handled in any special way, so that behavior lead from standard plasmoid's handling.
Intended common behavior is to activate the applet - the same as you do clicking it.
In the screenshot we see the applet starts behave as it have Compact Mode, but is wasn't designed to have one. So it seems some weird side effects from Plasma side. Not sure what we can do in the applet itself.
Comment 2 Patrick Silva 2021-03-21 13:51:31 UTC
keyboard shortcuts work consistently with all applets I have tried (sound, notifications, battery, vautls, disks & devices).
Comment 3 Andrey 2021-03-21 14:14:07 UTC
Yes, that's because they all have Compact Representation probably
Comment 4 Nate Graham 2021-03-21 15:01:23 UTC
UPSTREAM is not  logical status here.

Andrey is correct that the intended means of changing the layout is in the keyboard KCM, but Patrick is also right that assigning a shortcut to the applet itself is buggy and should work properly. It's a valid concern.

I notice that assigning a shortcut to the Night Color applet also behaves oddly, and it also has no popup, same as the Keyboard Layout applet.
Comment 5 Andrey 2021-04-22 16:52:34 UTC
One of the possible solutions Nate suggested is to get rid of that shortcut's setting altogether. Because it's useless anyway.
Still, I don't know if it possible.
Comment 6 Nate Graham 2021-04-22 17:06:17 UTC
To be clear, we can remove the keyboard shortcut for activating the applet itself because there are already existing global keyboard shortcuts for switching keyboard layouts. So there is no need to have two methods to set different shortcuts to do the exact same thing.
Comment 7 Andrey 2021-05-17 13:35:38 UTC
Some links I got form the community, thanks driglu4it:
Hiding Plasma Widget Global Shortcut Tab:
https://zren.github.io/2018/11/25/hiding-plasma-widget-global-shortcut-tab
https://github.com/Zren/plasma-applet-tiledmenu/blob/master/package/contents/ui/config/ConfigGeneral.qml
Comment 8 Andrey 2021-06-11 16:40:55 UTC
*** Bug 438460 has been marked as a duplicate of this bug. ***
Comment 9 Driglu4it 2021-06-16 11:14:29 UTC
The widget shows the full representation only from the system tray (from the panel it works as it should).
Comment 10 Andrey 2022-03-28 15:37:00 UTC
*** Bug 451993 has been marked as a duplicate of this bug. ***
Comment 11 Driglu4it 2022-03-29 11:57:39 UTC
To prevent the assignment of a third-party shortcut, you can remove the remove tab from the widget settings. Put this in the root element of the widget settings page (configGeneral.qml - formLayout):

        function getTopItem(item) {
		var curItem = item
		while (curItem.parent) {
			curItem = curItem.parent
		}
		return curItem
	}
	function hideKeyboardShortcutTab() {
		var appletConfiguration
                appletConfiguration = getTopItem(app)
		if (typeof appletConfiguration !== "undefined" && typeof appletConfiguration.globalConfigModel !== "undefined") {
			appletConfiguration.globalConfigModel.removeCategoryAt(0)
		}
	}
	Component.onCompleted: {
		hideKeyboardShortcutTab()
	}
Comment 12 Driglu4it 2022-04-19 18:19:48 UTC
Or we can override the action of the shortcut to activate the plasmoid so that it switches the layout without opening the full widget representation.
Comment 13 Chris Holland 2022-04-19 19:42:35 UTC
Keep in mind that I recently had to refactor the hide keyboard shortcut code as the AppletConfiguration is no longer the top root item in Plasma 5.24

* https://github.com/Zren/plasma-applet-tiledmenu/blame/master/package/contents/ui/config/ConfigGeneral.qml#L21
* https://github.com/Zren/plasma-applet-tiledmenu/commit/ea15d8a2f141f0676b9608815a20707f0070b503
Comment 14 Andrey 2022-04-19 19:44:13 UTC
Thanks you for let us know, Chris
Comment 15 Andrey 2022-07-27 15:27:14 UTC
(In reply to Chris Holland from comment #13)
> *
> https://github.com/Zren/plasma-applet-tiledmenu/blame/master/package/
> contents/ui/config/ConfigGeneral.qml#L21
> *
> https://github.com/Zren/plasma-applet-tiledmenu/commit/
> ea15d8a2f141f0676b9608815a20707f0070b503

We still need to remove existing shortcut from the config, any ideas?
Comment 16 Bug Janitor Service 2022-07-28 13:11:48 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/1065
Comment 17 Andrey 2022-07-29 10:51:23 UTC
Git commit 098a965b5df31a7b6a212b5269eecb36b9dadc6c by Andrey Butirsky.
Committed on 29/07/2022 at 10:51.
Pushed by butirsky into branch 'master'.

applets/keyboardlayout: fix unexpected expansion to full representation

As a workaround, remove Keyboard Shortcuts configuration tab and already
assigned shortcuts for the applet

M  +11   -0    applets/keyboardlayout/contents/ui/configGeneral.qml
A  +25   -0    desktoppackage/contents/updates/keyboardlayout_remove_shortcut.js

https://invent.kde.org/plasma/plasma-desktop/commit/098a965b5df31a7b6a212b5269eecb36b9dadc6c