Follow

For those of you who are using newsboat as their rss feeder, the use of macros is nice but I found it bothering to have to activate a given macro every single time before you want to use it.
Hence, thanks to the power of this tool, I came up with this simple command in my config: browser ~/.config/newsboat/browser
The referenced file is a shell script that recognize the type of link I'm trying to open and will use the appropriate tool to do so.

And here is the brwoser script:
#!/usr/bin/env bash

# save the image and open it with ucollage in fullscreen
if [ ! -z $(echo $1 | grep -E '.jpg$|.jpeg$|.png$') ]; then
curl $1 --output /tmp/img_newsboat && tmux new-window\; send-keys "ucollage /tmp/img_newsboat" Enter\; send-keys Enter
# open videos or youtube with mpv
elif [ ! -z $(echo $1 | grep -E 'youtube.com|.mpg$|.mpeg$|.mp4$|.avi$|.mov$') ]; then
mpv $1
# open any other link type with librewolf
else
librewolf $1
fi

BTW, to prevent applications from printing messages and warnings over newsboat interface use this in the config file:
browser "~/.config/newsboat/browser >/dev/null 2>&1"

@wwwgem yes, but I haven't used a lot of macros lol

I have failed you :c

now write a blog about how to do that

@joel Ok. So basically by setting this "browser" script as the browser variable in newsboat config I can now hit a link number and it'll be open in the right tool whether it's an image, a video, a YouTube link, or anything else. By default you'd have to use a given macro keybinding to open a link in your image viewer, another to open in your video player, and so on.

@wwwgem I'm going to add it to my config. Thanks.

I have been using macros for images and sending links to wallabag.

@wwwgem Thank you @joel for pointing me to this thread! I find this way of handling images interesting and will try it when I re-activate newsboat!

When I was trying to view images a while ago, this was my setup. I had the screenshotted script running in a second terminal (full script in alt text) and the newsboat configuration was:

external-url-viewer "tee /tmp/newsboat-image-viewer.fifo"

This made use of the kitty terminal's image viewer, but of course that can be tweaked to other programs.

Sign in to participate in the conversation
Linux.Pizza

A instance dedicated - but not limited - to people with an interest in the GNU+Linux ecosystem and/or general tech. Sysadmins to enthusiasts, creators to movielovers - Welcome!