Adventures in setting up a T60 with a modern OS — YouTube, noises and screen locking

This is just a quick post wherein I would like to talk about how it's possible to watch YouTube without lagging or high CPU usage on such an old machine; I will talk about some strange noises coming from the PC; and I will talk about some issues I had with screen locking.

YouTube

Let's start off by examining the main reason for the high CPU usage of YouTube videos: the player. The YouTube video player has always been horrendous when it comes to CPU usage and this problem was quite evident back in the day for me, as I used to have a rather slow computer; it could handle Full-HD video just fine, but watching YouTube in Full-HD or even 720p was impossible and whilst this problem mostly doesn't bother modern PC users due to their usually relatively high CPU and also GPU performance, it does matter on an old machine such as this one.

Thus, I decided it was time to do something about it and I downloaded youtube-dl which is a small, Terminal-based program that can download and convert YouTube videos in addition to mpv which is a nice multimedia player. mpv actually has the ability to play YouTube videos if you give it a YouTube URL, so I created a small setting in my i3 config that simply copies what I have in my clipboard (for example a YouTube video) and uses that as the argument for mpv. The line that I added to my config is as follows:

bindsym $mod+y --release exec --no-startup-id "mpv `xclip -o`"

This allows me to open YouTube, copy the URL of a video I'd like to watch and simply press Windows Key + Y; this will result in mpv opening said video and playing it.

However, mpv usually plays videos at their highest available resolution which is obviously not needed on a display that has a resolution of 1024 x 768; therefore, I added the following line to my mpv.conf: —

ytdl-format=bestvideo[height<?720]+bestaudio/best

This will select a resolution below 720p, i.e. 240p – 480p; the argument inside the brackets could be change to [height<=?720] to also allow 720p resolutions to play.

Where is the mpv.conf?

You may be wondering where the configuration file is located and I too had the problem of not being able to find it at first; I therefore ran sudo find / -name mpv.conf and the following was returned: /usr/share/doc/mpv/mpv.conf. I hence created a new folder inside my .config folder by typing mkdir -p ~/.config/mpv/ and by then copying the config file from /usr/shrae/doc/ to my ~/.config directory by typing cp /usr/share/doc/mpv/mpv.conf/ ~/.config/mpv/.

Strange noises

Recently, I started hearing strange noises coming from the computer and I was quite honestly quite concerened that they would indicate an impeding failure; however, it luckily does not seem to be that way.

I started hearing these noises and at first I believed they were coming from the hard drive; but considering the fact that I no longer have an HDD inside this computer, it must've been something else. I hence put my ear towards the laptop and started listening and found out that the noises seem to be originiating from the RAM / CPU. Additionally, they seem to react to activity on my computer, such as moving the mouse or installing something.

Being obviously concerned, I did some googling and stumpled upon a very helpful page on the ThinkWiki which details the same noise problems that I have been having and I have narrowed it down to CPU power saving states. It appears that the “extreme” power saving modes C3 and C4 trigger the noise and this does seem to be the problem with me as well; When plugged into AC power, the noise does not appear, but when running on battery power it is very noticeable.

There are a handful of fixes, such as straight-up disabling these power saving CPU states, but they come at the cost of reduced battery life. Undervolting the processor seems to be a possible solution as well, but I am somewhat afraid of doing that.

There are also some people that this may be related to the microphone, something that, to me, sounds utterly ridiculous, but I will keep my eyes open and see if that could possibly fix it.

As these noises don't bother me too much, however, I will be ignoring them for now; I was simply concerned they could indicate an underlying problem with the computer.

Screen locking

Another thing that I noticed on all my Manjaro i3 installations is that, when closing the laptop lid, the computer goes into suspension, but does not lock the screen; this results in me being able to open the laptop back up without needing to enter a password and I find that very insecure.

Thus, I looked around the internet and found a fix for it; you simply need to create your own systemd service and place it in /etc/systemd/system. I have created a blurlock.service with the following content, wherein sophon is my user name and needs to be replaced according to your local installation: —

[Unit]
Description=blurlock on suspend
Before=sleep.target

[Service]
user=sophon
Type=forking
Environment=DISPLAY=:0
ExecStart=/usr/bin/blurlock -time 1

[Install]
WantedBy=sleep.target

This will automatically lock the screen when you suspend the laptop.