tested on openbsd 6.3 and thinkpad
toggle displays with xrandr(1).
for example, only laptop's display (eDP-1) is on, then an external
one (HDMI-1), then both side by side:
$ xrandr --output eDP-1 --auto --output HDMI-1 --off
$ xrandr --output HDMI-1 --auto --output eDP-1 --off
$ xrandr --output HDMI-1 --auto --output eDP-1 --auto --right-of HDMI-1
$
list all connected devices with xinput(1):
$ xinput
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ /dev/wsmouse0 id=7 [slave pointer (2)]
⎜ ↳ /dev/wsmouse id=8 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ /dev/wskbd id=6 [slave keyboard (3)]
$
in this example, /dev/wsmouse0 is a built-in touchpad and
/dev/wsmouse is an external mouse. reverse scrolling (swap 4
and 5, 6 and 7) for the touchpad and slow down the mouse.
$ xinput set-button-map /dev/wsmouse0 1 2 3 5 4 7 6
$ xinput set-prop /dev/wsmouse 'Device Accel Constant Deceleration' 5
$
for devices (e.g. trackballs) with two buttons: enable Middle
Button Emulation and then press two buttons at the same time to
emulate the middle button.
$ xinput set-prop /dev/wsmouse 'WS Pointer Middle Button Emulation' 1
$
for devices (e.g. mices) with three or more buttons: enable Wheel
Emulation, then hold the middle button (2) and move the mouse
up and down to scroll. adjust Inertia and Timeout if needed.
$ xinput set-prop /dev/wsmouse 'WS Pointer Wheel Emulation' 1
$ xinput set-prop /dev/wsmouse 'WS Pointer Wheel Emulation Button' 2
$ xinput set-prop /dev/wsmouse 'WS Pointer Wheel Emulation Inertia' 3
$ xinput set-prop /dev/wsmouse 'WS Pointer Wheel Emulation Timeout' 500
$
install unclutter:
# pkg_add unclutter
quirks-3.16 signed on 2018-10-12T15:26:25Z
unclutter-8p1: ok
#
...then add this line to ~/.xsession to hide X pointer when it has not moved for a
few seconds:
unclutter -root -idle 2 -noevents &
See also my .xsession.
toggle dpi for all x programs (including firefox) and fonts for xterm(1). on high dpi screens, use large truetype fonts:
Xft.dpi: 133
XTerm*font:
XTerm*faceName: DejaVu Sans Mono:size=12
on low dpi screens, use bitmap ones:
Xft.dpi: 92
XTerm*font: -misc-fixed-medium-r-normal--15-140-75-75-c-90-iso10646-1
XTerm*faceName:
to apply these settings use xrdb(1) (don't forget to restart x programs after that):
$ xrdb .Xdefaults
$ echo 'Xft.dpi: 92' | xrdb -merge
$
here is my .Xdefaults.
define an action on laptop's lid closing. do nothing (0), suspend
(1), or hibernate (2):
# sysctl machdep.lidaction=0
machdep.lidaction: 2 -> 0
# sysctl machdep.lidaction=1
machdep.lidaction: 0 -> 1
# sysctl machdep.lidaction=2
machdep.lidaction: 1 -> 2
#
@hi@romanzolotarev.com