TransWikia.com

How to disable all global hotkeys in KDE Plasma?

Unix & Linux Asked on November 17, 2021

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?

One Answer

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!

Answered by Utkarsh Verma on November 17, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP