diff options
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/communication/neomutt/.neomuttrc | 3 | ||||
| -rw-r--r-- | modules/communication/neomutt/assertions.nix | 8 | ||||
| -rw-r--r-- | modules/communication/neomutt/macros.nix | 8 | ||||
| -rw-r--r-- | modules/communication/neomutt/neomutt.nix | 2 | ||||
| -rw-r--r-- | modules/desktop/waybar/lib.nix | 2 | ||||
| -rw-r--r-- | modules/desktop/waybar/module/window.nix | 1 | ||||
| -rw-r--r-- | modules/desktop/waybar/module/workspaces.nix | 1 | ||||
| -rw-r--r-- | modules/scripts/aria2-run/assertions.nix | 7 | ||||
| -rw-r--r-- | modules/scripts/aria2-run/default.nix | 26 | ||||
| -rw-r--r-- | modules/scripts/aria2-run/script.sh | 1 | ||||
| -rw-r--r-- | modules/scripts/default.nix | 2 | ||||
| -rw-r--r-- | modules/web/chawan/assertions.nix | 13 | ||||
| -rw-r--r-- | modules/web/chawan/default.nix | 69 | ||||
| -rw-r--r-- | modules/web/default.nix | 4 | ||||
| -rw-r--r-- | modules/web/w3m/assertions.nix | 13 | ||||
| -rw-r--r-- | modules/web/w3m/default.nix | 37 |
16 files changed, 96 insertions, 101 deletions
diff --git a/modules/communication/neomutt/.neomuttrc b/modules/communication/neomutt/.neomuttrc index 877e265..34d5a8e 100644 --- a/modules/communication/neomutt/.neomuttrc +++ b/modules/communication/neomutt/.neomuttrc @@ -12,7 +12,8 @@ set abort_key = "<Esc>" # attachments: use our mailcap for dedicated openers, # and auto-render html/images inline where sensible set mailcap_path = "~/.config/neomutt/mailcap" -auto_view text/html image/png image/jpeg image/gif application/pdf +auto_view text/plain +alternative_order text/html image/png image/jpeg image/gif application/pdf # Nerd Font icon-based flag/attachment/crypto indicators # order: new, old, deleted, flagged, replied, old(unused), tagged, encrypt, ... diff --git a/modules/communication/neomutt/assertions.nix b/modules/communication/neomutt/assertions.nix index c4ce62a..5fad5c9 100644 --- a/modules/communication/neomutt/assertions.nix +++ b/modules/communication/neomutt/assertions.nix @@ -1,4 +1,4 @@ -# Assertions - Validates neomutt dependencies (less, bat, kitty, w3m) are enabled +# Assertions - Validates neomutt dependencies (less, bat, kitty, chawan) are enabled { config, ... }: { assertions = [ @@ -24,10 +24,10 @@ ''; } { - assertion = !config.communication.neomutt.enable || config.web.w3m.enable; + assertion = !config.communication.neomutt.enable || config.web.chawan.enable; message = '' - communication.neomutt is enabled but web.w3m.enable is not. - neomutt uses w3m for HTML email rendering. Please enable web.w3m. + communication.neomutt is enabled but web.chawan.enable is not. + neomutt uses chawan for HTML email rendering. Please enable web.chawan. ''; } ]; diff --git a/modules/communication/neomutt/macros.nix b/modules/communication/neomutt/macros.nix index bc18e43..d8b6f55 100644 --- a/modules/communication/neomutt/macros.nix +++ b/modules/communication/neomutt/macros.nix @@ -11,7 +11,7 @@ action = "<enter-command>set my_wait_key=$wait_key wait_key=no<enter><sync-mailbox><shell-escape>${lib.getExe config.scripts.neomutt-sync.package}<enter><sync-mailbox><enter-command>set wait_key=$my_wait_key<enter>"; } { - # gx: open the message body in interactive w3m -- real vim-style + # gx: open the message body in interactive chawan -- real vim-style # cursor navigation (hjkl, Tab/Shift-Tab between links, Enter to # follow, B back, q to return to neomutt). Replaces the old # urlscan-based link picker. @@ -23,19 +23,19 @@ action = "<pipe-message>urlscan<enter>"; } { - # Ctrl-B in the pager: same interactive w3m view as gx, kept as + # Ctrl-B in the pager: same interactive chawan view as gx, kept as # a second binding since Ctrl-B is a common muscle-memory key # for "open this in a browser-like view". map = [ "pager" ]; key = "\\Cb"; - action = "<enter-command>set my_pipe_decode=$pipe_decode pipe_decode=yes<enter><pipe-message>${lib.getExe' config.web.w3m.package "w3m"} -T text/html<enter><enter-command>set pipe_decode=$my_pipe_decode<enter>"; + action = "<enter-command>set my_pipe_decode=$pipe_decode pipe_decode=yes<enter><pipe-message>${lib.getExe config.web.chawan.package} -T text/html<enter><enter-command>set pipe_decode=$my_pipe_decode<enter>"; } { # Ctrl-B on a specific attachment (not just the top-level # message): pipe-entry sends the selected attachment instead. map = [ "attach" ]; key = "\\Cb"; - action = "<pipe-entry>${lib.getExe' config.web.w3m.package "w3m"} -cols 100 -T text/html<enter>"; + action = "<pipe-entry>${lib.getExe config.web.chawan.package} -cols 100 -T text/html<enter>"; } { # gF: clear the current limit/filter and show every message again, diff --git a/modules/communication/neomutt/neomutt.nix b/modules/communication/neomutt/neomutt.nix index 792f90e..623c3dd 100644 --- a/modules/communication/neomutt/neomutt.nix +++ b/modules/communication/neomutt/neomutt.nix @@ -18,7 +18,7 @@ "x-scheme-handler/mailto" = "neomutt.desktop"; }; xdg.configFile."neomutt/mailcap".text = '' - text/html; ${lib.getExe' config.web.w3m.package "w3m"} -dump -cols 100 -T text/html '%s'; copiousoutput; nametemplate=%s.html + text/html; ${lib.getExe config.web.chawan.package} '%s'; nametemplate=%s.html image/*; xdg-open '%s' & application/pdf; xdg-open '%s'; nametemplate=%s.pdf video/*; xdg-open '%s' & diff --git a/modules/desktop/waybar/lib.nix b/modules/desktop/waybar/lib.nix index 4e59cd3..c4ccf06 100644 --- a/modules/desktop/waybar/lib.nix +++ b/modules/desktop/waybar/lib.nix @@ -15,7 +15,7 @@ let "Opencode" = mkIcon "#98C379" ""; "EnteAuth" = mkIcon "#E5C07B" ""; "Yazi" = mkIcon "#56B6C2" ""; - "W3M" = mkIcon "#8BE9FD" ""; + "Chawan" = mkIcon "#8BE9FD" ""; "bluetui" = mkIcon "#BD93F9" ""; "impala" = mkIcon "#50FA7B" ""; "neomutt" = mkIcon "#FFB86C" ""; diff --git a/modules/desktop/waybar/module/window.nix b/modules/desktop/waybar/module/window.nix index a6ea1e9..27229c1 100644 --- a/modules/desktop/waybar/module/window.nix +++ b/modules/desktop/waybar/module/window.nix @@ -15,7 +15,6 @@ "Ente Auth" = "${icons."EnteAuth"} Ente Auth"; "Yazi:(.*)" = "${icons."Yazi"} $1"; "Swayimg:(.*)" = "${icons."Swayimg"} $1"; - "(.*)w3m(.*)" = "${icons."W3M"} $1$2"; "bluetui" = "${icons."bluetui"} bluetui"; "impala" = "${icons."impala"} impala"; "neomutt" = "${icons."neomutt"} NeoMutt"; diff --git a/modules/desktop/waybar/module/workspaces.nix b/modules/desktop/waybar/module/workspaces.nix index 8a3be38..a47ee5e 100644 --- a/modules/desktop/waybar/module/workspaces.nix +++ b/modules/desktop/waybar/module/workspaces.nix @@ -36,7 +36,6 @@ "title<OC \\| (.*)>" = lib.mkIf config.development.opencode.enable icons."Opencode"; "title<Swayimg:(.*)>" = lib.mkIf config.media.swayimg.enable icons."Swayimg"; "title<Yazi:(.*)>" = lib.mkIf config.file-management.yazi.enable icons."Yazi"; - "title<(.*)w3m(.*)>" = lib.mkIf config.web.w3m.enable icons."W3M"; "title<bluetui>" = lib.mkIf config.networking.bluetui.enable icons."bluetui"; "title<impala>" = lib.mkIf config.networking.impala.enable icons."impala"; "title<neomutt>" = lib.mkIf config.communication.neomutt.enable icons."neomutt"; diff --git a/modules/scripts/aria2-run/assertions.nix b/modules/scripts/aria2-run/assertions.nix deleted file mode 100644 index 8d1e1cd..0000000 --- a/modules/scripts/aria2-run/assertions.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ config, ... }: -[ - { - assertion = !config.scripts.aria2-run.enable || config.web.aria2.enable; - message = "scripts.aria2-run is enabled but requires `web.aria2.enable`."; - } -] diff --git a/modules/scripts/aria2-run/default.nix b/modules/scripts/aria2-run/default.nix deleted file mode 100644 index 0cdc456..0000000 --- a/modules/scripts/aria2-run/default.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -let - inherit ((import ../lib.nix { inherit lib pkgs; })) mkScriptModule; - base = mkScriptModule { - name = "aria2-run"; - path = ./script.sh; - description = "Start aria2 RPC daemon"; - deps = [ config.web.aria2.package ]; - desktop = { - enable = true; - displayName = "Aria2 Download Manager"; - }; - inherit config; - }; -in -{ - options = base.options; - config = base.moduleConfig // { - assertions = base.moduleConfig.assertions ++ (import ./assertions.nix { inherit config lib; }); - }; -} diff --git a/modules/scripts/aria2-run/script.sh b/modules/scripts/aria2-run/script.sh deleted file mode 100644 index 167fc5d..0000000 --- a/modules/scripts/aria2-run/script.sh +++ /dev/null @@ -1 +0,0 @@ -aria2c --enable-rpc --rpc-listen-all=false --rpc-listen-port=6800 diff --git a/modules/scripts/default.nix b/modules/scripts/default.nix index 1de4b61..684ca42 100644 --- a/modules/scripts/default.nix +++ b/modules/scripts/default.nix @@ -1,12 +1,10 @@ { config, lib, - pkgs, ... }: { imports = [ - ./aria2-run ./deep-clean ./neomutt-sync ./screen-recording 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 - ]; - }; -} |
