nixos-dotfiles

nixos-dotfiles

https://git.tonybtw.com/nixos-dotfiles.git git://git.tonybtw.com/nixos-dotfiles.git
7,426 bytes raw
1
#+TITLE: DWL Window Manager Setup
2
#+AUTHOR: Tony, btw
3
#+DATE: 9-21-2025
4
5
* Prerequisites
6
7
Before building and using dwl, you'll need to install the following dependencies:
8
9
1. wayland, wayland-protocols
10
2. wlroots_0_19 (dependency for dwl)
11
3. foot (terminal emulator)
12
4. base-devel (so we can compile dwl)
13
5. git (to clone the 2 repos for dwl, and slstatus)
14
6. wmenu (a dmenu clone for wayland)
15
7. wl-clipboard (wayland clipboard tool)
16
8. grim, slurp for screenshots
17
9. swaybg (for wallpapers)
18
10. firefox (web browser)
19
11. ttf-jetbrains-mono-nerd (font)
20
21
** Installation Commands by Distribution
22
23
*** Arch Linux
24
#+begin_src sh
25
sudo pacman -S wayland wayland-protocols wlroots_0_19 foot base-devel git wmenu wl-clipboard grim slurp swaybg firefox ttf-jetbrains-mono-nerd
26
#+end_src
27
28
*** Gentoo Linux
29
#+begin_src sh
30
sudo emerge -av dev-libs/wayland dev-libs/wayland-protocols gui-libs/wlroots x11-terms/foot sys-devel/base-devel dev-vcs/git gui-apps/wmenu gui-apps/wl-clipboard media-gfx/grim gui-apps/slurp gui-apps/swaybg www-client/firefox media-fonts/jetbrains-mono
31
#+end_src
32
33
*** NixOS
34
Add to your =configuration.nix=:
35
#+begin_src nix
36
environment.systemPackages = with pkgs; [
37
  wayland
38
  wayland-protocols
39
  wlroots_0_19
40
  foot
41
  git
42
  wmenu
43
  wl-clipboard
44
  grim
45
  slurp
46
  swaybg
47
  firefox
48
  jetbrains-mono
49
];
50
#+end_src
51
52
* Colors and Customization
53
54
To customize the colors in dwl, you'll need to edit the =config.h= file before compiling. This setup uses the TokyoNight color scheme.
55
56
** TokyoNight Color Scheme
57
The current configuration uses TokyoNight colors with 32-bit RGBA values:
58
59
#+begin_src c
60
/* TokyoNight colors (0xRRGGBBAA) */
61
static const uint32_t col_bg    = 0x1a1b26ff; /* background */
62
static const uint32_t col_fg    = 0xa9b1d6ff; /* foreground */
63
static const uint32_t col_blk   = 0x32344aff; /* black (normal) */
64
static const uint32_t col_red   = 0xf7768eff; /* red */
65
static const uint32_t col_grn   = 0x9ece6aff; /* green */
66
static const uint32_t col_ylw   = 0xe0af68ff; /* yellow */
67
static const uint32_t col_blu   = 0x7aa2f7ff; /* blue */
68
static const uint32_t col_mag   = 0xad8ee6ff; /* magenta */
69
static const uint32_t col_cyn   = 0x0db9d7ff; /* cyan (highlight) */
70
static const uint32_t col_brblk = 0x444b6aff; /* bright black */
71
#+end_src
72
73
** Color Applications
74
These colors are used in different parts of the interface:
75
76
- =SchemeNorm= (vacant tags): Uses =col_fg= on =col_bg= with =col_brblk= borders
77
- =SchemeSel= (selected tag): Uses =col_cyn= on =col_bg= with =col_mag= borders
78
- =SchemeOcc= (occupied tags): Uses =col_cyn= on =col_bg= with =col_cyn= borders
79
- =SchemeUnder= (underlines): Uses =col_mag= on =col_bg= with =col_mag= borders
80
81
** Changing Colors for Your Setup
82
1. Edit =config.h= in your dwl source directory
83
2. Modify the color hex values (format: 0xRRGGBBAA where AA is alpha)
84
3. Update the =colors= array to use your preferred color combinations
85
4. Recompile dwl with =make clean && make=
86
5. Reinstall with =sudo make install=
87
88
Popular alternative color schemes:
89
- Gruvbox: =#282828=, =#3c3836=, =#ebdbb2=, =#fb4934=
90
- Nord: =#2e3440=, =#3b4252=, =#eceff4=, =#88c0d0=
91
- Dracula: =#282a36=, =#44475a=, =#f8f8f2=, =#bd93f9=
92
93
* slstatus
94
95
slstatus is a status bar for dwl that displays system information like time, battery, CPU usage, etc. It uses the same TokyoNight colors for consistency.
96
97
** Installation
98
#+begin_src sh
99
git clone https://git.suckless.org/slstatus
100
cd slstatus
101
sudo make clean install
102
#+end_src
103
104
** Configuration
105
Edit =config.h= to customize what information is displayed:
106
#+begin_src c
107
static const struct arg args[] = {
108
    /* function format          argument */
109
    { datetime, "%s",           "%F %T" },
110
    { separator, " | " },
111
    { battery_perc, "%s%%",     "BAT0" },
112
};
113
#+end_src
114
115
** Using the Launch Script
116
117
The provided script starts both slstatus and dwl together, with slstatus feeding information to dwl's status bar and swaybg setting a wallpaper.
118
119
*** Script Content
120
#+begin_src sh
121
#!/bin/sh
122
slstatus -s | dwl -s "sh -c 'swaybg -i /home/tony/walls/wall1.png &'"
123
#+end_src
124
125
*** Adding Script to PATH
126
If you want to add this to your PATH for easy access:
127
128
#+begin_src sh
129
mkdir ~/.local/bin
130
cp ~/start_dwl.sh ~/.local/bin/start_dwl
131
vim ~/.bashrc
132
# Add this line to ~/.bashrc:
133
export PATH="$HOME/.local/bin:$PATH"
134
source ~/.bashrc
135
#+end_src
136
137
Now you can start your desktop environment by simply running =start_dwl= from anywhere.
138
139
* Keybinds
140
141
Here are all the configured keybinds for this dwl setup. MODKEY is typically the Super/Windows key.
142
143
** Application Launchers
144
| Key Combination | Action | Description |
145
|-----------------|--------|-------------|
146
| =MODKEY + d= | wmenu | Launch application menu |
147
| =MODKEY + Return= | foot | Launch terminal |
148
149
** Screenshots
150
| Key Combination | Action | Description |
151
|-----------------|--------|-------------|
152
| =Ctrl + F12= | snip script | Take screenshot (via script) |
153
| =MODKEY + s= | /home/tony/scripts/snip.sh | Take screenshot |
154
| =MODKEY + Shift + S= | Screenshot selection | Select area and copy to clipboard |
155
156
** Window Management
157
| Key Combination | Action | Description |
158
|-----------------|--------|-------------|
159
| =MODKEY + j= | Focus next | Focus next window in stack |
160
| =MODKEY + k= | Focus previous | Focus previous window in stack |
161
| =MODKEY + q= | Kill client | Close focused window |
162
| =MODKEY + Return= | Zoom | Move focused window to master |
163
| =MODKEY + Tab= | View last tag | Switch to previously viewed tag |
164
| =MODKEY + e= | Toggle fullscreen | Make window fullscreen |
165
| =MODKEY + Shift + Space= | Toggle floating | Make window floating/tiled |
166
167
** Layout Management
168
| Key Combination | Action | Description |
169
|-----------------|--------|-------------|
170
| =MODKEY + t= | Tiled layout | Set layout to tiled |
171
| =MODKEY + f= | Floating layout | Set layout to floating |
172
| =MODKEY + m= | Monocle layout | Set layout to monocle |
173
| =MODKEY + Space= | Toggle layout | Cycle through layouts |
174
| =MODKEY + h= | Decrease master | Decrease master area size |
175
| =MODKEY + l= | Increase master | Increase master area size |
176
| =MODKEY + i= | Increase masters | Increase number of masters |
177
| =MODKEY + p= | Decrease masters | Decrease number of masters |
178
179
** Status Bar and Gaps
180
| Key Combination | Action | Description |
181
|-----------------|--------|-------------|
182
| =MODKEY + b= | Toggle bar | Show/hide status bar |
183
| =MODKEY + a= | Toggle gaps | Enable/disable window gaps |
184
185
** Tag Management (Workspaces)
186
| Key Combination | Action | Description |
187
|-----------------|--------|-------------|
188
| =MODKEY + [1-9]= | View tag | Switch to tag 1-9 |
189
| =MODKEY + Shift + [1-9]= | Move to tag | Move window to tag 1-9 |
190
| =MODKEY + 0= | View all tags | Show windows from all tags |
191
| =MODKEY + Shift + )= | Tag all | Tag window with all tags |
192
193
** Monitor Management
194
| Key Combination | Action | Description |
195
|-----------------|--------|-------------|
196
| =MODKEY + ,= | Focus left monitor | Focus monitor to the left |
197
| =MODKEY + .= | Focus right monitor | Focus monitor to the right |
198
| =MODKEY + Shift + <= | Move to left monitor | Move window to left monitor |
199
| =MODKEY + Shift + >= | Move to right monitor | Move window to right monitor |
200
201
** System Control
202
| Key Combination | Action | Description |
203
|-----------------|--------|-------------|
204
| =MODKEY + Shift + Q= | Quit dwl | Exit window manager |
205
| =Ctrl + Alt + Backspace= | Terminate server | Force quit (emergency exit) |