VSIDO Support > WM Designs and Discussions

spectrwm - tiling made simple

(1/3) > >>

Tiling window managers are pretty efficient (low resource usage etc ...) and a good way to get the most out of limited screen real estate like on a netbook or laptop. The downside of a lot of tiling window managers is that they use complex programing languages like lua (awesome), haskel (xmonad), LISP (stumpwm), or python (qtile) for configuration. If you know the programing language, or are the type that likes to learn them, you can get a lot out of those window managers - just look at some of digit's xmonad setups if you don't believe me.

For those of us that prefer simpler text files for configuration there is spectrwm which according to the authors is:

--- Quote ---spectrwm is a small dynamic tiling window manager for X11. It tries to stay out of the way so that valuable screen real estate can be used for much more important stuff. It has sane defaults and does not require one to learn a language to do any configuration. It was written by hackers for hackers and it strives to be small, compact and fast.
--- End quote ---

That also makes it an excellent tiling window manager for those that are trying one out for the first time.

It's in the repos and fairly current, but when I installed it from the repos, a file related to keybindings didn't seem to get installed. The window manager still worked, but it's really handy to have that other file so I recommend you install from git.

Get the deps (there are 2-3 small files not installed by default):

--- Code: ---sudo apt-get build-dep spectrwm
--- End code ---

and install suckless-tools (provides dmenu and slock if you don't have them installed)

--- Code: ---sudo apt-get install suckless-tools
--- End code ---

then get the sources from git (git is not installed by default in VSIDO):

git page for spectrwm

or here (towards bottom of page)

spectrwm page

this creates a <build directory>/spectrwm; for linux, change to the <build dir>/spectrwm/linux

--- Quote ---cd <build dir>/spectrwm/linux
--- End quote ---


--- Quote ---make

# followed by

sudo make install
--- End quote ---

There is a spectrwm.desktop file included with the git download you can copy over to /usr/share/xsessions.

The main configuration file and the default keybinding file are also included with the git download. The main configuration file is spectrwm.conf, the keybinding file is tagged with a language - for me it is spectrwm_us.conf.

First thing to do is edit the spectrwm.conf file. In your favorite text editor find the lines:

--- Code: ---# program[lock] = xlock
--- End code ---

and change it to:

--- Code: ---program[lock] = slock
--- End code ---

instead of slock, you can use whatever screen locking program you use, or xscreensaver, etc  ....

also find this line:

--- Code: ---#keyboard_mapping = ~/.spectrwm_us.conf

and uncomment it

keyboard_mapping = ~/.spectrwm_us.conf  <-- also edit to reflect the language file you're using; us is the default.

--- End code ---

this allows you to edit the default keybindings for spectrwm.

Once that is done copy spectrwm.conf and spectrwm_us.conf to /etc to provide system-wide configuration. To make your own customized configuration, copy these two files to your home directory as dotfiles

--- Code: ---cp spectrwm.conf ~/.spectrwm.conf


cp spectrwm_us.conf ~/.spectrwm_us.conf  <- use the lanuguage file of choice
--- End code ---

Should be all set to log into the default configuration for spectrwm. To customize the configuration, you'll want to be familiar with xprop and xev so you can get the window class and key codes if you need them. Read the man pages for those as well as the man page for spectrwm. The man page for spectrwm is well written and worth the read.

To configure spectrwm, you edit the ~/.spectrwm.conf file. It's pretty self-explanatory and editing it while you also have the man page open makes configuration really simple. The configuration file lists all the default settings, if you want to make a change, uncomment the line and make the change.

A couple changes I typically make:

--- Code: ---# workspace_limit = 22
workspace_limit         = 9  <-- I can think of no situation where I need 22 workspaces
--- End code ---

--- Code: ---# focus_mode = default
focus_mode              = manual  <-- the default is focus follows mouse which is sort of annoying in a tiler, manual is the familiar click-to-focus
--- End code ---

and similar through the rest of the file.

Note that for colors, spectrwm works with rgb notation or the name so its (for black): rgb:00/00/00, or black - not #000000 or "#000000".

Spectrwm has the typical default layouts, but I make a couple changes:

--- Code: ---# layout = ws[1]:4:0:0:0:vertical
# layout = ws[2]:0:0:0:0:horizontal
layout = ws[1]:0:0:0:0:horizontal
layout = ws[2]:0:1:0:0:vertical
--- End code ---

I prefer the horizontal (bottom stack) as default so I use it on workspace 1 ( ws[1] ). That first nuber (4) is a size increment increase (-4 would decrease) for the master window, I change it to 0 so that the master window is the same size as the stack, occupying 50% of the screen. For workspace 2, I add a master window - the 1 - so that the vertical layout is now a grid:

this -

becomes -

Definitely worth reading how to code those layouts in the spectrwm man page.

Spectrwm has it's own status bar, if you can script you can output to the bar by changing the line:

--- Code: ---# bar_action = baraction.sh     <-- note that baraction.sh is included with the git download, but gives me a syntax error
bar_action = some_script.sh <- may need to use full path to script.
or if you prefer to use conky:
bar_action       = conky
--- End code ---

conky needs to be configured so that it does not output to X:


--- Code: ---out_to_console yes
out_to_x no
background no
update_interval 1
total_run_times 0
use_spacer none

<all your conky stuff>
--- End code ---

If you prefer a statusbar like dzen2, you can use it as well. Either run it so that it covers the spectrwm statusbar, or create a region for it (or any panel). Creating a region in spectrwm is done by editing:

--- Code: ---# region = screen[1]:1280x1024+0+0
# region = screen[1]:1280x1024+1280+0
--- End code ---

It's somewhat counter intuitive in that the region is the amount of screen real estate used by the open windows, not the amount you want used by the panel. My laptop resolution is 1366x768 so a region:

--- Code: ---region  = screen[1]:1366x740+0+0
--- End code ---

makes a working area of 1366x740 and places the upper left corner of the region at +0+0 (upper left corner of screen). Leaves a 28 pixel gap at the bottom of the screen that I ca fill with my own dzen taksbar:


tint2 and xfce4-panel do not work well with spectrwm.

If you want to change the default keybindings of spectrwm, make edits to the ~/.spectrwm_us.conf file, if you want to add your own, add them to the ~/.spectrwm.conf file. Just follow the example provided for firefox.

Some apps you don't want tiled - like xcalc - for that you need to define a quirk for that app using the class. Use xprop to get the class name for the app, and then define the quirk - note that the quirk reverses the order of the class name provided by xprop.

Without a quirk -


--- Code: ---quirk[XCalc:xcalc] = FLOAT + ANYWHERE
--- End code ---

to get -

quirks are also handy if you want to have a system tray - stalonetray works pretty well with spectrwm. This quirk:

--- Code: ---quirk[stalonetray:stalonetray] = FLOAT + ANYWHERE + NOFOCUSCYCLE + NOFOCUSONMAP + OBEYAPPFOCUSREQ
--- End code ---

causes stalonetray to float, and removes it from the cycling order so that Alt-Tabbing does not bring it into focus:

quirks can be set up for any app - like xfce4-appliction finder if you don't want to use dmenu. Another section of the man page you'll want to read.

That pretty much covers the hilights. The configuration file is well annotated and the man page is well written. Also read through the default keybinding file to know what the basics are:

MOD+Shift+Return - starts an xterm  <- by default the Alt key is the MOD, that can be changed in the .spectrwm.conf file
MOD+q - restarts the window manager
MOD+Shift+q - exits the window manager
MOD+p - runs dmenu

and plenty more for changing workspaces, resizing the master area, toggle floating etc ...

Spectrwm is an excellent window manager, and an excellent introduction to tiling.

Very nice PackRat!  That was a lot of work.  Nicely done.  Now of course I'll have to try it out!  Been back to Fluxbox since my foray into the world of awesomewm.  Actual text file configs are a very tempting reason to give it a shot...

What Jedi said... nice work wolfy...  ;)


Should point out that the spectrwm bar does not support xft fonts, use xfontsel to find a font you like if you don't want terminus. It doesn't support colored output from conky, so keep your conkyrc simple.

VSIDO, spectrwm, urxvt, htop -

One popular feature is to have an application open on a certain workspace; this is also done with a quirk - by changing the default to this:

--- Code: ---quirk[Gimp:gimp] = FULLSCREEN + WS[3]
--- End code ---

gimp will open fullscreen on workspace 3.

Spectrwm also has an autorun section in the .spectrwm.conf:

--- Code: ---# Launch applications in a workspace of choice
# autorun = ws[1]:xterm
# autorun = ws[2]:xombrero http://www.openbsd.org
--- End code ---

add some apps here to start them when logging into spectrwm:

--- Code: ---autorun = ws[4]:xchat
autorun = ws[1]:stalonetray -c ~/.stalonetray-spectrwm
--- End code ---

starts xchat on workspace 4, and stalonetray in workspace 1

One limit of spectrwm is that the system tray isn't sticky across workspaces (neither are panels like tint2) so it is only visible on workspace 1 (only visible on the workspace it starts on). The xchat icon should blink when a message is recieved, and stalonetray will adhere to the quirks defined in the previous post.


[0] Message Index

[#] Next page

Go to full version