exaroth/i3-news
Interactive RSS/Atom news headlines plugin for i3wm and sway - compatible with i3status, i3blocks, polybar and waybar
master
ab5cf5feb936fa3b72c95d3ad0c0c67791937ba1
59c06617d5b86546c0c739e73ae01d3965dbe8ce
I3 News let's you create interactive news headline snippets compatible with various i3/sway bar plugins, based on user defined RSS/Atom feeds.
Compatibility list:
NOTE i3 news requires
fuse
/libfuse
libraries installed in the system
I3 news ships with 2 versions available:
To install this version execute:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/exaroth/i3-news/master/install.sh)"
sh -c "$(curl -fsSL https://raw.githubusercontent.com/exaroth/i3-news/master/install_full.sh)"
You can also download i3_news
executables from releases page.
Following the installation update your crontab to set up regular RSS feed reloads , eg to update feeds every 20 minutes:
crontab -e
*/20 * * * * /usr/local/bin/i3_news reload
Note: Supported zig versions - 0.14.1
/0.15.0
Clone the repository and run make build-appimage
to compile the source and build AppImage for the executable.
Usage: i3news ?<command> <options>
Commands: open|reload|zscroll|bscroll|version
Options:
-c, --configs Snippet configuration or configurations to use
-s, --i3status I3status output
-b, --i3blocks I3blocks output
-p, --polybar Polybar output
-w, --waybar Waybar output
-a, --add-config Add new i3-news configuration
-r, --rm-config Remove existing configuration
-e, --edit-config Edit urls for given configuration
--get-url Retrieve url for currently displayed headline
--plain Plain output
--random Retrieve headlines using random strategy
--latest Retrieve headlines prioritising latest articles
--debug Print debug info
-h, --help Print help
In order to create new I3 news snippet execute:
i3_news -a <snippet_name>
You will be prompted to enter list of RSS/Atom urls which will be tracked by the snippet.
Use
i3_news -e <snippet_name>
To edit snippet urls, or
i3_news -r <snippet_name>
to remove existing one.
Snippet configurations are stored at $HOME/.config/i3_news/
.
In order to add i3 news snippet to i3blocks bar edit existing configuration (typically stored at ~/.i3blocks
) adding following entry:
[News]
command=/usr/local/bin/i3_news -b -c <snippet_name>
interval=30
(interval
value will determine how often headlines will be refreshed)
Additionally in order to customize browser command to use when opening headline url you can use I3_NEWS_BROWSER_CMD
env variable, for example to open url in new firefox tab use:
command=I3_NEWS_BROWSER_CMD="/usr/bin/firefox --new-tab" /usr/local/bin/i3_news -b -c <snippet_name>
NOTE i3status plugin is non-interactive, thus clicking on headline wont result in opening of the url in the browser
Edit i3
configuration (typically stored at ~/.config/i3/config
) and locate bar { ... }
block containing
status_command i3status
entry, replace it with:
status_command i3status | /usr/local/bin/i3_news -s -c <snippet_name>
You can also output more than 1 snippet by passing comma delimited list of snippet names as part of -c
parameter.
Edit polybar configuration file (usually stored at ~/.config/polybar/config.ini
), add following entry:
[module/i3-news]
type = custom/script
exec = /usr/local/bin/i3_news -p -c <snippet_name>
tail = true
interval = 10
click-left = /usr/local/bin/i3_news open -c <snippet_name>
then update either modules-left
or modules-right
entry with i3-news
.
Similarly to i3blocks
integration you can customize browser used for opening headline urls by adding I3_NEWS_BROWSER_CMD
env when executing click-left
handler.
Edit waybar configuraton (typically stored at ~/.config/waybar/config
), add following entry
"custom/i3-news": {
"exec": "/usr/local/bin/i3_news -w -c <snippet_name>",
"return-type": "json",
"interval": 10,
"tooltip": false,
"on-click": "/usr/local/bin/i3_news open -c <snippet_name>"
}
and update modules-right
, modules-left
or modules-center
with custom/i3-news
entry.
You can customize color rendering by editing ~/.config/waybar/style.css
and adding
#custom-i3-news.<snippet_name> {
color: white;
}
i3-news
ships with zscroll script which allows for easy incorporation of scrolling text headlines, this feature is only compatible with polybar
and waybar
plugins. In order to output headline snippet run:
i3_news zscroll -c <snippet_name>
Parameters of the scrolling snippets can be configured via environment variables:
ZSCROLL_INTERVAL
- how often to refresh news headlinesZSCROLL_DELAY
- Controls scroll speedZSCROLL_WIDTH
- Width of the snippetScrolling plugins work best with monotype fonts.
Reference configuration, note there's no need to include interval
field for scrolling snippets.
[module/i3-news-scroll]
type = custom/script
exec = ZSCROLL_DELAY=0.3 /usr/local/bin/i3_news zscroll -c <snippet_name>
click-left = /usr/local/bin/i3_news open -c <snippet_name>
tail = true
label = %output:0:40:...%
"custom/i3-news-scroll": {
"escape": "true",
"exec": "ZSCROLL_WIDTH=50 /usr/local/bin/i3_news zscroll -c <snippet_name>",
"max-length": 50,
"min-length": 50,
"on-click": "/usr/local/bin/i3_news open -c <snippet_name>"
}
I3 news comes supplied with dedicated command bscroll
to handle scrolling headlines for i3bar, to use it execute:
i3_news bscroll -c <snippet_name>
Command defaults can be overriden using following env vars:
BSCROLL_INTERVAL
- Refresh rate for the headlinesBSCROLL_DELAY
- Scroll speedBSCROLL_WIDTH
- Width of the snippetExample usage in i3blocks config (markup=pango
and interval=persist
settings are required)
[News]
command=BSCROLL_INTERVAL=20 /usr/local/bin/i3_news bscroll -c <snippet_name>
markup=pango
color=#FEC925
interval=persist
Configuration for each snippet is stored at ~/.config/i3_news/<snippet_name>/config
with following options available:
max-article-age
- amount of hours in the past for which to display headlines foroutput-color
- text color for given snippet (hex based)refresh-interval
- (i3status only) refresh rate when displaying the headlinesSee LICENSE
file for details