Making Xterm Play (Mostly) Nice With Copy-And-Paste (and Not Look Ugly Too)

Some guys work on cars;  I work on getting the last little bit of performance and customization out of my computer.

That’s why I’m using Xterm (if I’m not using screen) for terminal applications.  Especially since I’m constantly starting up and closing terminal windows, the small difference in startup times between it and my GNOME terminal gets…annoying.

However, there’s some issues setting up Xterm.  It’s finicky.  It is, by default, ugly as sin. I like a nice black terminal, the lovely Inconsolata monospace font and generally the clean look that you can get with it.  That’s the first part of the .Xresources file – setting up those colors so it behaves nicely.

Xterm is also, shall we say, not fond of the way the clipboard is handled in *nix.  (There’s three clipboards, see… no, really.)  Anyway, I hate the “select it with the mouse and that puts it on the clipboard” method that *nix seems to prefer.  I’m too sloppy with the mouse, especially when using a touchpad.  So with this .Xresources, I can select by holding SHIFT and the mouse button, and then it copies it to all the clipboards. The key elements are here (I highly recommend copying from the gist later):

XTerm*VT100.translations: #override
<Btn1Up>: select-end(PRIMARY, CLIPBOARD, CUT_BUFFER0) n
Shift<Btn1Down>: select-start() n
Shift<Btn1Motion>: select-extend() n
Shift<Btn1Up>: select-end(PRIMARY, CLIPBOARD)

Yes, there’s a duplication in there. Find it for extra points – it works right now, and I’m not messing with it any more.

Anyway, this is something that took a while to research and set up, so hopefully this will be of some use to other power users out there. (Not to mention typos, control characters, or brackets and the like being entirely missing…)

This is my .Xresources file; you edit (or create) it in your home directory.  Once you’ve edited .Xresources, run this command from your terminal:

xrdb -merge .Xresources

Despite what lots of web pages say, sometimes it shows up right away. Sometimes it required me to restart X (effectively relogging). If it doesn’t behave as expected, relog and see if it does what it’s supposed to then. You can get the .Xresources file from gist on GitHub or the embed below. I cite where I got the bits of this solution at the top of the .Xresources file if you’d like to do some additional reading.

Writing, Critiquing, and Challenges, oh my!

I've not been making the posts recently, but the challenge has still been going strong. Come write with us this
Read More
<span class='p-name'>Writing, Critiquing, and Challenges, oh my!</span>

Tracking, Advertising, Your Privacy, and this blog

Given the (hopefully temporary) defeat of net neutrality in the United States and my evolving desire to protect your privacy,
Read More
<span class='p-name'>Tracking, Advertising, Your Privacy, and this blog</span>

Four Things To Do on World Refugee Day

About every other post or tweet/toot thread I see about the way the US is treating families of immigrants has some variation of this: "But what can we do?" Here's four ways.
Read More
<span class='p-name'>Four Things To Do on World Refugee Day</span>

Never forget: This land was made for you and me

I'd like to remind you that with countries, just like people, it's easy to let the best of yourself slip away. This land was made for you and me.
Read More
<span class='p-name'>Never forget: This land was made for you and me</span>

It is time to stand.

Read More
<span class='p-name'>It is time to stand.</span>

Neo-Confederate = Current Racist

"Neo-Confederate" is an ugly euphemism, nothing more.
Read More
<span class='p-name'>Neo-Confederate = Current Racist</span>

A Father’s Day Wish. Copy, share, repeat.

Read More
<span class='p-name'>A Father’s Day Wish. Copy, share, repeat.</span>

Weekends are writing time.

The challenge has still been going strong. Come write with us this weekend!
Read More
<span class='p-name'>Weekends are writing time.</span>

There is no perfect candidate. There is only the best one available.

Oh. My. Sweet. Lord. We're already seeing it. The threats that if Democrats aren't "pure" enough, then they're not getting the
Read More
<span class='p-name'>There is no perfect candidate. There is only the best one available.</span>

If there’s one Nazi (or a racist) at the table…

Because this post by David Avallone needs signal-boosted outside of Facebook (or Twitter) alone: "As we say in Germany, if there’s
Read More
<span class='p-name'>If there’s one Nazi (or a racist) at the table…</span>

Popular posts:

  • HOWTO Make Your Hamburger Helper Better
  • If there's one Nazi (or a racist) at the table...
  • The Songs That Chronicle Our Lives
  • Word Porn Quotes
  • I am not a number; I am a free man, OR, why you should never rely on social media
  • It's not being "Awkward", and the difference between Excuses and Explanations
  • I really like you, but I have to break up with you before I don't.