Dwm: Difference between revisions

From Alpine Linux
m (Added missing package in dwm dependencies)
 
(36 intermediate revisions by 11 users not shown)
Line 1: Line 1:
{{TOC right}}
{{DISPLAYTITLE:dwm}}[https://dwm.suckless.org/ dwm] is a dynamic window manager for X. It manages windows in tiled, monocle and floating layouts.
 
[https://dwm.suckless.org/ dwm] is a dynamic window manager for X. It manages windows in tiled, monocle and floating layouts.


This guide covers:
This guide covers:


* Creating  a user account that can run as sudo
* Installing dependencies for the [https://suckless.org suckless] tools and installing firefox  
* Installing dependancies for the [https://suckless.org suckless] tools and installing firefox  
* Installing from source or from repository dwm (dynamic window manager), dmenu (dynamic menu), st (simple terminal)
* Installing from source dwm (dynamic windows manager), dmenu (dynamic menu), st (simple terminal)
* Configuring the new profile to run dwm at login.
* Configuring the new profile to run dwm at login.


= Prerequisites =
* [[Installation|Install]] AlpineLinux
* [[Setting_up_a_new_user#Creating_a_new_user|Create a user account]] (optional but recommended)
* [[Repositories#Enabling_the_community_repository|Enable the Community repository]]
* [[Alpine_setup_scripts#setup-xorg-base|Install Xorg]]


== Creating a new user account ==
== Installing from binary repository ==
After the install of alpine you get the root account. We want to use a new user account that is not root but will have sudoers.
{{Cmd|# apk add dwm dmenu st}}
{{cmd|# adduser myname}}
Where '''myname''' is the name you want to use


Install sudo so we can add '''myname''' to sudoers
This will install {{Pkg|dwm}}, {{Pkg|dmenu}} and {{Pkg|st}}
{{cmd|# apk add sudo}}


edit the sudores file by running:
== Installing from source  ==
{{cmd|# visudo}}
{{Note|Only edit the sudoers file using '''visudo'''}}
Add your user account so you can have sudoers. Make your change below root. The relevant section should look like this:
{{cat|/etc/sudoers.tmp|
<pre>
##
## User privilege specification
##
root ALL=(ALL) ALL
myname ALL=(ALL) ALL</pre>}}


Switch to the new account
=== Installing dependencies ===
{{cmd|# su myname}}
{{Note|'''git make gcc g++ libx11-dev libxft-dev libxinerama-dev ncurses''' are needed to install suckless tools from source.


== Installing Xorg ==
'''dbus-x11''' is needed for the dbus system (enables firefox running in dwm to open in a tile)
run the following command
{{cmd|# sudo setup-xorg-base}}


== Configuring the community repositories ==
The last three '''adwaita-gtk2-theme adwaita-icon-theme font-dejavu''' are optional, but recommended for a nicer looking firefox.}}
We need to do this so we can install firefox. Edit the file with this command:
{{cmd|# sudo vi /etc/apk/repositories}}
Uncomment the community line by removing the '''#''' then save the file and exit.
It should look something like this:
{{cat|/etc/apk/repositories|
#/media/cdrom/apks
http://linorg.usp.br/AlpineLinux/v3.9/main
http://linorg.usp.br/AlpineLinux/v3.9/community
#http://linorg.usp.br/AlpineLinux/edge/main
#http://linorg.usp.br/AlpineLinux/edge/community
#http://linorg.usp.br/AlpineLinux/edge/testing}}
Next let the package manager know we made this change:
{{cmd|# sudo apk update}}


== Installing dependencies ==
The command to install the dependencies:
{{Note|
{{cmd|# apk add {{pkg|git}} {{pkg|make}} {{pkg|gcc}} {{pkg|g++}} {{pkg|libx11-dev}} {{pkg|libxft-dev}} {{pkg|libxinerama-dev}} {{pkg|ncurses}} {{pkg|dbus-x11}} {{pkg|firefox-esr}} {{pkg|adwaita-gtk2-theme}} {{pkg|adwaita-icon-theme}} {{pkg|font-dejavu}} {{pkg|libxft-dev}}}}
'''git make gcc g++ libx11-dev libxft-dev libxinerama-dev ncurses''' are needed to install suckless tools from source.


'''dbus-x11''' is needed for the dbus system (when we run firefox in dwm we want it to open in a tile)
=== Installing suckless tools dwm, dmenu, and st from source ===
the last three '''adwaita-gtk2-theme adwaita-icon-theme ttf-dejavu''' are optional but I recommend them so you can have a nicer looking firefox. }}
Change to the {{Path|/tmp directory}}.
The command to install the dependencies
{{cmd|$ cd /tmp}}
{{cmd|# sudo apk add git make gcc g++ libx11-dev libxft-dev libxinerama-dev ncurses dbus-x11 firefox-esr adwaita-gtk2-theme adwaita-icon-theme ttf-dejavu}}
then execute:
{{cmd|# git clone https://git.suckless.org/dwm}}
Once downloaded, go to the dwm directory
{{cmd|# cd dwm}}
To install, run:
{{cmd|# make clean install}}
Next, go up one directory level
{{cmd|# cd ..}}
to install dmenu:
{{cmd|# git clone https://git.suckless.org/dmenu
&#35; cd dmenu
&#35; make clean install}}
Finally, go up one more directory level
{{cmd|# cd ..}}
to install st:
{{cmd|# git clone https://git.suckless.org/st
&#35; cd st
&#35; make clean install}}


== Installing suckless tools dwm, dmenu, and st from source ==
Go to this directory {{cmd| # cd /tmp}} this is where we will download the source code
{{cmd|# git clone https://git.suckless.org/dwm}}
Once downloaded go to the dwm directory {{cmd|# cd dwm}}
to install run
{{cmd|# sudo make clean install}}
next leave this directory {{cmd|# cd ..}} so we can install dmenu
{{cmd|# git clone https://git.suckless.org/dmenu}}
{{cmd|# cd dmenu}}
{{cmd|# sudo make clean install}}
next leave this directory {{cmd|# cd ..}} so we can install st
{{cmd|# git clone https://git.suckless.org/st}}
{{cmd|# cd st}}
{{cmd|# sudo make clean install}}
== Setting up your profile ==
== Setting up your profile ==
Go to your profile
Change to your home directory:
{{cmd|# cd /home/myname}} Where '''myname''' is the name of your profile
{{cmd|$ cd ~}}
create .xinitrc
Create or edit {{Path|.xinitrc}} with at least the following:
{{cmd|# vi .xinitrc}}
{{cat|~/.xinitrc|exec dwm}}
add this line
Save the file and exit vi.
{{cat|~/.xinitrc|
 
exec dwm}} save the file and exit vi
Next, create or edit {{Path|.profile}} with at least the following:
next create .profile
{{cat|~/.profile|startx}}
{{cmd|# vi .profile}}
add this line
{{cat|~/.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.
{{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.
{{cat|~/.profile|
{{cat|~/.profile|if [ -z $DISPLAY ] && [ $(tty) {{=}} /dev/tty1 ]; then
if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then
     startx
     startx
fi
fi
}}
}}
|gotchas}}
|gotchas}}
exit to log out of the system or reboot and when you log in dwm will run.
Press alt+p to launch dmenu and start typing firefox. Press enter to run firefox, it will load in tile 9.


Log out or reboot. dwm will run the next time you log in.
Press {{Key|Alt}}+{{Key|p}} to launch dmenu. Type firefox then press {{key|enter}}. Firefox will load and run in tile 9.
= See Also =
* https://pkgs.alpinelinux.org/contents?file=dwm
* [https://wiki.gentoo.org/wiki/Dwm "dwm is only a single binary, and its source code is intended to never exceed 2000 SLOC. dwm is customized through editing its source code"]
* [[AwesomeWM]]
* [[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.
== See also ==
* [https://wiki.archlinux.org/title/Dwm Dwm - Archwiki]


[[category:Desktop]]
[[Category:Desktop]]
[[Category:Window Managers]]

Latest revision as of 17:12, 25 April 2024

dwm is a dynamic window manager for X. It manages windows in tiled, monocle and floating layouts.

This guide covers:

  • Installing dependencies for the suckless tools and installing firefox
  • Installing from source or from repository dwm (dynamic window manager), dmenu (dynamic menu), st (simple terminal)
  • Configuring the new profile to run dwm at login.

Prerequisites

Installing from binary repository

# apk add dwm dmenu st

This will install dwm, dmenu and st

Installing from source

Installing dependencies

Note: git make gcc g++ libx11-dev libxft-dev libxinerama-dev ncurses are needed to install suckless tools from source.

dbus-x11 is needed for the dbus system (enables firefox running in dwm to open in a tile)

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

The command to install the dependencies:

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

Installing suckless tools dwm, dmenu, and st from source

Change to the /tmp directory.

$ cd /tmp

then execute:

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

Once downloaded, go to the dwm directory

# cd dwm

To install, run:

# make clean install

Next, go up one directory level

# cd ..

to install dmenu:

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

Finally, go up one more directory level

# cd ..

to install st:

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

Setting up your profile

Change to your home directory:

$ cd ~

Create or edit .xinitrc with at least the following:

Contents of ~/.xinitrc

exec dwm

Save the file and exit vi.

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

See also