Dwm: Difference between revisions

From Alpine Linux
(fixed link)
(rewrote sentence to make it easier to follow)
Line 1: Line 1:
{{DISPLAYTITLE:dwm}}[https://dwm.suckless.org/ 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.  
{{DISPLAYTITLE:dwm}}[https://dwm.suckless.org/ dwm] is an extremely fast, small, and dynamic window manager for X. It manages windows in tiled, monocle and floating layouts. This page provides instructions for installing dwm both from binary packages and from source along with dependencies.  


== Prerequisites ==
== Prerequisites ==
Line 8: Line 8:
== Installation ==
== 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 {{Pkg|dwm}}, {{Pkg|dmenu}} and {{Pkg|st}}, issue the command:{{Cmd|# apk add dwm dmenu st}}
=== Installing binary packages ===


Proceed to [[#Configuration|configuration]] to configure and start using dwm immediately with default settings. If you are new to dwm, refer to the [https://dwm.suckless.org/tutorial/ official dwm tutorial].
Alpine Linux provides  binary packages for {{Pkg|dwm}} (dynamic window manager), {{Pkg|dmenu}} (dynamic menu) and {{Pkg|st}} (simple terminal). This allows new users to experience dwm quickly without compiling the source code. To install the binary packages, issue the command:{{Cmd|# apk add dwm dmenu st}}


To customize dwm, the source code must be edited and compiled for the changes to take effect. Refer [[#Installing from source|Installing from source]] for complete instructions.
Proceed to [[#Configuration|configure]] and start using dwm immediately with default settings. If you are new to dwm, refer to the [https://dwm.suckless.org/tutorial/ official dwm tutorial].
 
To customize dwm, refer [[#Installing from source|Installing from source]].  


=== Installing from source  ===
=== Installing from source  ===
To customize dwm the source code written in '''c''' language must be edited, compiled and installed everytime for the changes to take effect, which usuaully takes less than a minute. If you have installed the [[#Installing binary packages|binary packages]], remove them first using the command:{{Codeline| # apk del dwm dmenu st}}


==== Install dependencies ====
==== Install dependencies ====


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


{{pkg|dbus-x11}} package is needed for the dbus system as it enables Firefox running in dwm to open in a tile.
{{pkg|dbus-x11}} package is needed for the dbus system as it enables Firefox running in dwm to open in a tile.
Line 25: Line 28:
The {{pkg|adwaita-gtk2-theme}} {{pkg|adwaita-icon-theme}} {{pkg|font-dejavu}} are optional, but recommended for a nicer looking firefox.
The {{pkg|adwaita-gtk2-theme}} {{pkg|adwaita-icon-theme}} {{pkg|font-dejavu}} are optional, but recommended for a nicer looking firefox.


The command to install all the dependencies:
The command to install all the dependencies: {{cmd|# apk add {{pkg|git}} {{pkg|make}} {{pkg|gcc}} {{pkg|g++}} {{pkg|libx11-dev}} {{pkg|libxft-dev}} {{pkg|libxinerama-dev}} {{pkg|ncurses}} {{pkg|libxft-dev}}  {{pkg|dbus-x11}} {{pkg|firefox-esr}} {{pkg|adwaita-gtk2-theme}} {{pkg|adwaita-icon-theme}} {{pkg|font-dejavu}}}}
{{cmd|# apk add {{pkg|git}} {{pkg|make}} {{pkg|gcc}} {{pkg|g++}} {{pkg|libx11-dev}} {{pkg|libxft-dev}} {{pkg|libxinerama-dev}} {{pkg|ncurses}} {{pkg|libxft-dev}}  {{pkg|dbus-x11}} {{pkg|firefox-esr}} {{pkg|adwaita-gtk2-theme}} {{pkg|adwaita-icon-theme}} {{pkg|font-dejavu}}}}
 
==== Install dwm ====


==== Installing suckless tools ====
The following instructions downloads the sources for dwm, dmenu and st in {{Path|/usr/src/suckless}}, compiles the source code(make) and installs the binaries in {{Path|/usr/local/bin}}. Use {{Path|/tmp}} directory for downloading the sources, if you do not want to keep the sources.


Create a directory {{Path|/usr/src}} directory using the command: {{Cmd|# mkdir -p /usr/src/suckless}}
Create a directory {{Path|/usr/src/suckless}} using the command: {{Cmd|# mkdir -p /usr/src/suckless}}
{{Note| The {{Path|/tmp}} directory can be used if you want to keep the downloaded files in tmpfs filesystem.}}
Change to the {{Path|/usr/src/suckless directory}}:{{cmd|$ cd /usr/src/suckless}}
Change to the {{Path|/usr/src/suckless directory}}:{{cmd|$ cd /usr/src/suckless}}
Download and install {{ic|dwm}}: {{cmd|# git clone https://git.suckless.org/dwm
Download the {{ic|dwm}} sources: {{cmd|# git clone https://git.suckless.org/dwm}}
# cd dwm
Once downloaded, go to the dwm directory:{{cmd|# cd dwm }} (or whatever it is)
# make clean install}}
To install dwm, issue the command: {{cmd|# make clean install}}
Next, go up one directory level {{cmd|# cd ..}}
Next, go up one directory level {{cmd|# cd ..}}
Download and install {{ic|dmenu}} launcher: {{cmd|# git clone https://git.suckless.org/dmenu
Download and install {{ic|dmenu}} launcher: {{cmd|# git clone https://git.suckless.org/dmenu
Line 47: Line 50:
== Configuration ==
== Configuration ==


=== Set up your profile ===  
The configuration of dwm and other suckless tools are done by editing the {{Path|config.h}} file. The {{ic|make}} command will create {{Path|config.h}} file from {{Path|config.def.h}}. If the file {{Path|config.h}} already exists, {{ic|make}} won't overwrite it and instead use it. Based on above instructions, for customizing dwm, edit the file {{Path|/usr/src/suckless/dwm/config.h}}.
 
All changes related to keybindings, colors, fonts, patches, etc. are to be made to the {{Path|config.h}} file and (re)compile the source code by issuing the command {{Codeline|# make clean install}}.
 
=== Set up profile ===  


Change to your home directory:{{cmd|$ cd ~}}
Change to your home directory:{{cmd|$ cd ~}}
Line 57: Line 64:
     startx
     startx
fi
fi
}}
}}}}
|gotchas}}


Log out or reboot. dwm will run the next time you log in.  
Log out or reboot. dwm will run the next time you log in.  
Line 66: Line 72:
* [https://dwm.suckless.org/ Official dwm website]
* [https://dwm.suckless.org/ Official dwm website]
* [https://git.sr.ht/~bt/alpine-suck-installer Alpine Suck] Desktop installer for Alpine Linux based on the suckless philosophy
* [https://git.sr.ht/~bt/alpine-suck-installer Alpine Suck] Desktop installer for Alpine Linux based on the suckless philosophy
* [https://wiki.gentoo.org/wiki/Dwm gentoo wiki page on dwm]
* [https://wiki.gentoo.org/wiki/Dwm Gentoo wiki page on dwm]
* [https://wiki.archlinux.org/title/Dwm Dwm - Archwiki page on dwm]
* [https://wiki.archlinux.org/title/Dwm Archwiki page on dwm]
* [[Raspberry Pi 3 - Browser Client]] - A guide which omits dwm, but uses similar steps to install firefox in a diskless install on ARM. dwm is not used on the RPI3, due to tmpfs limitations.
* [[Raspberry Pi 3 - Browser Client]] - A guide which omits dwm, but uses similar steps to install firefox in a diskless install on ARM. dwm is not used on the RPI3, due to tmpfs limitations.


[[Category:Window Managers]]
[[Category:Window Managers]]

Revision as of 04:49, 24 June 2025

dwm is an extremely fast, small, and dynamic window manager for X. It manages windows in tiled, monocle and floating layouts. This page provides instructions for installing dwm both from binary packages and from source along with dependencies.

Prerequisites

Installation

Installing binary packages

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

# apk add dwm dmenu st

Proceed 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, refer Installing from source.

Installing from source

To customize dwm the source code written in c language must be edited, compiled and installed everytime for the changes to take effect, which usuaully takes less than a minute. If you have installed the binary packages, remove them first using the command: # apk del dwm dmenu st

Install dependencies

The following Alpine Linux packages are needed to install and compile dwm: 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

Install dwm

The following instructions downloads the sources for dwm, dmenu and st in /usr/src/suckless, compiles the source code(make) and installs the binaries in /usr/local/bin. Use /tmp directory for downloading the sources, if you do not want to keep the sources.

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

# mkdir -p /usr/src/suckless

Change to the /usr/src/suckless directory:

$ cd /usr/src/suckless

Download the dwm sources:

# git clone https://git.suckless.org/dwm

Once downloaded, go to the dwm directory:

# cd dwm

(or whatever it is) To install dwm, issue the command:

# 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

The configuration of dwm and other suckless tools are done by editing the config.h file. The make command will create config.h file from config.def.h. If the file config.h already exists, make won't overwrite it and instead use it. Based on above instructions, for customizing dwm, edit the file /usr/src/suckless/dwm/config.h.

All changes related to keybindings, colors, fonts, patches, etc. are to be made to the config.h file and (re)compile the source code by issuing the command # make clean install.

Set up 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