Sunday, October 16, 2011

Archlinux and Thinkpad T410s

So, shit. It appears that I was not paying attention when I was making partitions to my SSD. Everybody knows that you are supposed to make your swap partition at least the size of your usable RAM, right? Well it seems I did not make it that big. How do I know that? Simple, pm-hibernate is not hibernating.

One thing though: SSD is fast. I have read some articles where new SSD owners state that they are never going to switch back to HDD drives, even if the statistics shows that SSD-s will break up several times per year (worst case). It's because SSD is fast and you should backup your data anyway. I agree with them.

Of course, my 128GB drive is small compared to standard HDD-s that ship with modern laptops, but for programs and some pictures and files it's big enough. For backup I have 2 external HDD drives. They also store files that I don't plan to use frequently.

Tuesday, October 11, 2011

Archlinux and Thinkpad T410s

 II


Thinkpad laptops (and laptops in general) have special actions mapped to certain keys, which can be accessed with "Fn" key. For example, "Fn+F4" will suspend the laptop to RAM. Of course that happens only in the pre-installed Windows 7. If you install linux you usually have to configure those keys to do the actions they're supposed to yourself. There are some keys that work out of the box, for example the "Fn+PgUp" will toggle the Thinklight, and also the screen brightness can be adjusted using the predefined keys ("Fn+Home" and "Fn+End"). In my old Thinkpad T60, the volume buttons were also working (probably hardwired), but in T410s this is not so.

Fortunately Awesome (also Openbox, and probably other WM-s and DE-s) will allow you to define global keys. In rc.lua (usually placed in ~/.config/awesome) you can define your own key codes and map some action to them. Here's an example:

awful.key({}, "XF86AudioPrev",function () awful.util.spawn("mocp -r") end)


What this does is it maps the key "XF86AudioPrev" to do the action "mocp -r". In Thinkpads "XF86AudioPrev" is mapped to "Fn+Arrow left". This is supposed to select previous song from some audioplayer. What it does in my system is it will select previous song in MOC.

To assign the actions to the keys you need to know the key names and of  course some program to do the task (preferably something similar to the task that was configured under Windows). For the key names I used a program called xev that prints out different data it receives by events (key presses etc.) generated by X.

Here is a list of various configured keys in my system:

globalkeys = awful.util.table.join(
...
awful.key({}, "XF86AudioPrev",function () awful.util.spawn("mocp -r") end),
awful.key({"Control"}, "XF86AudioPrev",function () awful.util.spawn("mocp -k -10") end),
awful.key({}, "XF86AudioNext",function () awful.util.spawn("mocp -f") end),
awful.key({"Control"}, "XF86AudioNext",function () awful.util.spawn("mocp -k 10") end),
awful.key({}, "XF86AudioPlay",function () awful.util.spawn("mocp -G") end),
awful.key({"Control"}, "XF86AudioPlay" ,function () awful.util.spawn("mocp -p") end),
awful.key({"Control", "Mod1"}, "XF86AudioPlay",function () awful.util.spawn("mocp -S") end),
awful.key({}, "XF86AudioStop",function () awful.util.spawn("mocp -s") end),
awful.key({"Control"}, "XF86AudioStop",function () awful.util.spawn("mocp -x") end),
awful.key({}, "XF86AudioRaiseVolume",function () awful.util.spawn("amixer set Master unmute 2%+ > /dev/null") end),
awful.key({}, "XF86AudioLowerVolume",function () awful.util.spawn("amixer set Master unmute 2%- > /dev/null") end),
awful.key({}, "XF86ScreenSaver",function () awful.util.spawn("slock") end),
awful.key({}, "XF86AudioMute",function () awful.util.spawn("amixer set Master toggle > /dev/null") end),
...
)



So, for locking the screen I use slock, suspend works via pm-utils. Music is served through MOC server and since the audio functionality is provided by ALSA, all the volume actions are done through amixer. One thing to note with the volume buttons is that when the volume is muted, pressing the volume up or down button will unmute it and then increase or lower the volume. So for every time the volume raise or volume lower button is pressed you have to explicitly unmute the mixer for the keys to work as expected (of course you could make a script that checks if the volume is muted and only then unmute it).

Going to go ahead and add hibernation functionality now, see how it goes (on T60 it stopped working correctly after some use so I had to disable it).

Monday, October 10, 2011

Archlinux and Thinkpad T410s

I


Since I've been using linux (more specifically Archlinux) for a long time now, I decided to use it as an OS on my new Thinkpad T410s. The following is a series of notes on how the integration of these two goes.

So first some pictures

Archlinux desktop view. The window  manager I use is Awesome
The desktop view is quite minimalistic, and that, I think, is a good thing. In the upper left corner one can see the links for the 6 different desktops (first one is selected). The upper right corner shows the date and time, current CPU usage, memory usage, battery level and CPU temperature.

Some windows open. In the background there is Thunar filemanager and in the foreground there is chrome running with google search page displayed. What is neat is that the desktop theme I use under Awesome is also available for chrome and it seems google+ also uses somewhat similar theme.


The desktop theme I use is Elegant Brit and the icon set is area.o43 (the Awesome theme is Zenburn with slight modifications to fit the desktop theme). These two seem to fit nicely together.

So this is the gist of what can be seen with an eye. There is a lot more that goes on under the cover, but more about it in next posts.

First!

I win, lol.