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
|
# Chawan - Text-based web browser and pager
{
config,
lib,
pkgs,
...
}:
{
imports = [
./assertions.nix
];
options.web.chawan = {
enable = lib.mkEnableOption "Enables chawan.";
package = lib.mkOption {
type = lib.types.package;
default = pkgs.chawan;
defaultText = lib.literalExpression "pkgs.chawan";
description = "Package to use for chawan.";
};
homeUrl = lib.mkOption {
type = lib.types.str;
default = "https://searx.space";
description = "The first page to open when chawan is launched.";
};
};
config = lib.mkIf config.web.chawan.enable {
home.file.".local/share/icons/hicolor/scalable/apps/internet-web-browser.svg" = {
source = ../../../assets/icons/internet-web-browser.svg;
};
xdg.desktopEntries."chawan" = {
name = "Chawan";
exec = "${lib.getExe config.terminal.kitty.package} --class chawan -e ${lib.getExe config.web.chawan.package} ${config.web.chawan.homeUrl}";
icon = "internet-web-browser";
categories = [ "Network" ];
comment = "Text-based web browser";
terminal = false;
type = "Application";
};
programs.chawan = {
enable = true;
package = config.web.chawan.package;
settings = {
buffer = {
images = true;
user-style = ''
html, body, div, section, article, main, header, footer, nav, aside, table, tr, td, th, ul, ol, li, span, p, pre, code {
background-color: black !important;
color: white !important;
}
a, a:link { color: #6bb6ff !important; }
a:visited { color: #d19aff !important; }
@media (prefers-color-scheme: light) {
html, body, div, section, article, main, header, footer, nav, aside, table, tr, td, th, ul, ol, li, span, p, pre, code {
background-color: black !important;
color: white !important;
}
}
'';
};
display = {
image-mode = "auto";
set-title = false;
};
network = {
allow-http-from-file = true;
};
page = {
o = ''() => pager.extern('xdg-open "$CHA_HOVER_URL"', {env: {CHA_HOVER_URL: pager.hoverLink}})'';
};
};
};
home.packages = [
config.web.chawan.package
];
};
}
|