3

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.

2 Answers2

3

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']"
wjandrea
  • 14,236
  • 4
  • 48
  • 98
  • 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
0

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:

#!/bin/bash
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?

derHugo
  • 3,356
  • 5
  • 31
  • 51
dessert
  • 39,982