Bug 374575

Summary: "Shortcut for switching to this activity" has no effect when set from the Activities KCM
Product: [Plasma] plasmashell Reporter: Shitikanth <golu3990>
Component: Activity SwitcherAssignee: Ivan Čukić <ivan.cukic>
Status: RESOLVED FIXED    
Severity: normal CC: aarmn80, bob, bugs.kde.org, christian, f4tmike, fabrice.salvaire, fdelgado.it, fortissimoX, halbach.volker, j.georkas, kde, kde, knut.hildebrandt, likivik, muesli, mutlaqja, nate, notuxius, petrbren, plasma-bugs, stanczakdominik, thomas.bigot, ville.aakko, wbauer1
Priority: NOR    
Version: master   
Target Milestone: 1.0   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.18.8
Attachments: kglobalshortcutsrc file generated through activity manager, and through global shortcuts, for comparison

Description Shitikanth 2017-01-05 04:11:40 UTC
Steps to reproduce:

1. Open the Activity Switcher.

2. Click the Configure button for any activity.

3. Go to "Other" tab and set a shortcut for the activity and press Ok. (I used "Meta+1")

4. Pressing the shortcut does not open the activity. 

5. If we open the settings for that activity, we can see that the shortcut is still "None".
Comment 1 Kai Uwe Broulik 2017-01-05 13:26:19 UTC
Meta+Number is now assigned to the task manager.
The bug is that Plasma doesn't confirm that a shortcut is already taken (usually it would ask "Would you still like to assign?") and just discards your choice.
Comment 2 Shitikanth 2017-01-05 16:33:26 UTC
@Kal, I had actually tried a number of key combinations and none of them worked. Can you perhaps point out something that *would* work?
Comment 3 Ivan Čukić 2017-01-16 11:12:17 UTC
*** Bug 360975 has been marked as a duplicate of this bug. ***
Comment 4 Knut Hildebrandt 2017-05-22 21:10:13 UTC
The same here and that for a while. I tried to assign Meta-F1 etc. They seem to get assigned but after saving and reopening the configuration menu the settings have disappeared again.
Comment 5 Alexander Mentyu 2017-12-02 08:51:28 UTC
Looks related to https://bugs.kde.org/show_bug.cgi?id=386783
Comment 6 David Edmundson 2017-12-04 14:10:17 UTC
*** Bug 386783 has been marked as a duplicate of this bug. ***
Comment 7 Erik Quaeghebeur 2018-06-11 19:51:49 UTC
Duplicate of Bug 342186?
Comment 8 Ivan Čukić 2018-08-07 08:03:53 UTC
*** Bug 342186 has been marked as a duplicate of this bug. ***
Comment 9 Ivan Čukić 2018-08-07 09:07:00 UTC
Hopefully this works in current master.

If it does not, try the following steps:

- stop kactivitymanagerd and kglobalaccel5
- edit the kglobalshortcutsrc and remove the section for activity manager
- restart kactivitymanagerd and kglobalaccel5

Set the shortcuts via System Settings -> Shortcuts -> Global Shortcuts -> Activity Manager

The issue that remains is that setting the shortcut via the activities kcm is broken.
Comment 10 Nate Graham 2018-08-08 14:08:42 UTC
Can anyone reproduce this? I cannot. Let's call it fixed, and if anyone running recent software can still reproduce it, we can re-open it.

Thanks folks!
Comment 11 Shitikanth 2018-10-29 20:20:47 UTC
@Nate, I can still reproduce this bug, with the same steps as before. 
(KDE Plasma version 5.14.2)
Comment 12 Nate Graham 2018-11-01 03:26:27 UTC
Darn. Can you do as Ivan asked?

> If it does not, try the following steps:
> 
> - stop kactivitymanagerd and kglobalaccel5
> - edit the kglobalshortcutsrc and remove the section for activity manager
> - restart kactivitymanagerd and kglobalaccel5
> 
> Set the shortcuts via System Settings -> Shortcuts -> Global Shortcuts ->
> Activity Manager
> 
> The issue that remains is that setting the shortcut via the activities kcm
> is broken.
Comment 13 Shitikanth 2018-11-04 18:11:58 UTC
@Nate, I tried Ivan's suggestions again, and it works! Thanks.
Comment 14 Ville Aakko 2019-01-27 16:37:54 UTC
Hi,

Shortcuts to switching X activity still do not sometimes work.

FWIW, I originally set my shortcuts keys as suggested by Ivan - didn't even know it is possible to do the way as in original report.

Ivans workaroung works, but only for after a few reboots, after shortcut keys stop working again.

(Plasmashell 5.14.5 on Arch Linux)
Comment 15 Christian Muehlhaeuser 2019-04-11 18:22:59 UTC
Experiencing the same problem here. It works occasionally, but most of the times they simply don't work. Set mine to Meta/Win + F-keys.
Comment 16 halbach.volker 2019-06-16 20:07:29 UTC
There are workarounds out there. Obviously it won't be fixed. But then please remove at least the option to assign shortcuts in Desktop Behaviour>Activities, so that people don't try there. It will people save time if nonfunctional clutter is removed.
Comment 17 Christian Parpart 2020-02-17 08:29:53 UTC
Sadly, I've to put myself onto the list. If Any KDE developer is listening. What's the policy of fixing bugs? Is this considered one? It's 3 years old now.
If you refuse to fix this bug, you could at least either remove this feature (because it is highly frustrating), or put a bounty on fixing it, so that external volunteers feel motivated enough to try fixing it, or 3rd, you provide some hints what to do to fix it.

That would be really awesome :)
Comment 18 Likivik 2020-03-21 10:32:21 UTC
Seems to still be an issue.

(In reply to Ivan Čukić from comment #9)
> Hopefully this works in current master.
> 
> If it does not, try the following steps:
> 
> - stop kactivitymanagerd and kglobalaccel5
> - edit the kglobalshortcutsrc and remove the section for activity manager
> - restart kactivitymanagerd and kglobalaccel5
> 
> Set the shortcuts via System Settings -> Shortcuts -> Global Shortcuts ->
> Activity Manager
> 
> The issue that remains is that setting the shortcut via the activities kcm
> is broken.
---

Could you help a noob to figure out how to do these steps?

---
Operating System: NixOS 19.09.2229.d7843c8add6
KDE Plasma Version: 5.16.5
KDE Frameworks Version: 5.61.0
Qt Version: 5.12.3
Kernel Version: 4.19.108
OS Type: 64-bit
Processors: 2 × Intel® Pentium® CPU G3220 @ 3.00GHz
Memory: 8,7 GiB of RAM
Comment 19 Likivik 2020-03-21 10:40:37 UTC
*** Bug 397134 has been marked as a duplicate of this bug. ***
Comment 20 Dominik Stańczak 2020-07-23 09:46:43 UTC
Created attachment 130330 [details]
kglobalshortcutsrc file generated through activity manager, and through global shortcuts, for comparison

While this bug does still occur, Ivan's fix does help sidestep it. I'm attaching an example of the relevant part of the kglobalshortcutsrc file as generated through Global Shortcuts and through the Activity Manager.

I notice two things:

* Global shortcuts go "hotkey,none", while Activity manager does "none,hotkey" - adding the set hotkey as the secondary one
* ActivityManager generates a bunch of spurious activities the IDs of which I haven't been able to track down.
Comment 21 Dominik Stańczak 2020-07-23 09:49:28 UTC
One more note - I would honestly be in favor of removing this functionality while it doesn't work. I would suspect somewhere around https://invent.kde.org/search?utf8=%E2%9C%93&snippets=false&scope=&repository_ref=master&search=shortcut&group_id=1568&project_id=2674 would be the place to do that?
Comment 22 Michael K. 2020-07-23 11:21:39 UTC
(In reply to Dominik Stańczak from comment #21)
> One more note - I would honestly be in favor of removing this functionality
> while it doesn't work. I would suspect somewhere around
> https://invent.kde.org/
> search?utf8=%E2%9C%93&snippets=false&scope=&repository_ref=master&search=shor
> tcut&group_id=1568&project_id=2674 would be the place to do that?

+1
Features that don't work mess up the user experience - fatal for new users..
Comment 23 Ivan Čukić 2020-07-23 15:02:52 UTC
I proposed removing this some time ago as the shortcut can be set from Shortcuts KCM, but I was told it will be fixed.

That hasn't happened, so I'm in favor of removing this part of the configuration. Expect the patch soon.
Comment 24 Bug Janitor Service 2020-07-23 15:15:21 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/78
Comment 25 David Edmundson 2020-09-25 08:59:58 UTC
>kglobalshortcutsrc file generated through activity manager, and through global shortcuts, for comparison

So keys and defaultKeys get switched. 

Probably means someone is using the wrong type of setShortcut somewhere and not setting autoloading.
Comment 26 Bug Janitor Service 2020-09-25 14:01:43 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/164
Comment 27 Bug Janitor Service 2020-09-25 14:02:02 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kactivitymanagerd/-/merge_requests/6
Comment 28 David Edmundson 2020-09-25 14:58:13 UTC
Git commit bd2fab0a52f85cad26c5dd1562313e4138d3352c by David Edmundson.
Committed on 25/09/2020 at 14:57.
Pushed by davidedmundson into branch 'master'.

Use correct way to register for a shortcut

setDefaultShortcut sets a default shortcut, but it doesn't bind it to
the action.

We want setShortcut.

setGlobalShortcut wraps both. By setting autoloading, it doesn't
actually overwrite the user-set shortcut if one is set.

M  +1    -1    src/service/plugins/globalshortcuts/GlobalShortcutsPlugin.cpp

https://invent.kde.org/plasma/kactivitymanagerd/commit/bd2fab0a52f85cad26c5dd1562313e4138d3352c
Comment 29 David Edmundson 2020-09-25 14:58:54 UTC
Git commit 3bd3ef32a6fead65e7925e097a7abe51909231d5 by David Edmundson.
Committed on 25/09/2020 at 14:58.
Pushed by davidedmundson into branch 'Plasma/5.20'.

Use correct way to register for a shortcut

setDefaultShortcut sets a default shortcut, but it doesn't bind it to
the action.

We want setShortcut.

setGlobalShortcut wraps both. By setting autoloading, it doesn't
actually overwrite the user-set shortcut if one is set.


(cherry picked from commit bd2fab0a52f85cad26c5dd1562313e4138d3352c)

M  +1    -1    src/service/plugins/globalshortcuts/GlobalShortcutsPlugin.cpp

https://invent.kde.org/plasma/kactivitymanagerd/commit/3bd3ef32a6fead65e7925e097a7abe51909231d5
Comment 30 David Edmundson 2020-09-25 14:59:37 UTC
Git commit c5413826168497c361bb7122f9910b267e1e8e50 by David Edmundson.
Committed on 25/09/2020 at 14:59.
Pushed by davidedmundson into branch 'master'.

[kcms/activities] Use correct method to set active global shortcut

We're not binding to the action so we don't want setGlobalShortcut. We
also need to not autoload in order to actually save anything.

M  +1    -2    kcms/activities/imports/dialog.cpp

https://invent.kde.org/plasma/plasma-desktop/commit/c5413826168497c361bb7122f9910b267e1e8e50
Comment 31 David Edmundson 2020-09-25 14:59:58 UTC
Git commit 33fd305870d2be3996fa79a2480db1a7521bca3c by David Edmundson.
Committed on 25/09/2020 at 14:59.
Pushed by davidedmundson into branch 'Plasma/5.20'.

[kcms/activities] Use correct method to set active global shortcut

We're not binding to the action so we don't want setGlobalShortcut. We
also need to not autoload in order to actually save anything.


(cherry picked from commit c5413826168497c361bb7122f9910b267e1e8e50)

M  +1    -2    kcms/activities/imports/dialog.cpp

https://invent.kde.org/plasma/plasma-desktop/commit/33fd305870d2be3996fa79a2480db1a7521bca3c
Comment 32 Nate Graham 2020-10-05 20:37:20 UTC
*** Bug 427256 has been marked as a duplicate of this bug. ***
Comment 33 Wolfgang Bauer 2021-01-18 11:22:44 UTC
*** Bug 398069 has been marked as a duplicate of this bug. ***
Comment 34 Wolfgang Bauer 2021-01-18 11:24:53 UTC
*** Bug 417853 has been marked as a duplicate of this bug. ***
Comment 35 Wolfgang Bauer 2021-01-18 11:25:22 UTC
@David Edmundson:
Could the fixes be backported to the 5.18 LTS branch too, please?
They do apply cleanly and fix the problem there as well, AFAICT.
Comment 36 David Edmundson 2021-01-18 11:35:37 UTC
Git commit ac03e7c5f150f25f4560f5b2d9b084a45a212737 by David Edmundson.
Committed on 18/01/2021 at 11:35.
Pushed by davidedmundson into branch 'cherry-pick-bd2fab0a'.

Use correct way to register for a shortcut

setDefaultShortcut sets a default shortcut, but it doesn't bind it to
the action.

We want setShortcut.

setGlobalShortcut wraps both. By setting autoloading, it doesn't
actually overwrite the user-set shortcut if one is set.


(cherry picked from commit bd2fab0a52f85cad26c5dd1562313e4138d3352c)

M  +1    -1    src/service/plugins/globalshortcuts/GlobalShortcutsPlugin.cpp

https://invent.kde.org/plasma/kactivitymanagerd/commit/ac03e7c5f150f25f4560f5b2d9b084a45a212737
Comment 37 David Edmundson 2021-01-18 11:35:50 UTC
Git commit 395aba0f3dc2e076715c64ec19d9f1487630a4dd by David Edmundson.
Committed on 18/01/2021 at 11:35.
Pushed by davidedmundson into branch 'cherry-pick-33fd3058'.

[kcms/activities] Use correct method to set active global shortcut

We're not binding to the action so we don't want setGlobalShortcut. We
also need to not autoload in order to actually save anything.


(cherry picked from commit c5413826168497c361bb7122f9910b267e1e8e50)

(cherry picked from commit 33fd305870d2be3996fa79a2480db1a7521bca3c)

M  +1    -2    kcms/activities/imports/dialog.cpp

https://invent.kde.org/plasma/plasma-desktop/commit/395aba0f3dc2e076715c64ec19d9f1487630a4dd
Comment 38 Wolfgang Bauer 2021-01-18 11:39:53 UTC
@David Edmundson:
Could the fixes be backported to the 5.18 LTS branch too, please?
They do apply cleanly and fix the problem there as well, AFAICT.
Comment 39 Nate Graham 2021-01-19 17:13:35 UTC
Git commit 52c5290bf48bb96b9e0073880c72abf7c9c14c50 by Nate Graham, on behalf of David Edmundson.
Committed on 19/01/2021 at 17:13.
Pushed by ngraham into branch 'Plasma/5.18'.

[kcms/activities] Use correct method to set active global shortcut

We're not binding to the action so we don't want setGlobalShortcut. We
also need to not autoload in order to actually save anything.


(cherry picked from commit c5413826168497c361bb7122f9910b267e1e8e50)

(cherry picked from commit 33fd305870d2be3996fa79a2480db1a7521bca3c)

(cherry picked from commit 395aba0f3dc2e076715c64ec19d9f1487630a4dd)

M  +1    -2    kcms/activities/imports/dialog.cpp

https://invent.kde.org/plasma/plasma-desktop/commit/52c5290bf48bb96b9e0073880c72abf7c9c14c50
Comment 40 Nate Graham 2021-01-19 17:14:19 UTC
Done.
Comment 41 Wolfgang Bauer 2021-05-10 10:15:08 UTC
(In reply to Nate Graham from comment #40)
> Done.

I just noticed that the (more important) fix to kactivitymanagerd was still missing in Plasma 5.18.7 though. (see comment#28/comment#29)

Can you please cherry-pick that to the 5.18 branch as well?
Thanks.
Comment 42 Nate Graham 2021-05-10 16:28:54 UTC
Git commit 0429ab68833c46bb513d440d998326698ce41144 by Nate Graham, on behalf of David Edmundson.
Committed on 10/05/2021 at 16:28.
Pushed by ngraham into branch 'Plasma/5.18'.

Use correct way to register for a shortcut

setDefaultShortcut sets a default shortcut, but it doesn't bind it to
the action.

We want setShortcut.

setGlobalShortcut wraps both. By setting autoloading, it doesn't
actually overwrite the user-set shortcut if one is set.


(cherry picked from commit bd2fab0a52f85cad26c5dd1562313e4138d3352c)

M  +1    -1    src/service/plugins/globalshortcuts/GlobalShortcutsPlugin.cpp

https://invent.kde.org/plasma/kactivitymanagerd/commit/0429ab68833c46bb513d440d998326698ce41144