nixos-dotfiles

nixos-dotfiles

https://git.tonybtw.com/nixos-dotfiles.git git://git.tonybtw.com/nixos-dotfiles.git
9,797 bytes raw
1
* Installation Guide per Distro:
2
** Arch Linux
3
4
For Arch Linux, installation is straightforward using the AUR:
5
6
#+begin_src sh
7
yay -S mangowc-git
8
#+end_src
9
10
Then install the required dependencies:
11
12
#+begin_src sh
13
sudo pacman -Sy foot wl-clipboard wmenu grim slurp swaybg firefox ttf-jetbrains-mono-nerd
14
#+end_src
15
16
** NixOS
17
18
For NixOS, you'll need to add MangoWC as a flake input to your configuration.
19
First, add the flake input to your =flake.nix=:
20
21
#+begin_src nix
22
{
23
  inputs = {
24
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
25
    mangowc = {
26
      url = "github:DreamMaoMao/mangowc";
27
      inputs.nixpkgs.follows = "nixpkgs";
28
    };
29
  };
30
31
  outputs = { self, nixpkgs, mangowc, ... }: {
32
    nixosConfigurations.yourHostname = nixpkgs.lib.nixosSystem {
33
      system = "x86_64-linux";
34
      modules = [
35
        ./configuration.nix
36
        mangowc.nixosModules.default
37
      ];
38
    };
39
  };
40
}
41
#+end_src
42
43
Then enable MangoWC in your =configuration.nix=:
44
45
#+begin_src nix
46
{ config, pkgs, ... }:
47
48
{
49
  programs.mangowc.enable = true;
50
51
  environment.systemPackages = with pkgs; [
52
    foot
53
    wmenu
54
    wl-clipboard
55
    grim
56
    slurp
57
    swaybg
58
    firefox
59
  ];
60
61
  fonts.packages = with pkgs; [
62
    nerd-fonts.jetbrains-mono
63
  ];
64
}
65
#+end_src
66
67
Rebuild your system:
68
69
#+begin_src sh
70
sudo nixos-rebuild switch --flake .#your_hostname
71
#+end_src
72
73
** Gentoo
74
75
For Gentoo users, you'll need to add MangoWC via an overlay or manually compile it.
76
First, install the dependencies:
77
78
#+begin_src sh
79
sudo emerge --ask \
80
  dev-libs/wayland \
81
  dev-libs/wayland-protocols \
82
  gui-libs/wlroots \
83
  dev-libs/libinput \
84
  x11-libs/libdrm \
85
  x11-libs/libxkbcommon \
86
  x11-libs/pixman \
87
  dev-util/meson \
88
  dev-util/ninja \
89
  sys-apps/hwdata \
90
  sys-auth/seatd \
91
  dev-libs/libpcre2 \
92
  gui-apps/foot \
93
  gui-apps/wmenu \
94
  gui-apps/wl-clipboard \
95
  gui-apps/grim \
96
  gui-apps/slurp \
97
  gui-apps/swaybg \
98
  www-client/firefox \
99
  media-fonts/jetbrains-mono
100
#+end_src
101
102
Then clone and build MangoWC from source:
103
104
#+begin_src sh
105
git clone https://github.com/DreamMaoMao/mangowc
106
cd mangowc
107
meson setup build
108
ninja -C build
109
sudo ninja -C build install
110
#+end_src
111
112
* My Keybinds:
113
114
Here's a breakdown of all the essential keybinds for MangoWC. These are configured in your =~/.config/mango/config.conf= file:
115
116
** Basic Controls
117
118
| Keybind              | Action              | Description                                      |
119
|----------------------+---------------------+--------------------------------------------------|
120
| =Super + Enter=      | Launch Terminal     | Opens foot terminal emulator                     |
121
| =Super + d=          | Application Launcher| Opens wmenu for launching applications           |
122
| =Super + q=          | Kill Window         | Closes the currently focused window              |
123
| =Super + Shift + r=  | Reload Config       | Reloads the MangoWC configuration file           |
124
| =Super + R=          | Reload Waybar       | Runs the rebar script to restart waybar         |
125
| =Super + s=          | Screenshot          | Takes a screenshot of selected area (using snip.sh) |
126
127
** Workspace Management
128
129
| Keybind         | Action          | Description                              |
130
|-----------------+-----------------+------------------------------------------|
131
| =Super + 1-9=   | Switch Tag      | Switches to workspace/tag 1 through 9    |
132
| =Super + i=     | Increase Master | Adds one more window to master area      |
133
| =Super + p=     | Decrease Master | Removes one window from master area      |
134
| =Super + 0=     | Toggle Overview | Shows overview of all windows/workspaces |
135
136
** Window Management
137
138
| Keybind                 | Action       | Description                              |
139
|-------------------------+--------------+------------------------------------------|
140
| =Super + j=             | Focus Next   | Focuses the next window in the stack     |
141
| =Super + k=             | Focus Previous | Focuses the previous window in the stack |
142
| =Super + h=             | Focus Left   | Focuses the window to the left           |
143
| =Super + l=             | Focus Right  | Focuses the window to the right          |
144
| =Super + Shift + j=     | Swap Down    | Swaps current window with the one below  |
145
| =Super + Shift + k=     | Swap Up      | Swaps current window with the one above  |
146
| =Super + Shift + h=     | Swap Left    | Swaps current window with the one on the left |
147
| =Super + Shift + l=     | Swap Right   | Swaps current window with the one on the right |
148
| =Ctrl + Shift + j/k/h/l= | Smart Move   | Moves window in specified direction      |
149
150
** Layout Controls
151
152
| Keybind             | Action           | Description                             |
153
|---------------------+------------------+-----------------------------------------|
154
| =Super + t=         | Tile Layout      | Sets layout to tiled mode               |
155
| =Super + v=         | Vertical Grid    | Sets layout to vertical grid            |
156
| =Super + c=         | Spiral Layout    | Sets layout to spiral mode              |
157
| =Super + x=         | Scroller Layout  | Sets layout to scroller mode            |
158
| =Super + n=         | Switch Layout    | Cycles through available layouts        |
159
| =Super + a=         | Toggle Gaps      | Toggles window gaps on/off              |
160
| =Super + f=         | Toggle Float     | Toggles floating mode for current window |
161
| =Super + Shift + f= | Toggle Fullscreen | Toggles fullscreen for current window   |
162
163
** Mouse Bindings
164
165
| Keybind                | Action        | Description                              |
166
|------------------------+---------------+------------------------------------------|
167
| =Super + Left Click=   | Move Window   | Click and drag to move floating windows  |
168
| =Super + Right Click=  | Resize Window | Click and drag to resize windows         |
169
170
** Touchpad Gestures
171
172
| Gesture                          | Action          | Description                              |
173
|----------------------------------+-----------------+------------------------------------------|
174
| 3-finger swipe left/right/up/down | Focus Direction | Focuses window in the swipe direction    |
175
| 4-finger swipe left              | Previous Tag    | Switches to previous tag with clients    |
176
| 4-finger swipe right             | Next Tag        | Switches to next tag with clients        |
177
| 4-finger swipe up/down           | Toggle Overview | Shows/hides workspace overview           |
178
179
* Load MangoWC
180
181
We're in mangowc now by and as you can see, it's literally just a blank screen with a mouse cursor. Super minimal.
182
183
Let's jump into mango's config.conf and get started with some keybinds.
184
So lets hit Alt + Enter to open foot, by defualt.
185
186
Open up .config/mango/config.conf, and lets change a few keybinds, and add a wmenu script.
187
188
#+begin_src conf
189
bind=SUPER,Return,spawn,foot
190
bind=SUPER,q,killclient,
191
bind=SUPER,d,spawn,wmenu-run -l 10
192
#+end_src
193
194
We can reload the config file with Super R. Now we can spawn terminals with Super Enter as we are used to. Alright this is nice, but we can do better. I personally could get by just like this, with no bar, but lets add one.
195
196
Let's add some custom binds for movements, and whatnot later, but for now lets move on to the bar. I encourage you to play around with this file and add/change your binds as needed, and a great place to start especially if you are coming over from dwm is to checkout ArgosNothing's DWM config conversion, and add stuff to it. He made this mango config and this article about it on my website here:
197
https://tonybtw.com/community/mango
198
199
* Waybar + Autostart
200
201
So the file structure for the config directory is gonna be pretty simple today, we're just going to use an autostart.sh, a config.conf, and we'll put waybar's config.jsonc and style.css in here. This will allow you to use waybar with other configs as needed, and not disrupt your other wayland compositor's waybar configs.
202
203
#+begin_src sh
204
/home/tony/.config/mango
205
├── autostart.sh
206
├── config.conf
207
├── config.jsonc
208
├── menu.sh
209
├── rebar.sh
210
└── style.css
211
#+end_src
212
213
I already made a video about waybar, so I'm just going to clone my waybar config and start it up with autostart.sh. If you want guidance on customizing waybar, I encourage you to check out the waybar video.
214
215
#+begin_src
216
git clone https://github.com/tonybanters/waybar
217
cp waybar/* ~/.config/mango/.
218
#+end_src
219
220
And let's add waybar to our autostart.sh
221
222
#+begin_src
223
vim ~/.config/mango/autostart.sh
224
waybar -c ~/.config/mango/config.jsonc -s ~/.config/mango/style.css >/dev/null 2>&1 &
225
#+end_src
226
227
This will tell mango to start up with a wallpaper, and waybar.
228
So we're ready to launch Mango at this point. Let's go ahead and do so, by typing `mango`
229
230
* Wallpaper
231
We need a wallpaper. With swaybg, we can set one, but we need to download one first. so lets open firefox, and head over to wallhaven.cc and pick one from there.
232
233
Let's grab this one, and put it in ~/walls/wall1.png
234
235
Now we can set that with
236
237
#+begin_src sh
238
swaybg -i ~/walls/wall1.png & disown
239
#+end_src
240
241
Let's add disown here so when we close this terminal, our wallpaper persists.
242
243
But we see the issue here, we want this wallpaper to be enabled whenever we launch mangoWC. We can accomplish this simply by adding it to autostart.sh
244
245
#+begin_src sh
246
vim ~/.config/mango/autostart.sh
247
waybar -c ~/.config/mango/config.jsonc -s ~/.config/mango/style.css >/dev/null 2>&1 &
248
swaybg -i ~/walls/wall1.png >/dev/null 2>&1 &
249
#+end_src
250
251
Now if we relaunch mangoWC, we see our wallpaper persists.
252
253
* Screenshot Script
254
We can add a screenshot script here with `grim`, `slurp`, and `wl-copy`
255
256
#+begin_src sh
257
#!/bin/sh
258
grim -l 0 -g "$(slurp)" - | wl-copy
259
#+end_src
260
261
And bind this screenshot in our config.conf here:
262
263
#+begin_src conf
264
bind=SUPER,s,spawn,snip
265
#+end_src