⌨ Labor omnia vincit ☮

openSUSE :: stumpWM

Posted in Lisp, openSUSE by anaumov on 08.02.2013

stumpWM

When you think about GNU/Linux, you probably think about servers or data storage systems. It could be also development machines or maybe desktops (but probably not). For me GNU/Linux was always place for different experiments and also platform on which I can implement my ideas (which often break system). So, today I would like to tell a bit about the Stump Window Manager.

Let’s start by saying that stumpWM is a tiling, keyboard driven X11 Window Manager written entirely in Common Lisp, and Common Lisp is a one of dialects of the Lisp – a family of a multi-paradigm programming languages (supports a combination of procedural, functional, and object-oriented programming paradigms). There are many reasons to use stumpWM. For example, you would like to have benefits of tiling window managers (its tiling windows to use the whole screen and focus on a user experience which is highly keyboard driven operation), or maybe you just want to learn Common Lisp (as we all know, reading the source code of a big professional project is a good idea when you learn a new programming language).

Installation: compiler

It is not matter will you make a new fresh installation or will use your system with another DE/WM (it is pretty easy to disable stumpWM and continue to use your previous WM/DE). It is more important which interpreter/compiler you are going to use. There are many implementations for Common Lisp avaliable for UNIX/Linux and you can choice what you want (if you have experience already). I will use SBCL and I recomend you to use it, if you are not familiar with Lisp:

> sudo zypper in sbcl

> cat hello.lisp
(write-line "Hello GNU/Linux!")

> sbcl --script hello.lisp
Hello GNU/Linux!

After installing SBCL and test it, you can install stumpWM. How to do that? We have NO official/supported package in our repositories, but in case using Quicklisp we don’t really need it.

What is Quicklisp and why we don’t need RPM packages?

As reported on the official Quicklisp website:

Quicklisp is a library manager for Common Lisp. It works with your existing Common Lisp implementation to download, install, and load any of over 700 libraries with a few simple commands.

That means that stumpWM, that has some dependencies, can be installed via Quicklisp, that will care about download and install all needed sources and libraries. We don’t need to package these, we don’t need to test how they work together, care about difference between versions and so one. All those stuff we can pass on to the shoulders of Quicklisp library manager. Hm… how lucky is that?😉 But now I should remind you, that this method is NOT official way to install stumpWM on openSUSE. On another hand, this is the recommended way to install Common Lisp dependencies for stumpWM.

Why we can’t use Qucklisp for packaging i.e. make this way as offical for openSUSE? The problem is that such features, like access to the Internet and download some unforeseen stuff, will never support for OBS (in the .opensuse.org instance), I guess. The reason is that for one the builds would not be reproducable anymore. Also it would create a number of security problems. It would be, for example, possible to attack oS servers and also external servers.

Ok, and what’s about official way? Well… there is no official way to do that for openSUSE until now. Such distributions like Debian, Fedora, Gentoo and Ubuntu use another system for installing Common Lisp libraries and sources called common-lisp-controller and ASDF. Theoretically, we can also use they, but first, these packages are not avaliable for openSUSE, and second – there is Qucklisp, which is easier to use and which has more intelligent principle of operation.

Installation: stumpWM

This is the recommended and distribution-independent way (should work on another UNIX/Linux systems) to install stumpWM and all needed dependencies. After installing SBCL we need to download quicklisp.lisp file:

> curl -O http://beta.quicklisp.org/quicklisp.lisp

and tell SBCL to download and install all needed sources and libraries (you should be online):

> sbcl --load quicklisp.lisp --eval "(quicklisp-quickstart:install)" \
--eval "(ql:add-to-init-file)"
> sbcl --eval "(ql:quickload \"stumpwm\")"

After that we can run stumpWM using this command:

> sbcl --eval "(ql:quickload \"stumpwm\")" --eval "(stumpwm:stumpwm)"

You can add this string, for example, to ~/.xinitrc file or config file of your login-manager (yes, sometimes you don’t need to change system configuration (/etc/sysconfig), it is enough just to edit config file of xdm, kdm, gdm, slim or another). Finally, restart the X session by logging out. If all goes well, after successful login you should see a “Welcome To the Stump Window Manager” message pop up in the upper, right corner.
If you will want to come back to your previous DE/WM, just delete/edit ~/.xinitrc or config file of your login-manager.

Customize your window manager… while it’s running

That’s right! Since stumpWM is a Lisp program, there is a way for you to evaluate Lisp code directly, on the same Lisp-process that stumpWM is running on. It makes hacking much more interesting! On the stumpWM project page you can find detail manual about it and there is also wiki on github. I will recommend you to get acquainted with it (it makes no sense to repeat it all here). Here I’m going to show just one example, that will demonstrate possibility to change demeanor of your stumpWM without having to restart it.

The config file of stumpWM is ~/.stumpwmrc. For example, put these strings to it:

(defcommand chromium () ()
    "Start your favorite web-browser"
    (run-or-raise "/usr/bin/chromium" '(:class "chromium")))

(define-key *root-map* (kbd "W") "chromium")

and reload config file: StumpWM is controlled entirely by keystrokes, so use Ctrl-t ; for call stumpwm-command-line and run loadrc command there. It will reload config file and apply all new stuff (own defcommand-macros). After that you should see the “rc file loaded successfully” message (and the new available commands via Ctrl-t ?), which means that now we can run chromium via own Ctrl-t W command using the same stumpWM-process.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: