dwm

From Alpine Linux
Revision as of 16:20, 23 June 2025 by Prabuanand (talk | contribs) (fixed link)

dwm is a dynamic window manager for X. It manages windows in tiled, monocle and floating layouts. This page covers installing the binary packages and installing from source along with dependencies for dwm (dynamic window manager), dmenu (dynamic menu) and st (simple terminal) along with configuration information.

Prerequisites

Installation

Alpine Linux provides binary packages for dwm (dynamic window manager), dmenu (dynamic menu), st (simple terminal). This allows new users to experience dwm without compiling software. To install the following binary packages dwm, dmenu and st, issue the command:

# apk add dwm dmenu st

Proceed to configuration to configure and start using dwm immediately with default settings. If you are new to dwm, refer to the official dwm tutorial.

To customize dwm, the source code must be edited and compiled for the changes to take effect. Refer Installing from source for complete instructions.

Installing from source

Install dependencies

The following Alpine Linux packages are needed to install and compile suckless tools. git make gcc g++ libx11-dev libxft-dev libxinerama-dev ncurses libxft-dev

dbus-x11 package is needed for the dbus system as it enables Firefox running in dwm to open in a tile.

The adwaita-gtk2-theme adwaita-icon-theme font-dejavu are optional, but recommended for a nicer looking firefox.

The command to install all the dependencies:

# apk add git make gcc g++ libx11-dev libxft-dev libxinerama-dev ncurses libxft-dev dbus-x11 firefox-esr adwaita-gtk2-theme adwaita-icon-theme font-dejavu

Installing suckless tools

Create a directory /usr/src directory using the command:

# mkdir -p /usr/src/suckless

Note: The /tmp directory can be used if you want to keep the downloaded files in tmpfs filesystem.

Change to the /usr/src/suckless directory:

$ cd /usr/src/suckless

Download and install dwm:

# git clone https://git.suckless.org/dwm # cd dwm # make clean install

Next, go up one directory level

# cd ..

Download and install dmenu launcher:

# git clone https://git.suckless.org/dmenu # cd dmenu # make clean install

Finally, go up one more directory level:

# cd ..

Download and install st terminal:

# git clone https://git.suckless.org/st # cd st # make clean install

Configuration

Set up your profile

Change to your home directory:

$ cd ~

Create or edit .xinitrc with at least the following:

Contents of ~/.xinitrc

exec dwm

Next, create or edit .profile with at least the following:

Contents of ~/.profile

startx
Note: If you install additional programs that call your `$SHELL` with the POSIX `-l` login flag, you'll need to make launching `startx` conditional, otherwise X will attempt to launch every time your shell is called with the login flag.

Contents of ~/.profile

if [ -z $DISPLAY ] && [ $(tty) = /dev/tty1 ]; then startx fi

Log out or reboot. dwm will run the next time you log in. Press Alt+p to launch dmenu. Type firefox then press enter. Firefox will load and run in tile 9.

See also