# cwm tips
> A short guide on the window manager, its keybindings and configuration

cwm's native keybinding is already intuitive, but there are several habits I sought to recreate. Following are
several bits from my .cwmrc file.

## Desktop switching

I am a fan of i3's handling of desktop switching: Super + number to switch between numbered desktops, Shift + Super +
number to send a window to a desktop of the specific number.

cwm is capable of emulating such feature by utilising the grouping function. To make it akin to i3, append your .cwmrc
file with the following and restart cwm (default Ctrl+Shift+Alt+r):

``
bind-key 4S-1 window-movetogroup-1
bind-key 4S-2 window-movetogroup-2
bind-key 4S-3 window-movetogroup-3
bind-key 4S-4 window-movetogroup-4
bind-key 4S-5 window-movetogroup-5
bind-key 4S-6 window-movetogroup-6
bind-key 4S-7 window-movetogroup-7
bind-key 4S-8 window-movetogroup-8
bind-key 4S-9 window-movetogroup-9

bind-key 4-1 group-only-1
bind-key 4-2 group-only-2
bind-key 4-3 group-only-3
bind-key 4-4 group-only-4
bind-key 4-5 group-only-5
bind-key 4-6 group-only-6
bind-key 4-7 group-only-7
bind-key 4-8 group-only-8
bind-key 4-9 group-only-9
``

To have newly created windows stay on the current desktop, append .cwmrc with:

``
sticky yes
``

Once a desktop has accumulated several windows, they can be tiled. I believe this function is not natively bound. The
following will use Super+h and Super+v to tile horizontally and vertically respectively.

``
bind-key 4-h window-htile
bind-key 4-v window-vtile
``

The currently selected window will always occupy the top left corner. Only raised windows are affected. Don't expect
much functionality out of this feature, as you are still working with a floating window manager. You cannot easily
change the position of the tiles.

## Window switching

cwm offers no bar to keep track of open windows, instead one can get a list of windows with Alt+/. Note that the list
comes up empty by default. Either begin typing a name of a window or press Ctrl+A to get a list of all open windows.
Windows can also be labeled with Ctrl+Alt+n. Alt+Tab cycles through raised windows on a specific desktop.

Alt+Enter minimizes the focused window. You can raise it by switching to the numbered group (desktop) it is a member of,
Alt+/ or left clicking the desktop. Minimized windows begin with &. View desktop/Minimize all/Show all windows

The following line has multiple uses. (Default Ctrl+Alt +a).

``
bind-key 4-d group-toggle-all
``

Press it once to minimize all windows and show the wallpaper. Press it again to raise all windows from all desktops.
Otherwise press it once to hide the current desktop and return to it with Super + number.

## Further reading:

 * cwm(1)
 * cwmrc(5)