summaryrefslogtreecommitdiff
path: root/README.curses
blob: f5e61ddeb78167ce5d979209f4a4a98d3be2db88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
sfeed_curses
------------

sfeed_curses is a curses UI front-end for sfeed.

It shows the TAB-separated feed items in a graphical command-line UI. The
interface has a look inspired by the mutt mail client. It has a sidebar panel
for the feeds, a panel with a listing of the items and a small statusbar for
the selected item/URL. Some functions like searching and scrolling are
integrated in the interface itself.


Build and install
-----------------

$ make
# make install


Usage
-----

Like the format programs included in sfeed you can run it like this:

	sfeed_curses ~/.sfeed/feeds/*

... or by reading from stdin:

	sfeed_curses < ~/.sfeed/feeds/xkcd

By default sfeed_curses marks the items of the last day as new/bold. To manage
read/unread items in a different way a plain-text file with a list of the read
URLs can be used. To enable this behaviour the path to this file can be
specified by setting the environment variable $SFEED_URL_FILE to the URL file:

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

There is a shellscript "sfeed_markread" to process the read and unread items.
See the man page for more detailed information.


Dependencies
------------

- C compiler (C99).
- libc (recommended: C99 and POSIX >= 200809).
- curses (typically ncurses), optional but recommended: but see minicurses.h.


Optional dependencies
---------------------

- POSIX make(1) for Makefile.
- mandoc for documentation: https://mdocml.bsd.lv/


Run-time dependencies
---------------------

- A (POSIX) shell.
- A terminal (emulator) supporting UTF-8 and the used capabilities.


Optional run-time dependencies
------------------------------

- xclip for yanking the URL or enclosure. See $SFEED_YANKER to change it.
- xdg-open, used as a plumber by default. See $SFEED_PLUMBER to change it.
- awk, used by the sfeed_content and sfeed_markread script.
  See the ENVIRONMENT VARIABLES section in the man page to change it.
- lynx, used by the sfeed_content script to convert HTML content.
  See the ENVIRONMENT VARIABLES section in the man page to change it.


OS tested
---------

- Linux (compilers: clang, gcc, tcc, libc: glibc, musl).
- OpenBSD (clang, gcc).
- NetBSD
- FreeBSD
- DragonFlyBSD
- Illumos (OpenIndiana).
- Windows (cygwin gcc + mintty).
- HaikuOS


Known terminal issues
---------------------

Below lists some bugs or missing features in terminals that are found while
testing.  Some of them might be fixed already upstream:

- cygwin + mintty: the xterm mouse-encoding of the mouse position is broken for
  scrolling.
- HaikuOS terminal: the xterm mouse-encoding of the mouse button number of the
  middle-button, right-button is incorrect / reversed.
- putty: the full reset attribute (ESC c, typically `rs1`) does not reset the
  window title.


Color themes
------------

To change the default theme you can set SFEED_THEME using make or in the
Makefile or include the a header file in sfeed_curses.c. See also the themes/
directory.


Running custom commands inside the program
------------------------------------------

Running commands inside the program can be useful for example to sync items or
mark all items across all feeds as read. It can be comfortable to have a
keybind for this inside the program to perform a scripted action and then
reload the feeds by sending the signal SIGHUP.

In the input handling code you can then add a case:

	case 'M':
		forkexec((char *[]) { "markallread.sh", NULL }, 0);
		break;

or

	case 'S':
		forkexec((char *[]) { "syncnews.sh", NULL }, 1);
		break;

The specified script should be in $PATH or an absolute path.

Example of a `markallread.sh` shellscript to mark all URLs as read:

	#!/bin/sh
	# mark all items/URLs as read.

	tmp=$(mktemp)
	(cat ~/.sfeed/urls; cut -f 3 ~/.sfeed/feeds/*) | \
	awk '!x[$0]++' > "$tmp" &&
	mv "$tmp" ~/.sfeed/urls &&
	pkill -SIGHUP sfeed_curses # reload feeds.

Example of a `syncnews.sh` shellscript to update the feeds and reload them:

	#!/bin/sh
	sfeed_update && pkill -SIGHUP sfeed_curses


Open an URL directly in the same terminal
-----------------------------------------

To open an URL directly in the same terminal using the text-mode lynx browser:

	SFEED_PLUMBER=lynx SFEED_PLUMBER_INTERACTIVE=1 sfeed_curses ~/.sfeed/feeds/*


Yank to tmux buffer
-------------------

This changes the yank command to set the tmux buffer, instead of X11 xclip:

	SFEED_YANKER="tmux set-buffer \`cat\`"


License
-------

ISC, see LICENSE file.


Author
------

Hiltjo Posthuma <hiltjo@codemadness.org>