sfeed_curses

[fork] sfeed (atom feed) reader
git clone https://hhvn.uk/sfeed_curses
git clone git://hhvn.uk/sfeed_curses
Log | Files | Refs | README | LICENSE

README (6582B)


      1 sfeed_curses
      2 ------------
      3 
      4 sfeed_curses is a curses UI front-end for sfeed.
      5 
      6 It shows the TAB-separated feed items in a graphical command-line UI. The
      7 interface has a look inspired by the mutt mail client. It has a sidebar panel
      8 for the feeds, a panel with a listing of the items and a small statusbar for
      9 the selected item/url. Some functions like searching and scrolling are
     10 integrated in the interface itself.
     11 
     12 
     13 Build and install
     14 -----------------
     15 
     16 $ make
     17 # make install
     18 
     19 
     20 Usage
     21 -----
     22 
     23 Like the format programs included in sfeed you can run it like this:
     24 
     25 	sfeed_curses ~/.sfeed/feeds/*
     26 
     27 ... or by reading from stdin:
     28 
     29 	sfeed_curses < ~/.sfeed/feeds/xkcd
     30 
     31 By default sfeed_curses marks the items of the last day as new/bold. To manage
     32 read/unread items in a different way a plain-text file with a list of the read
     33 urls can be used. To enable this behaviour the path to this file can be
     34 specified by setting the environment variable $SFEED_URL_FILE to the url file:
     35 
     36 	SFEED_URL_FILE=~/.sfeed/urls sfeed_curses ~/.sfeed/feeds/*
     37 
     38 There is an shellscript "sfeed_markread" to process the read and unread items.
     39 See the man page for more detailed information.
     40 
     41 
     42 Dependencies
     43 ------------
     44 
     45 - C compiler (C99).
     46 - libc (recommended: C99 and POSIX >= 200809).
     47 - curses (typically ncurses), optional but recommended: but see minicurses.h.
     48 
     49 
     50 Optional dependencies
     51 ---------------------
     52 
     53 - POSIX make(1) for Makefile.
     54 - mandoc for documentation: https://mdocml.bsd.lv/
     55 
     56 
     57 Run-time dependencies
     58 ---------------------
     59 
     60 - A (POSIX) shell.
     61 - A terminal (emulator) supporting UTF-8 and the used capabilities.
     62 
     63 
     64 Optional run-time dependencies
     65 ------------------------------
     66 
     67 - xclip for yanking the url or enclosure. See $SFEED_YANKER to change it.
     68 - xdg-open, used as a plumber by default. See $SFEED_PLUMBER to change it.
     69 - awk, used by the sfeed_content and sfeed_markread script.
     70   See the ENVIRONMENT VARIABLES section in the man page to change it.
     71 - lynx, used by the sfeed_content script to convert HTML content.
     72   See the ENVIRONMENT VARIABLES section in the man page to change it.
     73 
     74 
     75 OS tested
     76 ---------
     77 
     78 - Linux (compilers: clang, gcc, tcc, libc: glibc, musl).
     79 - OpenBSD (clang, gcc).
     80 - NetBSD
     81 - FreeBSD
     82 - DragonFlyBSD
     83 - Illumos (OpenIndiana).
     84 - Windows (cygwin gcc + mintty).
     85 - HaikuOS
     86 
     87 
     88 Known terminal issues
     89 ---------------------
     90 
     91 Below lists some bugs or missing features in terminals that are found while
     92 testing.  Some of them might be fixed already upstream:
     93 
     94 - cygwin + mintty: the xterm mouse-encoding of the mouse position is broken for
     95   scrolling.
     96 - HaikuOS terminal: the xterm mouse-encoding of the mouse button number of the
     97   middle-button, right-button is incorrect / reversed.
     98 - putty: the full reset attribute (ESC c, typically `rs1`) does not reset the
     99   window title.
    100 
    101 
    102 Color themes
    103 ------------
    104 
    105 /* newsboat-like (blue, yellow) */
    106 #define THEME_ITEM_NORMAL()           do {                          } while(0)
    107 #define THEME_ITEM_FOCUS()            do {                          } while(0)
    108 #define THEME_ITEM_BOLD()             do { attrmode(ATTR_BOLD_ON);  } while(0)
    109 #define THEME_ITEM_SELECTED()         do { ttywrite("\x1b[93;44m"); } while(0) /* bright yellow fg, blue bg */
    110 #define THEME_SCROLLBAR_FOCUS()       do { ttywrite("\x1b[34m");    } while(0) /* blue fg */
    111 #define THEME_SCROLLBAR_NORMAL()      do { ttywrite("\x1b[34m");    } while(0)
    112 #define THEME_SCROLLBAR_TICK_FOCUS()  do { ttywrite("\x1b[44m");    } while(0) /* blue bg */
    113 #define THEME_SCROLLBAR_TICK_NORMAL() do { ttywrite("\x1b[44m");    } while(0)
    114 #define THEME_STATUSBAR()             do { attrmode(ATTR_BOLD_ON); ttywrite("\x1b[93;44m"); } while(0)
    115 #define THEME_INPUT_LABEL()           do {                          } while(0)
    116 #define THEME_INPUT_NORMAL()          do {                          } while(0)
    117 
    118 
    119 /* TempleOS-like (for fun and god) */
    120 /* set true-color foreground / background, Terry would've preferred ANSI */
    121 #define SETFGCOLOR(r,g,b)    ttywritef("\x1b[38;2;%d;%d;%dm", r, g, b)
    122 #define SETBGCOLOR(r,g,b)    ttywritef("\x1b[48;2;%d;%d;%dm", r, g, b)
    123 
    124 #define THEME_ITEM_NORMAL()           do { SETFGCOLOR(0x00, 0x00, 0xaa); SETBGCOLOR(0xff, 0xff, 0xff); } while(0)
    125 #define THEME_ITEM_FOCUS()            do { SETFGCOLOR(0x00, 0x00, 0xaa); SETBGCOLOR(0xff, 0xff, 0xff); } while(0)
    126 #define THEME_ITEM_BOLD()             do { attrmode(ATTR_BOLD_ON); SETFGCOLOR(0xaa, 0x00, 0x00); SETBGCOLOR(0xff, 0xff, 0xff); } while(0)
    127 #define THEME_ITEM_SELECTED()         do { attrmode(ATTR_REVERSE_ON); } while(0)
    128 #define THEME_SCROLLBAR_FOCUS()       do { SETFGCOLOR(0x00, 0x00, 0xaa); SETBGCOLOR(0xff, 0xff, 0xff); } while(0)
    129 #define THEME_SCROLLBAR_NORMAL()      do { SETFGCOLOR(0x00, 0x00, 0xaa); SETBGCOLOR(0xff, 0xff, 0xff); } while(0)
    130 #define THEME_SCROLLBAR_TICK_FOCUS()  do { SETBGCOLOR(0x00, 0x00, 0xaa); SETFGCOLOR(0xff, 0xff, 0xff); } while(0)
    131 #define THEME_SCROLLBAR_TICK_NORMAL() do { SETBGCOLOR(0x00, 0x00, 0xaa); SETFGCOLOR(0xff, 0xff, 0xff); } while(0)
    132 #define THEME_STATUSBAR()             do { ttywrite("\x1b[6m"); SETBGCOLOR(0x00, 0x00, 0xaa); SETFGCOLOR(0xff, 0xff, 0xff); } while(0) /* blink statusbar */
    133 #define THEME_INPUT_LABEL()           do { SETFGCOLOR(0x00, 0x00, 0xaa); SETBGCOLOR(0xff, 0xff, 0xff); } while(0)
    134 #define THEME_INPUT_NORMAL()          do { SETFGCOLOR(0x00, 0x00, 0xaa); SETBGCOLOR(0xff, 0xff, 0xff); } while(0)
    135 
    136 #undef SCROLLBAR_SYMBOL_BAR
    137 #define SCROLLBAR_SYMBOL_BAR  "\xe2\x95\x91" /* symbol: "double vertical" */
    138 
    139 
    140 Running custom commands inside the program
    141 ------------------------------------------
    142 
    143 Running commands inside the program can be useful for example to sync items or
    144 mark all items across all feeds as read. It can be comfortable to have a
    145 keybind for this inside the program to perform a scripted action and then
    146 reload the feeds by sending the signal SIGHUP.
    147 
    148 In the input handling code you can then add a case:
    149 
    150 	case 'M':
    151 		forkexec((char *[]) { "markallread.sh", NULL });
    152 		break;
    153 
    154 or
    155 
    156 	case 'S':
    157 		forkexec((char *[]) { "syncnews.sh", NULL });
    158 		break;
    159 
    160 The specified script should be in $PATH or an absolute path.
    161 
    162 Example of a `markallread.sh` shellscript to mark all urls as read:
    163 
    164 	#!/bin/sh
    165 	# mark all items/urls as read.
    166 
    167 	tmp=$(mktemp)
    168 	(cat ~/.sfeed/urls; cut -f 3 ~/.sfeed/feeds/*) | \
    169 	awk '!x[$0]++' > "$tmp" &&
    170 	mv "$tmp" ~/.sfeed/urls &&
    171 	pkill -SIGHUP sfeed_curses # reload feeds.
    172 
    173 Example of a `sync.sh` shellscript to update the feeds and reload them:
    174 
    175 	#!/bin/sh
    176 	sfeed_update && pkill -SIGHUP sfeed_curses
    177 
    178 
    179 License
    180 -------
    181 
    182 ISC, see LICENSE file.
    183 
    184 
    185 Author
    186 ------
    187 
    188 Hiltjo Posthuma <hiltjo@codemadness.org>