Bug 345252

Summary: khotkeys can not save custom shortcut actions
Product: [Unmaintained] khotkeys Reporter: microcai <microcaicai>
Component: generalAssignee: Michael Jansen <kde>
Status: RESOLVED DUPLICATE    
Severity: grave CC: bj.cardon, bugs.kde.org.id324, cyanmystery, db0451, jason.tokarz, kdelibs-bugs, keplicz, majewsky, mgraesslin, mpritcha, nbigaouette, warthogdj
Priority: NOR    
Version: 5.3.1   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: there is where I set globalshortcut
Screenshot showing customised shortcut
Screenshot showing shortcut reverted to default after logout / login

Description microcai 2015-03-17 10:34:03 UTC
installed kde-frameworks/kglobalaccel-5.8.0

setting globalaccel in systemsettings5, but lost all settings when reboot.

Reproducible: Always

Steps to Reproduce:
1.  set custom globalaccel in systemsettings5
2. restart


Actual Results:  
all custom shotcut settings lost

Expected Results:  
custom shotcut settings shout be persistent
Comment 1 Martin Flöser 2015-03-17 11:56:40 UTC
could you please describe where and how you added the shortcut?
Comment 2 microcai 2015-03-17 17:31:35 UTC
Is there secondary way?

systemsettings -> keyborad shortcut -> custom shorcut
Comment 3 microcai 2015-03-17 17:37:44 UTC
Created attachment 91604 [details]
there is where I set globalshortcut
Comment 4 Martin Flöser 2015-03-18 07:39:03 UTC
that's khotkeys and has nothing to do with kglobalaccel (except that it uses it).

Could you please specify the version of khotkeys you are using - it looks quite KDE4ish.
Comment 5 microcai 2015-03-18 10:18:25 UTC
I‘m running kde-plasma/khotkeys-5.2.1

it looks quite KDE4ish because I use different decoration theme
Comment 6 Nicolas Bigaouette 2015-04-20 17:32:06 UTC
I'm having a similar issue.

Using plasma 5.2.2 & Qt 5.4.1 on ArchLinux x86_64. Keyboard shortcuts have been quite unstable for a long time, on different machines.

I often have trouble setting a shortcut; what often happens is that I set a shortcut in a specific application, and as soon as I close the application, the shortcut is gone. Or setting the shortcut succeed but using it will not.

I wanted to start a fresh config, so I moved my ~/.kde4 and ~/.config away before logging in. Changing some custom shortcuts in "System Settings -> Shortcuts -> Global Keyboard Shortcuts" does work (for example, F4 to maximize vertically), but in "System Settings -> Shortcuts -> Custom Shortcuts" I want to bind F12 to launch konsole. I can set the shortcut, but the "Command/URL" field of the "Action" tab is always cleared when I leave the panel (closing it or clicking the top left button to bring back to "Overview" of the System Settings panel).
Comment 7 Stefan Majewsky 2015-06-13 12:25:08 UTC
Confirmed on the khotkeys-5.3.1-1 Arch package (I explicitly ran "kcmshell5 khotkeys" to eliminate the possibility that I was using the KDE 4 KCM for whatever reasons).

To reproduce:
1. Run "kcmshell5 khotkeys".
2. Add an action with "New > Global Shortcut > Command/URL" (at least that's what I used).
3. Enter a command in the "Action" tab of the new action and "Apply".
4. Go to another action, then back to this action. -> The command is still remembered by the UI.
5. Close the KCM and open it up again, going back to the created action -> The command is now lost.

Also, the shortcut never works inbetween step 3 and 5.
Comment 8 Stefan Majewsky 2015-06-14 14:20:09 UTC
Here's a workaround that I've applied to my system that works for actions of the type "Global Shortcut > Command/URL". (It might also work for other action types if step 4 is adjusted appropriately.)

1. Create the shortcuts in the usual "Custom Shortcuts" UI. Don't bother filling in the commands, since as this bug says, they are not saved.
2. Save everything and close the app, then open the file ~/.config/khotkeysrc in a text editor. This file contains the keybindings you defined.
3. For each action, locate the section containing the name of your action. The section name will be something like "Data_5_2", for example in my case:

[Data_5_2]
Comment=Comment
Enabled=true
Name=Stop
Type=SIMPLE_ACTION_DATA

4. Locate the section called "Data_5_2Actions0" a few lines further below (i.e. the name of the previous section plus an "Actions0" suffix), and enter the command you want at the end of the line "CommandURL=". For example, in my case:

[Data_5_2Actions0]
CommandURL=mpc stop
Type=COMMAND_URL

5. Don't forget to repeat step 3 and 4 for every action you want to configure; then save and close the file.
6. Log out of Plasma and back in to reload the changed configuration. Shortcuts should now work properly.
Comment 9 bj.cardon 2015-07-09 20:59:44 UTC
I wanted to add to what Stefan said, as his instructions do work. However, they fail for me every time if I try to add a command to the shortcut. If I put a command in the UI it would never end up in the khotkeysrc file.
Comment 10 Jan 2015-07-30 18:37:12 UTC
The shortcuts seem to be registered in a wrong place. When I close and reopen the settings dialog a newly added shortcut is vanished from the "Custom Shortcut" section. An entry with the name and the assigned key reappears then under the "Global Shortcut" section. But the entry doesn't define the action anymore.

Furthermore when I try to add a custom shortcut a few times, the whole settings on the global shortcuts seem to be violated. Now the only component shown under "Global Shortcuts" is "System Settings". The other ones disappeared.

I'm using arch linux with Plasma 5.
Comment 11 Victor B. Gonzalez 2015-08-03 09:31:29 UTC
I just went through this and after going through the motions to set up a custom shortcut, they get lost. I'd usually get a "no service configured" when attempting the shortcut. I have a workaround that worked for me and hopefully it'll work in general.

Open System Settings and navigate to shortcuts.

Create your Custom Shortcuts and those shortcuts that fail (those that don't get called) in custom shortcuts where "action" tab has no entry, try this.

Go back to "Global Keyboard Shortcuts" and look in KDE component "KDE Daemon". In here you'll probably see the shortcuts you're having trouble with and it might look like they're assigned the proper shortcut. Highlight them and assign "none" to them. Hit apply and go back to custom shortcuts. Modify your shortcut once more and hit apply.

Hopefully it worked. If it didn't, I can further detail my exact steps. Hopefully it works :)
Comment 12 mpritcha 2015-08-13 04:47:40 UTC
Created attachment 94009 [details]
Screenshot showing customised shortcut
Comment 13 mpritcha 2015-08-13 04:48:15 UTC
Created attachment 94010 [details]
Screenshot showing shortcut reverted to default after logout / login
Comment 14 mpritcha 2015-08-13 04:48:46 UTC
Hello, I can see this on 5.2.2 as well. Please see screenshots I'll upload shortly.

To reproduce:
1) Run System Settings
2) Shortcuts -> Global Keyboard Shortcuts -> KDE component = plasmashell
3) Remove key assigned to 'Activate Application Launcher Widget'

(see attached screenshot called "Screenshot showing customised shortcut " - key is able to be used in other applications)

4) Logout
5) Login and run steps 1 & 2
6) Observe customisation has been lost

(see attached screenshot called "Screenshot showing shortcut reverted to default after logout / login")

I can't see any errors / warnings logged in ~/.xsession-errors or in the console if I run systemsettings5 from a terminal.

Keen to get this fixed, so let me know if there is anything else I can do to collect info.
Comment 15 Stefan Majewsky 2015-08-13 06:30:16 UTC
mpritcha: This sounds like a completely different bug. This bug is about losing actions (not shortcuts) in the Custom Shortcuts KCM (not the Global Shortcuts KCM). Can you open a new bug please?
Comment 16 Victor B. Gonzalez 2015-08-19 18:31:33 UTC
Please disregard my above workaround in comment 11. Even I can't get it to work but I can confirm that comment 8 has some meat to it. I got it to work without logging out by just going back into the "kcmshell5 khotkeys" and creating and deleting a null shortcut I can push apply to.

Anyhow, on Fedora 22, I've updated to "test updates" and enabled dvratil/plasma-5-beta and the shortcut issue is still around. I still can't create shortcuts from either of the interfaces "edit applications menu" or "kcmshell5 khotkeys".
Comment 17 Victor B. Gonzalez 2015-08-19 19:21:34 UTC
Hmm, I was running into this issue when trying to create shortcuts under Custom Shortcuts > KMenuEdit... but when I create shortcuts under Custom Shortcuts (not nested under KMenuEdit) the shortcuts work and apply successfully the first time, no fiddling with it.
Comment 18 warthogdj 2015-08-31 10:17:44 UTC
I also had this issue, the workaround for me was to :
add a custom shortcut and then add another custom shortcut (dumb), because only the last added was dismissed. Also i did not have to reboot simply reopening the shortcut editor was enough to see it was gone.
Comment 19 Jason Tokarz 2015-10-02 15:54:47 UTC
I have seen this problem also in khotkeys 5.4.1.

Further investigation shows that the keys are still configured under [khotkeys] section of kglobalshortcutsrc but they no longer appear in the custom shortcuts dialog and the keys no longer work.
Comment 20 Thomas Lübking 2015-10-10 21:49:01 UTC

*** This bug has been marked as a duplicate of bug 343891 ***
Comment 21 Daniel Boles 2015-12-16 18:50:43 UTC
Confirmed in 5.4.3-1 on Debian testing. Rather disruptive. Any other info I can help with to get it fixed?