Howto install stumpwm and little more

Share

Introduction

For just install, skip the intro

What is stumpwm?

A tiling, keyboard driven X11 window manager. Simply put, it permits you to choose what you do at any given time with key-bindings. Another simple way to sum up: Less is more :d.

Why?

I was lost with all the shining catch-eyes effects everywhere.

With a friend, Denis Labaye, we search for simpler. We found stumpwm and it was mind blowing.

How do i use it?

Personally, i choose to work with only one window at a time and ask for the one i want when i want it. It’s my way of seeing it but stumpwm does not limit you in this way.

For me, stump empowers you with the choice of doing anything you want your way.

The small price to pay is learning key-bindings. Small price because you can override them so the sky is really the limit.

It’s the computer that adapts to you and not the other way around.

Goal of the article

This howto explains how to install stumpwm and the little things you have to do to login with it in the gnome display manager.

Limits of the article

Targeted platform

This article is clearly oriented for a debian based distribution using a gnome display manager as the login manager. You may use some part with other distribution but i do not know how because i didn’t have the problem to solve.

Targeted audience

Geeky/Nerdy people who likes to make computer adapts to them and not the other way around.

What is stumpwm in details.

How to install

Install stumpwm from CLI

sudo apt-get install stumpwm

Add a new entry to gdm

We need to add an entry menu to gdm for stumpwm so that we can log in with it.

For this we add the file /usr/share/xsessions/stumpwm.desktop

sudo emacs -nw /usr/share/xsessions/stumpwm.desktop

Content of the file:

[Desktop Entry]
        Exec=stumpwm
        TryExec=stumpwm
        Name=stumpwm
        Comment=The Mouseless Window Manager!

Here is a simple script to do that in one shot (feel free to patch):

#!/bin/bash

WDIR=$(dirname $0)

PACKAGE=stumpwm

# Install $PACKAGE
$WDIR/install.sh $PACKAGE

# Create the file
sudo touch /usr/share/xsessions/$PACKAGE.desktop

# Add the entry for gdm
(cat <<EOF
[Desktop Entry]
        Exec=$PACKAGE
        TryExec=$PACKAGE
        Name=$PACKAGE
        Comment=The Mouseless Window Manager!
EOF
)> $PACKAGE.buffer

sudo cp $PACKAGE.buffer /usr/share/xsessions/$PACKAGE.desktop

rm $PACKAGE.buffer

src: deploy-stumpwm.sh

Logout from gdm

Gdm will reload. At next login, when you’ll choose your user to log in, you will be proposed a new entry “stumpwm” at the bottom of the screen (it may depend on your theme). Choose it and log in.

Stumpwm starts

At the top right corner, you’ll only see a help message inviting you to type “CTRL-t ?” (Control and t pressed at the same time followed by a pressure on ‘t’) for a presentation of all the simple commands you need to start.

How to improve itb

Some simple commands

Syntax

C for Control

<l> for a letter

combination C-t for Control + t pressed together

C-t x for Control+t pressed together followed by a pressure on x.

C-t ?

List the basic commands

C-t c

To launch a terminal instance (xterm or gnome-terminal)

C-t e

To launch emacs or if it is already launched, call it to display before every other window.

C-t t

To make the window behind the current one pass before and vice-versa Inside the browser, you need to escape the t to add a tab (i gives a C-t t t).

C-t s

Split the screen horizontally in two frames of equal size (emacs way). You can move the window inside each frame the same way that when you have only one frame.

C-t Q

Cancel all the split screen.

C-t k

To kill a window not responding

C-t !

To launch a shell command not mapped yet on any binding.

etc…

cf. C-t ?

Stumpwm is really cool

You can override commands simply by putting a ‘.stumpwmrc’ at the root of your home.

Granted, the file is in lisp. But you can understand it anyway.

Plus you can search the web for solution to your problems. You will find some geek who already has the answer.

My setup

The run or raise means that it only turns with one instance which is sufficient.

C-t f

Run or raise (only one instance at a time) firefox (f stands for firefox).

C-t b

Run or raise chromium (b stands for browser).

C-t i

Run or raise eclipse (i for ide)

C-t x

Run or raise gnome-terminal (x stands for xterm or any x terminal)

C-t o

To add a label (a letter) to each frame to move directly to this frame by typing the letter

C-t C-e

Launch the pdf reader (evince here)

C-t I

Display ifconfig result and display it inside a small window

C-t H

Display the content of /etc/hosts inside a small window

C-t B

Display the content of acpi -b

C-t K

Display the keys the ssh-agents holds.

C-t A

Launch the scripts ssh-add-identities that adds the keys i work with to the ssh-agent

C-t C-o

Launch the image reader (here eog)

C-t n

Launch nautilus

C-t C-s

Launch a window screenshot.

etc…

~/.stumpwmrc

Here is my setup:

;; Hey, Emacs! This is a -*- lisp -*- file!

(setf *frame-number-map* "abcdefghijklmnopqrst")

(setf *window-format* "%m%n%s nm=%50t cl=%c id=%i")

;;(run-commands "restore-from-file ~/.stumpwm.screendump")

(defcommand terminal () ()
  "run an xterm instance or switch to it, if it is already running."
  (run-or-raise "gnome-terminal --title=xterm1 --hide-menubar" '(:class "Gnome-terminal")))
(define-key *root-map* (kbd "x") "terminal")

(defcommand ssh-add-identities () ()
  "Add the identities present in ~/.ssh-agent-identities script."
  (run-shell-command "~/bin/ssh/ssh-add.sh"))
(define-key *root-map* (kbd "A") "ssh-add-identities")

(defcommand ssh-add-list () ()
  "run the ~/bin/ssh-add.sh script."
  (run-shell-command "zenity --info --text \"$(ssh-add -L)\""))
(define-key *root-map* (kbd "K") "ssh-add-list")

(defcommand cat-etc-environment () ()
  "Display the content of the file /etc/environment."
  (run-shell-command "zenity --info --text \"$(cat /etc/environment)\""))
(define-key *root-map* (kbd "E") "cat-etc-environment")

(defcommand cat-etc-hosts () ()
  "cat /etc/hosts"
  (run-shell-command "zenity --info --text \"$(cat /etc/hosts)\""))
(define-key *root-map* (kbd "H") "cat-etc-hosts")

(defcommand sbin-ifconfig () ()
  "cat /etc/hosts"
  (run-shell-command "zenity --info --text \"$(/sbin/ifconfig)\""))
(define-key *root-map* (kbd "I") "sbin-ifconfig")

(defcommand acpi-cmd () ()
  "acpi -b"
  (run-shell-command "zenity --info --text \"$(/usr/bin/acpi -b)\""))
(define-key *root-map* (kbd "B") "acpi-cmd")

(defcommand dec-brightness () ()
  "brightness decrement"
  (run-shell-command "for i in {1..5}; do ~/bin/brightness/dec.sh; done"))
(define-key *root-map* (kbd "F5") "dec-brightness")

(defcommand inc-brightness () ()
  "brightness increment"
  (run-shell-command "for i in {1..5}; do ~/bin/brightness/inc.sh; done"))
(define-key *root-map* (kbd "F6") "inc-brightness")

;; Frame selection
(define-key *root-map* (kbd "o") "fselect")

;; Emacs command
(defprogram-shortcut :emacs :command "emacsclient -c"
                     :props '(:class "Emacs")
                     :map *root-map* :key (kbd "e"))

;; Firefox
(defprogram-shortcut :firefox :command "firefox"
                     :props '(:class "Firefox")
                     :map *root-map* :key (kbd "f"))

;; Another way to declare a shortcut for launching google-chrome
(defprogram-shortcut :chrome :command "chromium-browser"
                     :props '(:instance "chromium-browser")
                     :map *root-map* :key (kbd "b"))

;; Another way to declare a shortcut for launching google-chrome
(defprogram-shortcut :chrome :command "google-chrome --no-proxy-server"
                     :props '(:instance "google-chrome")
                     :map *root-map* :key (stumpwm:kbd "C-b"))

;; Conkeror - keyboard-driven navigator - C-t c
(defprogram-shortcut :conkeror :command "conkeror"
                     :props '(:class "Conkeror")
                     :map *root-map* :key (kbd "c"))

;; IDE to the keybinding i (C-t i)
(defprogram-shortcut :eclipse :command "~/bin/ide/eclipse.sh"
                     :props '(:class "Eclipse")
                     :map *root-map* :key (kbd "i"))

;; Gnome-control-center (C-t ,)
(defprogram-shortcut :gnome-control-center :command "gnome-control-center"
                     :props '(:class "Gnome-Control-Center")
                     :map *root-map* :key (kbd ","))

;; Totem (C-t .)
(defprogram-shortcut :video-player :command "totem"
                     :props '(:class "Totem")
                     :map *root-map* :key (kbd "."))

;; Intellij-idea (C-t j)
(defprogram-shortcut :intellij-idea :command "~/applications/idea/bin/idea.sh"
                     :props '(:class "jetbrains-idea-ce")
                     :map *root-map* :key (kbd "j"))

;; File explorer nautilus (C-t n)
(defprogram-shortcut :nautilus :command "nautilus"
                     :props '(:instance "nautilus")
                     :map *root-map* :key (kbd "n"))

;; Transmission-gtk (C-t /)
(defprogram-shortcut :torrent :command "transmission-gtk"
                     :props '(:instance "transmission-gtk")
                     :map *root-map* :key (kbd "/"))

;; PDF reader evince (C-t C-e)
(defprogram-shortcut :evince :command "evince"
                     :props '(:instance "evince")
                     :map *root-map* :key (stumpwm:kbd "C-e"))

;; Image reader eog (C-t C-o)
(defprogram-shortcut :eog :command "eog"
                     :props '(:instance "eog")
                     :map *root-map* :key (stumpwm:kbd "C-o"))

;; Add a binding for gnome-screenshot (C-t C-s)
(defprogram-shortcut :screenshot :command "gnome-screenshot"
                     :props '(:instance "gnome-screenshot")
                     :map *root-map* :key (stumpwm:kbd "C-s"))

;; yEd (C-t y)
(defprogram-shortcut :yEd :command "~/bin/app/yed.sh"
                     :props '(:instance "sun-awt-X11-XFramePeer")
                     :map *root-map* :key (kbd "y"))

;; arduino ide (C-t C-c)
(defprogram-shortcut :arduino :command "arduino"
                     :props '(:class "processing-app-Base")
                     :map *root-map* :key (stumpwm:kbd "C-c"))

;; fritzing (C-t C-f)
(defprogram-shortcut :fritzing :command "~/applications/fritzing/Fritzing"
                     :props '(:instance "Fritzing")
                     :map *root-map* :key (stumpwm:kbd "C-f"))

;; Virtualbox (C-t C-v)
(defprogram-shortcut :virtualbox :command "virtualbox"
                     :props '(:instance "Qt-subapplication")
                     :map *root-map* :key (stumpwm:kbd "C-v"))

;;Set the mouse focus policy to ignore the mouse
(setf *mouse-focus-policy* :ignore) ;; :click, :ignore, :sloppy

;; Launch commands
(run-shell-command "/usr/bin/gnome-settings-daemon")
(run-shell-command "/usr/bin/nm-applet &")
(run-shell-command "/usr/bin/bluetooth-applet &")
(run-shell-command "/usr/bin/pactl load-module module-x11-xsmp &")
(run-shell-command "gnome-power-manager")
(run-shell-command "gnome-panel &")
(run-shell-command "dropbox start")
(run-shell-command "nautilus --no-default-window")
;; start an emacs server in background
(run-shell-command "emacs --daemon &")
(terminal)

src: .stumpwmrc

Last points

It’s “emacs compatible”. The prefix key is C-t whereas the prefix key of emacs is mostly C-x. They work well together and they have a lot in common in their usability.

Here is a screencast which presents rapidly how to use it.