Plasma 6 method to refresh kglobalaccel shortcuts?

It seems the setShortcut method is deprecated since KF 5.90, and kept in the build not to break the public D-Bus API. So, the setShortcutKeys method is more preferable.

It does that indeed. qdbus org.kde.KWin /KWin reconfigure doesn’t help, but the shortcut set via the D-Bus API functions (mostly) normally after restarting, or after the “Apply” workaround via the System Settings application, apparently.


The task switching actions have Alt-Tab and Shift-Alt-Tab as the default shortcuts, there is a pane dedicated to task switching in the System Settings application, and there are also explicitly defined alternative shortcuts for them to allow different task switching GUIs/effects (compact, icons, thumbnails, etc.) to be used, so these factors may be causing the complications with task switching shortcuts. Actions that don’t have default shortcuts or aren’t being used in any way in the current session may not require the restart or the “Apply” workaround. For example, the command below sets two shortcuts, which become effective immediately after the command, and the shortcuts are propagated to ~/.config/kglobalshortcutsrc as tab-delimited shortcuts in the first field after the equals sign:

gdbus call --session --dest org.kde.kglobalaccel --object-path /kglobalaccel \
  --method org.kde.KGlobalAccel.setShortcutKeys \
  "['kwin', 'Window Move Center', 'KWin', 'Move Window to the Center']" \
  "[([$KEYCODE_1, 0, 0, 0],), ([$KEYCODE_2, 0, 0, 0],)]" 4


So, the setShortcutKeys method in the D-Bus API works, but still using the kwriteconfig6 utility or modifying the configuration files manually look like the intended way of configuring Plasma.

2 Likes