Lenovo X220 and audio control in i3wm

This will serve as a note to myself as I found myself really looking for it every time I redid the device.

The Lenovo X220 has audio control buttons above the keyboard and they are nice to have working when using the device. I use i3-wm myself and I have a old version of my i3 config in my Github, yes it’s time to update it as well so I don’t have to do this every time.

Anyway, this time the writing is for Debian, I’m using the testing version but I would assume this works in any of them. First and foremost, I am using the kernel module thinkpad_acpi and alsa, if you are using pulseaudio you need to look for the commands for that.

In my i3-config I have the following

# Audio settings
bindsym XF86AudioRaiseVolume exec “amixer -q sset Master,0 1+ unmute”
bindsym XF86AudioLowerVolume exec “amixer -q sset Master,0 1- unmute”
bindsym XF86AudioMute exec “amixer -q sset Master,0 toggle”

Reload your i3 config and you should see the mute led turn on and of as you press it. Volume up and down works as well.

Adventures in i3 land

As a geek I do like a lot of the modern things. At work I spend my time working with device services ranging from cloud services like Intune to things like traditional printing in factory floors.

There is very little that get’s me as exited as opening a box with new hardware in it, but from time to time I feel the hardware improvements are eaten alive by the ever growing complexity of the software. So while I spend a lot of my time reading about new things, I also like to go back in time and take a look at what can be done with older hardware instead of throwing it away.
As an example my daughter is using a Mid 2009 MacBook Pro for her needs at the moment. With an SSD and 8Gb of RAM it works a lot better than expected. I have a bunch of old ThinkPad’s that have been neglected for quite some time. One of them being an old X220, and it is the device I’m writing on at the moment. And speaking of writing, the keyboard on this thing is second to none. I’ve never typed on a better keyboard than the old Thinkpad’s. They are in my personal opinion better than any of the current keyboards and so durable.

X220

X220_Closed

Considering this device was released in 2011, almost 10 years ago, it still handles what I throw at it extremely well. I did not try Windows 10 in it although I think it would have ran decently as well, instead it’s now running Debian testing with the i3 window manager. A cold boot from entering the encryption password takes about 7 seconds to the desktop. So even by modern standards more than decent, in fact a lot faster than my 2018 MacBook Pro and even faster than my Surface Laptop 3.

i3 window manager

Being fast does come with it’s downsides, if you don’t like them. For me, I don’t see it as a downside, quite the opposite. As the hardware is older I set out to use something lightweight. Tiling window managers have fascinated me for a while now and I thought this hardware could really benefit from one. So instead of the large WM’s in Linux I decided to go with i3 and for the login screen Slim DM. Both extremely light and extremely configurable.

2020-04-11-140841_1366x768_scrot

Finding your comfort with a tiling window manager might require some work, at least it did for me. As an example there are things that are so wired in my brain I have issues trying to change them. One such is the Windows + L key to lock the computer. My i3 configuration used the VIM keys to move between open windows, meaning H,J,K,L were bind to that movement. I changed them to the arrow keys, not perfect, but I do need my Windows + L to lock my session.

Slimlock

As I stated above I use Windows + L to lock my screen. This is something really wired into my brain, leaving a computer I always do this, needed or not. i3 has this functionality in i3lock and you can call that to lock your screen. I however wanted to use the same nice GUI that Slim provides me on startup.

I also wanted the system to lock whenever I put my computer to sleep or close the lid so slimlock had to be called in those cases as well.

My i3 config, contains,

# Lock screen
bindsym $mod+l exec “slimlock”

and I created the a new file in /etc/systemd/system/i3lock@.service containing;

[Unit]
Description = Lock screen when going to sleep/suspend/hibernate

[Service]
User=%I
Type=simple
Environment=DISPLAY=:0
ExecStart=/usr/bin/slimlock
TimeoutSec=infinity

[Install]
WantedBy=sleep.target
WantedBy=suspend.target
WantedBy=hibernate.target

The combination works exactly as I want it to.

Changes in hardware

To make the X220 a bit more modern I added 4Gb of RAM in it. I rarely go over 4Gb in this but still, as I had some laying around I gave it some additional memory. The time of HDD’s in laptops is long gone as well, so I had a Samsung 860 SSD 1Tb driver on my table I stuffed into the laptop as well. The combination of the SSD and 8Gb of RAM makes the X220 fly.

Before doing anything else I pulled the whole ting into pieces and replaced the thermal paste on the CPU, it is as I said 10 years old so it was time to get this done. If you have ever taken a Lenovo or IBM ThinkPad apart you start to appreciate the way these things are built. No laptop is easy to pull apart but with the servicing manuals and no-stress this was a enjoyable moment. I also notice the fans rarely spool up after applying some Arctic Silver paste on the CPU and putting everything back together.

1

Can your really do something on it?

Counting the running laptops and desktops in my house I have 5 of them in daily use. I really do not work on the X220 but it is able to get things done. I’ve tried using many of the tools I use in my daily job on it and so far have not had a single issue or noticeable dip in performance. Microsoft Teams is probably what I spend the majority of my time collaborating in and it works flawlessly on this device. I use O365 for email and documents, and although the web-versions of Word, PowerPoint and Visio are not 1:1 with the desktop version’s I can still be as effective in them. If I need a Windows desktop I can even get into one in our Cloud services meaning I really could make this old-timer my daily driver if I wanted to. And for my job when designing services for the enterprise, if I can use it from this device then anyone can use them from whatever they want.

What’s next?

I’ve been reading about Coreboot quite a bit, the next step for this old Lenovo is to get rid of the old BIOS and clear out as much as possible from the Intel Management Engine, I don’t have to, but I want to. Tinkering is still fun.

 

 

MacOS unhide dock faster

As I’ve stated I more or less cross paths almost on a daily basis with all the major operating systems. Most of the time my main driver is the 2018 MacBook Pro which is with me whenever I leave the comfort of the home-office.

Although the resolution is good on this device the dock at the bottom takes up a bit of space. I must say I’m not a heavy dock user, I’ve learnt long ago to use CMD+Space to find my applications, just like I use the Windows key in Windows 10 and MOD+D in my i3wm on Arch Linux. In my normal configuration I keep the dock hidden and if you keep the default values you, for a split second, wonder if it’s coming out at all. So, tweaking it to appear faster felt like a good idea. Three commands later and we are done. As always, this blog is mostly so I don’t have to search information on this again and try to find my personal sweetspot
Open a terminal and run the following commands, in the following order:


$ defaults write com.apple.dock autohide-delay -float 0
$ defaults write com.apple.dock autohide-time-modifier -float 0.5
$ killall Dock

Now it does not feel like the Dock is stuck in mud somewhere, it actually appears fast enough the few times I really need it.

Nixadmins.net back from hiatus

I can’t believe it’s now 7 years since I was actively posting content. Why? I started as a Field Engineer at Microsoft and could not find the time nor energy to keep creating quality content. It’s now a year since I changed my role starting as an Architect designing the device journey with all that comes with it. With this role in mind my posts in the future will be different, the content will be wider than before, meaning I will create posts about the design journeys and the architectural view as well. But, as I am still me, and deep inside a geek who loves to tinker with things from A-Z the content will also reflect this.

In my daily life I’m now more or less in multiple platforms, using Windows, MacOS and Linux in my daily life. Some posts will be deep in a technology sense while others might offer you high level views on services I am working on in my daily life.

I will not commit to a schedule as this site still mostly notes on my personal ramblings and trying to answer questions I get in my daily life.

First up will be recreation of some of the former posts as I have lost my backups from my previous site in 2013. Some of them were extremely popular and I still haven’t found a good  replacement for them.

//Mats