Bug 397662

Summary: Activity Switcher not cycles through more than two activities on Wayland with Meta+Tab shortcut
Product: [Plasma] plasmashell Reporter: Alexander Mentyu <notuxius>
Component: Activity Switcher sidebarAssignee: Ivan Čukić <ivan.cukic>
Status: RESOLVED FIXED    
Severity: normal CC: dev.bacteriostat, f4tmike, g111, herzenschein, nate, oded, p.r.worrall, philipp.reichmuth, plasma-bugs, rapiteanu.catalin
Priority: NOR Keywords: wayland
Version: master   
Target Milestone: 1.0   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.24
Sentry Crash Report:

Description Alexander Mentyu 2018-08-20 15:45:57 UTC
Prerequisites:
Have more than two activities

Steps:
1. Open Activities with Meta+Q shortcut.
2. Use Meta+Tab shortcut.

Actual:
Activities are cycling only between current and next - but there is no switching to third, fourth and so on. Meta+Shift+Tab cycles backwards ok.

Distribution: KDE neon Developer Edition
Kernel: 4.15.0-29-generic
Plasma: 5.13.80
Apps: 18.11.70
Qt: 5.11.1
Frameworks: 5.48.0
Graphics:
Card-1: Intel driver: i915 v: kernel bus ID: 00:02.0 chip ID: 8086:5917 
Card-2: NVIDIA GM108M [GeForce 940MX] driver: nouveau v: kernel bus ID: 01:00.0 
chip ID: 10de:134d 
Display: wayland server: X.Org 1.19.6 driver: modesetting,nouveau 
unloaded: fbdev,vesa alternate: nvidia compositor: kwin wayland 
resolution: 1920x1080~57Hz 
OpenGL: renderer: Mesa DRI Intel UHD Graphics 620 (Kabylake GT2) v: 4.5 Mesa 18.0.5 
compat-v: 3.0 direct render: Yes
Comment 1 Michael K. 2019-11-21 13:36:39 UTC
Same behaviour under xorg. 
I defined alternative shortcuts to forward and backward key on my MS keyboard.
backward switching works but forward switching only toggles between the last and the current.

Operating System: openSUSE Tumbleweed 20191118
KDE Plasma Version: 5.17.3
KDE Frameworks Version: 5.64.0
Qt Version: 5.13.1
Kernel Version: 5.3.11-1-default
OS Type: 64-bit
Processors: 4 × Intel® Core™ i5-4590 CPU @ 3.30GHz
Memory: 15,5 GiB
Comment 2 Thiago Sueto 2020-08-23 03:07:46 UTC
Can confirm this on current Plasma from master branch.

Operating System: openSUSE Tumbleweed 20200818
KDE Plasma Version: 5.19.80
KDE Frameworks Version: 5.74.0
Qt Version: 5.15.0
Kernel Version: 5.8.0-1-default
Comment 3 Thiago Sueto 2020-08-23 03:10:44 UTC
Actually, the current Activity switcher on master does not cycle with Meta+Q, it cycles with Meta+Tab.
Comment 4 phrxmd 2021-04-19 14:10:20 UTC
I can confirm the same behaviour in the Task Switcher on Plasma 5.21.4, Frameworks 5.81.0 on X11 on OpenSUSE..
Comment 5 Paul Worrall 2021-06-29 08:45:44 UTC
(I think this is the same bug):

With the plasma keyboard shortcut settings set to default, Meta+Tab is assigned to "Walk through activities".  

In an X11 session Meta+Tab displays the activity switcher panel and walks through all activities (as expected). 

In a Wayland session Meta+Tab does not show the panel and only cycles between the most recent two activities.  Meta+Shift+Tab cycles backwards through all activities (but still doesn't show the panel in Wayland)

Operating System: KDE neon 5.22
KDE Plasma Version: 5.22.2
KDE Frameworks Version: 5.83.0
Qt Version: 5.15.3
Kernel Version: 5.8.0-59-generic (64-bit)
Graphics Platform: Wayland
Processors: 2 × AMD A6-6400K APU with Radeon(tm) HD Graphics
Memory: 7.7 GiB of RAM
Graphics Processor: AMD CEDAR
Comment 6 Oded Arbel 2021-09-19 05:36:11 UTC
The activity switcher behavior is still very much broken under Wayland - I think all these issues are related, but I can't be sure:

When using the "Walk through activities" shortcut by holding the modifiers (I use a non-default and more complex shortcut with multiple modifiers) and hitting the activation key repeatedly, the following behaviors can be observed - with no discernible reason as to which behavior is happening:
- switcher moves to next activity as expected.
- switcher cycles back and forth through only two activities (when there are more).
- switcher appears to try to switch to the next activity (the selector in the activities bar jumps to the next activity and wallpaper changes briefly) but then immediately goes back to the current one.

Sometimes hitting the activation key quickly multiple times can coax one of the other behaviors to appear, though for me the last one is the most consistent.
Comment 7 Bacteria 2021-10-18 05:50:45 UTC
Just updated to 5.23 and the Activity Switcher adds an entry to task manager sometimes when I switch activities in quick successions with some windows open in all activities. This happens both in X and Wayland. 

In addition to it, on Wayland, the switcher behaves like a window and shifts the windows already open instead of overlapping the windows.
Comment 8 Oded Arbel 2021-10-18 06:14:44 UTC
(In reply to Shavez from comment #7)
> Just updated to 5.23 and the Activity Switcher adds an entry to task manager
> sometimes when I switch activities in quick successions with some windows
> open in all activities. This happens both in X and Wayland. 

Huh! I was wandering what that new window, labeled "Plasma" with zero width, that started appearing recently. I didn't tie it to the activity switcher, but it looks like you are right - if I switch activities back and forth using the "Walk through activities" shortcut, I can see a new task manager entry labeled "Plasma" that disappears after a few seconds - and sometimes it doesn't disappear but remains until I close it with the taskbar context menu. This may warrant opening a new ticket?
Comment 9 Bacteria 2021-10-18 06:19:34 UTC
(In reply to Oded Arbel from comment #8)

> This may warrant opening a new ticket?

I guess you are right. I will open a new ticket.
Comment 10 Bacteria 2021-10-18 06:30:07 UTC
(In reply to Oded Arbel from comment #8)
> (In reply to Shavez from comment #7)
> > Just updated to 5.23 and the Activity Switcher adds an entry to task manager
> > sometimes when I switch activities in quick successions with some windows
> > open in all activities. This happens both in X and Wayland. 
> 
> Huh! I was wandering what that new window, labeled "Plasma" with zero width,
> that started appearing recently. I didn't tie it to the activity switcher,
> but it looks like you are right - if I switch activities back and forth
> using the "Walk through activities" shortcut, I can see a new task manager
> entry labeled "Plasma" that disappears after a few seconds - and sometimes
> it doesn't disappear but remains until I close it with the taskbar context
> menu. This may warrant opening a new ticket?

https://bugs.kde.org/show_bug.cgi?id=443941

Opened a new ticket.
Comment 11 g111 2021-11-23 18:52:55 UTC
Hello,

I am not sure if this is the same issue as I would like to report. I am on X11, not wayland. 

Currently I have configured 3 activities and the following shortcuts:
ctrl+alt+down => Walk through activities
ctrl+alt+up => Walk through activities (Reverse)

While the (Reverse) case correctly cycles through all 3 activities, the down-hotkey only switches to two of them.

Operating System: Kubuntu 21.10
KDE Plasma Version: 5.23.3
KDE Frameworks Version: 5.88.0
Qt Version: 5.15.2
Kernel Version: 5.13.0-21-generic (64-bit)
Graphics Platform: X11
Comment 12 g111 2021-12-15 09:06:07 UTC
I have found that I do not want to use
"Walk through activities" and "...(Reverse)"

but instead
"Switch to Next Activity" and "Switch to Previous Activity". 
This does what I want when pressing ctrl+alt+Cursor-Up/Down

Though I am not sure if the Walk Through actions should not reach all activities, too.
Comment 13 Ben Cooksley 2021-12-16 18:41:35 UTC
Git commit f4a2161017b831c91a532c6a1dfa5c40da423ef5 by Ben Cooksley, on behalf of David Redondo.
Committed on 16/12/2021 at 17:15.
Pushed by ngraham into branch 'master'.

switcherbackend: only map the workaround window once the switch is complete

Otherwise we will switch first to the new activity, but activating a new
window on the old activity will cause a switch back.

M  +5    -2    imports/activitymanager/switcherbackend.cpp

https://invent.kde.org/plasma/plasma-desktop/commit/f4a2161017b831c91a532c6a1dfa5c40da423ef5