update waybar scripts

This commit is contained in:
sudacode 2025-03-18 20:07:55 -07:00
parent b931f47e07
commit 8e19d89ba2
Signed by: sudacode
SSH Key Fingerprint: SHA256:lT5C2bB398DcX6daCF/gYFNSTK3y+Du3oTGUnYzfTEw
5 changed files with 38 additions and 7 deletions

View File

@ -127,7 +127,10 @@ class PlayerManager:
player_name = player.props.player_name
artist = player.get_artist()
title = player.get_title()
title = title.replace("&", "&")
if title is not None:
title = title.replace("&", "&")
else:
title = "No title"
track_info = ""
if (

View File

@ -1,6 +1,13 @@
#!/bin/sh
STATUS="$(playerctl -p firefox status)"
PLAYER="$1"
if [ -z "$PLAYER" ]; then
echo "Usage: $0 <player>"
exit 1
fi
STATUS="$(playerctl -p "$PLAYER" status)"
if [ -z "$STATUS" ] || [ "$STATUS" = "Stopped" ]; then
exit 0
@ -12,7 +19,7 @@ else
exit 0
fi
TITLE="$(playerctl -p firefox metadata title)"
ARTIST="$(playerctl -p firefox metadata artist)"
TITLE="$(playerctl -p "$PLAYER" metadata title)"
ARTIST="$(playerctl -p "$PLAYER" metadata artist)"
printf "%s\n" "$STATUS$TITLE - $ARTIST"

View File

@ -6,5 +6,14 @@ if pgrep -af "waybar -c /home/sudacode/.config/waybar/catppuccin-macchiato/confi
fi
BASE_DIR="$HOME/.config/waybar/catppuccin-macchiato"
NODE_NAME="$(hyprctl systeminfo | grep -i "node name" | sed 's/Node name: //')"
waybar -c "$BASE_DIR/config-battery.jsonc" -s "$BASE_DIR/style.css" &>/dev/null &
if [[ "$NODE_NAME" = "sc-arch" ]]; then
CONFIG="$BASE_DIR/config.jsonc"
else
CONFIG="$BASE_DIR/config-laptop.jsonc"
fi
waybar -c "$CONFIG" -s "$BASE_DIR/style.css" &>/dev/null &

View File

@ -2,9 +2,10 @@
zscroll -p ' | ' --delay 0.2 \
--length 30 \
--match-command "$HOME/.config/waybar/scripts/firefox-status.sh" \
--match-command "$HOME/.config/waybar/scripts/playerctl.sh firefox" \
--match-text ' ' "" \
--match-text ' ' "--scroll 0" \
--match-text "^volume:" "--before-text '' --scroll 0 --after-text ''" \
--update-interval 1 \
--update-check true "$HOME/.config/waybar/scripts/firefox-status.sh" &
--update-check true "$HOME/.config/waybar/scripts/playerctl.sh firefox" &
wait

11
waybar/scroll-mpv.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
zscroll -p ' | ' --delay 0.2 \
--length 30 \
--match-command "$HOME/.config/waybar/scripts/playerctl.sh mpv" \
--match-text ' ' "" \
--match-text ' ' "--scroll 0" \
--match-text "^volume:" "--before-text '' --scroll 0 --after-text ''" \
--update-interval 1 \
--update-check true "$HOME/.config/waybar/scripts/playerctl.sh mpv" &
wait