From ed906f27e798ea78000ecab4fa127b382d5eaf2e Mon Sep 17 00:00:00 2001 From: Joshua Yuen Date: Sat, 12 Sep 2026 18:22:46 -0400 Subject: [PATCH] Add media player card and bar center track button --- modules/home/ags/app/style.scss | 70 +++++++ modules/home/ags/app/widget/Bar.tsx | 5 +- modules/home/ags/app/widget/Media.tsx | 189 ++++++++++++++++++ modules/home/ags/app/widget/QuickSettings.tsx | 2 + modules/home/ags/default.nix | 1 + 5 files changed, 266 insertions(+), 1 deletion(-) create mode 100644 modules/home/ags/app/widget/Media.tsx diff --git a/modules/home/ags/app/style.scss b/modules/home/ags/app/style.scss index e3ab040..3f2d2ed 100644 --- a/modules/home/ags/app/style.scss +++ b/modules/home/ags/app/style.scss @@ -285,6 +285,76 @@ $module-bg: transparentize($base02, 0.4); } } +.media-section { + margin-top: 10px; + border-top: 1px solid $base02; + padding-top: 8px; +} + +.player { + .cover { + min-width: 48px; + min-height: 48px; + padding: 12px; + border-radius: 8px; + background-color: transparentize($base02, 0.4); + background-size: cover; + background-position: center; + } + + .player-title { + font-weight: bold; + } + + .player-artist { + font-size: 0.85em; + opacity: 0.7; + } +} + +.position { + trough { + background: $base03; + border-radius: 999px; + min-height: 10px; + + highlight { + background: $base0D; + border-radius: 999px; + } + + slider { + min-width: 12px; + min-height: 12px; + background: $base05; + border-radius: 999px; + } + } +} + +.player-ctl { + padding: 4px 6px; + border-radius: 6px; + + icon { + font-size: 14px; + } + + &:hover { + background: transparentize($base05, 0.88); + } +} + +.bar .media { + icon { + font-size: 12px; + } + + .media-title { + font-size: 0.9em; + } +} + .wifi-section { margin-top: 10px; border-top: 1px solid $base02; diff --git a/modules/home/ags/app/widget/Bar.tsx b/modules/home/ags/app/widget/Bar.tsx index 273b670..c080d48 100644 --- a/modules/home/ags/app/widget/Bar.tsx +++ b/modules/home/ags/app/widget/Bar.tsx @@ -2,6 +2,7 @@ import { App, Astal, Gdk, Gtk } from "astal/gtk3" import Workspaces from "./Workspaces" import Logo from "./Logo" import Clock from "./Clock" +import { MediaButton } from "./Media" import QuickSettings from "./QuickSettings" const RADIUS = 12 @@ -85,7 +86,9 @@ export default function Bar(gdkmonitor: Gdk.Monitor) { className="bar-center" halign={Gtk.Align.CENTER} valign={Gtk.Align.CENTER} - /> + > + + + player.available ? player.position : -1, + ) + + return ( + + + c !== "" ? `background-image: url('${encodeURI(`file://${c}`)}')` : "", + )} + > + c === "")} + /> + + + + +