diff --git a/ags/style.css b/ags/style.css index ca13324..9d7c36c 100644 --- a/ags/style.css +++ b/ags/style.css @@ -16,6 +16,34 @@ font-family: "JetBrainsMono Nerd Font", sans-serif; } +.media-cover { + min-width: 64px; + min-height: 64px; + border-radius: 4px; + background-size: cover; + background-position: center; +} + +.media-info-box { + margin-left: 10px; +} + +.media-title { + color: @foreground; + font-size: 14px; + font-weight: bold; +} + +.media-artist { + color: @foreground; + font-size: 13px; + opacity: 0.8; +} + +.media-controls { + /* Box spacing is handled by the component */ +} + .media-btn { color: @color5; font-size: 16px; @@ -26,9 +54,3 @@ .media-btn:hover { color: @color4; } - -.media-text { - color: @foreground; - font-size: 14px; - margin-left: 10px; -} \ No newline at end of file diff --git a/ags/widget/Media.tsx b/ags/widget/Media.tsx index a7fcb53..cc5c734 100644 --- a/ags/widget/Media.tsx +++ b/ags/widget/Media.tsx @@ -6,9 +6,22 @@ import { createPoll } from "ags/time" export default function Media(gdkmonitor: Gdk.Monitor) { const { TOP, LEFT } = Astal.WindowAnchor - // Poll playerctl for metadata and status - const mediaInfo = createPoll("No Media Playing", 1000, 'sh -c "playerctl metadata -f \'{{title}} - {{artist}}\' 2>/dev/null || echo \'No Media Playing\'"') - const statusIcon = createPoll("▶", 1000, 'sh -c "s=\\$(playerctl status 2>/dev/null); if [ \\"\\$s\\" = \\"Playing\\" ]; then echo \\"⏸\\"; else echo \\"▶\\"; fi"') + // Poll playerctl for complete metadata and status in one go + const mediaState = createPoll({ + title: "No Media", + artist: "", + artUrl: "", + status: "Stopped" + }, 1000, "playerctl metadata -f '{{title}}|||{{artist}}|||{{mpris:artUrl}}|||{{status}}' 2>/dev/null || echo 'No Media||||||Stopped'", (stdout) => { + const parts = stdout.split("|||"); + const title = parts[0]?.trim() || "No Media"; + const artist = parts[1]?.trim() || ""; + // GTK supports raw paths better than file:// URIs in background-image CSS + const rawUrl = parts[2]?.trim() || ""; + const artUrl = rawUrl.replace(/^file:\/\//, ''); + const status = parts[3]?.trim() || "Stopped"; + return { title, artist, artUrl, status }; + }); return ( - - - - - ) -} \ No newline at end of file +} diff --git a/branding/boot_flash.png b/branding/boot_flash.png index b9825ec..713e8cb 100644 Binary files a/branding/boot_flash.png and b/branding/boot_flash.png differ