Hund

My Rofi plugin for wtwitch

February 5, 2021

I recently wrote about wtwitch (a CLI-client for Twitch) and while it’s a really good client, I was missing the ability to launch the streams via Rofi like I used to be able to do in the past with Twitchy.

That’s why I adapted my current Rofi script for wtwitch instead of Twitchy:

And here’s the script itself:

#!/bin/bash

handle_selection() {
    if [[ $1 ]]; then
        name=$(echo $1 | awk {'print $1'} | sed 's/\://')
    	notify-send "wtwitch" "Launching the livestream with $name"
        streamlink https://twitch.tv/$name --title "{author}: {title} ({category})"
    else
        exit 1
    fi
}

handle_selection "$( wtwitch check | sed -n '/Live/,/Settings/p' | sed '/Live channels/d;/Settings/d' | sed 's/\x1B\[[0-9;]\{1,\}[A-Za-z]//g;s/   //;' | rofi -font "xos4terminus 12" -bw 3 -dmenu -i -p 'wtwitch' )"

The only thing it’s missing is the current online time of the channels, but that’s a limitation of wtwitch and not my script.

And I know, I haven’t made a post about Rofi itself yet. I’ve been using it for years now, perhaps it’s time for it soon.

Meta

No Comments

Use the e-mail form, if you wish to leave feedback for this post. Markdown is supported. [Terms of service]