Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Ideally, I'd like to bind a hotkey across all apps using gtk.

I have Ctrl+Shift+p bound to paste from the selection buffer in urxvt, which generally means I can do everything without moving my hands from the keyboard (vim is X buffer aware, and I have a tmux hook to place copied text into that buffer) however, when I go to firefox et al, I have to move my hand to the mouse to middle click.

Is it possible to bind global behaviour like this in the context of the gtk textentry widget?

share|improve this question
up vote 2 down vote accepted

GTK+ 2 allows customization of keyboard bindings (among other things) via gtkrc files, such as ~/.gtkrc-2.0. (There does not seem to be any equivalent for GTK+ 3 programs.)

Unfortunately, I couldn't find any way to paste from the PRIMARY selection, only from CLIPBOARD selection (which already has CtrlV assigned by default, so this customization will be useless):

binding "custom-text-entry"
    bind "<ctrl><shift>p" { "paste-clipboard" () }
class "GtkEntry" binding "custom-text-entry"

However, real GTK+ programs already have a keyboard shortcut ShiftIns for pasting from the PRIMARY selection, while Firefox is not pure GTK+ – many controls it uses are reimplemented in Firefox itself. You might need to edit some internal files to change its shortcuts.

share|improve this answer
Thanks! I realised that firefox may be tricky but I use a stack of GTK apps so just having it work in them is a lot better than nothing! – richo Dec 20 '11 at 1:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .