Strict Standards: Redefining already defined constructor for class wpdb in /home/bdmurray/murraytwins.com/blog/wp-includes/wp-db.php on line 52

Deprecated: Assigning the return value of new by reference is deprecated in /home/bdmurray/murraytwins.com/blog/wp-includes/cache.php on line 36

Strict Standards: Redefining already defined constructor for class WP_Object_Cache in /home/bdmurray/murraytwins.com/blog/wp-includes/cache.php on line 389

Strict Standards: Declaration of Walker_Page::start_lvl() should be compatible with Walker::start_lvl($output) in /home/bdmurray/murraytwins.com/blog/wp-includes/classes.php on line 537

Strict Standards: Declaration of Walker_Page::end_lvl() should be compatible with Walker::end_lvl($output) in /home/bdmurray/murraytwins.com/blog/wp-includes/classes.php on line 537

Strict Standards: Declaration of Walker_Page::start_el() should be compatible with Walker::start_el($output) in /home/bdmurray/murraytwins.com/blog/wp-includes/classes.php on line 537

Strict Standards: Declaration of Walker_Page::end_el() should be compatible with Walker::end_el($output) in /home/bdmurray/murraytwins.com/blog/wp-includes/classes.php on line 537

Strict Standards: Declaration of Walker_PageDropdown::start_el() should be compatible with Walker::start_el($output) in /home/bdmurray/murraytwins.com/blog/wp-includes/classes.php on line 556

Strict Standards: Declaration of Walker_Category::start_lvl() should be compatible with Walker::start_lvl($output) in /home/bdmurray/murraytwins.com/blog/wp-includes/classes.php on line 653

Strict Standards: Declaration of Walker_Category::end_lvl() should be compatible with Walker::end_lvl($output) in /home/bdmurray/murraytwins.com/blog/wp-includes/classes.php on line 653

Strict Standards: Declaration of Walker_Category::start_el() should be compatible with Walker::start_el($output) in /home/bdmurray/murraytwins.com/blog/wp-includes/classes.php on line 653

Strict Standards: Declaration of Walker_Category::end_el() should be compatible with Walker::end_el($output) in /home/bdmurray/murraytwins.com/blog/wp-includes/classes.php on line 653

Strict Standards: Declaration of Walker_CategoryDropdown::start_el() should be compatible with Walker::start_el($output) in /home/bdmurray/murraytwins.com/blog/wp-includes/classes.php on line 678

Deprecated: Assigning the return value of new by reference is deprecated in /home/bdmurray/murraytwins.com/blog/wp-includes/query.php on line 21

Deprecated: Assigning the return value of new by reference is deprecated in /home/bdmurray/murraytwins.com/blog/wp-includes/theme.php on line 508
Brian’s Blog » A Magic Upstart User Job
Ubuntu04 Dec 2013 06:13 pm

One thing I remember being excited about when moving from Windows to Linux was using my middle mouse button to paste. I somewhat recently got a Apple Wireless Trackpad and lost this ability as there is no middle mouse button. (As far as I knew at the time, but it looks like the upper right corner is a middle click.) I discovered that I could set a three finger tap to middle click and subsequently paste by the following:

/usr/bin/xinput set-prop "Apple Wireless Trackpad" "Synaptics Tap Action" 2 3 0 0 1 3 2

However, running that on every reboot, and battery change in the trackpad was rather annoying. With the advent of upstart user jobs (the real point of this post) I thought one would be a good way to set this functionality.

I put the following in a file named magicpad-paste.conf in my ~/.config/upstart/ directory:

description "Enable three finger middle click with an Apple Trackpad"
author "Brian Murray

start on :sys:input-device-added NAME='"Apple Wireless Trackpad"'

script

DATE=$(date)
echo "$DATE Apple Wireless Trackpad detected"
# it seems that a sleep is needed for the device to become fully available
sleep 5
/usr/bin/xinput set-prop "Apple Wireless Trackpad" "Synaptics Tap Action" 2 3 0 0 1 3 2

end script

The hardest part was figuring out that a sleep was necessary for the device to become fully registered so that xinput would work.

Feed on comments to this Post

Leave a Reply