dotfiles

regexghost dotfiles and scripts
git clone https://git.regexghost.com/dotfiles.git
Log | Files | Refs | README

commit 024290fbb07355b4bc1c73cb8047ab81ed9427af
parent a2f9c128bb5783b1db7e73401757b36e816eabf3
Author: regexghost <dev@regexghost.com>
Date:   Wed, 17 Jun 2026 20:10:10 +0100

added stream checkers to panel

Diffstat:
Mjwm/.config/jwm/jwmrc | 3++-
Mpanel-scripts/lemonbar-bar.sh | 27+++++++++++++++++++++++++--
Mpanel-scripts/lemonbar-runner.sh | 2+-
Mterminal-scripts/stream-check.sh | 35+++++++++++++++++++++++++++++------
4 files changed, 57 insertions(+), 10 deletions(-)

diff --git a/jwm/.config/jwm/jwmrc b/jwm/.config/jwm/jwmrc @@ -50,7 +50,7 @@ </Group> <!-- Tray at the bottom. --> - <Tray x="0" y="0" autohide="off" delay="1000" height="26" width="614"> + <Tray x="0" y="0" autohide="off" delay="1000" height="26" width="550"> <TrayButton label="JWM">root:1</TrayButton> <Spacer width="2"/> @@ -177,6 +177,7 @@ <Key mask="4" key="q">exec:~/.local/share/regexghost/wm-scripts/bookmarks.sh</Key> <Key mask="4" key="f">exec:~/.local/share/regexghost/wm-scripts/dmenu-programs.sh</Key> <Key mask="4" key="s">exec:st -t Soundboard -e soundboard</Key> + <Key mask="4S" key="c">exec:dunstctl close-all</Key> <!-- Mouse bindings --> <!-- <Mouse context="root" button="4">ldesktop</Mouse> --> diff --git a/panel-scripts/lemonbar-bar.sh b/panel-scripts/lemonbar-bar.sh @@ -19,6 +19,9 @@ music_playing_colour="%{F#${GREEN}}" music_paused_colour="%{F#${YELLOW}}" wifi_up_colour="%{F#${GREEN}}" wifi_down_colour="%{F#${RED}}" +stream_live_colour="%{F#${GREEN}}" +stream_not_live_colour="%{F#${YELLOW}}" +stream_error_colour="%{F#${RED}}" update_time () { current_time="$(date +"%a %d %b - %H:%M")" @@ -78,6 +81,24 @@ update_weather () { weather="0${weather_today} 1${weather_tomorrow} 2${weather_2_days}" } +# This is done by index so I can change the streams checked by just altering the order in the config file +stream_live () { + streamer_name="$(sed -n "${1}p" "$XDG_CONFIG_HOME/regexghost/streams.csv" | cut -d "," -f 1)" + first_char="$(echo "$streamer_name" | head -c 1)" + live="$(stream-check -yn "$streamer_name")" + if [ "$live" = "y" ]; then + echo "${first_char} ${stream_live_colour} ${COLOUR_RESET}" + elif [ "$live" = "n" ]; then + echo "${first_char} ${stream_not_live_colour} ${COLOUR_RESET}" + else + echo "${first_char} ${stream_error_colour} ${COLOUR_RESET}" + fi +} + +update_streams () { + stream="$(stream_live 1) $(stream_live 2)" +} + update_music () { state="$(mocp -M "$XDG_CONFIG_HOME/moc" -i)" song="$(echo "$state" | grep -e "SongTitle" -e "Artist" | tac | paste -sd "-" | sed 's/-Artist: / - /g' | sed 's/^SongTitle: //g; s/"//g' | head -c 16 | sed 's/ $//g')" @@ -117,9 +138,9 @@ update_music () { # # # - +# display () { - echo "%{r} ${music} | ${sunset} | ${sunrise} | ${weather}| ${vol} | ${network_down} | ${wifi} | ${cpu} | ${uptime} | ${cpu_temp} | ${memory} | ${current_time} " + echo "%{r} ${music} | ${stream}| ${sunset} | ${sunrise} | ${weather}| ${vol} | ${network_down} | ${wifi} | ${cpu} | ${uptime} | ${cpu_temp} | ${memory} | ${current_time} " } update_vol @@ -128,6 +149,7 @@ update_time update_sunrise update_sunset update_weather +update_streams update_music i=1 @@ -148,6 +170,7 @@ while true; do [ $((i%3)) -eq 0 ] && update_music [ $((i % 180)) -eq 0 ] && update_sunset [ $((i % 300)) -eq 0 ] && update_sunrise + [ $((i % 600)) -eq 0 ] && update_streams [ $((i % 360)) -eq 0 ] && update_weather i=$((i+1)) [ $i -gt 900 ] && i=0 diff --git a/panel-scripts/lemonbar-runner.sh b/panel-scripts/lemonbar-runner.sh @@ -2,4 +2,4 @@ . "$XDG_CONFIG_HOME"/regexghost/current-theme.sh -"$XDG_DATA_HOME/regexghost/panel/lemonbar-bar.sh" | lemonbar -o +0 -f "${FONT_FAMILY} Medium:size=10" -o -2 -f "Font Awesome 7 Free Solid:size=10" -g 1310x26+610+0 -B "#${BACKGROUND_BLACK}" -F "#${FOREGROUND_WHITE}" +"$XDG_DATA_HOME/regexghost/panel/lemonbar-bar.sh" | lemonbar -o +0 -f "${FONT_FAMILY} Medium:size=10" -o -2 -f "Font Awesome 7 Free Solid:size=10" -g 1374x26+546+0 -B "#${BACKGROUND_BLACK}" -F "#${FOREGROUND_WHITE}" diff --git a/terminal-scripts/stream-check.sh b/terminal-scripts/stream-check.sh @@ -2,6 +2,9 @@ CONFIG_FILE="$XDG_CONFIG_HOME/regexghost/streams.csv" +format="pretty" +[ "$1" = "-yn" ] && format="yn" && shift + line="$(grep "^${1}," "$CONFIG_FILE")" [ "$line" = "" ] && exit @@ -11,20 +14,40 @@ youtube_at="$(echo "$line" | cut -d "," -f 3)" kick_at="$(echo "$line" | cut -d "," -f 4)" if ! [ "$twitch_at" = "NONE" ]; then - curl -s "https://www.twitch.tv/${twitch_at}" > /tmp/live_twitch.html + curl --connect-timeout 5 -s "https://www.twitch.tv/${twitch_at}" > /tmp/live_twitch.html if grep -q "live_user" /tmp/live_twitch.html; then - echo "${name} is live on Twitch: https://www.twitch.tv/${twitch_at}" + if [ "$format" = "pretty" ]; then + echo "${name} is live on Twitch: https://www.twitch.tv/${twitch_at}" + elif [ "$format" = "yn" ]; then + echo "y" + exit + fi fi fi if ! [ "$youtube_at" = "NONE" ]; then - curl -s "https://www.youtube.com/${youtube_at}/live" > /tmp/live_youtube.html + curl --connect-timeout 5 -s "https://www.youtube.com/${youtube_at}/live" > /tmp/live_youtube.html if grep -q "isLive\":true" /tmp/live_youtube.html; then - echo "${name} is live on YouTube: https://www.youtube.com/${youtube_at}/live" + if [ "$format" = "pretty" ]; then + echo "${name} is live on YouTube: https://www.youtube.com/${youtube_at}/live" + elif [ "$format" = "yn" ]; then + echo "y" + exit + fi fi fi if ! [ "$kick_at" = "NONE" ]; then - wget -q --user-agent "NetSurf" "https://kick.com/api/v1/channels/${kick_at}" -O /tmp/live_kick.html + wget --timeout=5 -q --user-agent "NetSurf" "https://kick.com/api/v1/channels/${kick_at}" -O /tmp/live_kick.html if grep -q "is_live\":true" /tmp/live_kick.html; then - echo "${name} is live on Kick: https://www.kick.com/${kick_at}" + if [ "$format" = "pretty" ]; then + echo "${name} is live on Kick: https://www.kick.com/${kick_at}" + elif [ "$format" = "yn" ]; then + echo "y" + exit + fi fi fi + +if [ "$format" = "yn" ]; then + echo "n" + exit +fi