StumpWM

Since Canonical decided to ship Ubuntu with Unity as opposed to GNOME as the default desktop in their next release, I decided to take a look at StumpWM again.

Although I like keyboard driven apps like emacs, conkeror, and screen, GNOME with Tracker + deskbar-applet (similar to Mac OS X’s Spotlight) has been sufficient; I think any stable Linux desktop is sufficient for me since they’re all very configurable by default (keyboard shortcuts!). The need for a tiling window manager doesn’t apply to me since 1) I work on my laptop/netbook (10in-13in), so I usually have windows maximized; 2) I’m pretty fast with Alt-Tab; and 3) non-minimal window manangers have certain services all set up, such as sound/video control (with shortcuts), network manager, etc. Basically, having convenient applets, a quick way to move between windows, and a quick way to launch apps (think Mac OS X’s Spotlight) makes me happy.

Nonetheless, I toyed with StumpWM again but decided I’m not ready for it yet. Maybe I will be ready the next time when I’m using a bigger screen. I’ll outline my trial for documentation.

I followed this to set up StumpWM on Ubuntu. This screencast gives a good overview of the powers of StumpWM.

Compile

sudo apt-get install sbcl sbcl-doc ## common lisp compiler
sudo sbcl
## enter following in sbcl prompt
## select [SKIP-GPG-CHECK] when asked. Have to do this a few times
(require 'asdf)
(require 'asdf-install)
(asdf-install:install 'clx)
(asdf-install:install 'cl-ppcre)
(quit)
## more install
sudo apt-get install xorg-dev
git clone git://git.savannah.nongnu.org/stumpwm.git ## use latest version
cd stumpwm
autoconf
./configure
make
sudo make install
sudo make install stalonetray ## for docking applets from GNOME

Add StumpWM as an entry in GDM Sessions Menu

sudo emacs -q -nw /usr/share/xsessions/stumpwm.desktop
## add following
[Desktop Entry]
Encoding=UTF-8
Name=StumpWM
Comment=This session logs you into StumpWM (a minimalistic window manager)
Exec=/usr/local/bin/stumpwm
Icon=
Type=Application

Restart computer and choose StumpWM when logging in.

~/.stumpwmrc

;; -*- lisp -*-
(in-package :stumpwm)

;mode line
(stumpwm:set-fg-color "green")
(stumpwm:set-bg-color "black")

;startup apps
(stumpwm::run-shell-command "stalonetray")
(stumpwm::run-shell-command "nm-applet")
(stumpwm::run-shell-command "gnome-volume-control-applet")
(stumpwm::run-shell-command "gnome-power-manager")
(stumpwm::run-shell-command "system-config-printer-applet")
(stumpwm::run-shell-command "dropbox start -i")
(stumpwm::run-shell-command "gnome-power-manager")
;; (stumpwm::run-shell-command "")
;; (stumpwm::run-shell-command "")

;keybinding
(define-key *top-map* (kbd "M-Tab") "pull-hidden-next")
(define-key *top-map* (kbd "M-ISO_Left_Tab") "pull-hidden-previous") ;; shift
(define-key *top-map* (kbd "M-]") "pull-hidden-next")
(define-key *top-map* (kbd "M-[") "pull-hidden-previous")
(define-key *top-map* (kbd "s-Tab") "fnext")
(define-key *top-map* (kbd "s-]") "gnext")
(define-key *top-map* (kbd "s-[") "gprev")
(define-key *top-map* (kbd "s-b") "move-focus left")
(define-key *top-map* (kbd "s-n") "move-focus down")
(define-key *top-map* (kbd "s-p") "move-focus up")
(define-key *top-map* (kbd "s-f") "move-focus right")
(define-key *top-map* (kbd "M-F4") "kill")
(define-key *top-map* (kbd "s-s") "fullscreen")
(define-key *top-map* (kbd "M-F2") "exec")
(define-key *top-map* (kbd "s-SPC") "exec")


(define-key *root-map* (kbd "M-F") "fullscreen")

I want to try xmonad next when I have time. My verdict now is to stay with GNOME.

file management: emacs dired to replace Finder in mac os x (and other OS)

I hate Finder in Mac OS X. I mean, it looks nice and all, but it is not customizable. I really liked the KDE window management back when I used Kubuntu because I can select/de-select files with the keyboard, cut/paste/copy files with the keyboard, have shortcuts to different locations, etc. Finder has some keyboard shortcuts, but not at all flexible. You can copy and paste files, but you can’t cut and paste files. Selecting/de-selecting files is not as flexible (eg, skipping a file). I can’t go to the sidebar window where all my bookmarked locations reside using the keyboard. Finder, and in general Mac OS X, is not so flexible. This bugs me a lot. I wanted to get stumpwm working in OS X so that things are more keyboard-oriented. However, it doesnt work with all the native mac apps. The fix is with dired mode in emacs. I spend most of my time in emacs already. With dired, I can even manage files inside emacs (I can do so in the shell, but this makes browsing and executing commands on files a breeze). Use “C-x f” and navigate to a location rather than a file. Learn all the keyboard shortcuts for delete, rename, execute shell command, etc. You can even cut/copy/paste with wuxch-dired-copy-paste. The functions below also allow me to open files the Mac way, with the “open” command. This is cool because files will be opened with the native Mac default application.

<pre class="src src-sh">;; http://www.emacswiki.org/emacs/DiredPlus

;; copy and paste files in dired ;; needed additional files, such as dired+, dired-details+, find-dired+, and find-dired- (require ‘wuxch-dired) (require ‘wuxch-dired-copy-paste) ;;http://stackoverflow.com/questions/1824696/function-to-call-same-shell-command-in-dired ;; (defun dired-do-shell-mac-open-vqn () ;; (interactive) ;; (dired-do-async-shell-command ;; “open” current-prefix-arg ;; (dired-get-marked-files t current-prefix-arg))) (defun dired-do-shell-mac-open-vqn () (interactive) (save-window-excursion (dired-do-async-shell-command “open” current-prefix-arg (dired-get-marked-files t current-prefix-arg))))

(define-key dired-mode-map (kbd “s-o”) ‘dired-do-shell-mac-open-vqn)

I can use Apple-o/Windows-o to open files with the default mac program for the marked files.I also use emacs’ bookmark system (“C-x r b” and “C-x r m”) to bookmark locations.Note that all this is not specific to Mac OS X. Dired’s been around forever – I just never picked it up really. Now with my “open” trick and the bookmark system, this should really replace my use of Finder in Mac OS X.

Update 11/10/2010 – On Linux

I’m back on Linux now. A few updates on launching files with the default application. Add the following to the emacs init file:

(defun dired-do-shell-launch-file-default ()
 (interactive)
 (save-window-excursion
 (dired-do-async-shell-command
 "$HOME/Documents/bin/open.sh" current-prefix-arg ;; linux;; multiple files
 ;; "nohup xdg-open" current-prefix-arg ;; linux can open multiple files, but one at a time
 ;; "see" current-prefix-arg ;; linux;; can open at most 1 file (being opened)
 ;; "open" current-prefix-arg ;; mac os x
 (dired-get-marked-files t current-prefix-arg))))
(define-key dired-mode-map (kbd "s-o") 'dired-do-shell-launch-file-default)

Need the script open.sh (thank you fledermaus from #emacs):

#! /bin/bash

for file in "$@"
do
nohup xdg-open "$file" &
done
sleep 1

Now, to unmount devices in emacs:

;; unmount disk in dired
;;http://loopkid.net/articles/2008/06/27/force-unmount-on-mac-os-x
(defun dired-do-shell-unmount-device ()
 (interactive)
 (save-window-excursion
 (dired-do-async-shell-command
 "umount" current-prefix-arg ;; linux
 ;; "diskutil unmount" current-prefix-arg ;; mac os x
 (dired-get-marked-files t current-prefix-arg))))
(define-key dired-mode-map (kbd "s-u") 'dired-do-shell-unmount-device)

If an error is returned, make sure the device is not being used anywhere, including opened in nautilus or in some terminal.

The ability to launch files with the default application (look into xdg-open, gnome-open, and see), unmnount devices, and being able to copy/paste files in emacs help makes dired the perfect file manager. I will use this from now on over Nautilus. It’ll compliment using stumpwm.

stumpwm on mac os x

stumpwm is to window managing (tiling?) system what emacs is to text editing and conkeror is to web browsing.

very cool. if i was on a linux laptop/desktop like i used to be, i would definitely use this. i’m even debating on quitting my mac os x for this (with emacs and conkeror). however, i most likely won’t since mac os x is pretty stable and most new stuff will be compatible with it (ease of use, plug and play).

i wanted to get stumpwm working on mac os x (intel based) like this post, but i never got it to work. somehow, i got it to work. my steps:

  1. update xquartz like the post said.
  2. install sbcl via macports.

UPDATE: actually, i think i used the sbcl for mac via this site.

  1. download the stumpwm source:

git clone git://git.savannah.nongnu.org/stumpwm.git

  1. followed the README file of stumpwm for sbcl:
  <pre class="src src-sh">$ sbcl

* (require ‘asdf) * (require ‘asdf-install) * (asdf-install:install ‘clx) * (asdf-install:install ‘cl-ppcre)

this step gave me MANY errors. i kept selecting the option to retry and continue like crazy. i finally gave up.

  1. continued with README
  <pre class="src src-sh">autoconf <span style="color: #ff4500;">##</span><span style="color: #ff4500;">get if not available. macports?</span>

./configure ##may need to specify sbcl if clisp is also installed make

stumpwm binary should be installed

  1. put following in ~/.xinitrc:

exec ~/Downloads/stumpwm/stumpwm ## path to stumpwm binary

launch programs in X (for example, xterm). look at stumpwm manual for keyboard shortcuts. very cool. this makes me REALLY want to go back to linux as my main computer.