16 November
2014

Touchpad Synaptic Settings for Thinkpad L440

Probably the same for X240, T440, ... other 40 series Thinkpads

Got myself a cheapish Lenovo Thinkpad L440 as a replacement/spare laptop (while my X220 is hopefully being fixed), running OpenBSD ofcows. Problem with this machine's hardware: There are no real buttons for the TrackPoint, instead it uses the top of the Touchpad (you press it down) and some software to determine where you clicked.

On the X220 I had the Touchpad disabled in the Bios, and used exclusively the TrackPoint. Works great. On the L440, you can't disable the Touchpad in the Bios. Instead in OpenBSD you have to use the synaptics(4) driver, with some synclient(1) commands to set things up. Basically you disable the Touchpad (aka Trackpad) for mouse movement. You keep its functionality for clicking, and you define some areas where the middle and right button clicks are. This works fine, but the feel of the dedicated buttons was much, much better.

In any case, here are the settings that I'm using in my .xinitrc::

# disable touchpad, except for clicking
synclient TouchpadOff=1
# set up fake buttons for the trackpoint
synclient ClickPad=1

synclient MiddleButtonAreaLeft=2636
synclient MiddleButtonAreaRight=3442
synclient MiddleButtonAreaTop=0
synclient MiddleButtonAreaBottom=3306

synclient RightButtonAreaLeft=3443
synclient RightButtonAreaRight=0
synclient RightButtonAreaTop=0
synclient RightButtonAreaBottom=3306


Posted by betabug at 17:57 | Comments (1) | Trackbacks (0)
17 April
2012

Getting the current session name from tmux

Are you talking to me?

Had the little mystery of how to get the name of the current session in tmux into a shell script. Why? Because that script should talk to the same pane/window/session again later. Hacking and searching around a bit, this is what I came up with:

SESSION=`tmux list-panes -F '#{session_name}'`

Funny enough it uses the list-panes command, which by default lists only the panes of the current window and session. Then, using the -F format string, we can tell it to give us the session name only.

Later I can use this in the script like this:

tmux select-window -t$SESSION:window_name

... and there shouldn't be any mistakes as to which session I'm talking to.


Posted by betabug at 21:00 | Comments (1) | Trackbacks (0)
14 April
2012

openbsd ipsec.conf roadwarrior puzzlestone

Took me a while to notice...

When setting up the IPSec NAT on my "roadwarrior" laptop, I was baffled for quite some time with the question: How do I set up the src address, without having to edit ipsec.conf whenever I am on a different network in a different RFC1918 private natted address range? One day I would be on 192.168.1.17 and the next on 10.0.1.28:

# this can't be it!! wtf?
# ike dynamic 192.168.1.17 from iwn0 to any
# ike dynamic 10.0.2.5 from iwn0 to any
ike dynamic 10.0.1.28 from iwn0 to any

Add up DHCP on all those networks and this really can't be it.

Turns out the information / solution actually is in the man page (yay for OpenBSD man pages):

Addresses can be specified in CIDR notation (matching netblocks), as
symbolic host names, interface names, or interface group names.

So basically what you can do is to start your ipsec.conf setup with your interface name as something like:

ike dynamic esp from iwn0 to any

Which means that the ipsec tunnel will get set up on whatever address that interface gets assigned. And you could even create an interface group "vpn" to cover both your wifi and ethernet interfaces. Neat.

The next thing to find out for me is how I can do from iwn0 to any but not to my local subnet... but I guess I'll figure that out too some day.

BTW: having OpenBSD IPSec on both sides of my VPN made the setup really easy.


Posted by betabug at 17:55 | Comments (0) | Trackbacks (0)
31 March
2012

xrandr example script

Switching an extra VGA monitor around on an OpenBSD laptop

To set up and configure an external monitor in X on OpenBSD, we typically use xrandr(1). There are some GUI tools (like lxrandr, from ports) to "help" with that, but for me, a very simple shell script can do the job:

#!/bin/sh

# TODO: handle HDMI-3 / 4 / 5

case "$1" in
"mirror")
    xrandr --output VGA --same-as LVDS
    ;;
"external")
    xrandr --output LVDS --off --output VGA --auto
    ;;
"off")
    # external monitor is off, internal on
    xrandr --output LVDS --auto --output VGA --off
    ;;
"right")
    xrandr --output VGA --auto --right-of LVDS
    ;;
"left")
    xrandr --output VGA --auto --left-of LVDS
    ;;
*)
    # default fall through ...
    # external monitor is off, internal on
    xrandr --output LVDS --auto --output VGA --off
    ;;
esac

Usage: I save this as a script with the name "monitor" and then use it as one of monitor mirror, monitor right, ... etc.

When a more special setup is needed, this script can serve as a cheat sheet. Further than that, the xrandr man page is pretty good.

Differences to lxrandr: lxrandr doesn't do dual monitor setups (the ones where the extra monitor is used in addition to the internal one), it only does mirroring and "choose one of them". On the other hand, lxrandr handles changing of the resolutions. Also my script is only set up for the VGA port, if I ever get around to hook up something to the displayport, I'll have to adapt it.


Posted by betabug at 20:12 | Comments (0) | Trackbacks (0)