GNU/Linux {docs}

dwm & i3wm

i3WM

Installation

sudo apt install i3

Key Binds

You can change the MOD key to Windows(⊞) / Command(⌘) key by editing .config/i3/config and changing the line set $mod Mod1 to set $mod Mod4.

Main

  • MOD + Enter: Open terminal
  • MOD + d: Open app launcher
  • MOD + left / down / up / right: Focus left, down, up, right (or J / K / L / Ñ)
  • MOD + Shift + left / down / up / right: Move window left, down, up, right (or J / K / L / Ñ)
  • MOD + Number: Switch to another workspace
  • MOD + Shift + Number: Move window to workspace

Modifying windows

  • MOD + f: Toggle Fullscreen
  • MOD + v / h: Split new window vertically / horizontally
  • MOD + r: Resize Window

Changing the container layout

  • MOD + e: Split mode (default)
  • MOD + s: Stack mode
  • MOD + w: Tabbed mode

Floating

  • MOD + Shift + Space: Toggle floating
  • MOD + Left click: Drag floating

Miscelanea

  • MOD + Shift + q: Close Window
  • MOD + Shift + c: Reload configuration file
  • MOD + Shift + r: Restart i3 inplace
  • MOD + Shift + e: Exit i3

If you want to switch between the last two workspaces by pressing MOD + Tab, edit .config/i3/config and add this line:

bindsym $mod+Tab workspace back_and_forth

Customization

Configuration file is in .config/i3/config

Launch Apps shortcuts

# start firefox, file manager nautilus, brave browser, visual studio code and st terminal
bindsym $mod+Shift+f exec firefox
bindsym $mod+Shift+n exec nautilus
bindsym $mod+Shift+b exec brave-browser
bindsym $mod+Shift+v exec code
bindsym $mod+Shift+s exec st

How to launch Gnome System Settings

Open app launcher (MOD + d) and type gnome-control-center

i3status.conf

i3status.conf is the configuration file for the status bar that appears at the bottom of the screen. The system reads the file by default in the following locations in order of priority:

  1. ~/.config/i3status/config (or $XDG_CONFIG_HOME/i3status/config if set)
  2. /etc/xdg/i3status/config (or $XDG_CONFIG_DIRS/i3status/config if set)
  3. ~/.i3status.conf
  4. /etc/i3status.conf

If you want to place your i3status.conf in a different location, for instance ~/.config/i3/, follow these steps:

  1. Copy the file to ~/.config/i3/
cp /etc/i3status.conf ~/.config/i3/
  1. Edit the main i3 config file to make use of ~/.config/i3/i3status.conf
vi ~/.config/i3/config
...
bar {
status_command i3status -c ~/.config/i3/i3status.conf
...
}

i3blocks.conf

If you want to use i3blocks instead of i3status, follow these steps:

apt install i3blocks
cp /etc/i3blocks.conf ~/.config/i3/
vi ~/.config/i3/i3blocks.conf

After editing ~/.config/i3/i3blocks.conf, edit the main i3 config file to make use of ~/.config/i3/i3blocks.conf

vi ~/.config/i3/config
...
bar {
#status_command i3status i3status
status_command i3blocks -c ~/.config/i3/i3blocks.conf
}
...

You can download the FontAwesome from https://github.com/FortAwesome/Font-Awesome/releases/tag/5.13.0

cd Downloads
unzip unzip fontawesome-free-5.13.0-desktop
cp fontawesome-free-5.13.0-desktop/otfs/Font\ Awesome\ 5\ Free-Regular-400.otf ~/.fonts/
vi·~/.config/i3/config

Append:

font pango:monospace, 'Font Awesome 5 Free Regular' 9

Check all FontAwesome icons at https://fontawesome.com/cheatsheet

DWM

Key binds

Basics

  • Mod + Shift + Enter: launch Terminal
  • Mod + b: show/hide bar
  • Mod + p: open app launcher
  • Mod + Return: toggles window between master and stack
  • Mod + j/k: focus on next/previous window
  • Mod + h/l: increase/decrease master size
  • Mod + Number: focus on tag number
  • Mod + Shift + Number: move active window to tag number
  • Mod + i/d: decrease/increase number of windows in master area
  • Mod + comma/dot: move focus between screens (multi monitor setup)
  • Mod + Shift + comma/dot: move active window to different screen
  • Mod + Tab: toggle between the last two active tags
  • Mod + 0: view all windows on screen
  • Mod + Shift + c: kill active window
  • Mod + Shift + q: quit dwm cleanly

Layout

  • Mod + t: tiled mode []=
  • Mod + f: floatin mode ><>
  • Mod + m: monocle mode [M] (single window fullscreen)
  • Mod + space: toggle previous layout mode

Floating mode

  • Mod + Left Button: move floating window around
  • Mod + Right Button: resize floating window
  • Mod + Space: change the layout into floating mode
  • Mod + Shift + Space: make an individual window float
  • Mod + Middle Button: make an individual window un-float

Install dwm

sudo apt install make gcc libx11-dev libxft-dev libxinerama-dev
sudo apt autoremove
git clone git://git.suckless.org/dwm
cd dwm
sudo make clean install

Add dwm to windows session

If we want dwm to appear in a display manager options when logging in, add dwm to windows session:

sudo vi /usr/share/xsessions/dwm.desktop
[Desktop Entry]
Encoding=UTF-8
Name=dwm
Comment=dwm window manager
Exec=/usr/local/bin/dwm
Type=Application

Customize dwm

  • Edit config.h file to your liking
  • Then run: sudo make clean install
  • Reboot

Install st

sudo apt install libx11-dev libxft-dev
git clone git://git.suckless.org/st
cd st
sudo make clean install

Customize st

  • Edit config.h file to your liking
  • Then run: sudo make clean install
  • Reboot

Install dmenu

wget https://dl.suckless.org/tools/dmenu-4.9.tar.gz
tar -xvf dmenu-4.9.tar.gz
cd dmenu-4.9
sudo make clean install

Change MODKEY to Mac CMD or Windows key

  • Edit config.h and change line:
#define MODKEY Mod1Mask

to

#define MODKEY Mod4Mask

Create a status monitor by using dwm-bar

git clone https://github.com/joestandring/dwm-bar.git

dwm-bar does not need to be compiled. It is a bash executable file. You can execute the script at start up by adding this line at the end of your .xinitrc or .profile config file:

~/.path/to/dwm_bar.sh &

Services

There are 20 services to use with dwm-bar. I only use two, so I uncomment these lines on the file dwm_bar.sh:

. "$DIR/bar-functions/dwm_resources.sh"
. "$DIR/bar-functions/dwm_date.sh"

I customize those services by editing each file:

bar-functions/dwm_date.sh

I change the date format to:

printf "$(date "+%a %d-%b %H:%M")"

bar-functions/dwm_resources.sh

#!/bin/sh
SCRIPT_PATH="test.sh"
dwm_resources () {
# Storaged Used/Total
STOUSED=$(df -h | grep '/dev/sda1' | awk '{print $3}')
STOTOTAL=$(df -h | grep '/dev/sda1' | awk '{print $2}')
# Used and total memory
MEMUSED=$(free -h | awk '(NR == 2) {print $3}')
MEMTOT=$(free -h |awk '(NR == 2) {print $2}')
printf "%s" "$SEP1"
printf "MEM %s/%s" "$MEMUSED" "$MEMTOT"
printf "] [sda1 %s/%s" "$STOUSED" "$STOTOTAL"
printf "%s\n" "$SEP2"
}
dwm_resources

bar-functions/dwm_networkmanager.sh

If you want to mess with WiFi stats, add these lines. However, your logs will grow exponentially over time.

SIGNAL=$(nmcli dev wifi list | awk '/\*/{if (NR!=1) {print $7}}')
printf "%s%% %s" "$SIGNAL" "$CONNAME"

Adding fontawesome

  1. Download and configure fontawesome as per i3wm steps in previous section
  2. Edit dwm/config.h:
static const char *fonts[] = { "monospace:size=9", "Font Awesome 5 Free Regular:size=9" };

Sound

To change system sound, launch pavucontrol. Pavucontrol uses pulseaudio sound server.

Pavucontrol is a simple volume control tool (mixer) for the PulseAudio sound server. In contrast to classic mixer tools this one allows you to control both the volume of hardware devices and of each playback stream separately. It also allows you to redirect a playback stream to another output device without interrupting playback.