fix waybar config and some other stuff

This commit is contained in:
2025-10-09 23:56:49 -07:00
parent 4c99d38f05
commit 7f963a9a6c
4 changed files with 25 additions and 24 deletions

View File

@@ -8,13 +8,13 @@ import logging
import os
import signal
import sys
from typing import List
import gi
from gi.repository import GLib, Playerctl
from gi.repository.Playerctl import Player
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
is_plain = False
@@ -66,7 +66,7 @@ class PlayerManager:
self.manager.manage_player(player)
self.on_metadata_changed(player, player.props.metadata)
def get_players(self) -> List[Player]:
def get_players(self) -> list[Player]:
return self.manager.props.players
def write_output(self, text, player):
@@ -234,5 +234,4 @@ def main():
if __name__ == "__main__":
main()

View File

@@ -3,21 +3,22 @@
PLAYER="$1"
if [ -z "$PLAYER" ]; then
echo "Usage: $0 <player>"
exit 1
echo "Usage: $0 <player>"
exit 1
fi
STATUS="$(playerctl -p "$PLAYER" status)"
STATUS="$(playerctl -p "$PLAYER" status 2>/dev/null)"
if [ -z "$STATUS" ] || [ "$STATUS" = "Stopped" ]; then
exit 0
elif [ "$STATUS" = "Paused" ]; then
STATUS=" "
elif [ "$STATUS" = "Playing" ]; then
STATUS=" "
else
exit 0
fi
case "$STATUS" in "" | "Stopped")
exit 0
;;
"Paused")
STATUS=" "
;;
"Playing")
STATUS=" "
;;
esac
TITLE="$(playerctl -p "$PLAYER" metadata title)"
ARTIST="$(playerctl -p "$PLAYER" metadata artist)"