![]() Registered Member ![]()
|
I am modifying file ~/.kde/share/config/kglobalshortcutsrc and trying to make kglobalaccel process to reload its config (Python)
This also doesn't work:
But when i go to System Settings, i don't see my shortcut there. If i do
everything is ok. What might be the problem? |
![]() Administrator ![]()
|
I suspect kglobalaccel is not intended to support having it's configuration file changed from underneath it.
What are you attempting to do by manipulating the kglobalaccel configuration file? The recommended method of interacting with KGlobalAccel is through the class in kdelibs which shares it's name.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
![]() Registered Member ![]()
|
I did a program for changing my KDE configuration in bulk (https://github.com/warvariuc/mykde).
One of the actions is setting additional global shortcuts. So am doing this by modifying file ~/.kde/share/config/kglobalshortcutsrc. |
![]() Administrator ![]()
|
I see. Upon checking the code used by the control module, it appears that it interfaces not with the configuration file, but with kglobalaccel itself, over D-Bus (as all other KDE applications do, when setting global shortcuts).
I suggest either ensuring that kglobalacceld is restarted after completing your modifications, or porting your script to use doRegister and setShortcut, which are parts of the kglobalaccel D-Bus API.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
![]() Registered Member ![]()
|
This is what i do - restart kglobalacceld. doRegister and setShortcut are making permanent changes? |
![]() Administrator ![]()
|
The D-Bus commands doRegister and setShortcut will make the changes at runtime, using the standard mechanisms which are used by all KDE applications. If you were to use this mechanism, then it would not be necessary to restart kglobalacceld.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
![]() Registered Member ![]()
|
Can you please point to the control module source which calls doRegister - i want to see how to use the dbus interface. I downloaded KDE sources and looked into kde-workspace/khotkeys/kcm_hotkeys/kcm_hotkeys.cpp but there is communicates only with org.kde.kded/modules/khotkeys UPDATE: Ah, i think i found it: kde-workspace/kcontrol/keys/kglobalshortcutseditor.cpp
Last edited by blindvic on Sat Sep 21, 2013 8:39 am, edited 1 time in total.
|
![]() Registered Member ![]()
|
Also i want to set a global shortcut to launch terminal or other applications, but changing the config files is a too complex task in this case, because there are too many entries to change.
Is there a dbus interface for this too? Or a class in PyKDE4? |
![]() Administrator ![]()
|
kglobalaccel is only responsible for global shortcuts - so the doRegister / setShortcut combination of D-Bus API should suffice... does this not work in this case?
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
![]() Registered Member ![]()
|
I looked for doRegister string in the sources:
but cannot figure out how to use doRegister. Looked at the dbus interface - it expects actionId, which i don't know what is. Also, in my task i want to reassign global shortcut Win+L to lock screen, and when i add this shortcut via system settings, it says that this shortcut is already assigned to a Kwin action and allows me to use this shortcut anyway. When i change the shortcut directly in config files, i unset the shortcut manually in Kwin section. But is this possible via doRegister? Thanks! |
![]() Administrator ![]()
|
You could try looking into http://api.kde.org/pykde-4.2-api/kdeui/ ... Accel.html
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
Registered users: Bing [Bot], blue_bullet, Google [Bot], Yahoo [Bot]