Difference between revisions of "Snapwm"

From ArchWiki
Jump to: navigation, search
(Installation)
m (Style fixes.)
(31 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 
[[Category:Dynamic WMs]]
 
[[Category:Dynamic WMs]]
[https://github.com/moetunes/Nextwm Snapwm] is a very minimal and lightweight dynamic tiling window manager based on [https://github.com/moetunes/dminiwm dminiwm] (same author), which is based on [https://bbs.archlinux.org/viewtopic.php?id=100215&p=1 catwm] (by pyknite). It's basically dminiwm with a bar and reloadable rc file. It's primarily keyboard driven but has some mouse support also.
+
[https://github.com/moetunes/Nextwm Snapwm] is a xinerama aware, very minimal and lightweight dynamic tiling window manager based on [https://github.com/moetunes/dminiwm dminiwm] (same author), which is based on [https://bbs.archlinux.org/viewtopic.php?id=100215&p=1 catwm] (by pyknite).
  
== '''Layout Modes''' ==
+
Snapwm has an emphasis on easy configurability and choice. It's primarily keyboard driven but has some mouse support also.
  
It has five layout modes: vertical, horizontal, grid, fullscreen and center stacking. The default layout for all desktops is set in the config.h file and the rc file, and can be changed in the running wm.
+
== Installation ==
  
It allows the "normal" method of tiling window managers, with the new window as the master, or with the new window opened at the top or bottom of the stack(attach aside). The default tiling method for all layout modes is set in the config.h and rc file, and can be changed in the running wm.
+
=== Using the AUR ===
  
=== Vertical ===
+
[[pacman|Install]] {{AUR|snapwm-git}} from the [[AUR]].
  
    --------------
+
The sample configuration files will be installed in {{ic|/usr/share/snapwm-git/}}. Create the directory {{ic|~/.config/snapwm/}}:
    |        | W |
+
$ mkdir -p ~/.config/snapwm
    |        |___|
+
Copy the three sample files to {{ic|~/.config/snapwm/{rc.conf, key.conf, apps.conf} }} and edit to suit.
    | Master |  |
+
    |        |___|
+
    |        |  |
+
    --------------
+
  
  Default keyboard shortcut : Alt+Shift+v
+
=== Using Git ===
  
=== Horizontal ===
+
The latest version can be downloaded using [[Git]]. Initially, you can do:
 +
git clone https://github.com/moetunes/Nextwm
 +
and then update with {{ic|git pull}}.
  
    -------------
+
{{Note|While the official name of the window manager and executable is snapwm, you will notice that in moetunes' GitHub, the directory is named Nextwm which may cause some confusion.}}
    |           |
+
    |  Master  |
+
    |-----------|
+
    | W |  |  |
+
    -------------
+
  
  Default keyboard shortcut : Alt+Shift+h
+
Xlib is all that is required. To install it, do:
  
=== Grid ===
+
$ make
 +
# make install
 +
$ make clean
  
    -------------
+
=== Alternative method ===
    |      | W  |
+
    |Master|    |
+
    |------|----|
+
    |      |    |
+
    -------------
+
  
  Default keyboard shortcut : Alt+Shift+g
+
Instead of actually installing it system-wide as above, you can simply run make and then copy the executable to somewhere in your path, like {{ic|~/bin}} for example. You can then run it the same way ({{ic|exec snapwm}}) on a per user basis.
  
With three or four windows open the master window and the window *W*
+
=== Dmenu ===
can be resized. There are no useless gaps.
+
  
=== Center Stacking ===
+
Most users will want this. As the name implies, [http://tools.suckless.org/dmenu dmenu] is a menu that acts like an auto-complete for typing the name of binaries. It integrates well with tiling window managers like snapwm. See the [[dmenu]] wiki page or man dmenu for more info.
  
    -------------
+
The {{ic|sample.key.conf}} file comes with a command to start ''demenu_run'', which will search {{ic|$PATH}} for a matching executable as soon as you start typing.
    | ___      |
+
  CMD dmenucmd;dmenu_run;-i;-nb;#666622;-nf;white;NULL;
    | |___|    |
+
  KEY Alt;v;spawn;dmenucmd;
    |      ___ |
+
    |      |___||
+
    -------------
+
  
  Default keyboard shortcut : Alt+Shift+c
+
== Configuration ==
  
  Windows can be moved up/down
+
All user settings are read from three files in {{ic|~/.config/snapwm/}}.
    Default keyboard shortcut : Alt+Shift+j/k
+
Each line in these files takes the form of :
  Windows can be moved right/left
+
<Option><space><semi colon separated list>
    Default keyboard shortcut : Alt+Shift+p/o
+
and if there is more than one item in the list the line must end in a semi colon.
  Windows can be made wider/narrower
+
    Default keyboard shortcut : Alt+h/l
+
  Windows can be made taller/shorter
+
    Default keyboard shortcut : Alt+p/o
+
  
 +
snapwm comes with sample configurations files which make it easy to start configuration.
  
=== Fullscreen ===
+
All options and settings in the three configuration files are changeable in the running window manager
 +
by editing and saving the configuration file/s and updating. (default key Alt+u)
  
Takes up all the screen less the bar.
+
=== rc.conf ===
  
  Default keyboard shortcut : Alt+Shift+f
+
<Option><space><semi colon separated list>
  
  There are no borders in fullscreen mode or if there is only one open window.
+
Should have the number of desktops as the first option, which is changeable in the running window manager.
  
*Changing the layout mode or resizing windows on one desktop doesn't affect the other desktops.
+
Colours, how new windows are handled and options for the bar are set here.
*The Master window can be resized.
+
 
*The window *W* at the top of the stack can be resized.
+
=== key.conf ===
*In stacking mode the windows can be resized/moved with Alt+right/left mouse button and
+
 
* the size and position is remembered when the mode is changed
+
There are two options CMD and KEY. CMD should come before any key using it.
 +
 
 +
CMD takes the form of :
 +
  CMD<space><label>;<comand>;<command option1>;<command option2>...;NULL;
 +
The line must end in NULL;
 +
 
 +
The label is passed to a KEY with spawn as the function and the label as the variable
 +
 
 +
KEY takes the form of :
 +
  KEY<space><Modifier>;<key>;<function>;<variable>;
 +
There are nine modifying keys available :
 +
    Alt  CtrlAlt  ShftAlt  Super  ShftSuper  Control CtrlSuper ALTSuper NULL
 +
 
 +
An example for setting Alt+x to open xterm. The terminal command would be
 +
 
 +
xterm -bg black -fg white
 +
 
 +
To make the command and the keyboard shortcut.
 +
CMD xtermcmd;xterm;-bg;black;-fg;white;NULL;
 +
KEY Alt;x;spawn;xtermcmd;
 +
 
 +
=== apps.conf ===
 +
 
 +
There are two options DESKTOP and POSITION. Order isn't important.
 +
 
 +
DESKTOP is used to set the desktop that an app will open on and whether to change to that desktop when the app opens.
 +
 
 +
POSITION is used to set the geometry of an app in stacking mode.
 +
 
 +
DESKTOP takes the form of :
 +
  DESKTOP<space><window class>;<desktop to open on>;<zero to change to that desktop>;
 +
<window class> is found by using xprop on the app and reading the WM_CLASS value.
 +
 
 +
POSITION takes the form of :
 +
  POSITION<space><window class>;<x>;<y>;<width>;<height>;
  
== '''The Bar''' ==
+
== The Bar ==
  
Snapwm has an integrated bar that has a clickable desktop switcher, shows the tiling mode, shows the focused window's name and space to display some external text.
+
Snapwm has an integrated bar that has a clickable desktop switcher, shows the tiling mode, shows the focused window's name and has space to display some external text.
  
The desktop switcher can optionally show the number of windows open on unfocused desktops and in fullscreen mode. Clicking on the current desktop in the switcher will focus the next window.
+
The desktop switcher can optionally show the number of windows open on unfocused desktops and in fullscreen mode. Clicking on the current desktop in the switcher will focus the next window. Clicking elsewhere in the bar will change to the last desktop.
  
 
The bar uses the root window's name to display colored external text, which can be changed with xsetroot -name.
 
The bar uses the root window's name to display colored external text, which can be changed with xsetroot -name.
  
 
For example, with conky, you could use something like:  
 
For example, with conky, you could use something like:  
  conky | while read -r; do xsetroot -name "$REPLY"; done &
+
  $ conky | while read -r; do xsetroot -name "$REPLY"; done &
  
 
You can toggle the bars' visibility.
 
You can toggle the bars' visibility.
 
   Default keyboard shortcut : Super+b
 
   Default keyboard shortcut : Super+b
There's options in the config.h and rc file to have the bar shown at the top, the bottom or not at all. The bars' position is changeable in the running wm by editing the rc file.
+
There's options in the rc file to have the bar shown at the top or the bottom. The bars' position is changeable in the running wm by editing the rc file.
  
 
=== Colors ===
 
=== Colors ===
  
The colors for the bar are defined in defaultbarcolor[] in config.h and in BARTHEME in .snapwmrc.
+
The colors for the desktop switcher are defined in SWITCHERTHEME in rc.conf.
  
 
*'''Color 0''' : focused desktop in switcher.
 
*'''Color 0''' : focused desktop in switcher.
Line 104: Line 122:
 
*'''Color 3''' : the bar's border.
 
*'''Color 3''' : the bar's border.
  
The colors for the text in the bar are defined in defaulttextcolor[] in config.h and in TEXTTHEME in .snapwmrc.
+
The colors for the rest of the bar and text in the bar are defined in STATUSTHEME in rc.conf.
  
*'''Color 0''' : the current desktop font in the switcher and also the first color for external text.
+
*'''Color 0''' : the default background colour for the bar
*'''Color 1''' : the unfocused desktops font in the switcher and also the second color for external text.
+
*'''Color 1''' : the current desktop font in the switcher and also for external text.
*'''Color 2''' : the unfocused desktops with opened windows font in the switcher and also the third color for external text.
+
*'''Color 2''' : the unfocused desktops font in the switcher and also for external text.
*'''Color 3''' : the focused window name font and also the fourth color for external text.
+
*'''Color 3''' : the unfocused desktops with opened windows font in the switcher and also for external text.
*'''Colors 4, 5, and 6''' : the fourth, fifth and sixth colors for external text.
+
*'''Color 4''' : the focused window name font and also the for external text.
 +
*'''Colors 5 - 9''' : are for external text.
  
The colors for the windows are defined in defaultwincolor[] in config.h and in WINDOWTHEME in .snapwmrc.
+
The colors for the windows are defined in WINDOWTHEME in rc.conf.
  
 
*'''Color 0''' : focused window border.
 
*'''Color 0''' : focused window border.
 
*'''Color 1''' : unfocused window border.
 
*'''Color 1''' : unfocused window border.
  
The colors for external text can be displayed by placing & in front of the number of the color in your script. The numbers start at 0. For example, using conky, you could do something like this for displaying the time using the second color for external text:
+
The colors for external text can be displayed by placing & in front of the number of the color in your script. For example, using conky, you could do something like this for displaying the time using the second color for external text:
 
  &1${time %I:%M}
 
  &1${time %I:%M}
  
 +
The background colour in the bar can be changed by placing &B in front of the number of the wanted colour in your script.
 +
For example, using conky, you could do something like this for displaying the time using the third colour for the background and the second color for external text:
 +
&B2&1${time %I:%M}&B0
  
The colors in the running wm are changeable by editing the rc file.
+
The colors in the running wm are changeable by editing the rc file and updating.
  
 
=== Icons ===
 
=== Icons ===
  
The bar does not support icons but you can draw "icons" into a font and use those. You can find more info on that in the [https://bbs.archlinux.org/viewtopic.php?id=92895&p=1 dwm hacking thread] on the forum. There are a few fonts in the [https://aur.archlinux.org/ AUR], such as [https://aur.archlinux.org/packages.php?ID=49117 terminusmod], [https://aur.archlinux.org/packages.php?ID=53507 tamsynmod], [https://aur.archlinux.org/packages.php?ID=54304 termsyn], and [https://aur.archlinux.org/packages.php?ID=54124 ohsnap] that have some icons. To have them shown in the bar print them in a terminal then copy/paste them in snapwmrc/config.h or your script/conky.
+
The bar does not support icons but you can draw "icons" into a font and use those. You can find more info on that in the [https://bbs.archlinux.org/viewtopic.php?id=92895&p=1 dwm hacking thread] on the forum. There are a few fonts in the [[AUR]], such as {{AUR|terminusmod}}, {{AUR|tamsynmod}}, {{AUR|termsyn}}, and {{ic|ohsnap}} that have some icons. To have them shown in the bar print them in a terminal then copy/paste them in rc.conf or your script/conky. You can also use a font like {{ic|stlarch_font}} that just contains icons. You can use it in combination with another font using a comma to separate them in your {{ic|rc.conf}}:
 +
static const char defaultfontlist[] = "-*-stlarch-medium-r-*-*-10-*-*-*-*-*-*-*,-*-terminus-medium-r-*-*-12-*-*-*-*-*-*-*";
  
== '''Configuration''' ==
+
== Layout modes ==
  
Configuration changes are done first by copying config.h.def to config.h, editing config.h and running make. Most options are also in the rc file.
+
Snapwm has five layout modes: vertical, fullscreen, horizontal, grid and center stacking. The tiling mode for each desktop is set in {{ic|rc.conf}}, and can be changed in the running wm.
  
  The defined number of desktops must match the DESKTOPCHANGE keys
+
It allows the "normal" method of tiling window managers, with the new window as the master, or with the new window opened at the top or bottom of the stack (attach aside). The default tiling method for all layout modes is set in rc.conf, and can be changed in the running wm.
  
After you get a working config.h, you should compare that with the new config.h.def when updating and make any changes that are needed. You should familiarize yourself with the config.h. It's fairly self explanatory and well commented. You don't necessarily need any knowledge of C. You can look at other people's configs for examples and ideas, but don't just blindly copy and paste. At least try to understand what you're doing first. Remember to change the path for your .snapwmrc in config.h. At first, you'll need to at least learn a few of the basic keystrokes for opening a terminal, running dmenu, closing windows, quitting, etc. All of these can be found in the config.h.def. You can change them to suit, of course.
+
=== Vertical ===
  
An example for setting Alt+x to open xterm. The terminal command would be
+
    --------------
 +
    |        | W |
 +
    |        |___|
 +
    | Master |  |
 +
    |        |___|
 +
    |        |  |
 +
    --------------
  
xterm -bg black -fg white
+
Default keyboard shortcut: {{ic|Alt+Shift+v}}.
  
So make the command and the keyboard shortcut in the appropriate sections in the config.h.
+
Windows can be added/removed from the master area with a keyboard shortcut.
  const char* xtermcmd[] = {"xterm","-bg","black","-fg","white",NULL};
+
  
  {  MOD1,            XK_x,    spawn,            {.com = xtermcmd}},
+
=== Fullscreen ===
  
=== Window Manager Functions ===
+
Takes up all the screen less the bar.
The functions available to the user are :
+
  next_win
+
    Default keyboard shortcut : Alt + j
+
  
  prev_win
+
Default keyboard shortcut: {{ic|Alt+Shift+f}}.
    Default keyboard shortcut : Alt + k
+
  
  move_up
+
There are no borders in fullscreen mode or if there is only one open window.
    Default keyboard shortcut : Alt + Shift + j
+
  
  move_down
 
    Default keyboard shortcut : Alt + Shift + k
 
  
  swap_master
+
=== Horizontal ===
    Default keyboard shortcut : Alt + Shift + Return
+
  
   change_desktop
+
    -------------
     Default keyboard shortcut : Alt + [number]
+
    |          |
 +
    |  Master  |
 +
    |-----------|
 +
    | W |  |   |
 +
     -------------
  
  last_desktop
+
Default keyboard shortcut: {{ic|Alt+Shift+h}}.
    Default keyboard shortcut : Alt + Tab
+
  
  rotate_desktop
+
Windows can be added/removed from the master area with a keyboard shortcut.
    Default keyboard shortcut : Super + Right/Left
+
  
  follow_client_to_desktop
+
=== Grid ===
    Default keyboard shortcut : Alt + Shift + [number]
+
  
   client_to_desktop
+
    -------------
     Default keyboard shortcut : Super + Shift + [number]
+
    |      |    |
 +
    |Master|    |
 +
    |------|----|
 +
    |  w   |    |
 +
     -------------
  
  switch_mode
+
Default keyboard shortcut: {{ic|Alt+Shift+g}}.
    Default keyboard shortcut : Alt + Shift + c/f/g/h/v
+
  
  rotate_mode
+
=== Stacking ===
    Default keyboard shortcut : Alt + a
+
  
   resize_master
+
    ___________
     Default keyboard shortcut : Alt + h/l
+
    |   ______  |
 +
    | _|__    | |
 +
    ||    |  | |
 +
    ||____|___| |
 +
     |___________|
  
  resize_stack
+
Default keyboard shortcut: {{ic|Alt+Shift+c}}.
    Default keyboard shortcut : Alt + p/o
+
  
   kill_client
+
   Window placement strategy is set in rc.conf
     Default keyboard shortcut : Alt + c
+
     CENTER_STACK 0  all windows open centered on screen
 +
    CENTER_STACK 1  windows set their preferred position
  
   quit
+
   Windows can be moved up/down
     Default keyboard shortcut : Control + Alt + q
+
     Default keyboard shortcut : Alt+Shift+j/k
 +
  Windows can be moved right/left
 +
    Default keyboard shortcut : Alt+Shift+p/o
 +
  Windows can be made wider/narrower
 +
    Default keyboard shortcut : Alt+h/l
 +
  Windows can be made taller/shorter
 +
    Default keyboard shortcut : Alt+p/o
  
  spawn
+
* Changing the layout mode or resizing windows on one desktop doesn't affect the other desktops.
    Default keyboard shortcut : User defined for each application
+
* The Master window can be resized.
 +
* Windows can be added/removed to/from the master area with keyboard shortcuts Alt+Shift+m/l
 +
* The window *W* at the top of the stack can be resized with keyboard shortcuts Alt+o/p.
 +
* In stacking mode the windows can be resized/moved with Alt+right/left mouse button and
 +
* the size and position is remembered when the mode is changed
  
  toggle_bar
+
== Window manager functions ==
    Default keyboard shortcut : Super + b
+
  
  update_config
+
The functions available to the user are:
    Default keyboard shortcut : Alt + u
+
{{bc|
 +
next_win
 +
  Default keyboard shortcut: Alt + j
  
=== rc file ===
+
prev_win
snapwm comes with a rc file that can implement changes to most options on the fly, without the need for recompiling and which will take precedence over the compiled in options at startup. There is a sample.snapwmrc.file included that should be copied to $HOME/.config/snapwm/rc.conf and edited. To change something in the running window manager edit the rc file and save it, then hit the (default) Alt+u keys.
+
  Default keyboard shortcut: Alt + k
  
=== Transparency ===
+
move_up
 +
  Default keyboard shortcut: Alt + Shift + j
 +
      move the current window up the stack
  
Unfocused windows have an alpha value and can be transparent if used with a compositing manager(like cairo-compmgr).
+
move_down
 +
  Default keyboard shortcut: Alt + Shift + k
 +
      move the current window down the stack
  
The value is a percent and can be changed in the running wm by editing the rc file, 100 is opaque.
+
swap_master
 +
  Default keyboard shortcut: Alt + Shift + Return
 +
      move the current window to the master area
  
== '''Installation''' ==
+
change_desktop
 +
  Default keyboard shortcut: Alt + [number]
  
 +
last_desktop
 +
  Default keyboard shortcut: Alt + Tab
  
=== Using the [[AUR]] ===
+
rotate_desktop
 +
  Default keyboard shortcut: Super + Right/Left
  
Download [https://aur.archlinux.org/packages.php?ID=60164 snapwm-git]. Then, as a non-root user, run:
+
follow_client_to_desktop
$ makepkg -i
+
  Default keyboard shortcut: Alt + Shift + [number]
while in the saved PKGBUILD's directory. The files will be retrieved, built and installed.
+
      send the current window to another desktop and open that desktop
{{Note|If you have a working config.h, you can copy it to the saved PKGBUILD's directory before running makepkg and it will be used, or else the default config.h.def will be used.}}
+
The sample.rc.conf will be installed in /usr/share/snapwm-git/. Create the directory $HOME/.config/snapwm/:
+
$mkdir -p ~/.config/snapwm/
+
and copy /usr/share/snapwm-git/sample.rc.conf to ~/.config/snapwm/rc.conf and edit to suit.
+
The README.md is located in /usr/share/doc/snapwm-git/.
+
  
 +
client_to_desktop
 +
  Default keyboard shortcut: Super + Shift + [number]
 +
      send the current window to another desktop
  
=== Using [[Git]] ===
+
switch_mode
 +
  Default keyboard shortcut: Alt + Shift + v/f/h/g/c
  
The latest version can be downloaded using git. Initially, you can do:
+
rotate_mode
git clone https://github.com/moetunes/Nextwm
+
  Default keyboard shortcut: Alt + a
and then update with git pull. See the [[Git]] wiki page or man git for more info.
+
      order is vertical, fullscreen, horizontal, grid, stacking
  
{{Note|While the official name of the window manager and executable is snapwm, you'll notice that in moetunes github, the directory is named Nextwm which may cause some confusion.}}
+
resize_master
 +
  Default keyboard shortcut: Alt + h/l
  
Xlib is all that is required. To install it, do:
+
more_master
 +
  Default keyboard shortcut: Alt + Shift + m/l
 +
      add/remove window from the master area in vert or horiz mode
  
$make
+
resize_stack
#make install
+
  Default keyboard shortcut: Alt + p/o
$make clean
+
      increase/decrease the size of the window at the top of the stack
  
=== Alternative Method ===
+
kill_client
Instead of actually installing it system-wide as above, you can simply run make and then copy the executable to somewhere in your path, like ~/bin for example. You can then run it the same way(exec snapwm) on a per user basis.
+
  Default keyboard shortcut: Alt + c
  
=== Dmenu ===
+
quit
 +
  Default keyboard shortcut: Control + Alt + q
 +
 
 +
spawn
 +
  Default keyboard shortcut: User defined for each application
 +
 
 +
toggle_bar
 +
  Default keyboard shortcut: Super + b
 +
 
 +
update_config
 +
  Default keyboard shortcut: Alt + u
 +
}}
 +
 
 +
== Transparency ==
 +
 
 +
Unfocused windows have an alpha value and can be transparent if used with a compositing manager (like cairo-compmgr).
 +
 
 +
The value is a percent and can be changed in the running wm by editing the rc file, 100 is opaque.
 +
 
 +
== Multi Monitor Support ==
 +
 
 +
With X aware of multiple connected monitors, snapwm will place different desktops on each monitor.
 +
 
 +
Using xrandr, or the appropriate method for the graphics card, set the second monitor to the right of the first,
 +
the third monitor to the right of the second, etc.
 +
 
 +
Using two monitors and four desktops as an example:
 +
 
 +
desktops 1 & 3 will show on monitor 1, the last focused one always visible
 +
 
 +
desktops 2 & 4 will show on monitor 2, the last focused one always visible
  
Most users will want this. As the name implies, [http://tools.suckless.org/dmenu dmenu] is a menu that acts like an autocomplete for typing the name of binaries. It integrates well with tiling window managers like snapwm. See the [[dmenu]] wiki page or man dmenu for more info. To install it, do:
+
To move an application to the other monitor, send it to the desktop showing on that monitor
pacman -S dmenu
+
with the follow_/client_to_desktop functions.
The config.h.def comes with a command to start demenu_run, which will search $PATH for a matching executable as soon as you start typing.
+
  const char* dmenucmd[]      = {"dmenu_run","-i","-nb","#666622","-nf","white",NULL};
+
  
 
== See also ==
 
== See also ==
  
*The [https://github.com/moetunes/Nextwm README] and ChangeLog for additional info.
+
* The [https://github.com/moetunes/Nextwm README] and ChangeLog for additional info.
  
*[https://bbs.archlinux.org/viewtopic.php?id=126463 Snapwm and dminiwm forum thread]. The author(moetunes) is helpful, friendly and active on the forum.
+
* [https://bbs.archlinux.org/viewtopic.php?id=126463 Snapwm and dminiwm forum thread]. The author(moetunes) is helpful, friendly and active on the forum.

Revision as of 12:49, 1 November 2013

Snapwm is a xinerama aware, very minimal and lightweight dynamic tiling window manager based on dminiwm (same author), which is based on catwm (by pyknite).

Snapwm has an emphasis on easy configurability and choice. It's primarily keyboard driven but has some mouse support also.

Installation

Using the AUR

Install snapwm-gitAUR from the AUR.

The sample configuration files will be installed in /usr/share/snapwm-git/. Create the directory ~/.config/snapwm/:

$ mkdir -p ~/.config/snapwm

Copy the three sample files to ~/.config/snapwm/{rc.conf, key.conf, apps.conf} and edit to suit.

Using Git

The latest version can be downloaded using Git. Initially, you can do:

git clone https://github.com/moetunes/Nextwm

and then update with git pull.

Note: While the official name of the window manager and executable is snapwm, you will notice that in moetunes' GitHub, the directory is named Nextwm which may cause some confusion.

Xlib is all that is required. To install it, do:

$ make
# make install
$ make clean

Alternative method

Instead of actually installing it system-wide as above, you can simply run make and then copy the executable to somewhere in your path, like ~/bin for example. You can then run it the same way (exec snapwm) on a per user basis.

Dmenu

Most users will want this. As the name implies, dmenu is a menu that acts like an auto-complete for typing the name of binaries. It integrates well with tiling window managers like snapwm. See the dmenu wiki page or man dmenu for more info.

The sample.key.conf file comes with a command to start demenu_run, which will search $PATH for a matching executable as soon as you start typing.

 CMD dmenucmd;dmenu_run;-i;-nb;#666622;-nf;white;NULL;
 KEY Alt;v;spawn;dmenucmd;

Configuration

All user settings are read from three files in ~/.config/snapwm/. Each line in these files takes the form of :

<Option><space><semi colon separated list>

and if there is more than one item in the list the line must end in a semi colon.

snapwm comes with sample configurations files which make it easy to start configuration.

All options and settings in the three configuration files are changeable in the running window manager by editing and saving the configuration file/s and updating. (default key Alt+u)

rc.conf

<Option><space><semi colon separated list>

Should have the number of desktops as the first option, which is changeable in the running window manager.

Colours, how new windows are handled and options for the bar are set here.

key.conf

There are two options CMD and KEY. CMD should come before any key using it.

CMD takes the form of :

 CMD<space><label>;<comand>;<command option1>;<command option2>...;NULL;

The line must end in NULL;

The label is passed to a KEY with spawn as the function and the label as the variable

KEY takes the form of :

 KEY<space><Modifier>;<key>;<function>;<variable>;

There are nine modifying keys available :

   Alt  CtrlAlt  ShftAlt  Super  ShftSuper  Control CtrlSuper ALTSuper NULL

An example for setting Alt+x to open xterm. The terminal command would be

xterm -bg black -fg white

To make the command and the keyboard shortcut.

CMD xtermcmd;xterm;-bg;black;-fg;white;NULL;
KEY Alt;x;spawn;xtermcmd;

apps.conf

There are two options DESKTOP and POSITION. Order isn't important.

DESKTOP is used to set the desktop that an app will open on and whether to change to that desktop when the app opens.

POSITION is used to set the geometry of an app in stacking mode.

DESKTOP takes the form of :

 DESKTOP<space><window class>;<desktop to open on>;<zero to change to that desktop>;

<window class> is found by using xprop on the app and reading the WM_CLASS value.

POSITION takes the form of :

 POSITION<space><window class>;<x>;<y>;<width>;<height>;

The Bar

Snapwm has an integrated bar that has a clickable desktop switcher, shows the tiling mode, shows the focused window's name and has space to display some external text.

The desktop switcher can optionally show the number of windows open on unfocused desktops and in fullscreen mode. Clicking on the current desktop in the switcher will focus the next window. Clicking elsewhere in the bar will change to the last desktop.

The bar uses the root window's name to display colored external text, which can be changed with xsetroot -name.

For example, with conky, you could use something like:

$ conky | while read -r; do xsetroot -name "$REPLY"; done &

You can toggle the bars' visibility.

 Default keyboard shortcut : Super+b

There's options in the rc file to have the bar shown at the top or the bottom. The bars' position is changeable in the running wm by editing the rc file.

Colors

The colors for the desktop switcher are defined in SWITCHERTHEME in rc.conf.

  • Color 0 : focused desktop in switcher.
  • Color 1 : unfocused desktop in switcher.
  • Color 2 : unfocused desktop in switcher with open windows.
  • Color 3 : the bar's border.

The colors for the rest of the bar and text in the bar are defined in STATUSTHEME in rc.conf.

  • Color 0 : the default background colour for the bar
  • Color 1 : the current desktop font in the switcher and also for external text.
  • Color 2 : the unfocused desktops font in the switcher and also for external text.
  • Color 3 : the unfocused desktops with opened windows font in the switcher and also for external text.
  • Color 4 : the focused window name font and also the for external text.
  • Colors 5 - 9 : are for external text.

The colors for the windows are defined in WINDOWTHEME in rc.conf.

  • Color 0 : focused window border.
  • Color 1 : unfocused window border.

The colors for external text can be displayed by placing & in front of the number of the color in your script. For example, using conky, you could do something like this for displaying the time using the second color for external text:

&1${time %I:%M}

The background colour in the bar can be changed by placing &B in front of the number of the wanted colour in your script. For example, using conky, you could do something like this for displaying the time using the third colour for the background and the second color for external text:

&B2&1${time %I:%M}&B0

The colors in the running wm are changeable by editing the rc file and updating.

Icons

The bar does not support icons but you can draw "icons" into a font and use those. You can find more info on that in the dwm hacking thread on the forum. There are a few fonts in the AUR, such as terminusmodAUR, tamsynmodAUR, termsynAUR, and ohsnap that have some icons. To have them shown in the bar print them in a terminal then copy/paste them in rc.conf or your script/conky. You can also use a font like stlarch_font that just contains icons. You can use it in combination with another font using a comma to separate them in your rc.conf:

static const char defaultfontlist[] = "-*-stlarch-medium-r-*-*-10-*-*-*-*-*-*-*,-*-terminus-medium-r-*-*-12-*-*-*-*-*-*-*";

Layout modes

Snapwm has five layout modes: vertical, fullscreen, horizontal, grid and center stacking. The tiling mode for each desktop is set in rc.conf, and can be changed in the running wm.

It allows the "normal" method of tiling window managers, with the new window as the master, or with the new window opened at the top or bottom of the stack (attach aside). The default tiling method for all layout modes is set in rc.conf, and can be changed in the running wm.

Vertical

   --------------
   |        | W |
   |        |___|
   | Master |   |
   |        |___|
   |        |   |
   --------------

Default keyboard shortcut: Alt+Shift+v.

Windows can be added/removed from the master area with a keyboard shortcut.

Fullscreen

Takes up all the screen less the bar.

Default keyboard shortcut: Alt+Shift+f.

There are no borders in fullscreen mode or if there is only one open window.


Horizontal

   -------------
   |           |
   |  Master   |
   |-----------|
   | W |   |   |
   -------------

Default keyboard shortcut: Alt+Shift+h.

Windows can be added/removed from the master area with a keyboard shortcut.

Grid

   -------------
   |      |    |
   |Master|    |
   |------|----|
   |  w   |    |
   -------------

Default keyboard shortcut: Alt+Shift+g.

Stacking

    ___________
   |   ______  |
   | _|__    | |
   ||    |   | |
   ||____|___| |
   |___________|

Default keyboard shortcut: Alt+Shift+c.

 Window placement strategy is set in rc.conf
   CENTER_STACK 0  all windows open centered on screen
   CENTER_STACK 1  windows set their preferred position
 Windows can be moved up/down
   Default keyboard shortcut : Alt+Shift+j/k
 Windows can be moved right/left
   Default keyboard shortcut : Alt+Shift+p/o
 Windows can be made wider/narrower
   Default keyboard shortcut : Alt+h/l
 Windows can be made taller/shorter
   Default keyboard shortcut : Alt+p/o
  • Changing the layout mode or resizing windows on one desktop doesn't affect the other desktops.
  • The Master window can be resized.
  • Windows can be added/removed to/from the master area with keyboard shortcuts Alt+Shift+m/l
  • The window *W* at the top of the stack can be resized with keyboard shortcuts Alt+o/p.
  • In stacking mode the windows can be resized/moved with Alt+right/left mouse button and
  • the size and position is remembered when the mode is changed

Window manager functions

The functions available to the user are:

next_win
  Default keyboard shortcut: Alt + j

prev_win
  Default keyboard shortcut: Alt + k

move_up
  Default keyboard shortcut: Alt + Shift + j
      move the current window up the stack

move_down
  Default keyboard shortcut: Alt + Shift + k
      move the current window down the stack

swap_master
  Default keyboard shortcut: Alt + Shift + Return
      move the current window to the master area

change_desktop
  Default keyboard shortcut: Alt + [number]

last_desktop
  Default keyboard shortcut: Alt + Tab

rotate_desktop
  Default keyboard shortcut: Super + Right/Left

follow_client_to_desktop
  Default keyboard shortcut: Alt + Shift + [number]
      send the current window to another desktop and open that desktop

client_to_desktop
  Default keyboard shortcut: Super + Shift + [number]
      send the current window to another desktop

switch_mode
  Default keyboard shortcut: Alt + Shift + v/f/h/g/c

rotate_mode
  Default keyboard shortcut: Alt + a
      order is vertical, fullscreen, horizontal, grid, stacking

resize_master
  Default keyboard shortcut: Alt + h/l

more_master
  Default keyboard shortcut: Alt + Shift + m/l
      add/remove window from the master area in vert or horiz mode

resize_stack
  Default keyboard shortcut: Alt + p/o
      increase/decrease the size of the window at the top of the stack

kill_client
  Default keyboard shortcut: Alt + c

quit
  Default keyboard shortcut: Control + Alt + q

spawn
  Default keyboard shortcut: User defined for each application

toggle_bar
  Default keyboard shortcut: Super + b

update_config
  Default keyboard shortcut: Alt + u

Transparency

Unfocused windows have an alpha value and can be transparent if used with a compositing manager (like cairo-compmgr).

The value is a percent and can be changed in the running wm by editing the rc file, 100 is opaque.

Multi Monitor Support

With X aware of multiple connected monitors, snapwm will place different desktops on each monitor.

Using xrandr, or the appropriate method for the graphics card, set the second monitor to the right of the first, the third monitor to the right of the second, etc.

Using two monitors and four desktops as an example:

desktops 1 & 3 will show on monitor 1, the last focused one always visible
desktops 2 & 4 will show on monitor 2, the last focused one always visible

To move an application to the other monitor, send it to the desktop showing on that monitor with the follow_/client_to_desktop functions.

See also

  • The README and ChangeLog for additional info.