commit f358d07c93f0d4445c381ce815f9f6f2f33113d6
parent 1b91f341e868bc74360cecc96563b25d85d197c8
Author: regexghost <dev@regexghost.com>
Date: Fri, 29 May 2026 12:06:44 +0100
lemonbar music updates + minor newsraft tweaks
Diffstat:
8 files changed, 40 insertions(+), 8 deletions(-)
diff --git a/dotfiles/.config/newsraft/bbc-news.sh b/dotfiles/.config/newsraft/bbc-news.sh
@@ -30,6 +30,6 @@ sed 's/<span[^>]*>[^<]*<\/span>//g' |\
sed 's/<a[^>]*>/ /g' | \
sed 's/<\/a>//g' |\
sed 's/<p class="[^"]*">/PPSTART/g; s/<\/p>/PPEND/g; s/PPEND/\n/g; s/PPSTART/\n/g' |\
-xmlstarlet unesc | grep -v "$picture_desc" >> "$OUTPUT_FILE"
+xmlstarlet unesc | grep -v "$picture_desc" | fold -s >> "$OUTPUT_FILE"
${PAGER:-less} "$OUTPUT_FILE"
diff --git a/dotfiles/.config/newsraft/config b/dotfiles/.config/newsraft/config
@@ -2,3 +2,4 @@ bind g exec-quiet '~/.config/newsraft/show-image.sh "%l"'
bind f exec-quiet '~/.config/newsraft/queue-vid.sh "%l"'
bind t exec '~/.config/newsraft/article.sh "%l"'
global-section-hide true
+item-limit 20
diff --git a/dotfiles/.config/newsraft/reddit-gallery.sh b/dotfiles/.config/newsraft/reddit-gallery.sh
@@ -28,6 +28,8 @@ for link in $links; do
done
wait
+cd "$OUTPUT_FOLDER"; rename 's/[?].*//g' *
+
notify-send "Displaying"
notify-send "$IMAGE_VIEWER"
-$IMAGE_VIEWER "$OUTPUT_FOLDER"/*
+${IMAGE_VIEWER:-feh} "$OUTPUT_FOLDER"/*
diff --git a/dotfiles/.config/newsraft/show-image.sh b/dotfiles/.config/newsraft/show-image.sh
@@ -2,13 +2,13 @@
if echo "$1" | grep -q "youtube"; then
~/.config/newsraft/extract-thumbnail.sh "$1"
- feh /tmp/youtube_thumbnail.webp
+ ${IMAGE_VIEWER:-feh} /tmp/youtube_thumbnail.webp
rm -f /tmp/youtube_thumbnail.webp
rm -f /tmp/maxresdefault.webp
elif echo "$1" | grep -q "redd.it"; then
filename="$(echo "$1" | sed 's/.*\///g')"
wget -P /tmp "$1"
- $IMAGE_VIEWER "/tmp/${filename}"
+ ${IMAGE_VIEWER:-feh} "/tmp/${filename}"
rm -rf "/tmp/${filename}"
elif echo "$1" | grep -q "reddit.com/gallery"; then
~/.config/newsraft/reddit-gallery.sh "$1"
diff --git a/dotfiles/.profile b/dotfiles/.profile
@@ -25,7 +25,8 @@ export BUG_PROJECT="$XDG_DATA_HOME/regexghost/todo-bug"
export EDITOR="nano"
export VISUAL="nano"
-#export PAGER="bat --wrap auto"
+export PAGER="batcat --wrap auto --theme=base16"
export BROWSER="netsurf-gtk"
export PATH=~/.local/bin:$PATH:~/.npm/bin:~/.local/share/npm/bin:~/.local/share/go/bin:~/.local/share/cargo/bin
export TERMINAL="kitty"
+export IMAGE_VIEWER="sxiv"
diff --git a/panel-scripts/lemonbar-bar.sh b/panel-scripts/lemonbar-bar.sh
@@ -14,6 +14,8 @@ memory_colour="%{F#${YELLOW}}"
uptime_colour="%{F#${GREEN}}"
muted_colour="%{F#${RED}}"
volume_colour="%{F#${GREEN}}"
+music_stopped_colour="%{F#${YELLOW}}"
+music_playing_colour="%{F#${GREEN}}"
update_time () {
current_time="$(date +"%b, %a %d - %H:%M")"
@@ -60,7 +62,16 @@ update_weather () {
weather_today="$(~/.local/share/regexghost/panel/weather-formatter.sh --lemonbar "$(echo "$weather_days" | sed '1q;d')")"
weather_tomorrow="$(~/.local/share/regexghost/panel/weather-formatter.sh --lemonbar "$(echo "$weather_days" | sed '2q;d')")"
weather_2_days="$(~/.local/share/regexghost/panel/weather-formatter.sh --lemonbar "$(echo "$weather_days" | sed '3q;d')")"
- weather="0 ${weather_today} 1 ${weather_tomorrow} 2 ${weather_2_days}"
+ weather="0${weather_today} 1${weather_tomorrow} 2${weather_2_days}"
+}
+
+update_music () {
+ song="$(mocp -i | grep -e "SongTitle" -e "Artist" | tac | paste -sd "-" | sed 's/-Artist: / - /g' | sed 's/^SongTitle: //g' | head -c 18)"
+ if [ "$song" = "" ]; then
+ music="${music_stopped_colour} N/A${COLOUR_RESET}"
+ else
+ music="${music_playing_colour} ${song}..${COLOUR_RESET}"
+ fi
}
#
@@ -83,9 +94,12 @@ update_weather () {
#
#
#
+#
+#
+#
display () {
- echo "%{r} ${sunset} | ${sunrise} | ${weather} | ${vol} | ${network_down} | ${cpu} | ${uptime} | ${cpu_temp} | ${memory} | ${current_time} "
+ echo "%{r} ${music} | ${sunset} | ${sunrise} | ${weather}| ${vol} | ${network_down} | ${cpu} | ${uptime} | ${cpu_temp} | ${memory} | ${current_time} "
}
update_vol
@@ -93,10 +107,12 @@ update_time
update_sunrise
update_sunset
update_weather
+update_music
i=1
trap "update_vol;display" "RTMIN"
+trap "update_music;display" "RTMIN+1"
while true; do
sleep 2 & wait && {
@@ -107,6 +123,7 @@ while true; do
update_cpu_temp
update_vol
[ $((i%3)) -eq 0 ] && update_time
+ [ $((i%3)) -eq 0 ] && update_music
[ $((i % 180)) -eq 0 ] && update_sunset
[ $((i % 300)) -eq 0 ] && update_sunrise
[ $((i % 360)) -eq 0 ] && update_weather
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} Regular:size=11" -o -2 -f "Font Awesome 7 Free Solid:size=10" -g 1200x26+720+0 -B "#${BACKGROUND_BLACK}" -F "#${FOREGROUND_WHITE}"
+"$XDG_DATA_HOME/regexghost/panel/lemonbar-bar.sh" | lemonbar -o +1 -f "${FONT_FAMILY} Medium:size=10" -o -1 -f "Font Awesome 7 Free Solid:size=10" -g 1260x25+660+0 -B "#${BACKGROUND_BLACK}" -F "#${FOREGROUND_WHITE}"
diff --git a/panel-scripts/music.sh b/panel-scripts/music.sh
@@ -6,19 +6,27 @@ DMENU_SCRIPT="$XDG_DATA_HOME/regexghost/wm-scripts/dmenu-runner.sh"
MUSIC_DIR="$HOME/Music"
FAVOURITES_DIR="$MUSIC_DIR/Favourites"
+ping_panel () {
+ kill -35 "$(cat ~/.cache/bar_pid)"
+}
+
# Technically these first 4 are unnecessary, could just bind directly to the command
# but I like it all being in one file
if [ "$1" = "--toggle-pause" ]; then
mocp --toggle-pause
+ ping_panel
exit
elif [ "$1" = "--quit" ]; then
mocp --stop
+ ping_panel
exit
elif [ "$1" = "--next" ]; then
mocp --next
+ ping_panel
exit
elif [ "$1" = "--previous" ]; then
mocp --previous
+ ping_panel
exit
elif [ "$1" = "--favourite" ]; then
song="$(mocp -i | grep "File:" | sed 's/File: //g')"
@@ -56,6 +64,7 @@ fi
if [ "$1" = "--choice" ]; then
# Ask for playlist
playlist="$(ls "$MUSIC_DIR" | sed 's/\([A-Z][a-z]\)/ \1/g' | sed 's/\([a-z]\)\([0-9]\)/\1 \2/g' | sed 's/^ //g' | "${DMENU_SCRIPT}" "Select Playlist:")"
+ [ "$?" != "0" ] && exit
playlist_path="$MUSIC_DIR/$(echo "$playlist" | sed 's/ //g')"
else
playlist_path="$MUSIC_DIR/CurrentPlaylist"
@@ -64,6 +73,7 @@ fi
# Check for sub playlists
if find "$playlist_path" -mindepth 1 -type d | grep -q ""; then
playlist="$(ls "$playlist_path" | sed 's/\([A-Z][a-z]\)/ \1/g' | sed 's/\([a-z]\)\([0-9]\)/\1 \2/g' | sed 's/^ //g' | awk 'BEGIN {RS = ""} {print "All Songs\n"$0}' | "${DMENU_SCRIPT}" "Select Playlist:")"
+ [ "$?" != "0" ] && exit
# If all songs, don't change playlist path
if ! [ "$playlist" = "All Songs" ]; then
playlist_path="$playlist_path/$(echo "$playlist" | sed 's/ //g')"
@@ -73,3 +83,4 @@ fi
mocp --clear
mocp --append "$playlist_path"
mocp --play
+ping_panel