123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335 |
- <html>
- <head>
- <title>The Spectrwm Window Manager</title>
- <link rel="stylesheet" href="main.css" type="text/css" />
- </head>
- <body>
- <center><h3>The spectrwm window manager</h3></center>
- <a href="https://opensource.conformal.com/wiki/spectrwm">The spectrwm
- window manager</a> was inspired by xmonad and <a href="dwm.html">dwm</a>. It shares several
- characteristics of dwm and has several nice features of its own, things
- that I always had to add to dwm with scripts or patches. The downside of
- that is that it's a bit bigger, with more dependencies, than dwm, but even
- on an old machine, it would be considered a very lightweight and fast
- window manager. <p>
- It was originally named scrotwm. Whether the humor was amusing, infantile,
- or both can be left to the judgement of the reader. Some people were
- offended and eventually the name was changed to spectrwm.<p>
- After installation, a default spectrwm.conf is created. If building from
- source, it will be in the spectrwm directory created after untarring the
- tarball. In Ubuntu based systems, as well as Fedora, it's /etc/spectrwm.conf.
- In FreeBSD it's /usr/local/etc/spectrwm.conf<p>
- Copy this file to your home directory.
- <table border="0" bgcolor="#E8E8E8">
- <tr>
- <td>
- <pre>
- cd
- cp /etc/spectrwm.conf .spectrwm.conf
- </pre>
- </td>
- </tr>
- </table>
- <p>
- Note the period before the name in your home directory. That's making it a
- hidden file. <p>
- The file is fairly straightforward and has pretty sane defaults. The key
- bindings are described in the man page. Between the descriptions in the
- file and the man page, even the newcomer shouldn't have much trouble. This
- page is to just touch upon some things said newcomer may overlook.<p>
- Like many tiling window managers, Mod1 (the alt key), shift, and return
- launches an xterm by default. Mod1 and p will launch dmenu, which, if you're
- not familiar with it, is a very handy little application--it will appear by
- default, at the top of the screen and you can enter the name of an
- application into it. It has automatic tab completion, so if you enter the
- first few letters of thunderbird, for example, it will complete the
- word--you can then hit enter and it will launch thunderbird.<p>
- The first window, on the left, is the master window. As you add other
- windows, they will open in a stack on the right, automatically sizing
- themselves so that they can fit. To swap a window with the master window,
- Mod1 and return will put the focused window on the left, as the main
- window. So, you might have a browser on the left and two or three
- terminals on the right. If you're doing something involved in one terminal
- and need more top to bottom space, give it focus, hit Mod1 and return, and
- it's in the master window. Some prefer that new windows open in the master
- position, and all currently open windows get moved to the stack column.
- (This is the default behavior of dwm, for example). In such a case, find
- the line in your $HOME/.spectrm.conf that reads
- <table border="0" bgcolor="#E8E8E8">
- <tr>
- <td>
- <pre>
- spawn_position = last
- </pre>
- </td>
- </tr>
- </table>
- <p>
- and change the word last to read first.<p>
- The <a href="https://github.com/conformal/spectrwm/wiki">home page</a> has
- some screenshots. <p>
- Hitting Mod1+l (lower case L) will expand the master window to the right.
- Hitting Mod1+h will shrink it to the left, or expand the stack on the
- right, depending upon your point of view. Those used to dwm will find the
- default keybindings fairly similar--using h and l to expand and contract
- the master are similar to movement keys in the vi editor. To focus on the
- next window use Mod1+j and Mod1+k moves to the previous window.<p>
- All of the above is common on many tiling window managers, but may help the
- novice as a 1 minute tutorial. Many people choose to customize their
- window manager, and this is where spectrwm shines, with a plain text
- configuration file and the ability to reload without restarting.<p>
- Let's start with the status bar. The default bar has more information than
- I need or want. I want the title of the focused window, the number of the
- workspace, and the date. Depending upon your version of spectrwm, you may
- have to manually add bar_format to your $HOME/.spectrwm.conf. A full
- description of the format is in the man page. To get what I want I use
- <table border="0" bgcolor="#E8E8E8">
- <tr>
- <td>
- <pre>
- bar_format =[+I] %R %F +C
- </pre>
- </td>
- </tr>
- </table>
- <p>
- The [+I] gives me the workspace number, and %R %F are the date format I
- prefer, giving me a time and date like 14:20 2014-11-14 (if it was 14:20 on
- the 14th of November in 2014, the day I'm writing this). The +C gives me
- the window class, which can be useful if I have a bunch of windows open.
- Spectrwm does identify the focused window by default, by having a 1 pixel
- red outline around it, but it can be useful to see it in the status bar as
- well. Some people prefer to have +W as well, for the window name. As far
- as I can see, if you have +C, +W or both in your bar_format line, you can
- leave the window_class_enabled and window_name_enabled at their default
- value of off. I haven't tested this too much, but it does seem that even
- if you turn them on, if you don't have the +C or +W in your bar_format
- line, you won't see a window name (or class) in the status bar.<p>
- One nice feature of spectrwm is that once you've changed your config file,
- MOD+q will reload it so that you can see your changes. (To quit spectrwm
- entirely use MOD+Shift+q). So, after making a change, hit MOD+q, and see
- if you like it. <p>
- A common change is the mod key. The default is Mod1, the alt key.
- Many people, including myself, prefer Mod4, the Windows key on a Windows
- keyboard, also known as Super. In your $HOME/.spectrwm.conf file, look for
- the line (like most defaults, it is commented out)
- <table border="0" bgcolor="#E8E8E8">
- <tr>
- <td>
- <pre>
- # modkey = Mod1
- </pre>
- </td>
- </tr>
- </table>
- <p>
- Change it Mod4 to have the Windows key be your usual mod key.<p>
- It has certain default programs--for example, the default terminal is
- xterm . You will see lines in your spectrwm.conf file like
- <table border="0" bgcolor="#E8E8E8">
- <tr>
- <td>
- <pre>
- program[term] = xterm
- </pre>
- </td>
- </tr>
- </table>
- <p>
- If you preferred urxvt, you can change xterm to urxvt.
- Its default binding is MOD+Shift+Return. To disable any default binding,
- look for the section Validated default programs. In the section below it,
- you can see examples of how to disable validation, just uncomment the
- default bind keys. In practice, if you specify another binding, this
- probably isn't necessary. For example, I prefer to open dmenu with
- MOD+Shift+p as I use MOD+p for firefox--a habit formed long, long ago, when
- it was called phoenix. Even if I don't uncomment the default MOD+p for
- dmenu, MOD+p still opens firefox if I have it defined in my
- .spectrwm.conf.<p>
- To bind a program to a key, you must first define it with a program line.
- For example, if I want to open firefox with a key command, I must first
- define the program. They give an example of firefox, opening it to the
- spectrwm home page. Suppose I just want open the opera browser with the
- key combo of MOD+o. I first give it a name with a program line, then open
- it.
- <table border="0" bgcolor="#E8E8E8">
- <tr>
- <td>
- <pre>
- program[opera] = opera
- bind[opera] = Mod+o
- </pre>
- </td>
- </tr>
- </table>
- <p>
- The program line is necessary. It can be quite useful to, for example, open
- a program with specificed defaults. For example, if I want open irssi in a
- specifically colored terminal
- <table border="0" bgcolor="#E8E8E8">
- <tr>
- <td>
- <pre>
- program[irc] = urxvt -bg black -fg white -e 'irssi -c irc.freenode.net'
- bind[irc] = MOD+i
- </pre>
- </td>
- </tr>
- </table>
- <p>
- (Either MOD or Mod will work.)<p>
- One very nice feature of spectrwm is that one can quickly, with the
- keyboard, toggle a window from tiled to floating and then, if it's
- floating, move it around and resize it. The keyboard shortcuts are in the
- man page, and can be added or changed in $HOME/.spectrwm.conf. MOD+t
- toggles the window to floating--then MOD+] moves it to right, MOD+[ to the
- left. MOD+- (the minus sign) shrinks the window's width. MOD+_ (the
- underscore, done with MOD+Shift+ the -_ key) shrinks the height. MOD+=
- increases the width and adding the Shift key, so that it's MOD++ (the plus
- sign) increases the height.<p>
- At work, I have 4 1600x900 monitors. I have NVidia cards and use the
- nvidia-settings program to make it run in Xinerama, one big screen. Using
- dwm, it seems to recognize screen boundries by default. With spectrwm,
- this should be configured in your .spectrwm.conf You will see a default
- commented out entry
- <table border="0" bgcolor="#E8E8E8">
- <tr>
- <td>
- <pre>
- region =screen[1]:1280x1024+0+0
- region =screen[1]:1280x1024+1280+0
- </pre>
- </td>
- </tr>
- </table>
- <p>
- This refers to the screen resolution, X (left to right) and Y (top to
- bottom) positions. So, as all my monitors are 1600x900 I use
- <table border="0" bgcolor="#E8E8E8">
- <tr>
- <td>
- <pre>
- region =screen[1]:1600x900+0+0
- region =screen[1]:1600x900+1600+0
- region =screen[1]:1600x900+0+900
- region =screen[1]:1600x900+1600+900
- </pre>
- </td>
- </tr>
- </table>
- <p>
- I'm not sure what that first [1] is for. The man page says idx but at any
- rate, in my setup, it stays at [1] for all of them. The first monitor, the
- upper left is at 0 and 0 that is, the far left and top edge of both X and Y
- axis. The second one is to the right, so it's at 1600 on the left to right
- axis and 0 on the Y axis. The third one is bottom left and so it's 0 for
- left to right and 900 on the Y axis and the last one, the bottom right,
- starts at 1600 on the left right axis and 900 at the up down axis. Some
- people may want larger regions, in which case they would make something
- like 3200x900+0+0. (To make one huge screen, I guess it would be 3200x1800,
- but in my case, I want each monitor to be a separate region.)<p>
- Each screen, when I do it this way, unlike dwm, has a different workspace
- number. If I have, for example firefox open on the top left, and
- thunderbird on the upper right, then, on the lower left, have something
- else, and then use MOD+2 on the lower left, it will now show me workspace
- 2, in other words, what was on the upper right monitor. The former
- workspace 2 will also change numbers. I've never actually kept track of
- this, as it only happens to me by mistake--generally what I want to do is
- open a fresh workspace, meaning I should use MOD+5, and hit 2 by mistake.
- Putting it back, by, while focused on the lower left monitor, doing
- MOD+3, puts all workspaces back to normal. MOD+Shift+number will moved a
- focused window to the workspace indicated by the number. In other words, if
- I want to move a terminal from workspace 3 to workspace 5, I focus on the
- terminal, hit MOD+Shift+5 and the terminal will now be on workspace 5.
- <p>
- With multiple monitors, you have to watch this--MOD+number won't switch
- focus to the screen with workspace 2, it will switch workspace 2 to the
- currently focused monitor. To move focus to a different monitor, the
- default key combination is MOD+<number> with the number being the
- keypad,rather than the number keys, which, as mentioned will switch the
- workspace within the monitor. The command is rg_n, with n referring to the
- number. One can also use rg_next and rg_previous. If you want, for
- example, to use MOD+N and MOD+P for next and previous regions (as MOD+p
- with lower case is already used)
- <table border="0" bgcolor="#E8E8E8">
- <tr>
- <td>
- <pre>
- bind[rg_next] = MOD+Shift+n
- bind[rg_prev] = MOD+Shift+p
- </pre>
- </td>
- </tr>
- </table>
- <p>
- On FreeBSD, I've found that one has to install x11/fonts/fonts-misc-misc.
- Otherwise, if I try to start spectrwm with startx, it fails to start,
- complaining about missing fonts. (I installed spectrwm with pkg, this may
- not be true with ports. On Fedora, I wasn't able to get the
- rpm to work in 21 beta, latest F23 (in TC status as I write this),
- everything is fine. On older versions If I installed
- the git version, it worked as expected. <p>
- In CentOS 6,x I'm not able to get anything later than version 2.5.1 to
- compile. To get it to work, after extracting the tarball, I have to edit
- the linux/Makefile. There is a line that begins LDADD+=. To get it to
- compile I have to edit it so that it reads
- <table border="0" bgcolor="#E8E8E8">
- <tr>
- <td>
- <pre>
- LDADD+= -lX11 -lX11-xcb -lxcb-aux -lxcb-icccm -lxcb-randr -lxcb-keysyms -lxcb-xtest -lXft -lXcursor
- </pre>
- </td>
- </tr>
- </table>
- <p>
- If your browser broke that, it should be on one line. In version 2.6 and
- above, the linux/Makefile doesn't have that line. The Makefile in the main
- directory has an LDADD line, but editing that didn't enable me to compile
- it. I should add that I have no knowledge of C, and it's possible that
- there's an easy fix, but with my relatively simple needs, version 2.5.1 is
- fine.
- <!--(FIXME--what about MOD+right and left)-->
-
- </body>
- <center><h2></h2></center><p>
- <center><script language="JavaScript">
- if (Date.parse(document.lastModified) > 0) {
- document.write ('<b>last modified: </b>' + document.lastModified +'<p>');
- }
- document.write('<b> url:</b>' + document.location.href + '</font><p>');
- </script>
- <hr width=60% align="center"><p>
- </body>
- </html>
|