diff --git a/config/newsboat/config b/config/newsboat/config new file mode 100644 index 00000000..37fa0053 --- /dev/null +++ b/config/newsboat/config @@ -0,0 +1 @@ +macro i set pager "./kitty-img-pager.sh"; open; set pager internal diff --git a/config/newsboat/kitty-img-pager.sh b/config/newsboat/kitty-img-pager.sh new file mode 100755 index 00000000..a4b30713 --- /dev/null +++ b/config/newsboat/kitty-img-pager.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +# Shows images, scaled to terminal dimensions, via kitty's icat. +# Designed for image-feeds like xkcd.com. +# by Timm Heuss (https://github.com/heussd/) - CC-BY 4.0 +# +# Usage: +# 1) Define a new macro in your config: +# macro i set pager "$PATHTOTHIS/kitty-img-pager"; open; set pager internal +# 2) Now you use this pager in articleview using the hotkey + + +set -o errexit +set -o pipefail +set -o nounset + + +image=$(grep -E -o "https?://[a-zA-Z0-9./?=_%:-]*" < "${1}" | tail -1) + +# Detect terminal dimensions +dims="$(tput cols)x$(tput lines)@0x0" + +clear +kitty +kitten icat --clear +kitty +kitten icat --hold --scale-up --place "$dims" "$image" +clear diff --git a/config/newsboat/urls b/config/newsboat/urls new file mode 100644 index 00000000..0c075ead --- /dev/null +++ b/config/newsboat/urls @@ -0,0 +1 @@ +https://xkcd.com/rss.xml diff --git a/modules/shell/newsboat/default.nix b/modules/shell/newsboat/default.nix index 2f4c6b0c..27c5cd22 100644 --- a/modules/shell/newsboat/default.nix +++ b/modules/shell/newsboat/default.nix @@ -12,5 +12,13 @@ in users.users.sako.packages = with pkgs; [ newsboat ]; + home-manager.users.sako = { pkgs, ...}: { + xdg.configFile = { + newsboat = { + source = ../../../config/newsboat; + recursive = true; + }; + }; + }; }; }