Install with apt install spectrwm xfonts-terminus dmenu
.
Rationale
Understand the basic concepts and terminologies with official tutorial.
A workspace is divided into master area and stacking area. The former is for main window(s), the latter is for auxiliary window(s).
In vertical split layout, the master area is the left half screen,
and the right half is the stacking area.
In the status bar, the layout indicator is [1|1]
,
where the left number 1 means there is only one window allowed in the master area.
The vertical line followed means now we are in vertical split layout.
The second number 1 means there is only 1 column in the stacking area.
You can use M-comma (master_add) to move a window in stacking area
into master area, now the layout indicator becomes to [2|1]
.
Move it back into stacking area with M-period (master_del).
Use M-S-comma (stack_inc) to add a new column for stacking area,
with the incicator becomes [1|2]
.
In horizontal split layout, the master area is the upper half screen,
while the stacking area is the bottom half screen.
The indicator is [1-1]
, where the dash between means horizontal split layout.
Setup and Startup
Two important scripts, .xinitrc
for startup and .spectrwm.conf
for configurations:
$ copy /etc/spectrwm.conf ~/.spectrwm.conf
# uncomment the interested items. The result:
$ cat ~/.spectrwm.conf
color_focus = green
verbose_layout = 1
autorun = ws[1]:feh --bg-fill /home/leo/.config/variety/Favorites/virgo-galaxy-cluster.jpg
autorun = ws[9]:fcitx
autorun = ws[9]:goldendict
autorun = ws[9]:/home/leo/.local/bin/shadows
program[term] = urxvt
bind[menu] = MOD+d
...
$ cat ~/.xinitrc.spectrwm
export XMODIFIERS="@im=fcitx"
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export LC_CTYPE=en_US.UTF-8
xrandr --output eDP-1 --left-of HDMI-1 --auto
setxkbmap -option caps:swapescape -option ctrl:swap_lwin_lctl -option ctrl:swap_rwin_rctl
exec spectrw
$ startx /home/leo/.xinitrc.spectrwm
Use xrandr --output HDMI-1 --auto --output eDP-1 --off
to turn off a monitor if you wish.
You can define a seperated key mapping config file based on
/usr/share/doc/spectrwm/examples/spectrwm_us.conf
.
Note:
Without the environment variable (XMODIFIERS, GTK_IM_MODULE) definitions in .spectrwm.conf, you can't use fcitx in browsers, like Chromium and Firefox.
If fcitx IM still can't work after these export
added,
add these into ~/.xprofile, and run fcitx-diagnose
to find the errors and fix them.
Note:
Fix **Cannot find gtk-query-immodules for gtk 3**
(and the same error for gtk 2) errors when running fcitx-diagnose
:
sudo ln -s /usr/lib/x86_64-linux-gnu/libgtk-3-0/gtk-query-immodules-3.0 /usr/bin/gtk-query-immodules-3.0
sudo ln -s /usr/lib/x86_64-linux-gnu/libgtk2.0-0/gtk-query-immodules-2.0 /usr/bin/gtk-query-immodules-2.0
Frequently Used Actions
Here M
is Alt key by default, S
is shift key.
- Show help:
man spectrwm
- Quit wm: M-S-q
- Restart wm: M-q
-
Rename workspace: M-S-/
-
Start terminal: M-S-Return
- Start app launcher (dmenu by default): M-d (M-p by default)
- Toggle window maximize: M-e
- Toggle window full screen: M-S-e
- Toggle focus between master area and stacking area: M-m
- Delete window: M-x # close the window
- Kill window: M-S-x # unnecessary in most cases
- Toggle window floating: M-t
-
Move floating window up/down/left/right: M-S-[, M-S-], M-[, M-]
-
Iconify a window: M-w
-
Uniconify a window: M-S-w
-
Focus region (monitor) #2: M-(keypad)2
- Move a window to region #2: M-S-(keypad) 2