Dwm: Difference between revisions

From Alpine Linux
No edit summary
No edit summary
(7 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{TOC right}}
[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.


Line 4: Line 6:


* Creating  a user account that can run as sudo  
* Creating  a user account that can run as sudo  
* Installing dependancies for the [https://suckless.org suckless] tools and installing firefox  
* Installing dependencies for the [https://suckless.org suckless] tools and installing firefox  
* Installing from source dwm, dmenu, st  
* Installing from source dwm (dynamic window 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.




== Creating a new user account ==
== Creating a new user account ==
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.  
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 sudo permissions.  
{{cmd|# adduser myname}}
{{cmd|# adduser myname}}
Where '''myname''' is the name you want to use
Where '''myname''' is the username you want to use.


Install sudo so we can add '''myname''' to sudoers
Install sudo so we can add '''myname''' to sudoers.
{{cmd|# apk add sudo}}
{{cmd|# apk add sudo}}


edit the sudores file by running:
Edit the sudoers file by running:
{{cmd|# visudo}}
{{cmd|# visudo}}
{{Note|Only edit the sudoers file using '''visudo'''}}
{{Note|Only edit the sudoers file using '''visudo'''}}
Line 33: Line 35:


== Installing Xorg ==
== Installing Xorg ==
run the following command  
Run the following command to install X.org.
{{cmd|# sudo setup-xorg-base}}
{{cmd|# sudo setup-xorg-base}}


== Configuring the community repositories ==
== Configuring the community repositories ==
We need to do this so we can install firefox. Edit the file with this command:
We need to do this so we can install Firefox. Edit the file with this command:
{{cmd|# sudo vi /etc/apk/repositories}}
{{cmd|# sudo vi /etc/apk/repositories}}
Uncomment the community line by removing the '''#''' then save the file and exit.  
Uncomment the community line by removing the '''#''' then save the file and exit.  
Line 56: Line 58:


'''dbus-x11''' is needed for the dbus system (when we run firefox in dwm we want it to open in a tile)
'''dbus-x11''' is needed for the dbus system (when we run firefox in dwm we want it to open in a tile)
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. }}
 
The command to install the dependencies
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. }}
 
The command to install the dependencies:
{{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}}
{{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}}


== Installing suckless tools dwm, dmenu, and st from source ==
== 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
Go to this directory {{cmd| # cd /tmp}} this is where we will download the source code.
{{cmd|# git clone https://git.suckless.org/dwm}}
{{cmd|# git clone https://git.suckless.org/dwm}}
Once downloaded go to the dwm directory {{cmd|# cd dwm}}
Once downloaded go to the dwm directory {{cmd|# cd dwm}}
to install run  
To install, run:
{{cmd|# sudo make clean install}}
{{cmd|# sudo make clean install}}
next leave this directory {{cmd|# cd ..}} so we can install dmenu
Next, leave this directory {{cmd|# cd ..}} so we can install dmenu:
{{cmd|# git clone https://git.suckless.org/dmenu}}
{{cmd|# git clone https://git.suckless.org/dmenu}}
{{cmd|# cd dmenu}}
{{cmd|# cd dmenu}}
{{cmd|# sudo make clean install}}
{{cmd|# sudo make clean install}}
next leave this directory {{cmd|# cd ..}} so we can install st
Finally, leave this directory {{cmd|# cd ..}} so we can install st:
{{cmd|# git clone https://git.suckless.org/st}}
{{cmd|# git clone https://git.suckless.org/st}}
{{cmd|# cd st}}
{{cmd|# cd st}}
{{cmd|# sudo make clean install}}
{{cmd|# sudo make clean install}}
== Setting up your profile ==
== Setting up your profile ==
Go to your profile
Go to your home directory:
{{cmd|# cd /home/myname}} Where '''myname''' is the name of your profile
{{cmd|# cd /home/myname}} Where '''myname''' is your username.
create .xinitrc
Create .xinitrc:
{{cmd|# vi .xinitrc}}
{{cmd|# vi .xinitrc}}
add this line  
Add this line:
{{cat|~/.xinitrc|
{{cat|~/.xinitrc|
exec dwm}} save the file and exit vi
exec dwm}}
next create .profile  
Save the file and exit vi.
 
Next, create .profile.:
{{cmd|# vi .profile}}
{{cmd|# vi .profile}}
add this line  
Add this line:
{{cat|~/.profile|
{{cat|~/.profile|
startx}}
startx}}


exit to log out of the system or reboot and when you log in dwm will run.  
{{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|
if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then
    startx
fi
}}
|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.
Press alt+p to launch dmenu and start typing firefox. Press enter to run firefox, it will load in tile 9.
= =
* 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"]
* [[Awesome]]
* [[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:Desktop]]

Revision as of 12:35, 20 May 2020

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

This guide covers:

  • Creating a user account that can run as sudo
  • Installing dependencies for the suckless tools and installing firefox
  • Installing from source dwm (dynamic window manager), dmenu (dynamic menu), st (simple terminal)
  • Configuring the new profile to run dwm at login.


Creating a new user account

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 sudo permissions.

# adduser myname

Where myname is the username you want to use.

Install sudo so we can add myname to sudoers.

# apk add sudo

Edit the sudoers file by running:

# 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:

Contents of /etc/sudoers.tmp

##
## User privilege specification
##
root ALL=(ALL) ALL
myname ALL=(ALL) ALL

Switch to the new account

# su myname

Installing Xorg

Run the following command to install X.org.

# sudo setup-xorg-base

Configuring the community repositories

We need to do this so we can install Firefox. Edit the file with this command:

# sudo vi /etc/apk/repositories

Uncomment the community line by removing the # then save the file and exit. It should look something like this:

Contents of /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:

# sudo apk update

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 (when we run firefox in dwm we want it to open in a tile)

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.

The command to install the dependencies:

# 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

Installing suckless tools dwm, dmenu, and st from source

Go to this directory

# cd /tmp

this is where we will download the source code.

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

Once downloaded go to the dwm directory

# cd dwm

To install, run:

# sudo make clean install

Next, leave this directory

# cd ..

so we can install dmenu:

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

# cd dmenu

# sudo make clean install

Finally, leave this directory

# cd ..

so we can install st:

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

# cd st

# sudo make clean install

Setting up your profile

Go to your home directory:

# cd /home/myname

Where myname is your username.

Create .xinitrc:

# vi .xinitrc

Add this line:

Contents of ~/.xinitrc

exec dwm

Save the file and exit vi.

Next, create .profile.:

# vi .profile

Add this line:

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

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.