Home > nerdcore, software > tiling window manager on the mac

tiling window manager on the mac

January 28th, 2011 Leave a comment Go to comments

I recently switched to the awesome (thats the name !!!) wm on my linux box (lets see how long that one will last). So i decided to have dwm up and running again on my mac. Thats rather usefull when working with many terminals at once . . .
First thing is to get the newest XQuartz: http://xquartz.macosforge.org/trac/wiki – normal X11 produced some wierd key-codes on my site so i switched to XQuartz . . .
Now is the time to get the sources for dwm from suckless.org: http://dwm.suckless.org/ and while you’re there grab dmenu as well: http://tools.suckless.org/dmenu/. Compile and install both somewhere your shell can find them.

Here are the relevant parts of dwm’s config.h:

static const char font[]            = "-*-fixed-medium-r-*-*-15-*-*-*-*-*-*-*";
static const char normbordercolor[] = "#cccccc";
static const char normbgcolor[]     = "#cccccc";
static const char normfgcolor[]     = "#000000";
static const char selbordercolor[]  = "#0066ff";
static const char selbgcolor[]      = "#0066ff";
static const char selfgcolor[]      = "#ffffff";
static const unsigned int borderpx  = 1;        /* border pixel of windows */
static const unsigned int snap      = 32;       /* snap pixel */
static const Bool showbar           = True;     /* False means no bar */
static const Bool topbar            = True;     /* False means bottom bar */
static const char *dmenucmd[] = { "dmenu_run", "-fn", font, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL };
static const char *termcmd[]  = { "uxterm", "-font", font, "+cm", "-pc", "-rv", "-sl", "2000", NULL };
	TAGKEYS(                        XK_9,                      8)
	{ MODKEY|ControlMask,           XK_q,      quit,           {0} },

The last line ensures that you do not overlay the quit keycode with the logout-functionality of mac-os-x.

To have dwm start when starting XQuartz create or edit .xinitrc and .Xdefaults in your $HOME. Here’s the actual content of these files on my hardrive

cd ~
exec >>~/.xsession-errors 2>&1
export MANPATH=${MANPATH}:/Users/william/Software/app/dwm/share/man
export PATH=${PATH}:/Users/william/Software/app/dwm/bin
export DATE=`date +"%Y-%m-%d"`
while true
  xsetroot -name "$DATE"
  sleep 3600
done &
#xsetroot -solid '#4a525a'
#xmodmap -e 'remove Mod2 = Meta_L' -e 'add Mod1 = Meta_L'
exec dwm


# File : .Xresources
xterm*font:  -*-fixed-bold-r-*-*-15-*-*-*-*-*-*-*
xterm*font1: -*-fixed-medium-r-*-*-18-*-*-*-*-*-iso8859-*
xterm*font2: -*-*-*-*-*-*-2-*-*-*-*-*-*-*
xterm*font3: -misc-fixed-*-r-normal-*-8-*-*-*-*-*-iso8859-*
xterm*font4: -b&h-lucidatypewriter-bold-*-*-*-12-*-*-*-*-*-*-*
xterm*font5: -*-screen-bold-r-normal-*-16-*-*-*-*-*-iso8859-*
xterm*font6: -*-lucidatypewriter-medium-*-*-*-18-*-*-*-*-*-*-*
xterm*font7: -*-lucidatypewriter-medium-*-*-*-20-*-*-*-*-*-*-*
xterm*font8: -dec-terminal-bold-r-normal-*-14-*-*-*-*-*-iso8859-*
XTerm*background: black
XTerm*foreground: white
#XTerm*pointerColor: blue
#XTerm*pointerColorBackground: black
#XTerm*cursorColor: navy
#XTerm*internalBorder: 3
XTerm*loginShell: true
XTerm*scrollBar: false
XTerm*scrollKey: true
XTerm*saveLines: 1000
XTerm*multiClickTime: 250

Now dwn should startup when XQuartz ist launched. To make the Alt-keys work you have to switch on the corresponding option under X11->Preferences->Input “Option keys send Alt_L and Alt_R” and I’d also suggest enabling “Emulate three button mouse”.

The key combo shift-alt-enter now starts a new shell. Open a few more. Now you use Alt-j to cycle forward through your shells and Alt-k to cycle backwards. Alt+enter switches the actual shell to the biggest frame on the left. Alt-h and Alt-l move the border between the main shell and the sub-shells by 5% per keystroke.

With alt+number you can switch between the 9 different screens. Using shift-alt-number moves the shell/program with focus to the desired screen.

Starting other apps than the shell is easily done by using dmenu that is started with alt-p. This shows the list of possible target-apps as an overlay to the top-bar. Just type in the first few letters of the app you want to start to refine your selection to the point were you can use the cursor keys to highlight the right name and then press enter to start. You can even use parts of the app-name that are not at the beginning of the word – for example to start xcutsel its sufficient to type in “tsel” :

Rock on 😉

Categories: nerdcore, software Tags: ,
  1. petersen
    February 1st, 2011 at 01:03 | #1

    Hab ich auch schon alles probiert, is aber irgendwie alles scheisse.
    X unter Aqua geht gar nicht, finde ich. Und so Progrämmchen, die die Fenster resizen sind auch nicht das Wahre, da sie 1. kommerziell sind und 2. total unsicher, weil man die Behindertenhilfe einschalten muss.

    Wenn es Dir nur um mehrere Terminals geht, probier mal dvtm, das geht auch nativ.

  2. October 9th, 2011 at 01:01 | #2

    A big warm “Thank You!” for posting this! I’ve only recently been sold on DWM, and this totally got me on my feet setting it up in XQuartz.

  3. April 3rd, 2014 at 05:36 | #3

    Very soon this website will be famous amid all blog visitors, due to it’s
    nice articles or reviews

  4. September 24th, 2014 at 16:06 | #4

    I’m now not positive the place you are getting your information, but good topic.
    I needs to spend some time learning more or working out
    more. Thanks for fantastic information I was on the lookout for this information for my mission.

  1. No trackbacks yet.