5

I'm using a KDE+i3 setup on my machine and therefore I want to disable all the global hotkeys provided by KDE, since I've binded the keys properly in my i3-config.
Upon exploring qdbus API, I've found out the command works per Plasma session:

qdbus org.kde.kglobalaccel /kglobalaccel blockGlobalShortcuts true 

Issues

The issue is how to begin with its automation. The following are the issues:

  • Global keys start working again after Sleep, Lock etc. which restart Plasma.
  • I've used
    exec --no-startup-id qdbus org.kde.kglobalaccel /kglobalaccel \ blockGlobalShortcuts true 
    for now but only works till Plasma doesn't restart.

How should I proceed with implementing this?

1
  • Also, it would be better if the solution would be implemented by i3wm since I'm planning to keep my Plasma Xsession untouched. Commented Mar 29, 2020 at 2:20

2 Answers 2

4

I've found a way to disable all the global shortcuts of KDE. Here's what I did:

  • The hotkeys are saved in ~/.config/kglobalshortcutsrc in the form of foo=bar assignments.
  • Using sed, replace the hotkeys.
  • Restart kglobalaccel to observe the changes.

Here's the script:

#!/bin/sh hotkeysRC="$XDG_CONFIG_HOME/kglobalshortcutsrc" # Remove application launching shortcuts. sed -i 's/_launch=[^,]*/_launch=none/g' $hotkeysRC # Remove other global shortcuts. sed -i 's/^\([^_].*\)=[^,]*/\1=none/g' $hotkeysRC # Reload hotkeys. kquitapp5 kglobalaccel && sleep 2s && kglobalaccel5 & 

Now I can finally move all of my key bindings to i3 config!

0

I slightly modified the script by Utkarsh since it didn't work for my installation (probably syntax in kglobalshortcutsrc has changed):

#!/bin/sh fl="$HOME/.config/kglobalshortcutsrc" sed -i 's/=.*,.*,/=none,none,/g' $fl sed -i 's/Walk Through Windows=.*/Walk Through Windows=Alt+Tab,Alt+Tab,Walk Through Windows/' $fl # return alt+tab # Reload hotkeys. kquitapp5 kglobalaccel && sleep 2s && kglobalaccel5 & 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.