aboutsummaryrefslogtreecommitdiffstats
path: root/modules/web
diff options
context:
space:
mode:
Diffstat (limited to 'modules/web')
-rw-r--r--modules/web/chawan/assertions.nix13
-rw-r--r--modules/web/chawan/default.nix69
-rw-r--r--modules/web/default.nix4
-rw-r--r--modules/web/w3m/assertions.nix13
-rw-r--r--modules/web/w3m/default.nix37
5 files changed, 84 insertions, 52 deletions
diff --git a/modules/web/chawan/assertions.nix b/modules/web/chawan/assertions.nix
new file mode 100644
index 0000000..2ab30a0
--- /dev/null
+++ b/modules/web/chawan/assertions.nix
@@ -0,0 +1,13 @@
+# Assertions - Validates kitty is enabled for chawan desktop entry
+{ config, ... }:
+{
+ assertions = [
+ {
+ assertion = !config.web.chawan.enable || config.terminal.kitty.enable;
+ message = ''
+ web.chawan is enabled but terminal.kitty.enable is not.
+ chawan's desktop entry requires kitty as the terminal launcher. Please enable terminal.kitty.
+ '';
+ }
+ ];
+}
diff --git a/modules/web/chawan/default.nix b/modules/web/chawan/default.nix
new file mode 100644
index 0000000..0b47aec
--- /dev/null
+++ b/modules/web/chawan/default.nix
@@ -0,0 +1,69 @@
+# 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.";
+ };
+ };
+
+ config = lib.mkIf config.web.chawan.enable {
+ xdg.desktopEntries."chawan" = {
+ name = "Chawan";
+ exec = "${lib.getExe config.terminal.kitty.package} --class chawan -e ${lib.getExe config.web.chawan.package}";
+ icon = "kitty";
+ 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 = lib.mkIf config.terminal.kitty.enable "kitty";
+ };
+ 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
+ ];
+ };
+}
diff --git a/modules/web/default.nix b/modules/web/default.nix
index 8529770..7357df9 100644
--- a/modules/web/default.nix
+++ b/modules/web/default.nix
@@ -1,9 +1,9 @@
-# Web - Web browser and downloader modules (aria2, brave, w3m)
+# Web - Web browser and downloader modules (aria2, brave, chawan)
{ ... }:
{
imports = [
./aria2
./chromium
- ./w3m
+ ./chawan
];
}
diff --git a/modules/web/w3m/assertions.nix b/modules/web/w3m/assertions.nix
deleted file mode 100644
index b5ae2be..0000000
--- a/modules/web/w3m/assertions.nix
+++ /dev/null
@@ -1,13 +0,0 @@
-# Assertions - Validates kitty is enabled for w3m desktop entry
-{ config, ... }:
-{
- assertions = [
- {
- assertion = !config.web.w3m.enable || config.terminal.kitty.enable;
- message = ''
- web.w3m is enabled but terminal.kitty.enable is not.
- w3m's desktop entry requires kitty as the terminal launcher. Please enable terminal.kitty.
- '';
- }
- ];
-}
diff --git a/modules/web/w3m/default.nix b/modules/web/w3m/default.nix
deleted file mode 100644
index a4fdb1f..0000000
--- a/modules/web/w3m/default.nix
+++ /dev/null
@@ -1,37 +0,0 @@
-# w3m - Text-based web browser and pager
-{
- config,
- lib,
- ...
-}:
-{
- imports = [
- ./assertions.nix
- ];
-
- options.web.w3m = {
- enable = lib.mkEnableOption "Enables w3m.";
- package = lib.mkOption {
- type = lib.types.package;
- default = config.programs.w3m.finalPackage;
- defaultText = lib.literalExpression "config.programs.w3m.finalPackage";
- description = "Package to use for w3m. Defaults to the wrapped finalPackage from programs.w3m.";
- };
- };
-
- config = lib.mkIf config.web.w3m.enable {
- xdg.desktopEntries."w3m" = {
- name = "w3m";
- exec = "${lib.getExe config.terminal.kitty.package} --class w3m -e ${lib.getExe' config.web.w3m.package "w3m"}";
- icon = "kitty";
- categories = [ "Network" ];
- comment = "Text-based web browser";
- terminal = false;
- type = "Application";
- };
- programs.w3m.enable = true;
- home.packages = [
- config.web.w3m.package
- ];
- };
-}