Skip to content
Corey Stephan edited this page Apr 26, 2020 · 5 revisions

Getting started

The hardest thing in spectrwm is getting started. You start it, and suddenly you are looking at a blank screen. Now what? Where is the terminal?

Fear not! Press Windows/Apple key + Shift + Enter, and voilà! There she is -- a magnificent terminal. If that did not work, then you probably have to press Alt-Shift-Enter instead; that will be explained later.

Terminology

Before we go into more specifics, we have to go over some spectrwm terminology.

Master Area

The master area is defined as the anchor of the screen. This is the area of the physical screen where the first window appears but not the subsequent windows. In the default configuration, using a vertical stack, the master area is the window on the top left-hand side of the physical screen. As you open more windows, they appear on the right-hand side and divide the non-master area by the number of available windows.

See figure 1.

Stack

The stack refers to the non-master area where windows are 'stacked'. If you open more than 3 windows, you'll see this in action. Assuming the default vertical stack mode, you'll see that the right-hand side of the screen shows 2 windows. This is 'the stack.' Note that two modes of operation in spectrwm are referred to as vertical ([|]) and horizontal ([-]) stacking.

See figure 2.

Workspace

By default, there are ten workspaces (a.k.a. ws) numbered from 1 through 0 on the keyboard. Workspaces are typically used for collections of activities. For example, workspace 1 might be for chatting, workspace 2 might be for email, etc. Workspaces are meant to help the human organize his/her activities. A window can not exist in multiple workspaces.

Region

Regions are logical screens that may or may not represent physical screens. Typically regions do represent physical screens. A good example is a multi-screen setup. Without modification, a two screen setup will result in two regions, one per monitor.

Keyboard shortcuts

All keyboard shortcuts are abbreviated to something like this: M-S-enter. The abbreviations are as follows:

  • M Meta
  • S Shift
  • Button

The Meta key is special and is different based on what hardware you are using. On a PC it typically is either the Alt (Mod1) or Windows (Mod4) key. On a Mac, it typically is the Apple (Mod2) key. The default is the Alt key in order to support old and non-PC keyboards. The setting to alter this is modkey.

Button indicates a mouse button. Button1 is left mouse button, Button2 is middle mouse button, and Button3 is the right mouse button.

Navigating workspaces

Jumping between workspaces is simple. Press M-Number to jump to a workspace. For example, M-1 jumps to workspace 1, M-2 jumps to workspace 2, etc. The outlier here is M-S-0 which jumps to workspace 10.

Altering stack

Common tricks

  1. Control Key Since spectrwm does not have the Control key bound to anything by default, the Control key is useful for custom keybindings, perhaps especially when combined with spectrwm's ability to define custom 'programs.' For example, see (2) Keyboard Layout Switching.

  2. Keyboard Layout Switching An easy way to enable automatic keyboard layout switching in spectrwm is by pairing spectrwm's unique ability to define custom 'programs' with setxkbmap. For example, to allow easy switching between Greek and English (US) by toggling MOD+Control+1/2, one might set the following in his/her ~/.spectrwm.conf:

program[key_layout_gr] = setxkbmap gr

bind[key_layout_gr] = MOD+Control+2

program[key_layout_us] = setxkbmap us

bind[key_layout_us] = MOD+Control+1

  1. Laptop Bindings: Audio Keys + Display Backlight Controls In GNU/Linux (tested in bare Debian 10), the following bindings should enable the use of media keys and backlight controls on most laptops (tested on a basic 2018-2019 HP model). Requirements: xbindkeys (for all bindings), pulseaudio (for sound controls), and xbacklight (for backlight controls). xbacklight may require manual configuration; check your OS's/distribution's documentation for details.

program[sound_increase] = pactl set-sink-volume @DEFAULT_SINK@ +10%

bind[sound_increase] = XF86AudioRaiseVolume

program[sound_decrease] = pactl set-sink-volume @DEFAULT_SINK@ -10%

bind[sound_decrease] = XF86AudioLowerVolume

program[sound_mute] = pactl set-sink-mute @DEFAULT_SINK@ toggle

bind[sound_mute] = XF86AudioMute

program[brightness_increase] = xbacklight -inc 10

bind[brightness_increase] = XF86MonBrightnessUp

program[brightness_decrease] = xbacklight -dec 10

bind[brightness_decrease] = XF86MonBrightnessDown

Pitfalls