SFEED_CURSES(1)

NAME
sfeed_curses - curses UI for viewing feed data

SYNOPSIS
sfeed_curses [file ...]

DESCRIPTION
sfeed_curses formats feed data (TSV) from sfeed(1) from stdin or for each file into a curses UI. If one or more file arguments are specified then the basename of the file is used as the feed name in the output such as the feeds sidebar. The file arguments are processed and shown in the specified argument order in the feeds sidebar. If no file arguments are specified then the data is read from stdin and the feed name is "stdin" and no sidebar is visible by default in this case.

Items with a timestamp from the last day compared to the system time at the time of loading the feed are marked as new and bold. This value might be overridden through environment variables. There is also an alternative mode available to mark items as read by matching it against a list of URLs from a plain-text file. Items with an enclosure are marked with a @ symbol.

sfeed_curses aligns the output. Make sure the environment variable LC_CTYPE is set to a UTF-8 locale, so it can determine the proper column-width per rune, using mbtowc(3) and wcwidth(3).

KEYBINDS

k, ARROW UP
    Go one row up.

j, ARROW DOWN
    Go one row down.

K   Go to the previous bold row.

J   Go to the next bold row.

h, ARROW LEFT
    Focus feeds pane.

l, ARROW RIGHT
    Focus items pane.

TAB Cycle focused pane (between feeds and items).

g   Go to the first row.

G   Go to the last row.

PAGE UP, CTRL-B
    Scroll one page up.

PAGE DOWN, CTRL-F, SPACE
    Scroll one page down.

/   Prompt for a new search and search forward (case-insensitive).

?   Prompt for a new search and search backward (case-insensitive).

n   Search forward with the previously set search term.

N   Search backward with the previously set search term.

[   Go to the previous feed in the feeds pane and open it.

]   Go to the next feed in the feeds pane and open it.

CTRL-L
    Redraw screen.

R   Reload all feed files which were specified as arguments on startup. If SFEED_URL_FILE is set, it will reload the URLs from this file also.

m   Toggle mouse-mode. It supports xterm X10 and extended SGR encoding.

s   Toggle between monocle layout and the previous non-monocle layout.

<   Use a fixed sidebar size for the current layout and decrease the fixed width or height by 1 column.

>   Use a fixed sidebar size for the current layout and increase the fixed width or height by 1 column.

=   Reset the sidebar size to automatically adjust for the current layout. With the vertical layout the width is the longest feed name with the item counts right-aligned. With the horizontal layout the height is half of the window height (minus the status bar) or otherwise the total amount of visible feeds, whichever fits the best.

t   Toggle showing only feeds with new items in the sidebar.

a, e, @
    Plumb URL of the enclosure. The URL is passed as a parameter to the program specified in SFEED_PLUMBER.

o, ENTER, RETURN
    Feeds pane: load feed and its items. In the monocle layout it will also switch to the items pane after loading the feed items. Items pane: plumb current item URL, the URL is passed as a parameter to the program specified in SFEED_PLUMBER.

c, p, |
    Pipe the whole TAB-Separated Value line to a program. This program can be specified with SFEED_PIPER.

y   Pipe the TAB-Separated Value field for yanking the URL to a program. This program can be specified with SFEED_YANKER.

E   Pipe the TAB-Separated Value field for yanking the enclosure to a program. This program can be specified with SFEED_YANKER.

r   Mark item as read. This will only work when SFEED_URL_FILE is set.

u   Mark item as unread. This will only work when SFEED_URL_FILE is set.

f   Mark all items of the currently loaded feed as read. This will only work when SFEED_URL_FILE is set.

F   Mark all items of the currently loaded feed as unread. This will only work when SFEED_URL_FILE is set.

1   Set the current layout to a vertical mode. Showing a feeds sidebar to the left and the feed items to the right.

2   Set the current layout to a horizontal mode. Showing a feeds sidebar on the top and the feed items on the bottom.

3   Set the current layout to a monocle mode. Showing either a feeds or a feed items pane.

q, EOF
    Quit

MOUSE ACTIONS
When mouse-mode is enabled the below actions are available.

LEFT-CLICK
    Feeds pane: select and load the feed and its items. In the monocle layout it will also switch to the items pane after loading the feed items. Items pane: select item, when already selected then plumb it.

RIGHT-CLICK
    Feeds pane: select feed, but do not load it. Items pane: pipe the item.

SCROLL UP
    Scroll one page up.

SCROLL DOWN
    Scroll one page down.

FORWARD
    Switch to the items pane.

BACKWARD
    Switch to the feeds pane.

SIGNALS

SIGHUP
    Reload all feed files which were specified as arguments on startup. If SFEED_URL_FILE is set, it will reload the URLs from this file also. Cancels the line editor and handles the signal if received during a search.

SIGINT
    Interrupt: quit. When searching, it only cancels the line editor and doesn't quit.

SIGTERM
    Quit

SIGWINCH
    Resize the pane dimensions relative to the terminal size. When searching, it handles the signal after closing the line editor.

Signals are handled in the following order: SIGCHLD, SIGTERM, SIGINT, SIGHUP, SIGWINCH.

ENVIRONMENT VARIABLES

SFEED_AUTOCMD
    Read and process a sequence of keys as input commands from this environment variable first, afterwards it reads from the tty as usual. This can be useful to automate certain actions at the start.

SFEED_NEW_AGE
    Overwrite the maximum age in seconds to mark feeds as new. By default this is 86400, which equals one day.

SFEED_PIPER
    A program where the whole TAB-Separated Value line is piped to. By default this is "sfeed_content".

SFEED_PIPER_INTERACTIVE
    Handle the program interactively in the same terminal or not. By default this is set to "1".

SFEED_PLUMBER
    A program that receives the link URL or enclosure URL as a parameter. By default this is "xdg-open".

SFEED_PLUMBER_INTERACTIVE
    Handle the program interactively in the same terminal or not. This option can be useful to open a text-mode browser in the same terminal. By default this is set to "0".

SFEED_YANKER
    A program where the URL or enclosure field is piped to, to copy it to a clipboard. By default this is "xclip -r".

SFEED_YANKER_INTERACTIVE
    Handle the program interactively in the same terminal or not. By default this is set to "0".

SFEED_URL_FILE
    If this variable is set then a different mode is used to mark items as read, instead of checking the timestamp, which is the default. The value specified is a plain-text file containing a list of read URLs, one URL per line. This URL is matched on the link field if it is set, otherwise it is matched on the id field.

SFEED_MARK_READ
    A program to mark items as read if SFEED_URL_FILE is also set, if unset the default program used is "sfeed_markread read". The marked items are piped to the program line by line. If the feed item has a link then this line is the link field, otherwise it is the id field. The program is expected to merge items in a safe/transactional manner. The program should return the exit status 0 on success or non-zero on failure.

SFEED_MARK_UNREAD
    A program to mark items as unread if SFEED_URL_FILE is also set, if unset the default program used is "sfeed_markread unread". The unmarked items are piped to the program line by line. If the feed item has a link then this line is the link field, otherwise it is the id field. The program is expected to merge items in a safe/transactional manner. The program should return the exit status 0 on success or non-zero on failure.

SFEED_LAZYLOAD
    Lazyload items when reading the feed data from files. This can reduce memory usage but increases latency when seeking items, especially on slower disk drives. It can also cause a race-condition issue if the feed data on disk is changed while having the UI open and offsets for the lines are different. A workaround for the race-condition issue is by sending the SIGHUP signal to sfeed_curses after the data was updated. This makes sfeed_curses reload the latest feed data and update the correct line offsets. By default this is set to "0".

SFEED_FEED_PATH
    This variable is set by sfeed_curses when a feed is loaded. If the data was read from stdin this variable is unset. It can be used by the plumb or pipe program for scripting purposes.

INTERACTIVE AND NON-INTERACTIVE PROGRAMS
sfeed_curses can pipe content, plumb and yank interactively or in a non-interactive manner. In interactive mode sfeed_curses waits until the process exits. Stdout and stderr of the program are written as output. It stores and restores the terminal attributes before and after executing the program. The signals SIGHUP and SIGWINCH will be handled after sfeed_curses has waited on the program. SIGINT is ignored while waiting on the program.

In non-interactive mode sfeed_curses doesn't wait until the process exits. Stdout and stderr of the program are not written as output. When plumbing an URL then stdin is closed also.

EXIT STATUS
The exit status is 130 on SIGINT and 143 on SIGTERM.

EXAMPLES
Example:

    sfeed_curses ~/.sfeed/feeds/*

Another example which shows some of the features sfeed_curses has:

    export SFEED_AUTOCMD="2tgo"
    export SFEED_URL_FILE="$HOME/.sfeed/urls"
    [ -f "$SFEED_URL_FILE" ] || touch "$SFEED_URL_FILE"
    sfeed_curses ~/.sfeed/feeds/*

Which does the following:

1.  Set commands to execute automatically on startup:

    Set the current layout to a horizontal mode ('2' keybind). Showing a feeds sidebar on the top and the feed items on the bottom.

    Toggle showing only feeds with new items in the sidebar ('t' keybind).

    Go to the first row in the current panel ('g' keybind).

    Load the currently selected feed ('o' keybind).

2.  Set a file to use for managing read and unread items. This is a plain-text file containing a list of read URLs, one URL per line.

3.  Check if this file for managing the read and unread items exists. If it doesn't exist yet then create an empty file.

4.  Start sfeed_curses and read the specified feed files.

SEE ALSO
sfeed(1), sfeed_content(1), sfeed_markread(1), sfeed_plain(1), xclip(1), sfeed(5)

AUTHORS
Hiltjo Posthuma <hiltjo@codemadness.org>