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.

 

 

Scrolling with a external mouse on MacOS

If you have used a Mac with an external mouse you know there is something funky about this. In MacOS you can not individually select the scroll direction for a external mouse vs the trackpad. The trackpad when you want to scroll down a page you basically drag trough it and it’s a very natural motion, this however means that the scroll wheel on your external mouse will go the opposite way, whoever came up with this should work on a chair with nails for a few years.

It’s a totally unnatural way to scroll up on the mouse-wheel when you want to go down on the page, I mean, WTF.

Anyway, as always some nice folks created an app (I really wish I could do this in the operating system like any other decent operating system but no, it’s an app) to reverse the scrolling. You can set it to reverse the trackpad as well but I guess then you could just have the normal setting for the mouse and the trackpad would be the opposite. Anyway, let’s not get stuck on this.

I wanted my mouse-wheel to scroll properly as I switch between Windows, Linux and Mac all the time and I really can’t get my muscle memory to work this way.

Hallelujah, the fix is here, Scroll Reverser. You can either download it from the the link or if you, like me, use Homebrew you can just run:

$ brew cask install scroll-reverser

Screenshot 2019-12-03 at 23.15.16

It’s a really really simple app but it makes my life worth living again as I can scroll up and down the way you should be able to do.

If you do get this and, like me, feel it’s an essential tool to be able to work with an external mouse (and no, I will not get an external trackpad), then do not forget to drop the developers a donation. After all, they made life worth living again.

MacOS black screen after sleep

Yesterday I decided it was time to upgrade my MacBook Pro 2018 from Mojave to Catalina. Easy update but in the future if someone tells you Windows 10 upgrades are slow, ask them to try it on a Mac. I can update all Windows devices in my house one by one faster than my Mac from 10.14 to 10.15.
Anyhow, this was not a post to beat down my Mac, I do still like parts of you 😀

After the installation was done all was well with my applications, homebrew kept working and everything appeared to be just fine. Until this morning, like most mornings I pulled my Mac and opened the lid waiting for the screen to light up, but no. Touchbar (the worst idea ever by the way) was active but the screen was black. After my first meetings of the day it was time to test if this still happened. And yes, it did.

Some digging on the web and someone even had a fix to re-install the operating system… What the … I’m not going to re-install. Haven’t reinstalled any of my other computers either and hopefully the Mac is not this unstable that you have to re-install just for an upgrade when the Windows installations are fine after years and years of upgrades and Linux installations even more so.

The one common thing I found was that most fixes were deleting .kext files, kernel extensions. Some even mentioned the specific files to delete, I however did not have any of them but what I did have on my Mac was the DisplayLink software as I use it with my Lenovo USB-C docking station. All is fair in war and computer issues so:

Step 1; go to your applications folder and look up DisplayLink, then run the Uninstaller.

It will ask you to reboot so you should, once done go find the latest driver from Displaylink.com . Install it, reboot and your black screen should be gone. This of-course assumes you had DisplayLink installed in the first place :D.

As always the writing here is mostly notes for myself. If you had success with the above, enjoy and you are welcome.

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.

Hey, where’s my Yubikey?

This post is just for myself to remember this as it was behind so many clicks on the oh so phenomenal ArchWiki.

For many years I have been using multifactor authentication where possible. SMS in the beginning and today mostly authenticator application(s) or the Yubikey(s). These together with a decent password manager make me feel at least a bit more secure with all the accounts and passwords I need to remember. If you are looking for a password manager to help make your life a bit laid back when it comes to password management I recommend you take a look at BitWarden.

Problems…

Some nights ago I decided to install Arch Linux on one of my workstations. Easy and fast installation with a very customizable system, what’s there not to like 😀

Since the system is so highly customizable, you need to read. And I do really love learning something new, I just have an issue remembering a week down the line what I did. So that’s why this post is here. This way I can find it fast the next time I need it.

So, the problem was that my Yubikey did not show up in Firefox. First thing first you always check dmesg to make sure the device is even recognized. And so I did,


usb 1-2: new full-speed USB device number 5 using xhci_hcd
usb 1-2: New USB device found, idVendor=1050, idProduct=0120, bcdDevice= 5.02
usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 1-2: Product: Security Key by Yubico
usb 1-2: Manufacturer: Yubico

And there it was. At least my system knew about it. Some duckduckgo.com:fu later I found an article on ArchWiki Fido U2F authentication pointing me to the libu2f-host package. Easy as 1,2,3 fire up pacman install the package and restart the browser and my Yubikey is back in business.


$ sudo pacman -S libu2f-host
resolving dependencies...
looking for conflicting packages...

This as stated above is not meant to be a guide on MFA or the Yubikey, just a placeholder for me to remember what I did if I ever run into it again.

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