ThinkPad T495 Setup Notes

Fri 10 Jul 2020 09:25:51 PM EDT

These notes describe setting up a T495 with Debian Linux and the Sway compositor.


Debian packages to install

🐚  fortean  ~ $ sudo apt install tmux zsh neovim xinput firmware-iwlwifi \
	firmware-linux-free firmware-linux-nonfree firmware-misc-nonfree \
	firmware-realte firmware-amd-graphics curl libnotify-bin sway swaylock \
	swayidle brightnessctl mako-notifier nftables vlc

Fix the trackpad (under X11)

🐚  fortean  ~ $ xinput set-prop --type=int 'SynPS/2 Synaptics TouchPad' 'libinput Tapping Enabled' 1
🐚  fortean  ~ $ xinput set-prop 'SynPS/2 Synaptics TouchPad' 'libinput Accel Speed' 0.700000

Under Wayland, the compositor (Sway) handles this (see below).

How’s the battery?

🐚  fortean  ~ $ cat /sys/class/power_supply/BAT0/capacity
🐚  fortean  ~ $ upower -i /org/freedesktop/UPower/devices/battery_BAT0
🐚  fortean  ~ $ if [ $(cat /sys/class/power_supply/BAT0/capacity) -le 26 ]; then cat /sys/class/power_supply/BAT0/capacity | xargs -I X notify-send 'Low battery: X%'; fi

Adjust screen brightness (under X11)

🐚  fortean  ~ $ xrandr | grep ' connected'
eDP connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 309mm x 174mm
🐚  fortean  ~ $ xrandr --output eDP --brightness 0.7

In Wayland, use brightnessctl.


The default beep is very loud, and seeminly can only be 100% loud or off.

🐚  fortean  ~ $ xset b 'off'

A slightly modified .xsession (though we eventually went with Sway on Wayland)

#!/usr/bin/env bash

export PATH=/home/paulgorman/bin:$PATH
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DOCUMENTS_DIR="$HOME/Documents"

setxkbmap -option
setxkbmap -option ctrl:nocaps
setxkbmap -option compose:prsc

xinput set-prop --type=int 'SynPS/2 Synaptics TouchPad' 'libinput Tapping Enabled' 1
xinput set-prop 'SynPS/2 Synaptics TouchPad' 'libinput Accel Speed' 0.700000

xset b 'off'
# Set the number of seconds idle before the screensaver activates:
xset s 1800 1800
xset dpms 1800 1800 1800

xsetroot -solid 'Dark Sea Green'

if [[ -x /usr/bin/gnome-terminal ]]; then
	gnome-terminal &
	export TERMINAL=/usr/bin/gnome-terminal
	xterm -bg 'Gray18' -fg 'Grey85' &
	export TERMINAL=/usr/bin/xterm

xss-lock -- i3lock -c 330000  &
redshift -l 42.51:-83.21 -b 1.0:0.7 -t 6500K:3000K &
compton --backend glx --vsync opengl-swc --paint-on-overlay --glx-no-stencil --glx-no-rebind-pixmap &

exec /usr/bin/openbsd-cwm


Unfortunately, the Debian CWM port still seems to be buggy.

Sometimes (but rarely) moving or resizing a window moves the window out from under the pointer, losing focus. This happened to me years ago on other machines too, and still hasn’t been fixed. I never saw it happen on OpenBSD.

A new bug. Moving windows moves by moveamount (1 pixel by defautl). A “big” move moves by ten times moveamount (10 pixels). Resizing a window is supposed to resize by moveamount, but instead resizes by ten times moveamount (10 pixels). A “big” resize is supposed to resize by ten times moveamount (10 pixels), but resizes by 100 pixels! Actually, it’s not that simple, the vertical big resize is bigger than the horizontal big resize. Is it just the vertical resize on Gnome terminal?

M-M2 is documented to resize windows by default but does not. Explicitly doing bind-mouse M-M2 window-resize doesn’t help. Maybe it’s something about my input device setup?

Maybe I’ll dump CWM. Sway?


🐚  fortean  ~ $ sudo apt install sway swaylock swayidle brightnessctl
🐚  fortean  ~ $ mkdir ~/.config/sway
🐚  fortean  ~ $ cp /etc/sway/config ~/.config/sway/

Some bits from ~/.config/sway/config:

input "2:7:SynPS/2_Synaptics_TouchPad" {
	drag enabled
	dwt enabled
	pointer_accel 0.7
	natural_scroll disabled
	middle_emulation enabled
	scroll_method two_finger
	tap enabled
	tap_button_map lrm
input "*" {
	xkb_options "ctrl:nocaps,compose:prsc"
    # Don't clobber shell's alt-d
    bindsym $mod+p exec $menu
    bindsym $mod+Tab workspace back_and_forth
# Notificaton daemon
exec mako
bar {
    status_command while $HOME/bin/sway-bar-status; do sleep 10; done

My status bar shell script $HOME/bin/sway-bar-status:

echo \
	🔋 $(cat /sys/class/power_supply/BAT0/capacity)'%' \
	🔈 $(pactl list sinks | grep 'Volume: front' | cut -d' ' -f6) \
	📈 $(cat /proc/loadavg | cut -d' ' -f1,2,3) \
	📅 $(date +'%a %Y-%m-%d (%H)%I:%M %p')

Miscellaneous things

Sway doesn’t lock on suspend, even with swaylock installed. SOLVED. Oh, also needed to install swayidle, but that didn’t make it lock on suspend. Maybe I need to log out and log back in? Yeah, that did it.

Can’t ssh to nanook; it asks for a password but should be key-based. SOLVED. Ah, Nanook’s DNS returns “” for “nanook” lookups. Until we fix it properly, add this to /etc/hosts: nanook

Media/F keys. SOLVED. Had to install brightnessctl This made the volumne mute/down/up and brightness keys work:

bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5%
bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5%
bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle
bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle
bindsym XF86MonBrightnessDown exec brightnessctl set 5%-
bindsym XF86MonBrightnessUp exec brightnessctl set +5%
bindsym XF86AudioPlay exec playerctl play-pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous

Installed signal-desktop, and it frequently froze. SOLVED. Similar issue as in diary/20191228.txt, I think. (signal-desktop:11627): libnotify-WARNING **: 14:50:00.794: Failed to connect to proxy Does libnotify not play well with Wayland? Yeah, notify-send 'Hello.' just sits there. Dunst never got executed, and apparently it doesn’t work well under Wayland. 🐚 fortean ~ $ sudo apt install mako-notifier


🐚  fortean  ~ $ sudo vi /etc/nftables.conf 
🐚  fortean  ~ $ cat /etc/nftables.conf 
#!/usr/sbin/nft -f

flush ruleset

table inet filter {
        chain input {
                type filter hook input priority 0; policy drop;
                ct state invalid drop
                iif "lo" ct state new accept
                ct state established,related accept
                tcp dport ssh accept
                icmp type echo-request accept

        chain forward {
                type filter hook forward priority 0; policy accept;

        chain output {
                type filter hook output priority 0; policy accept;
🐚  fortean  ~ $ sudo nft --check --file /etc/nftables.conf
🐚  fortean  ~ $ sudo systemctl enable nftables.service
Created symlink /etc/systemd/system/ → /lib/systemd/system/nftables.service.
🐚  fortean  ~ $ sudo systemctl start nftables.service