[xmonad] shiftInsert behavior and Chromium...

Trey Blancher trey at blancher.net
Tue Oct 30 12:28:06 CET 2012

Chromium, like many other GTK apps does not draw a distinction between
primary selection buffer and the clipboard, CTRL-V and Shift-Insert
copy from the clipboard.  I stumbled upon a way to fudge it in
Chrome/Chromium (or any other designated application), so CTRL-V does
what I expect, and Shift-Insert pastes the primary buffer's contents.
So far, so good.  But this unfortunately breaks the application I use
separate clipboard and primary buffers the most:  urxvt.  Here's the
relevant XMonad code:

shiftInsert w =
  let translatedProgs = ["Chromium", "Chrome"]
  in do
    c <- runQuery className w;
    let toTranslate = any (== c) translatedProgs
    if toTranslate then spawn ("CLIP=$(xclip -out -selection
clipboard); xclip -out" ++
        " | xclip -in -selection clipboard; xdotool key
--clearmodifiers --window "
        ++ show w ++ " ctrl+v; echo -n $CLIP | xclip -in -selection clipboard")
    else sendKey shiftMask xK_Insert

-- snip

      , ((shiftMask, xK_Insert), withFocused shiftInsert)

-- snip

If I comment out the ",((shiftMask, xK_Insert), withFocused
shiftInsert)", I can paste the primary into urxvt again with
shift-Insert, but Chromium goes back to pasting the clipboard with
shift-Insert.  One thing I did notice is that Shift-Ctrl-Insert works
in urxvt with the above code enabled, but my muscle memory is for
shiftInsert and I really don't want to change my behavior at this
stage.  As suggested in #xmonad, I've tried adding ,"urxvt" to
translatedProgs, but that gives me the same undesirable behavior.

Stumped yet again in XMonad land.


More information about the xmonad mailing list