Is there a way for me to change the Ctrl+Alt+Numpad 0 shortcut using the terminal?

I tried listing all gsettings and dconf shortcuts using the answer here, but didn't find the window placement ones except:

org.gnome.desktop.wm.keybindings toggle-maximized ['<Control><Alt>KP_5']

We use this shortcut in Blender, so I would like to change it or unassigned it in Ubuntu 16.04/Unity.

I need a terminal solution because I need to apply the change to a lab full of computers.

  • You might be able to change it with CCSM, if nothing else. I'll check once I'm at my machine later. – wjandrea Sep 11 '17 at 22:37
  • This feature of CCSM is well explained in askubuntu.com/a/116889/507051. – dessert Sep 12 '17 at 5:26
  • This appears to be a GUI solution which doesn't help me. I need a terminal/command line solution – 43Tesseracts Sep 12 '17 at 7:06

I used gsettings list-recursively | grep minimize to find the gsettings key you're looking for: org.gnome.desktop.wm.keybindings minimize

If you wanted to disable it, you could use

gsettings set org.gnome.desktop.wm.keybindings minimize "['disabled']"
  • 1
    This isn't the problem. E.g: gsettings get org.gnome.desktop.wm.keybindings minimize ['<Control><Alt>m'] – 43Tesseracts Sep 12 '17 at 18:09
  • @43Tesseracts actually, I think it is. When I gsettings list-recursively | awk '/hotkey/||/keybinding/||/media-key/' | grep KP_0 I get org.gnome.desktop.wm.keybindings minimize ['<Control><Alt>KP_0'] don't you? – Elder Geek Sep 13 '17 at 16:10
  • You're totally right. I had already fixed this on the computer I was testing on (had changed it to Ctrl + Alt + M). – 43Tesseracts Sep 13 '17 at 16:35

You can use xbindkeys to reach your goal. I'd try it out on one of the lab computers, write a script to automate the necessary steps and run this script on every computer. Read man xbindkeys and the configuration example displayed by xbindkeys --defaults. Here's something to start with:

sudo apt install xbindkeys xbindkeys-config # install packages
echo -e '# descriptive comment\n"command --to execute"\n   Control + Alt + Mod2 + KP_Insert' > ~/.xbindkeysrc # create ~/.xbindkeysrc
echo -e '[Desktop Entry]\nType=Application\nName=xbindkeys\nExec=xbindkeys\nX-GNOME-Autostart-enabled=true' > ~/.config/autostart/xbindkeys.desktop # autostart xbindkeys using a .desktop file

You can use xbindkeys -k to determine keycodes like Mod2 + KP_Insert for Numpad 0. Don't forget to add xbindkeys to your autostart commands, I added the command to create a .desktop file above which should be working. If it's not, try other solutions from here: How do I start applications automatically on login?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.