Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

up vote 1 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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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