How to setup Newsboat – RSS Reader in Linux

Newsboat is an RSS/ATOM Feed Reader. It is a fork of newsbeutor which is no longer maintained. It is text-based which makes it lighter and faster than most RSS readers. In this article, I will talk about its application and configuration – color scheme, keybinding, etc.

Table of Contents

Installation

Arch Linux/Manjaro:

sudo pacman -S newsboat

Snap:

sudo snap install newsboat

Ubuntu/Debian:

Sudo apt install newsboat

Fedora:

sudo dnf install newsboat

How to use Newsboat

Here, I will explain its application using the configuration given below. If you want to experience it right now just copy all of the configurations as shown below into the two files config and urls.

The overall result of these configurations:

newsboat window
Figure 1: newsboat

In the above image, the third column tells you how many feeds the user has not read yet. For example, (18/51) in the first line of figure 1 means that the user still needs to read 18 feeds.

Shortcut keys

Newsboat uses both basic and vim/neovim keybindings.

  1. To open a feed/article, use the ENTER or l key.
  2. To Return to the previous dialog/Quit use h or q. Use Q to quit the program without any confirmation.
  3. To open the feed/article in your browser such as Firefox, use the o key.
  4. Use the / key to open the search. For command lines, use :.
  5. comma and space are macro prefixes (see in the configuration section to know more about this).
  6. UP or k keys can be used to move upwards i.e. to the previous entry.
  7. Similarly, Down or j for downward movement.
  8. g or HOME for moving to the start of the page.
  9. Similarly, END or G for moving to the bottom.

You don’t have to remember these keys because Newsboat shows you the most important ones at the bottom of your window. And you can also see the rest of the keys by using the shortcut key ?.

At the same time, you can modify these keybindings as well as given below.

Configuration of Newsboat

To configure it, you need to create two files:

  1. ~/.config/newsboat/config
  2. ~/.config/newsboat/urls

The first file includes basic configurations like colors, shortcut keys, etc. The second file includes RSS URLs. Now, I will explain what goes into each file.

Newsboat config file

Basic configurations:

In the first file ~/.config/newsboat/config put the following line:

refresh-on-startup yes

This will make sure that each time you open newsboat, new feeds will be added from the internet. However, this makes you wait each time you open it. To reduce the waiting time, you can include the code given below. That will make it download 100 feeds in parallel.

reload-threads 100

Moreover, to remove the feeds, which you have read, include the following lines. This will declutter the window.

show-read-feeds no
show-read-articles no

Shortcut Keys in newsboat:

You can change the shortcut keys by using the code bind-key <your key> <command> where <command> is what you see in the second column in the result of ?. I have modified some of these keybindings based on vim-keybindings and my convenience:

bind-key h quit
bind-key j down
bind-key k up
bind-key l open
bind-key H prev-feed
bind-key L next-feed
bind-key g home
bind-key G end
bind-key SPACE macro-prefix 
bind-key b bookmark 
bind-key ^F pagedown 
bind-key ^B pageup 
bind-key ^H toggle-show-read-feeds 

Further, macro keys allow you to use shortcuts like those in spacevim and vim-which key. I use newsboat to watch videos of my favorite YouTubers with the help of my favorite video player MPV. For this use the following code:

macro 3 set browser "setsid --fork mpv --profile=360p %u > /dev/null 2>&1"; open-in-browser; set browser "xdg-open %u";
macro 7 set browser "setsid --fork mpv --profile=720p %u > /dev/null 2>&1"; open-in-browser; set browser "xdg-open %u";

Now, use the macro prefix with 3 or 7 to open your youtube videos in the MPV. So, press the space key, release the key, and then press 3 to open the youtube video in 360p. Similarly, space+7 to open in 720p.

Opening youtube videos in newsboat using the default video player
Figure 2: Opening youtube videos in newsboat using the default video player.

Here are other macro combinations I use:

macro f set browser "setsid --fork firefox %u > /dev/null 2>&1"; open-in-browser; set browser "xdg-open %u";
macro q quit

The first shortcut (space+f) opens the RSS feed/article in firefox. The second shortcut (space+q) closes the window.

color configuration in newsboat:

If you like the color you see in the above images, use the following code:

# col # item              # fg      # bg
color background          color7   default        # the most bottom bar
color listnormal          color7   default        # unfocused and without N
color listnormal_unread   color7   default        # unfocused and with N
color listfocus           color7   color8         # focused and without N
color listfocus_unread    color7   color8   bold  # focused but with N
color info                color0   color1         # bottom and top info bars
color article             color7   default        # content of an article

# highlights
highlight article "^(Feed|Link):.*$" color6 default bold
highlight article "^(Title|Date|Author):.*$" color6 default bold
highlight article "https?://[^ ]+" color10 default underline
highlight article "\\[[0-9]+\\]" color10 default bold
highlight article "\\[image\\ [0-9]+\\]" color10 default bold

However, these colors (color0...7) will depend upon your terminal’s color. The above figure is based on my URxvt color configurations. There might be some differences for you.

Alternatively, newsboat also provides color schemes. In Arch Linux, these color schemes are located in the directory /usr/share/doc/newsboat/contrib/colorschemes. For your distribution, the directory might be slightly different. Just search using your file browser. Now use one of these color schemes as shown below.

include /usr/share/doc/newsboat/contrib/colorschemes/nord

In figure 1, you are also seeing I am separating my Reddit, YouTube, and other blogs using ╠═══════════════════YouTube, etc. I found this on some Reddit page. You can do the same, using the following highlights:

feedlist-format "%?T?║%4i %n %8u %8T %t &╠═══════════════════════════════════════════════════════════════%t?"
highlight feedlist "[║│]" color3 color0
highlight feedlist "╠═.*" color3 color0 

Newsboat urls file

Using the URL file ~/.config/newsboat/urls, we tell newsboat about the RSS/ATOM sources/channels whatever you may call them. You can start with my urls file as given below. Tinker with it to get suitable results.

"query:YouTube:tags # \"YouTube\""
https://www.youtube.com/feeds/videos.xml?channel_id=UCkf4VIqu3Acnfzuk3kRIFwA "Linux" "Youtube"                              #gobletu
https://www.youtube.com/feeds/videos.xml?channel_id=UCVls1GmFKf6WlTraIb_IaJg "Linux" "YouTube"                              #distrotube
https://www.youtube.com/feeds/videos.xml?channel_id=UCZiL6BoryLWxyapUuVYW27g "Linux" "YouTube"                              #avg linux user
https://www.youtube.com/feeds/videos.xml?channel_id=UCg6gPGh8HU2U01vaFCAsvmQ "Linux" "YouTube"                              #chris titus
https://www.youtube.com/feeds/videos.xml?channel_id=UCS97tchJDq17Qms3cux8wcA "Linux" "YouTube"                              #chris at machine
https://www.youtube.com/feeds/videos.xml?channel_id=UCUuWlKrLVaR6_yTckhLG7hg "Linux" "YouTube"                              #linux leech
https://www.youtube.com/feeds/videos.xml?channel_id=UCld68syR8Wi-GY_n4CaoJGA "Linux" "YouTube"                              #Brodie
https://www.youtube.com/feeds/videos.xml?channel_id=UC7YOGHUfC1Tb6E4pudI9STA "Linux" "YouTube"                              #Mental Outlaw
https://www.youtube.com/feeds/videos.xml?channel_id=UCngn7SVujlvskHRvRKc1cTw "Linux" "YouTube"                              #Bugs Writer
https://www.youtube.com/feeds/videos.xml?channel_id=UCorzANoC3fX9VVefJHM5wtA "Linux" "YouTube"                              #Nick Janetakis
https://www.youtube.com/feeds/videos.xml?channel_id=UCmO_G49F6QTFS5CPUfuQADg "Linux" "YouTube"                              #Sparty Cup of Linux
https://www.youtube.com/feeds/videos.xml?channel_id=UCsnGwSIHyoYN0kiINAGUKxg "Linux" "YouTube"                              #Wolf Gang
https://www.youtube.com/feeds/videos.xml?channel_id=UC2eYFnH61tmytImy1mTYvhA "Linux" "YouTube"                              #Luke Smith
https://www.youtube.com/feeds/videos.xml?channel_id=UCi8XrDg1bK_MJ0goOnbpTMQ "Linux" "YouTube"                              #Budlabs
https://www.youtube.com/feeds/videos.xml?channel_id=UCJYVW4HVrMWpUvvsjPQc8-Q "Linux" "YouTube"                              #Dorian Dot Slash
https://www.youtube.com/feeds/videos.xml?channel_id=UCJetJ7nDNLlEzDLXv7KIo0w "Linux" "YouTube"                              #Gavin Freeborn
https://www.youtube.com/feeds/videos.xml?channel_id=UCJdmdUp5BrsWsYVQUylCMLg "Linux" "YouTube" "~Arco Linux"                #Arco Linux
https://www.youtube.com/feeds/videos.xml?channel_id=UCfLsPYDDrGaFc9XhfDM-ktA "Linux" "YouTube"                              #Null Byte
https://www.youtube.com/feeds/videos.xml?channel_id=UCXuqSBlHAE6Xw-yeJA0Tunw "Tech"  "Youtube"                              #Linus Tech Tips
https://www.youtube.com/feeds/videos.xml?channel_id=UCtUqetWlf7GCvbbAqhI8fnA "Comedy" "Yotube"                              #i know i am awesome
https://www.youtube.com/feeds/videos.xml?channel_id=UCOOMgoGO9PwAb65v6Zyj43w "Comedy" "Yotube"                              #Nik Tek
https://www.youtube.com/feeds/videos.xml?channel_id=UCeeFfhMcJa1kjtfZAGskOCA "Comedy" "Yotube"                              #Technlinked
https://www.youtube.com/feeds/videos.xml?channel_id=UCj22tfcQrWG7EMEKS0qLeEg "Comedy" "Yotube"                              #Carry Minati
https://www.youtube.com/feeds/videos.xml?channel_id=UC7eHZXheF8nVOfwB2PEslMw "Comedy" "Yotube"                              #Ashish Chanchalani
https://www.youtube.com/feeds/videos.xml?channel_id=UCeE3lj6pLX_gCd0Yvns517Q "Comedy" "Yotube"                              #oozy man
https://www.youtube.com/feeds/videos.xml?channel_id=UCqwUrj10mAEsqezcItqvwEw "Comedy" "Yotube"                              #BB Ki Vines

"query:Reddit:tags # \"Reddit\""
https://www.reddit.com/r/bash.rss "Reddit" "linux bash"
https://www.reddit.com/r/vim.rss "Reddit" "linux"
https://www.reddit.com/user/C4rnAg3.rss "Reddit" "~Bangladeshi Bash"

"query:Blogs:tags # \"Blog\""
https://www.archlinux.org/feeds/news/ "Blog" "linux"
https://opensource.com/taxonomy/term/6803/feed "Blog" "linux"
https://www.chrisatmachine.com/rss.xml "Blog" "linux"
https://www.howtogeek.com/feed/ "Blog" "howtogeek"
https://www.topbug.net/blog/category/unix-variants/gnu-linux/feed/ "Blog" "linux"
http://lukesmith.xyz/rss.xml "Blog" "linux"

Explanations:

  1. # is being used to comment. So anything after that is ignored.
  2. The result is what you see in figure 1.
  3. You can find the youtube channel’s RSS link using the website comment picker.
  4. Double quoted items after each RSS link is called ‘tags’. The above configuration prints the first tag in your window’s fourth column (see figure 1).
  5. I am using the query lines to categorize these RSS into YouTube, Reddit, and Blog sections.
  6. Newsboat finds the youtube channel’s name on its own. However, you can choose custom names using ~ before tags as is shown above. The same is true for non-Youtube links as well.
  7. To hide specific feeds, use ! before their tags.
  8. To know more about the syntax, look at the official documentation.

Conclusion

That’s all folks. To learn more, read the man page and documentation.

3 thoughts on “How to setup Newsboat – RSS Reader in Linux”

Leave a Comment

Your email address will not be published. Required fields are marked *