Ctrl plus U not clearing location bar in Mozilla

From FVue
Jump to: navigation, search


Ctrl+U doesn't clear the location bar in Mozilla. Mozilla used to care if the cursor was in the location bar. If so, and I pressed Ctrl+U, the preceding portion of the location bar text would be cleared, just as I'm used from bash. After I upgraded to SuSE 9.3 and Mozilla 1.7.7 Ctrl+U always shows the page source, even when the cursor is in the location bar.

Solution (Firefox version < 46)

Mozilla and Firefox are both written with the GTK graphical engine. Some time ago it was decided by Mozilla to remove the 'Emacs' keys behaviour. You can now use global GTK settings to reinstate 'Emacs' key behaviour for all GTK applications, including Mozilla and Firefox.


The GNOME desktop is written with the GTK graphical engine. Issue this command:

gconftool-2 -s -t string /desktop/gnome/interface/gtk_key_theme "Emacs"

See also: Keyboard shortcuts: Faster than the speed of mouse

On Xubuntu, go to Keyboard Preferences and select "Emacs" as the Keyboard map.

KDE (preferred solution)

Add the line:

gtk-key-theme-name = "Emacs"

to ~/.gtkrc-2.0-kde4

See also: Emacs Keybindings - Firefox - MozillaZine Knowledge Base

KDE (deprecated solution)

The KDE desktop is written with the Qt graphical engine. Under KDE it takes some more effort to make GTK-applications like Mozilla listen to global GTK settings:

1. deinstall any gtk-qt-engine possibly running.
2. install the GNOME settings daemon: sudo apt-get install gnome-settings-daemon
3. set the GTK key theme to 'Emacs':

gconftool-2 -s -t string /desktop/gnome/interface/gtk_key_theme "Emacs"

4. load the GNOME configuration within the current session:


5. load the GNOME configuration every time KDE is started:

ln -s /usr/bin/gnome-settings-daemon ~/.kde/Autostart/

NOTE: Now that the GNOME Control Center settings are applied after KDE is started, mouse and screensaver settings are controlled by GNOME instead of KDE:

  • To change the mouse settings, run gnomecc or { Start | Utilities | Desktop | GNOME Control Center }. Doubleclick on Mouse and modify the mouse settings from here.
  • To change screensaver settings, run XScreenSaver or gnonecc if gnome-screensaver is installed.

Caveat: Keyboard repeat switching off

I found that when running the gnome-settings-daemon under Kubuntu 10.04, my keyboard repeat was switched off every time I started the gnome-settings-daemon. See also: Kde: keyboard repeat magically switching off.


So now — whenever the cursor is in a textarea or textfield, e.g. the browser location bar — these shortcuts take precedence above the ones from Mozilla:

       |                              action
  key  +-----------------------------------------+------------------
       |           gtk_key_theme 'Emacs'         |     Mozilla
CTRL+A | Move cursor to begin of line            | Select all
CTRL+B | Move cursor backwards one character     | Bookmark manager
CTRL+C | -->                                     | Copy
CTRL+D | Delete; delete character under cursor   | --
CTRL+E | Move cursor to end of line              | Edit page
CTRL+F | Move cursor forward one character       | Find in this page
CTRL+G | -->                                     | Find again
CTRL+H | Backspace                               | History
CTRL+I | -->                                     | Page info
CTRL+J | --                                      | --
CTRL+K | Delete from cursor to end of line       | --
CTRL+L | -->                                     | Focus location bar
CTRL+M | -->                                     | New message
CTRL+N | Next line                               | New navigator window
CTRL+O | -->                                     | Open file
CTRL+P | Previous line                           | Print
CTRL+Q | -->                                     | Quit
CTRL+R | -->                                     | Reload
CTRL+S | -->                                     | Save page as
CTRL+T | -->                                     | New navigator tab
CTRL+U | Delete from cursor to begin of line     | View source
CTRL+V | -->                                     | Paste
CTRL+W | Delete current word until previous word | Close tab
CTRL+X | -->                                     | Cut
CTRL+Y | Redo                                    | --
CTRL+Z | Undo                                    | --



As of Firefox-46 the solution doesn't work anymore.



Found solution here, which doesn't involve running the gnome-settings-daemon. Just add this line underneath to ~/.gtkrc-2.0-kde4:

gtk-key-theme-name = "Emacs"

I'll do some further testing before upgrading this as the solution.


Updated solution for KDE-4.4.2 (Kubuntu-10.04, Lucid Lynx).


After the above fix, the Gnome screensaver keeps appearing. Found out it can be disabled via {Configuration Editor}:

|- apps
   |- gnome-settings-daemon
      |- screensaver


The thread GNOME v. KDE, December 2005 edition hints the possibility to set the gtk_key_theme in KDE by running /opt/gnome/lib/GConf/2/gconfd-2.

The thread Firefox Ctrl-U n text entry field - solved! seems to offer a solution.
I do have a directory /usr/share/themes, but it is empty?

Created a ~./gtkrc-2.0:

include "/opt/gnome/share/themes/Emacs/gtk-2.0-key/gtkrc"

but it has no effect in KDE.

After I executed gnome-keybinding-properties, CTRL-U suddenly works in both Mozilla and Firefox (after restarting them). This process appears in my job list:

   --oaf-activate-iid=OAFIID:GNOME_SettingsDaemon --oaf-ior-fd=31

Let's restart the session... Now the desired CTRL-U behaviour is gone.

Surfed from Howto:gtk/gnome Apps Under Kde - SuSE Linux Forums to SuSELinuxSupport: HowToGTKGnomeAppsunderKDE. Uninstalled gtk-qt-engines which apparently bypassed my .gtkrc-2.0.


A solution is offered on Dumbbell's home: Ctrl+U with Mozilla and Firefox:


Mozilla Keyboard Shortcuts is not mentioning my Ctrl+U location bar behaviour?


Someone facing the same problem in Firefox Re: Firefox, I want my ctrl-u back


blog comments powered by Disqus