?

Log in

I recently installed ubuntu (12.04 LTS) on my laptop.  Ubuntu… - A Slave to Variance [entries|archive|friends|userinfo]
Andrew

[ website | My Website ]
[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

Links
[Links:| My Poker Blog PokerStove: A Poker Calculator European Vacation Current Fiction Current Non-Fiction ]

[Nov. 10th, 2012|07:07 pm]
Andrew
I recently installed ubuntu (12.04 LTS) on my laptop.  Ubuntu uses the "select to paste, middle button to paste" throughout the desktop. Unfortunately, after years of training my mind only understands "right click to paste" semantics.  I attribute this to the fact that I've been using Windows and putty for something like a decade.

So I went out in search of a fix.  One would think that this would be a trivial fix, as it is in putty.  Just pick the appropriate option from the application.

Nope.



Here are the steps I labored something like a week to generate:

Contents of /home/prock/bin/rightpaste.sh

#!/bin/bash

Class=`xprop -id \`xprop -root |nawk '/_NET_ACTIVE_WINDOW/ {print $5; exit;}'\` |nawk -F = '/WM_CLASS/ {N=split($2, A, ", ");  gsub(/\"/,"",A[2]); print A[2]; exit;}'`

case "$Class" in
	Gnome-terminal)
		/usr/bin/xte 'mouseclick 2' &
		;;
	"")		# this matches a window that does not have a Class name, e.g., VLC or xine in fullscreen mode
		;;
	*)		# this is the default action
		/usr/bin/xte 'mouseclick 3' &
		;;
esac
exit 0


contents of /home/prock/.xbindkeysrc

"/home/drewster/bin/rightpaste.sh &"
	b:3 + Release


With those two files in place, we just need to wire them up with the appropriate utility:

sudo apt-get install xbindkeys
xbindkeys


To run xbindkeys without manual startup, add the application xbindkeys to the list of Startup Applications. Alternatively, this is the contents of my startup file: ~/.config/autostart/xbindkeys.desktop

[Desktop Entry]
Type=Application
Exec=xbindkeys
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_US]=xbindkeys
Name=xbindkeys
Comment[en_US]=
Comment=
LinkReply