4

I want to disable all my custom and system keyboard shortcuts by one terminal command. Which command do I need to use for it/

Newtron Malayalam
  • 439
  • 1
  • 7
  • 18
  • yes of course . – Newtron Malayalam Jan 10 '20 at 15:06
  • Globally or [for a specific application](https://askubuntu.com/questions/62654/disable-global-keyboard-shortcuts-for-specific-application?rq=1). I'm not sure if this is possible with _one_ command. You can start by [`gsettings reset-recursively ...`](https://askubuntu.com/a/1200953/349837) keybindings schemas: `org.gnome.shell.keybindings`, `org.gnome.settings-daemon.plugins.media-keys`, `org.gnome.desktop.wm.keybindings`... – Pablo Bianchi Jan 10 '20 at 15:18

2 Answers2

1

i did this in a simple node application:

import childProcess from 'child_process'

const gnomeKeybindings = [  
    'activate-window-menu','maximize-horizontally','move-to-side-n','move-to-workspace-8','switch-applications','switch-to-workspace-3','switch-windows-backward',
    'always-on-top','maximize-vertically','move-to-side-s','move-to-workspace-9','switch-applications-backward','  switch-to-workspace-4','toggle-above',
    'begin-move','minimize','move-to-side-w','move-to-workspace-down','switch-group','switch-to-workspace-5','toggle-fullscreen',
    'begin-resize','move-to-center','move-to-workspace-1','move-to-workspace-last','switch-group-backward','switch-to-workspace-6','toggle-maximized',
    'close','move-to-corner-ne','move-to-workspace-10','move-to-workspace-left','switch-input-source','switch-to-workspace-7','toggle-on-all-workspaces',
    'cycle-group','move-to-corner-nw','move-to-workspace-11','move-to-workspace-right','switch-input-source-backward  switch-to-workspace-8','toggle-shaded',
    'cycle-group-backward','move-to-corner-se','move-to-workspace-12','move-to-workspace-up','switch-panels','switch-to-workspace-9','unmaximize',
    'cycle-panels','move-to-corner-sw','move-to-workspace-2','panel-main-menu','switch-panels-backward','switch-to-workspace-down',      
    'cycle-panels-backward','move-to-monitor-down','move-to-workspace-3','panel-run-dialog','switch-to-workspace-1','switch-to-workspace-last',              
    'cycle-windows','move-to-monitor-left','move-to-workspace-4','raise','switch-to-workspace-10','switch-to-workspace-left',    
    'cycle-windows-backward','move-to-monitor-right','move-to-workspace-5','raise-or-lower','switch-to-workspace-11','switch-to-workspace-right',   
    'lower','move-to-monitor-up','move-to-workspace-6','set-spew-mark','switch-to-workspace-12','switch-to-workspace-up',     
    'maximize','move-to-side-e','move-to-workspace-7','show-desktop','switch-to-workspace-2','switch-windows'  
]
const gnomeShellKeybindings = ['focus-active-notification','open-application-menu','screenshot','screenshot-window','shift-overview-down',
    'shift-overview-up','switch-to-application-1','switch-to-application-2','switch-to-application-3','switch-to-application-4','switch-to-application-5',
    'switch-to-application-6','switch-to-application-7','switch-to-application-8','switch-to-application-9','show-screenshot-ui','show-screen-recording-ui',
    'toggle-application-view','toggle-message-tray','toggle-overview'  ]

const gnomeMutterKeybindings = ['rotate-monitor','switch-monitor','tab-popup-cancel','tab-popup-select','toggle-tiled-left','toggle-tiled-right']

const gnomeDashToDockKeybindings = ['app-ctrl-hotkey-1','app-ctrl-hotkey-10','app-ctrl-hotkey-2','app-ctrl-hotkey-3','app-ctrl-hotkey-4','app-ctrl-hotkey-5',
    'app-ctrl-hotkey-6','app-ctrl-hotkey-7','app-ctrl-hotkey-8','app-ctrl-hotkey-9',
    'app-hotkey-1','app-hotkey-10','app-hotkey-2','app-hotkey-3','app-hotkey-4','app-hotkey-5','app-hotkey-6','app-hotkey-7','app-hotkey-8','app-hotkey-9',
    'app-shift-hotkey-1','app-shift-hotkey-10','app-shift-hotkey-2','app-shift-hotkey-3','app-shift-hotkey-4','app-shift-hotkey-5',
    'app-shift-hotkey-6','app-shift-hotkey-7','app-shift-hotkey-8','app-shift-hotkey-9','shortcut']

and then disable all of them in a loop

for (let binding of gnomeKeybindings){
            childProcess.execFile('gsettings', ['set' ,'org.gnome.desktop.wm.keybindings', `${binding}`, `['']`])
        }

for (let binding of gnomeShellKeybindings){
            childProcess.execFile('gsettings', ['set' ,'org.gnome.shell.keybindings', `${binding}`, `['']`])
        }

for (let binding of gnomeMutterKeybindings){
            childProcess.execFile('gsettings', ['set' ,'org.gnome.mutter.keybindings', `${binding}`, `['']`])
        }

for (let binding of gnomeDashToDockKeybindings){  // we could use gsettings reset-recursively org.gnome.shell to reset everything
            childProcess.execFile('gsettings', ['set' ,'org.gnome.shell.extensions.dash-to-dock', `${binding}`, `['']`])
        }

childProcess.execFile('gsettings', ['set' ,'org.gnome.mutter', `overlay-key`, `''`])

of course you can do that with a shellscript :-)

0

Run:

for schema in $(gsettings list-schemas | grep -E 'keybindings|media-keys')
do
    for key in $(gsettings list-keys $schema)
    do
        if [[ $(gsettings range $schema $key) == "type as" ]]; then
            gsettings set $schema $key "@as []"
        fi
    done
done

Please note that in my machine gsettings list-schemas | grep keybindings shows:

$ gsettings list-schemas | grep -E 'keybindings|media-keys'
org.cinnamon.desktop.keybindings
org.cinnamon.desktop.keybindings.media-keys
org.cinnamon.desktop.keybindings.wm
org.gnome.desktop.wm.keybindings
org.gnome.mutter.keybindings
org.gnome.mutter.wayland.keybindings
org.gnome.settings-daemon.plugins.media-keys
org.gnome.shell.keybindings

If you do not want to remove all of these then make an array of schemas an iterate over that like:

schemas=( org.gnome.desktop.wm.keybindings org.gnome.shell.keybindings org.gnome.mutter.keybindings )

for schema in "${schemas[@]}"
do
    for key in $(gsettings list-keys $schema)
    do
        if [[ $(gsettings range $schema $key) == "type as" ]]; then
            gsettings set $schema $key "@as []"
        fi
    done
done

To unset only the custom keybindings, the command is:

gsettings reset org.gnome.settings-daemon.plugins.media-keys custom-keybindings
Ahmad Ismail
  • 610
  • 9
  • 29