How can I disable the Alt + F1 and Alt + F2 shortcuts?

I sat with the same issue after upgrading to Ubuntu 12.04 (Precise Pangolin) and installing GNOME Shell. I tried to disable Alt + F1 from wherever I could, to no avail.

As I was about to give up, I found this gist: https://gist.github.com/2402448

gsettings set org.gnome.desktop.wm.keybindings panel-main-menu "[]" # disable Alt+F1

Credits go to Jan Musinsky.


With the Ubuntu Unity plugin installed, the musinsky gist snippet in the terminal wasn't enough.

Disable it using CompizConfig Settings Manager:

sudo apt-get install compizconfig-settings-manager
sudo apt-get install compiz-plugins-extra
ccsm

In section "Desktop" (third item on the left), click on "Ubuntu Unity Plugin". In tab "General" (the default), click the edit pencil for "Key to execute a command" (the fourth item), blank out (delete) the content, and press OK.

General tab

  • Key to show the HUD - disable
  • Key to execute a command - disable

Launcher tab

  • Key to give keyboard focus to Launcher - disable

Although johanmynhardt gave us the right answer for the Alt + F1, he did not tell us what it was for Alt + F2. With the for loop as shown by Jesse Glick in a comment, I figured out the Alt + F2 command. Like this to remove both keys:

gsettings set org.gnome.desktop.wm.keybindings panel-main-menu "[]" # Disable Alt + F1
gsettings set org.gnome.desktop.wm.keybindings panel-run-dialog "[]" # Disable Alt + F2

The way to find the valid keys (panel-main-menu an panel-run-dialog in the above examples) is to use the list-keys command line option of gsettings. Be ready to get a pretty long list.

The following are all the system defined keybindings for 20.04:

switch-group
begin-resize
switch-to-workspace-7
begin-move
move-to-side-w
move-to-corner-nw
move-to-workspace-10
move-to-workspace-6
move-to-workspace-right
always-on-top
toggle-maximized
move-to-workspace-left
switch-to-workspace-8
cycle-panels
move-to-workspace-11
lower
move-to-workspace-7
toggle-above
move-to-workspace-down
switch-panels
minimize
cycle-windows
switch-to-workspace-9
move-to-workspace-12
toggle-on-all-workspaces
switch-input-source
move-to-workspace-8
move-to-side-n
maximize-horizontally
activate-window-menu
set-spew-mark
switch-windows-backward
maximize-vertically
move-to-corner-sw
move-to-workspace-9
maximize
panel-main-menu
close
move-to-monitor-up
raise-or-lower
move-to-side-e
cycle-windows-backward
switch-to-workspace-1
move-to-monitor-right
switch-windows
panel-run-dialog
switch-panels-backward
unmaximize
switch-to-workspace-2
switch-applications
switch-to-workspace-last
move-to-workspace-1
move-to-corner-ne
switch-to-workspace-3
switch-to-workspace-up
move-to-side-s
show-desktop
move-to-center
move-to-workspace-2
switch-to-workspace-left
switch-to-workspace-right
raise
move-to-corner-se
switch-to-workspace-10
switch-to-workspace-4
toggle-shaded
cycle-group-backward
move-to-workspace-3
switch-to-workspace-down
cycle-panels-backward
move-to-monitor-left
switch-applications-backward
switch-to-workspace-11
switch-input-source-backward
switch-to-workspace-5
move-to-workspace-4
move-to-monitor-down
toggle-fullscreen
switch-to-workspace-6
switch-to-workspace-12
cycle-group
move-to-workspace-up
move-to-workspace-last
switch-group-backward
move-to-workspace-5

I still see a panel-run-dialog entry, I tested on my install and it worked as expected. After I ran the set command shown above, the Alt + F2 stopped working...


On Ubuntu 16.04 you can do it using the following command:

gsettings set org.compiz.unityshell:/org/compiz/profiles/unity/plugins/unityshell/ keyboard-focus ''