-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
-
64
-
65
-
66
-
67
-
68
-
69
-
70
-
71
-
72
-
73
-
74
-
75
-
76
-
77
-
78
-
79
-
80
-
81
-
82
-
83
-
84
-
85
-
86
-
87
-
88
-
89
-
90
-
91
-
92
-
93
-
94
-
95
-
96
-
97
-
98
-
99
-
100
-
101
-
102
-
103
-
104
-
105
-
106
-
107
-
108
-
109
-
110
-
111
-
112
-
113
-
114
-
115
-
116
-
117
-
118
-
119
-
120
-
121
-
122
-
123
-
124
-
125
-
126
-
127
-
128
-
129
-
130
-
131
-
132
-
133
-
134
-
135
-
136
-
137
-
138
-
139
-
140
-
141
-
142
-
143
-
144
-
145
-
146
-
147
-
148
-
149
-
150
-
151
-
152
-
153
-
154
-
155
-
156
-
157
-
158
-
159
-
160
-
161
-
162
-
163
-
164
-
165
-
166
-
167
-
168
-
169
-
170
-
171
-
172
-
173
-
174
-
175
-
176
-
177
-
178
-
179
-
180
-
181
-
182
-
183
-
184
-
185
-
186
-
187
-
188
-
189
-
190
-
191
-
192
-
193
-
194
-
195
-
196
-
197
-
198
-
199
-
200
-
201
-
202
-
203
-
204
-
205
-
206
-
207
-
208
-
209
-
210
-
211
-
212
-
213
-
214
-
215
-
216
-
217
-
218
-
219
-
220
-
221
-
222
-
223
-
224
-
225
-
226
-
227
-
228
-
229
-
230
-
231
-
232
-
233
-
234
-
235
-
236
-
237
-
238
-
239
-
240
-
241
-
242
-
243
-
244
-
245
-
246
-
247
-
248
-
249
-
250
-
251
-
252
-
253
-
254
-
255
-
256
-
257
-
258
-
259
-
260
-
261
-
262
-
263
-
264
-
265
-
266
-
267
-
268
-
269
-
270
-
271
-
272
-
273
-
274
-
275
-
276
-
277
-
278
-
279
-
280
-
281
-
282
-
283
-
284
-
285
-
286
-
287
-
288
-
289
-
290
-
291
-
292
-
293
-
294
-
295
-
296
-
297
-
298
-
299
-
300
-
301
-
302
-
303
-
304
-
305
-
306
-
307
-
308
-
309
-
310
-
311
-
312
-
313
-
314
-
315
-
316
-
317
-
318
-
319
-
320
-
321
-
322
-
323
-
324
-
325
-
326
-
327
-
328
-
329
-
330
-
331
-
332
-
333
-
334
-
335
-
336
-
337
-
338
-
339
-
340
-
341
-
342
-
343
-
344
-
345
-
346
-
347
-
348
-
349
-
350
-
351
-
352
-
353
-
354
-
355
-
356
-
357
-
358
-
359
-
360
-
361
-
362
-
363
-
364
-
365
-
366
-
367
-
368
-
369
-
370
-
371
-
372
-
373
-
374
-
375
-
376
-
377
-
378
-
379
-
380
-
381
-
382
-
383
-
384
-
385
-
386
-
387
-
388
-
389
-
390
-
391
-
392
-
393
-
394
-
395
-
396
-
397
-
398
-
399
{ config, lib, pkgs, ... }:
let
cfg = config.themes.catppuccin;
in
{
options = {
themes.catppuccin = {
flavor = lib.mkOption {
type = lib.types.enum [
"latte"
"frappe"
"macchiato"
"mocha"
];
default = "mocha";
description = ''
Specify which Catppuccin _flavor_ (color palette) to use.
'';
};
wallpaperWidth = lib.mkOption {
type = lib.types.ints.unsigned;
default = 3840;
};
wallpaperHeight = lib.mkOption {
type = lib.types.ints.unsigned;
default = 2160;
};
};
};
config =
let
json = builtins.fromJSON (builtins.readFile (
pkgs.fetchFromGitHub
{
owner = "catppuccin";
repo = "palette";
rev = "205dd54c6158b7648621cf9fd00e91f03888ce7e";
sha256 = "y14fd8lvnG9hNY6CRU0JgxWouexEw91aIEMkr1NaM/4=";
}
+ "/palette.json"
));
flavor = json."${cfg.flavor}";
wallpaper = import ./wallpaper {
inherit pkgs;
flavor = cfg.flavor;
colors = flavor;
mocha = json.mocha;
width = cfg.wallpaperWidth;
height = cfg.wallpaperHeight;
};
in
{
features.wayland-de = lib.mkIf config.features.wayland-de.enable {
tofi = rec {
fuzzyMatch = false;
font = {
family = "Dank Mono";
size = 11;
};
scale = true;
anchor = "bottom";
horizontal = true;
# "100%" does not work on fractional scaling display
# https://github.com/philj56/tofi/issues/79
width = 0;
height = font.size + padding.top + padding.bottom + selection.backgroundPadding.top + selection.backgroundPadding.bottom + border.width * 2;
resultSpacing = 10 + selection.backgroundPadding.left + selection.backgroundPadding.right;
# Avoid unwanted clipping
# https://github.com/philj56/tofi/issues/65#issuecomment-1335556041
clipToPadding = false;
padding = {
top = 6;
right = 8;
# There is no way to specify line-height: need to adjust padding-bottom or something.
bottom = 5;
left = 8;
};
prompt = {
text = ">";
background = "#00000000";
color = flavor.teal.hex;
padding = 8;
};
input = {
color = flavor.subtext0.hex;
backgroundPadding = {
top = 0;
right = 32;
bottom = 0;
left = 0;
};
};
selection = {
background = flavor.surface2.hex + "66";
color = flavor.text.hex;
matchColor = flavor.peach.hex;
backgroundPadding = {
top = 4;
right = 8;
bottom = 4;
left = 8;
};
backgroundCornerRadius = 4;
};
textColor = flavor.text.hex;
backgroundColor = flavor.mantle.hex;
outline = {
width = 0;
color = "#00000000";
};
border = {
width = 0;
color = "#00000000";
};
};
swaybg = {
background = flavor.base.hex;
image = "${wallpaper}/usr/share/backgrounds/catppuccin-${cfg.flavor}.png";
};
};
services.dunst = lib.mkIf config.services.dunst.enable {
settings = {
global = {
width = 400;
height = 300;
offset = "4x4";
padding = 4;
horizontal_padding = 8;
frame_width = 2;
gap_size = 6;
font = "Monospace 10";
corner_radius = 2;
};
urgency_low = {
background = flavor.base.hex;
foreground = flavor.subtext0.hex;
frame_color = flavor.overlay1.hex;
};
urgency_normal = {
background = flavor.base.hex;
foreground = flavor.text.hex;
frame_color = flavor.blue.hex;
};
urgency_critical = {
background = flavor.base.hex;
foreground = flavor.text.hex;
frame_color = flavor.yellow.hex;
};
};
};
home.packages = [
(lib.mkIf config.features.wayland-de.enable wallpaper)
];
wayland.windowManager.sway = lib.mkIf config.wayland.windowManager.sway.enable {
config = {
colors = {
focused = {
childBorder = flavor.lavender.hex;
background = flavor.base.hex;
text = flavor.text.hex;
indicator = flavor.rosewater.hex;
border = flavor.lavender.hex;
};
focusedInactive = {
childBorder = flavor.overlay0.hex;
background = flavor.base.hex;
text = flavor.overlay1.hex;
indicator = flavor.rosewater.hex;
border = flavor.overlay0.hex;
};
unfocused = {
childBorder = flavor.overlay0.hex;
background = flavor.base.hex;
text = flavor.overlay1.hex;
indicator = flavor.rosewater.hex;
border = flavor.overlay0.hex;
};
urgent = {
childBorder = flavor.peach.hex;
background = flavor.base.hex;
text = flavor.peach.hex;
indicator = flavor.overlay0.hex;
border = flavor.peach.hex;
};
placeholder = {
childBorder = flavor.overlay0.hex;
background = flavor.base.hex;
text = flavor.text.hex;
indicator = flavor.overlay0.hex;
border = flavor.overlay0.hex;
};
background = flavor.base.hex;
};
gaps = {
outer = 6;
inner = 6;
smartBorders = "on";
smartGaps = true;
};
window = {
border = 1;
titlebar = false;
hideEdgeBorders = "smart";
};
};
};
programs.waybar = lib.mkIf config.programs.waybar.enable {
settings = {
main = {
position = "bottom";
};
};
style = ''
* {
font-family: "FontAwesome", Roboto, Helvetica, Arial, sans-serif;
font-size: 14px;
}
window#waybar {
border-top: 1px solid ${flavor.overlay0.hex};
background-color: ${flavor.mantle.hex};
color: ${flavor.text.hex};
}
.modules-left,
.modules-right {
margin: 4px;
}
#workspaces button {
font-size: 12px;
padding: 0px 2px;
background-color: transparent;
border-radius: 2px;;
color: ${flavor.overlay1.hex};
}
#workspaces button:hover {
text-decoration: underline;
}
#workspaces button.focused {
font-weight: bold;
background-color: rgba(${flavor.surface2.raw}, 0.4);
color: ${flavor.text.hex};
}
#workspaces button.urgent {
color: ${flavor.yellow.hex};
}
#clock,
#network,
#pulseaudio,
#tray {
padding: 0px 6px;
color: inherit;
}
#pulseaudio:hover {
background-color: rgba(${flavor.surface2.raw}, 0.4);
}
'';
};
programs.ghostty =
let
darkFlavor =
if cfg.flavor == "latte" then
"mocha"
else
cfg.flavor;
in
{
settings = {
theme = "light:catppuccin-latte-corrected,dark:catppuccin-${darkFlavor}";
};
};
# The default palette is not correctly inverted.
xdg.configFile."ghostty/themes/catppuccin-latte-corrected" =
let
latte = json.latte;
hex = color: lib.strings.removePrefix "#" color.hex;
in
lib.mkIf config.programs.ghostty.enable {
text = ''
palette = 0=${latte.crust.hex}
palette = 1=${latte.red.hex}
palette = 2=${latte.green.hex}
palette = 3=${latte.yellow.hex}
palette = 4=${latte.blue.hex}
palette = 5=${latte.pink.hex}
palette = 6=${latte.teal.hex}
palette = 7=${latte.subtext0.hex}
palette = 8=${latte.surface2.hex}
palette = 9=#de293e
palette = 10=#49af3d
palette = 11=#eea02d
palette = 12=#456eff
palette = 13=#fe85d8
palette = 14=#2d9fa8
palette = 15=${latte.text.hex}
background = ${hex latte.base}
foreground = ${hex latte.text}
cursor-color = ${hex latte.rosewater}
selection-background = ${hex latte.surface2}
selection-foreground = ${hex latte.text}
'';
};
programs.kitty =
let
# Convert the input string's first character to upper case.
# Example: "foo" -> "Foo"
toCapital = with lib;
str:
let
len = builtins.stringLength str;
head = strings.toUpper (builtins.substring 0 1 str);
tail = builtins.substring 1 (len - 1) str;
in
head + tail;
in
{
themeFile = "Catppuccin-${toCapital cfg.flavor}";
settings.background_opacity = 1.0;
};
programs.foot =
let
toFootHex = lib.strings.removePrefix "#";
fg = toFootHex flavor.surface0.hex;
bg = toFootHex flavor.text.hex;
in
{
settings.main = {
include = "${config.xdg.configHome}/foot/theme.conf";
};
settings.cursor = {
# Foot by default invert fg/bg for cursor. However, this makes
# cursor on indent_blankline's indent char/spaces barely visible.
color = "${fg} ${bg}";
};
};
xdg.configFile."foot/theme.conf" = lib.mkIf config.programs.foot.enable {
text = builtins.readFile (
pkgs.fetchFromGitHub
{
owner = "catppuccin";
repo = "foot";
rev = "009cd57bd3491c65bb718a269951719f94224eb7";
sha256 = "0f0r8d4rn54gibrzfhiy4yr8bi7c8j18ggp1y9lyidc1dmy9kvw0";
}
+ "/catppuccin-${cfg.flavor}.conf"
);
};
};
}