NTM: My laptop function keys

This is a new series to my blog, which I call “note to myself”, because it’s just that. What urged me to write this first post is the configuration of my laptop after installing a new OS (or configuring a new window manager in this case). I realize that I need to configure the same items every time I do a fresh set-up, and I keep forgetting long file paths and where to look for several settings files etc.

This post will serve me as look-up when I set up my system next time, maybe it is useful for someone else, by chance.

My set-up

I’m using an Asus zenbook UX31, running Parabola GNU/Linux and i3-gaps window manager

I have the following function (fn) keys, that tend to not work out of the box when installing a new OS/wm:

  • F1: sleep
  • F2: toggle wifi
  • F3: decrease keyboard backlight
  • F4: increase keyboard backlight
  • F5: decrease screen brightness
  • F6: increase screen brightness
  • F7: turn off screen
  • F8: toggle alternate screen
  • F9: disable touch pad
  • F10: mute audio
  • F11: decrease volume
  • F12: increase volume

I usually don’t need all of those, but especially the screen brightness, keyboard leds and audio keys are important to me. This is how I can set the appropriate keybindings:

Keyboard backlight leds

The file containing the keyboards leds’ brightness is
/sys/class/leds/asus::kbd_backlight/brightness

It contains just the number that represents the brightness level, which ranges from 0 (leds off) to 3 (max brightness). I’ve written a script to increase or decrease the level stepwise.

Using bash


    #!/bin/bash

    if [ -z $1 ];
    then
        echo "usage $0 [-inc|-dec]"
        exit 1
    fi

    PATH=/sys/class/leds/asus\:\:kbd_backlight/brightness
    OLD=$(/usr/bin/cat $PATH)

    if [ $1 == "-inc" ]
    then
        if [ $OLD -lt 3 ]
        then
            echo $(($OLD + 1)) > $PATH
        fi
    elif [ $1 == "-dec" ]
    then
        if [ $OLD -gt 0 ]
        then
            echo $(($OLD - 1)) > $PATH
        fi
    fi

Using Python

    #!/usr/bin/env python
    import sys

    path = "/sys/class/leds/asus::kbd_backlight/brightness"

    try:
        with open(path, 'r') as b_old:
            brightness = int(b_old.read())
    except:
        sys.exit(1)

    if sys.argv[1] == "-inc" and brightness < 3:
        brightness += 1
    elif sys.argv[1] == "-dec" and brightness > 0:
        brightness -= 1

    try:
        with open(path, 'w') as b_new:
            b_new.write(str(brightness))
    except:
        sys.exit(1)

Either script works the same way. You must be root to write the brightness file, however. To overcome this in my i3 .config, I modified the sudoers file

    sudo visudo
    %robin ALL = NOPASSWD: <path to script>

This will allow me (Group robin) to execute the script without typing the sudo password. If you want to add this feature for all users on your machine, just add the users to users group and put that into the sudoers
instead

usermod -aG users 

I can now add the keybinding to my .config file

bindsym $mod+F3 sudo exec set_kbd_backlight -dec
bindsym $mod+F4 sudo exec set_kbd_backlight -inc

The keyboard backlight brightness was luckily the lengthiest part of all.

The screen brightness

The screen brightness can be adjusted with the xbacklight tool. The commands for my .config are

bindsym $mod+F5 exec xbacklight -dec 5
bindsym $mod+F6 exec xbacklight -inc 5

to decrease or increase the brightness by 5% each time.

Audio keys

I’m using pulseaudio per default. Although I heard about cpu consumption issues, I did not yet have reason to switch this to alsa completely. The pulseaudio settings can be controlled with the pactl tool. The audio
sinks can be listed with

pactl list short sinks

I only have one sink wich is labelled #0, so my keybindings in .config are

bindsym $mod+F10    exec pactl set-sink-mute 0 toggle
bindsym $mod+F11    exec pactl set-sink-volume 0 -5%
bindsym $mod+F12    exec pactl set-sink-volume 0 +5%

to toggle mute or decrease and increase the volume by 5% per keypress.

More to follow

These are the fn keys I definitely need every day. I will take care of the others later and update this post accordingly.

I also seem to have problems escaping my tag symbols using Markdown in wordpress. Looks like I have to surround code by “pre” tags and use &lt; and &gt; notation.

A libre OS

As described in my previous post, I migrated my system to a completely libre GNU/Linux distribution (seems I need to use the term libre in order to avoid the free/gratis confusion).

I admit that the pure migration process was pretty simple and almost unspectacular: I was running Manjaro Linux, an Arch-based distribution that comes with a nice set-up environment, but still has the freedom, simplicity and cutting edge packages, which I enjoyed very much. I decided to stay with an Arch derivative and followed these instructions to switch to Parabola Gnu/Linux. I expected some more magic, but basically I did the following:

  • removed all non-free packages
  • removed manjaro specific packages
  • installed libre alternatives where possible
  • installed your freedom

Removing the unwanted

While this sounds pretty straight forward there were some things I expected (like removal of certain software like TeamViewer, Skype etc) and some that were rather unexpected and made me swallow, like when I saw yaourt on the list of software-to-be-removed. Yaourt is a wrapper around the Arch packaging tool pacman. Whenever I could not find a package in the official repositories, that was my very first alternative, and I found what I was looking for in 99 of 100 searches.

However, it’s not crucial and I’ll be happy to invest more time in finding a solution in future, knowing that I will be more conscious about the software I install and use.
I was a bit puzzled about X not starting anymore, until I noticed that Plymouth is obviously non-free software and was hooked with my lightdm service; well I can absolutely forgo that one.

Embracing the alternative

My Thunderbird is now an Icedove, I totally can live with that ;) so far the libre alternative software does not at all change or affect the way I worked before. I was surprised to see that my kerned needed to be replaced. I nether thought about that, but apparently my linux kernel included binary blobs, I guess for hardware compatibility. The Free Software Foundation Latin America is developing libre-linux, a kernel free of any proprietary binaries, thanks for that!

More difficulties were caused by the software that was without alternative, like my proprietary wifi driver. Yes, I should have read just one more paragraph, so at least I would have been warned. Of course, no FOSS driver exists for my wifi card (since no specifications are made public), like for the vast majority of wifi cards, as far as I understood. So I ended up with buying an external usb wifi-dongle with a supported chipset (RTL8188 in my case) – I’ve come so far, I won’t be stopped by that :P

Keep the system clean

The funniest thing about the migration was indeed the your freedom package. The description given on the website tells you all you need to know about that:

This package conflicts with every nonfree package
known to date to ensure your system is free.

So this is my watchdog, conflicting with everything I didn’t know I didn’t want to have.

The system is up and running again, and I don’t feel much of a difference, yet. What I feel however, is to have gained deeper insight in how proprietary software and binary blobs are integrated in every layer of our system, unless we take the extra effort, time and knowledge to intentionally avoid it. I am no paranoiac and I don’t plan to become one in near future, but it is indeed alarming how many pieces of software are integrated per default, of which the operations that should be performed can not be verified – a very one-sided trust model.

free != gratis

Having a class on history of the hacker culture in the dgplug IRC channel has been highly interesting. Only within seconds after starting in 1955/56 with the TX-0 at MIT, my Wikipedia tabs popped up almost by themselves, going from TX-0 to Hacker to Hack Culture to Tech Model Railroad Club and Richard Stallman. By the end of the day I ended up installing FreeBSD and Plan9 on virtual machines on my laptop and began to explore those (what a weird thing, this Plan9, but interesting and consistent in concept)

Obviously, Richard Stallman had a great influence on hacker culture, the free software movement and actually on the working environment that I use right now and every day. After watching some talks and interviews, I realized that this guy really has the 100% freedom in mind (which ironically seems to be quite constraining), avoiding any proprietary software, but also boycotting a whole bunch of other services, tools, hardware and whatsoever if they violate against his philosophy.

Although I was a bit overwhelmed by the strict policy, I liked some of that thoughts initially. Like how he declares minified JavaScript to be proprietary software, because the code is not readable and you would need some reverse engineering to make sense of it. I also like his four essential freedoms (freedom 0, 1, 2 and 3) that finally helped me to understand that free software does not necessarily mean gratis software.

So I was interested in the OS and tools that are actually approved by Richard Stallman and found a good list here. I don’t remember how often I checked that box saying “install non-free packages” on my OS installations, without thinking twice even once. I will do now, and I think I might try out Parabola GNU/Linux and stay free, by staying propriety-free as good as possible. Judging from the post on stallman.org, not even he can manage to get the 100% he aims for; sometimes a trade-off is necessary until a better solution is found or created.

In the meantime I start searching and creating.

I open up

So I was browsing the web with my eyes more open to certain aspects. I never noticed that many Creative Commons logos before, though they have definitely been there. I searched the internet for free stuff a million times before. However, I realized that what I found (and actually was happy with) was shareware and adware most of the time. Now, for the first time I searched for FREE things. Not just software or media I can use for free, but things that are born free and live their free digital life out there in a free web.

I stumbled across the free music archive, where people share songs they produce and offer them for free download (again often with the CC involved), what a beautiful thing! Next I was searching a place for musicians to collaboratively create their music online and have their ideas continued by someone like-minded from across the continent. Looks like there are quite a few, though many of those projects are already dead or lack of funding. MyBlogBand looks promising, I will definitely try that out ;)

Meanwhile I will just start to share my own stuff on github; my writings, drawings, compositions and code, of course. I start with this little comic strip I’m working on.

first_draft.png

I know it’s not very good and it’s by far not done, yet. However, I realize that at this rate it will take me weeks to finalize. But maybe someone else likes the idea and has time and motivation to add whatever he thinks is missing, so fork it on github and here you go ;)

Going deeper

As written in my previous post, I’m attending the dgplug summertraining. It says they want to show the path of becoming an upstream contributor, which I think is pretty cool, but I must admit that all the time I was thinking about free and open software, only. Today’s homework, however, was to watch a documentary; The Internet’s own boy – the Aaron Swartz story.

This took me deeper. It’s not only about free software, it’s about free speech, free knowledge and free internet, issues that people have fought wars for for hundreds of years and still do. I’ve watched that movie and could not help but ask myself: Where have I been, what have I done and why didn’t I see all these things happen? The world wide web is about my age. We grew up together and we had a lot of fun. Well, turns out I was having more fun; although in permanent contact, I did not see the danger the internet was in and still is, as the threat to internet neutrality. I have the feeling of both, being affected directly and being able to change by contribution. This internet is still young and it’s not yet finished. More than ever I feel like I can help to make it better and protect it’s freedom.

As a physicist I also write publications that are published in scientific journals. Researchers like me heavily depend on publications to receive further grants to keep up the research projects. The majority of scientists will not make big money with research, it’s pure interest and the wish to contribute that keeps them going. From a scientific point of view absolutely reasonable to publish in a peer-reviewed journal, but it is also a necessity to survive. The impact factor of a journal represents the number of citations a journal gets, which in turn reflects the number of readers. For high impact factor journals, researchers even pay up to several 1000$ for publication; A ridiculous and perfidious system.

Luckily the numbers of Open Access journals are increasing, although I’m not sure if their impact factors do likewise. However, I’m glad, excited and curious where this summer training takes me. Maybe it is going to connect my worlds and wishes I have from science and coding.

Continue reading “Going deeper”

Why another blog?

To be honest

I thought that blogs were a trend of the 2000s that has ended a long time ago. I my life I have read only a handful of blog-posts but never followed a blog regularly, and I definitely never thought that I would start writing my own blog one day.

However…

This blog is part of a project I started recently. I think it must have been a @nixCraft tweet, that wrote about an online summertraining from the Linux User Group of Durgapur, that offers training to anyone who is interested in contributing to F/OSS projects, and introduce them to the most important tools and guidelines to prepare and advice them for contribution in any software project of their choice. From what I understood, the course is lead by Fedora developers, mostly, plus some guest speakers from other known projects.

Q&A with a group of experts

It’s just been one week of training now, but I already got hooked; I’ve been coding for quite some years now, but I’m coding alone. I always wanted to do projects in collaboration, but at work, there is just no-one else who could join me (we’re a very small business). Switching to Linux fully a few years ago and learning Python brought me closer to the F/OSS world, and I am fascinated. I’m using and enjoying free software and admire everyone who spends time and effort in developing these great tools. Like so many others, I need a lot of them in my daily routines, and I think it’s time to give something back to the F/OSS world by contributing myself.

An IRC classroom

…is very much like a real classroom. So far, I’ve used IRC only sporadically; from my experience, the channels were often full of users but hardly anyone typed back if I had a question I could not find answered elsewhere. This summer-training is definitely different, and I’m usually smiling from class begin to class end. There is a teacher speaking and there are students … speaking, of course. Some students join late, barging in, asking what they missed so far, some will never stop chiming in asking questions that have been answered many times before and and some just trolling around. I feel like I’m in school again and I’ve missed that feeling. It’s hilarious to follow discussions between students and experts and I really appreciate the patience of the teachers; while I’m learning a lot about communication, I’m having a lot of fun at the same time.

So why a blog?

I don’t think that many people (if any) will read this blog, but that’s not important. During the last week of summer-school, the sessions included communication & netiquette, touch-typing and vim. Often, some links with further information and documentation is provided to read for homework, but this Friday we were advised to start and write our own blog, mainly as tool to track our own progress and projects. I’m not absolutely sure what I will write about, though. But I will definitely try to document my own progress of getting into contribution of a free software project of my choice. Writing down my experiences and progress may really be helpful for me; so far my documentation consists of my git commit messages and my (quite infrequent) comments in my code. Maybe this blog will help me tidy and sort my thoughts and accelerate my progression.