No description
- Go 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| cmd/spotifywidget | ||
| internal | ||
| .gitignore | ||
| go.mod | ||
| go.sum | ||
| Makefile | ||
| README.md | ||
Spotify Wayland Widget
A sleek, lightweight, glassmorphic desktop Spotify widget written in Go for Wayland compositors (KDE Plasma 6 / KWin, Sway, Hyprland, Wayfire).
Features
- Wayland-Native Layer Shell: Docks into screen corners (
top-right,top-left,bottom-right,bottom-left) usingzwlr_layer_shell_v1on theOVERLAYlayer. - 100% Click-Through: The corner widget body has an empty input region, ensuring underlying window controls (such as titlebar buttons, close, maximize, and minimize) are never obstructed.
- Interactive Companion Configuration Window: Hover the corner widget and press the physical keyboard UP arrow key to open a sleek, less-transparent, draggable configuration window with smooth scale and alpha opening/closing animations.
- Dedicated 2-Tab Settings:
- Position & Size Tab: Real-time corner selection (
Top-Left,Top-Right,Bot-Left,Bot-Right), live stepper controls[-] / [+]for Widget Width, Widget Height, Margin X, and Margin Y. - Style & Glass Tab: Live glassmorphic theme selector (
Dark,Frost,OLED,Emerald,Custom), interactive Custom RGB tint steppers (Red,Green,Blue), Widget Glass Opacity stepper, Hover Dimmed Opacity stepper, Window Opacity stepper, Auto-Hide Paused toggle, and a Quick Reset to Defaults button.
- Position & Size Tab: Real-time corner selection (
- Custom Theme Engine: Create and configure custom glass tints on the fly with live preview.
- Buttery 60fps Animations:
- Smooth hover & unhover opacity fade when cursor enters or leaves the corner widget.
- Smooth window opening & closing pop/fade animation (scale 0.88 -> 1.00 and alpha 0.0 -> 1.0).
- Clean Standard Typography: Pure ASCII tab and button labels for reliable rendering across all Linux environments.
- Automatic Configuration Persistence: All changes made in the controller window automatically save to
~/.config/spotifywidget/config.json. - Flicker-Free Triple Buffering: Employs triple-buffered shared memory (
memfd_create) and rate-limited rendering to eliminate any flashing or tearing. - Real-Time Spotify Synchronization:
- Album cover art download and local disk/memory caching.
- Track title, all collaborating artists, and album.
- Smooth progress bar in Spotify green (
#1DB954). - Elapsed and total time (
MM:SS / MM:SS). - Playback status indicator (Playing / Paused / Idle).
- Event-driven D-Bus updates via
org.mpris.MediaPlayer2.
Architecture
flowchart LR
Spotify["Spotify (MPRIS2)"] -->|"D-Bus Signals"| GoMPRIS["internal/mpris (godbus)"]
GoMPRIS -->|"TrackInfo & Art"| CairoUI["internal/ui (Cairo)"]
CairoUI -->|"ARGB32 Pixels"| Wayland["internal/wayland (Layer Shell & XDG Toplevel)"]
Wayland -->|"Empty Input Region\n(Click-Through)"| KWin["Wayland Compositor (KWin / Plasma)"]
Building & Running
Dependencies (Fedora / RHEL / Arch / Debian / Ubuntu)
- Go (1.20+)
wayland-clientcairokdotool(for cursor tracking)
Building
make build
Run tests:
make test
Running
./spotifywidget
Command-Line Options
| Flag | Default | Description |
|---|---|---|
-corner |
top-right |
Screen corner anchor (top-right, top-left, bottom-right, bottom-left) |
-margin-x |
24 |
Horizontal distance from screen edge in pixels |
-margin-y |
24 |
Vertical distance from screen edge in pixels |
-width |
380 |
Widget width in pixels |
-height |
100 |
Widget height in pixels |
-opacity |
0.70 |
Background card glass opacity (0.0 - 1.0) |
-hover-opacity |
0.20 |
Dimmed opacity when mouse hovers over widget (0.0 - 1.0) |
-theme |
dark |
Glassmorphic theme (dark, frost, oled, emerald, custom) |
-custom-red |
0.18 |
Custom theme red component (0.0 - 1.0) |
-custom-green |
0.12 |
Custom theme green component (0.0 - 1.0) |
-custom-blue |
0.28 |
Custom theme blue component (0.0 - 1.0) |
-clickthrough |
true |
Whether pointer events pass through to underlying windows |
-autohide |
false |
Automatically hide the corner widget when Spotify is paused or closed |
-interval-ms |
500 |
Position ticker update interval while playing (ms) |
-window-width |
480 |
Companion configuration window width in pixels |
-window-height |
420 |
Companion configuration window height in pixels |
-window-opacity |
0.94 |
Companion configuration window opacity (0.0 - 1.0) |