feat: Redesign MiniPlayer to replace main window temporarily

- MiniPlayer now resizes the main window instead of creating a separate floating window
- Cider-inspired UI with large album art, track info, full playback controls
- Progress bar with current/remaining time display
- Shuffle, repeat, volume controls integrated
- Pin/restore buttons to control always-on-top and return to main view
- Fixed tray icon to use transparent PNG from static/icons
This commit is contained in:
vicrodh committed 2026-01-12 07:28:14 -06:00
1 parent 0a3ced23bf
commit 6d41741f76
6 files changed
+602 -287

No files matched your search

+3
View File
@@ -55,6 +55,9 @@ souvlaki = "0.7"
# Desktop notifications
notify-rust = "4"
# Image decoding (for tray icon)
image = { version = "0.25", default-features = false, features = ["png"] }
# URL opening
open = "5"
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

+18 -1
View File
@@ -2,12 +2,26 @@
//!
//! Provides system tray integration with playback controls and window management.
use image::GenericImageView;
use tauri::{
image::Image,
menu::{Menu, MenuItem, PredefinedMenuItem},
tray::{MouseButton, MouseButtonState, TrayIconBuilder, TrayIconEvent},
AppHandle, Emitter, Manager,
};
// Embed tray icon at compile time (transparent background)
const TRAY_ICON_PNG: &[u8] = include_bytes!("../icons/tray.png");
/// Decode PNG and convert to RGBA for Tauri Image
fn load_tray_icon() -> Image<'static> {
let img = image::load_from_memory(TRAY_ICON_PNG)
.expect("Failed to decode tray icon PNG");
let (width, height) = img.dimensions();
let rgba = img.into_rgba8().into_raw();
Image::new_owned(rgba, width, height)
}
/// Initialize the system tray icon with menu
pub fn init_tray(app: &AppHandle) -> Result<(), Box<dyn std::error::Error>> {
log::info!("Initializing system tray icon");
@@ -35,9 +49,12 @@ pub fn init_tray(app: &AppHandle) -> Result<(), Box<dyn std::error::Error>> {
],
)?;
// Load custom tray icon (with transparent background)
let tray_icon = load_tray_icon();
// Build and display tray icon
let _tray = TrayIconBuilder::new()
.icon(app.default_window_icon().unwrap().clone())
.icon(tray_icon)
.menu(&tray_menu)
.tooltip("QBZ - Music Player")
.show_menu_on_left_click(false) // Left click toggles window, right click shows menu
+109 -114
View File
@@ -1,154 +1,149 @@
/**
* MiniPlayer Window Management Service
* MiniPlayer Mode Service
*
* Handles creating, toggling, and controlling the MiniPlayer window.
* Handles switching between normal and miniplayer modes by resizing
* the main window instead of creating a separate window.
*/
import { WebviewWindow } from '@tauri-apps/api/webviewWindow';
import { getCurrentWindow } from '@tauri-apps/api/window';
import type { PhysicalSize, PhysicalPosition } from '@tauri-apps/api/window';
import { goto } from '$app/navigation';
let miniplayerWindow: WebviewWindow | null = null;
// Miniplayer dimensions (Cider-inspired compact mode)
const MINIPLAYER_WIDTH = 400;
const MINIPLAYER_HEIGHT = 150;
// Store original window state for restoration
let originalSize: PhysicalSize | null = null;
let originalPosition: PhysicalPosition | null = null;
let originalMaximized = false;
let isMiniplayerMode = false;
// Callbacks for state management
let onModeChangeCallback: ((isMini: boolean) => void) | null = null;
/**
* Create the MiniPlayer window
* Set callback for mode changes
*/
export async function createMiniPlayer(): Promise<void> {
// Check if window already exists
try {
const existing = await WebviewWindow.getByLabel('miniplayer');
if (existing) {
await existing.show();
await existing.setFocus();
return;
}
} catch {
// Window doesn't exist, proceed to create
export function onModeChange(callback: (isMini: boolean) => void): void {
onModeChangeCallback = callback;
}
/**
* Check if currently in miniplayer mode
*/
export function isInMiniplayerMode(): boolean {
return isMiniplayerMode;
}
/**
* Enter miniplayer mode - resize window and navigate to miniplayer route
*/
export async function enterMiniplayerMode(): Promise<void> {
if (isMiniplayerMode) return;
try {
miniplayerWindow = new WebviewWindow('miniplayer', {
url: '/miniplayer',
title: 'QBZ MiniPlayer',
width: 340,
height: 90,
minWidth: 300,
minHeight: 80,
maxHeight: 120,
decorations: false,
transparent: true,
alwaysOnTop: true,
resizable: false,
skipTaskbar: true,
// Position at top-right of screen
x: 100,
y: 100,
const window = getCurrentWindow();
// Store current window state
originalMaximized = await window.isMaximized();
originalSize = await window.innerSize();
originalPosition = await window.innerPosition();
console.log('[MiniPlayer] Saving original state:', {
size: originalSize,
position: originalPosition,
maximized: originalMaximized
});
miniplayerWindow.once('tauri://created', () => {
console.log('[MiniPlayer] Window created successfully');
});
// If maximized, unmaximize first
if (originalMaximized) {
await window.unmaximize();
}
miniplayerWindow.once('tauri://error', (e) => {
console.error('[MiniPlayer] Failed to create window:', e);
});
// Set miniplayer dimensions
await window.setResizable(false);
await window.setSize({ type: 'Physical', width: MINIPLAYER_WIDTH, height: MINIPLAYER_HEIGHT });
await window.setDecorations(false);
await window.setAlwaysOnTop(true);
// Navigate to miniplayer route
await goto('/miniplayer');
isMiniplayerMode = true;
onModeChangeCallback?.(true);
console.log('[MiniPlayer] Entered miniplayer mode');
} catch (err) {
console.error('[MiniPlayer] Error creating window:', err);
console.error('[MiniPlayer] Failed to enter miniplayer mode:', err);
}
}
/**
* Toggle MiniPlayer visibility
* Exit miniplayer mode - restore original window state
*/
export async function toggleMiniPlayer(): Promise<void> {
try {
const window = await WebviewWindow.getByLabel('miniplayer');
if (!window) {
await createMiniPlayer();
return;
}
export async function exitMiniplayerMode(): Promise<void> {
if (!isMiniplayerMode) return;
const isVisible = await window.isVisible();
if (isVisible) {
await window.hide();
try {
const window = getCurrentWindow();
// Restore window properties
await window.setAlwaysOnTop(false);
await window.setDecorations(true);
await window.setResizable(true);
// Restore size
if (originalSize) {
await window.setSize({ type: 'Physical', width: originalSize.width, height: originalSize.height });
} else {
await window.show();
await window.setFocus();
// Fallback to default size
await window.setSize({ type: 'Physical', width: 1280, height: 800 });
}
// Restore position
if (originalPosition) {
await window.setPosition({ type: 'Physical', x: originalPosition.x, y: originalPosition.y });
}
// Restore maximized state
if (originalMaximized) {
await window.maximize();
}
// Navigate back to main
await goto('/');
isMiniplayerMode = false;
onModeChangeCallback?.(false);
console.log('[MiniPlayer] Exited miniplayer mode');
} catch (err) {
console.error('[MiniPlayer] Error toggling:', err);
// Window might not exist, try creating it
await createMiniPlayer();
console.error('[MiniPlayer] Failed to exit miniplayer mode:', err);
}
}
/**
* Show the MiniPlayer window
* Toggle between normal and miniplayer modes
*/
export async function showMiniPlayer(): Promise<void> {
try {
const window = await WebviewWindow.getByLabel('miniplayer');
if (!window) {
await createMiniPlayer();
return;
}
await window.show();
await window.setFocus();
} catch {
await createMiniPlayer();
export async function toggleMiniplayerMode(): Promise<void> {
if (isMiniplayerMode) {
await exitMiniplayerMode();
} else {
await enterMiniplayerMode();
}
}
/**
* Hide the MiniPlayer window
* Set miniplayer always on top
*/
export async function hideMiniPlayer(): Promise<void> {
try {
const window = await WebviewWindow.getByLabel('miniplayer');
if (window) {
await window.hide();
}
} catch (err) {
console.error('[MiniPlayer] Error hiding:', err);
}
}
export async function setMiniplayerAlwaysOnTop(alwaysOnTop: boolean): Promise<void> {
if (!isMiniplayerMode) return;
/**
* Close the MiniPlayer window
*/
export async function closeMiniPlayer(): Promise<void> {
try {
const window = await WebviewWindow.getByLabel('miniplayer');
if (window) {
await window.close();
miniplayerWindow = null;
}
} catch (err) {
console.error('[MiniPlayer] Error closing:', err);
}
}
/**
* Check if MiniPlayer is currently visible
*/
export async function isMiniPlayerVisible(): Promise<boolean> {
try {
const window = await WebviewWindow.getByLabel('miniplayer');
if (!window) return false;
return await window.isVisible();
} catch {
return false;
}
}
/**
* Set MiniPlayer always on top
*/
export async function setMiniPlayerAlwaysOnTop(alwaysOnTop: boolean): Promise<void> {
try {
const window = await WebviewWindow.getByLabel('miniplayer');
if (window) {
const window = getCurrentWindow();
await window.setAlwaysOnTop(alwaysOnTop);
}
} catch (err) {
console.error('[MiniPlayer] Error setting always on top:', err);
console.error('[MiniPlayer] Failed to set always on top:', err);
}
}
+3 -3
View File
@@ -189,7 +189,7 @@
} from '$lib/services/sessionService';
// MiniPlayer
import { toggleMiniPlayer } from '$lib/services/miniplayerService';
import { enterMiniplayerMode } from '$lib/services/miniplayerService';
// Lyrics state management
import {
@@ -1551,7 +1551,7 @@
onToggleFavorite={toggleFavorite}
onOpenQueue={openQueue}
onOpenFullScreen={openFullScreen}
onOpenMiniPlayer={toggleMiniPlayer}
onOpenMiniPlayer={enterMiniplayerMode}
onCast={openCastPicker}
onToggleLyrics={toggleLyricsSidebar}
lyricsActive={lyricsSidebarVisible}
@@ -1574,7 +1574,7 @@
<NowPlayingBar
onOpenQueue={openQueue}
onOpenFullScreen={openFullScreen}
onOpenMiniPlayer={toggleMiniPlayer}
onOpenMiniPlayer={enterMiniplayerMode}
onCast={openCastPicker}
/>
{/if}
+469 -169
View File
@@ -1,63 +1,96 @@
<script lang="ts">
import { onMount } from 'svelte';
import { listen, type UnlistenFn } from '@tauri-apps/api/event';
import { onMount, onDestroy } from 'svelte';
import { invoke } from '@tauri-apps/api/core';
import { getCurrentWindow } from '@tauri-apps/api/window';
import { SkipBack, SkipForward, Play, Pause, X, Pin, PinOff } from 'lucide-svelte';
import {
Shuffle,
SkipBack,
SkipForward,
Play,
Pause,
Repeat,
Repeat1,
Pin,
PinOff,
Maximize2,
Volume2,
VolumeX,
Volume1
} from 'lucide-svelte';
import {
subscribe as subscribePlayer,
getPlayerState,
togglePlay,
seek as playerSeek,
setVolume as playerSetVolume,
type PlayerState
} from '$lib/stores/playerStore';
import {
subscribe as subscribeQueue,
getQueueState,
toggleShuffle,
toggleRepeat,
nextTrack,
previousTrack,
type RepeatMode
} from '$lib/stores/queueStore';
import { exitMiniplayerMode, setMiniplayerAlwaysOnTop } from '$lib/services/miniplayerService';
interface TrackUpdate {
id: number;
title: string;
artist: string;
artwork: string;
isPlaying: boolean;
}
interface PlaybackState {
isPlaying: boolean;
currentTime: number;
duration: number;
}
// State
let currentTrack = $state<TrackUpdate | null>(null);
let isPlaying = $state(false);
let currentTime = $state(0);
let duration = $state(0);
// Player state
let playerState = $state<PlayerState>(getPlayerState());
let isShuffle = $state(false);
let repeatMode = $state<RepeatMode>('off');
let isPinned = $state(true);
let isDragging = $state(false);
let isDraggingProgress = $state(false);
let isDraggingVolume = $state(false);
// Progress percentage
const progress = $derived(duration > 0 ? (currentTime / duration) * 100 : 0);
// Refs
let progressRef: HTMLDivElement;
let volumeRef: HTMLDivElement;
// Derived state
const progress = $derived(playerState.duration > 0 ? (playerState.currentTime / playerState.duration) * 100 : 0);
const hasTrack = $derived(playerState.currentTrack !== null);
function formatTime(seconds: number): string {
const mins = Math.floor(seconds / 60);
const secs = Math.floor(seconds % 60);
return `${mins}:${secs.toString().padStart(2, '0')}`;
}
// Store subscriptions
let unsubscribePlayer: (() => void) | null = null;
let unsubscribeQueue: (() => void) | null = null;
onMount(() => {
const unlisteners: UnlistenFn[] = [];
// Listen for track updates from main window
listen<TrackUpdate>('miniplayer:track', (event) => {
currentTrack = event.payload;
isPlaying = event.payload.isPlaying;
}).then((unlisten) => unlisteners.push(unlisten));
// Listen for playback state updates
listen<PlaybackState>('miniplayer:playback', (event) => {
isPlaying = event.payload.isPlaying;
currentTime = event.payload.currentTime;
duration = event.payload.duration;
}).then((unlisten) => unlisteners.push(unlisten));
return () => {
unlisteners.forEach((unlisten) => unlisten());
};
// Subscribe to player state
unsubscribePlayer = subscribePlayer(() => {
playerState = getPlayerState();
});
// Subscribe to queue state
unsubscribeQueue = subscribeQueue(() => {
const qState = getQueueState();
isShuffle = qState.isShuffle;
repeatMode = qState.repeatMode;
});
// Initial queue state
const qState = getQueueState();
isShuffle = qState.isShuffle;
repeatMode = qState.repeatMode;
});
onDestroy(() => {
unsubscribePlayer?.();
unsubscribeQueue?.();
});
// Playback controls
async function handlePlayPause(): Promise<void> {
try {
if (isPlaying) {
await invoke('pause_playback');
} else {
await invoke('resume_playback');
}
await togglePlay();
} catch (err) {
console.error('[MiniPlayer] Failed to toggle playback:', err);
}
@@ -65,7 +98,7 @@
async function handleNext(): Promise<void> {
try {
await invoke('next_track');
await nextTrack();
} catch (err) {
console.error('[MiniPlayer] Failed to skip to next:', err);
}
@@ -73,31 +106,95 @@
async function handlePrevious(): Promise<void> {
try {
await invoke('previous_track');
await previousTrack();
} catch (err) {
console.error('[MiniPlayer] Failed to skip to previous:', err);
}
}
async function handleClose(): Promise<void> {
async function handleToggleShuffle(): Promise<void> {
try {
const window = getCurrentWindow();
await window.hide();
await toggleShuffle();
} catch (err) {
console.error('[MiniPlayer] Failed to close:', err);
console.error('[MiniPlayer] Failed to toggle shuffle:', err);
}
}
async function togglePin(): Promise<void> {
async function handleToggleRepeat(): Promise<void> {
try {
isPinned = !isPinned;
const window = getCurrentWindow();
await window.setAlwaysOnTop(isPinned);
await toggleRepeat();
} catch (err) {
console.error('[MiniPlayer] Failed to toggle pin:', err);
console.error('[MiniPlayer] Failed to toggle repeat:', err);
}
}
// Progress bar
function handleProgressMouseDown(e: MouseEvent): void {
isDraggingProgress = true;
updateProgress(e);
document.addEventListener('mousemove', handleProgressMouseMove);
document.addEventListener('mouseup', handleProgressMouseUp);
}
function handleProgressMouseMove(e: MouseEvent): void {
if (isDraggingProgress) updateProgress(e);
}
function handleProgressMouseUp(): void {
isDraggingProgress = false;
document.removeEventListener('mousemove', handleProgressMouseMove);
document.removeEventListener('mouseup', handleProgressMouseUp);
}
function updateProgress(e: MouseEvent): void {
if (progressRef && playerState.duration > 0) {
const rect = progressRef.getBoundingClientRect();
const percentage = Math.max(0, Math.min(100, ((e.clientX - rect.left) / rect.width) * 100));
const newTime = Math.round((percentage / 100) * playerState.duration);
playerSeek(newTime);
}
}
// Volume control
function handleVolumeMouseDown(e: MouseEvent): void {
isDraggingVolume = true;
updateVolume(e);
document.addEventListener('mousemove', handleVolumeMouseMove);
document.addEventListener('mouseup', handleVolumeMouseUp);
}
function handleVolumeMouseMove(e: MouseEvent): void {
if (isDraggingVolume) updateVolume(e);
}
function handleVolumeMouseUp(): void {
isDraggingVolume = false;
document.removeEventListener('mousemove', handleVolumeMouseMove);
document.removeEventListener('mouseup', handleVolumeMouseUp);
}
function updateVolume(e: MouseEvent): void {
if (volumeRef) {
const rect = volumeRef.getBoundingClientRect();
const percentage = Math.max(0, Math.min(100, ((e.clientX - rect.left) / rect.width) * 100));
playerSetVolume(Math.round(percentage));
}
}
function handleMuteToggle(): void {
playerSetVolume(playerState.volume === 0 ? 75 : 0);
}
// Window controls
async function handleRestore(): Promise<void> {
await exitMiniplayerMode();
}
async function togglePin(): Promise<void> {
isPinned = !isPinned;
await setMiniplayerAlwaysOnTop(isPinned);
}
async function startDrag(): Promise<void> {
try {
isDragging = true;
@@ -117,62 +214,131 @@
role="application"
aria-label="MiniPlayer"
>
<!-- Drag handle / Header -->
<div
class="header"
onmousedown={startDrag}
role="banner"
>
<button class="header-btn" onclick={togglePin} title={isPinned ? 'Unpin' : 'Pin on top'}>
{#if isPinned}
<Pin size={12} />
<!-- Album Art Section -->
<div class="artwork-section" onmousedown={startDrag}>
{#if playerState.currentTrack?.artwork}
<img src={playerState.currentTrack.artwork} alt="Album art" class="artwork" />
{:else}
<PinOff size={12} />
{/if}
</button>
<button class="header-btn close" onclick={handleClose} title="Close">
<X size={12} />
</button>
<div class="artwork-placeholder">
<Play size={32} />
</div>
<!-- Content -->
<div class="content">
<!-- Album Art -->
<div class="artwork">
{#if currentTrack?.artwork}
<img src={currentTrack.artwork} alt="Album art" />
{:else}
<div class="artwork-placeholder"></div>
{/if}
</div>
<!-- Track Info -->
<!-- Main Content -->
<div class="content-section">
<!-- Header with track info and window controls -->
<div class="header" onmousedown={startDrag}>
<div class="track-info">
<div class="title">{currentTrack?.title ?? 'No track'}</div>
<div class="artist">{currentTrack?.artist ?? '-'}</div>
<div class="title">{playerState.currentTrack?.title ?? 'No track playing'}</div>
<div class="artist">{playerState.currentTrack?.artist ?? '—'}</div>
</div>
<!-- Controls -->
<div class="controls">
<button class="control-btn" onclick={handlePrevious} title="Previous">
<SkipBack size={16} />
</button>
<button class="control-btn play" onclick={handlePlayPause} title={isPlaying ? 'Pause' : 'Play'}>
{#if isPlaying}
<Pause size={18} />
<div class="window-controls">
<button class="window-btn" onclick={togglePin} title={isPinned ? 'Unpin' : 'Pin on top'}>
{#if isPinned}
<Pin size={14} />
{:else}
<Play size={18} />
<PinOff size={14} />
{/if}
</button>
<button class="control-btn" onclick={handleNext} title="Next">
<SkipForward size={16} />
<button class="window-btn restore" onclick={handleRestore} title="Restore window">
<Maximize2 size={14} />
</button>
</div>
</div>
<!-- Progress Bar -->
<div class="progress-container">
<div class="progress-bar" style="width: {progress}%"></div>
<div class="progress-section">
<span class="time">{formatTime(playerState.currentTime)}</span>
<div
class="progress-bar"
bind:this={progressRef}
onmousedown={handleProgressMouseDown}
role="slider"
tabindex="0"
aria-valuenow={playerState.currentTime}
aria-valuemin={0}
aria-valuemax={playerState.duration}
>
<div class="progress-track">
<div class="progress-fill" style="width: {progress}%"></div>
</div>
<div class="progress-thumb" style="left: {progress}%"></div>
</div>
<span class="time remaining">-{formatTime(Math.max(0, playerState.duration - playerState.currentTime))}</span>
</div>
<!-- Controls Row -->
<div class="controls-row">
<!-- Playback Controls -->
<div class="playback-controls">
<button
class="control-btn small"
class:active={isShuffle}
onclick={handleToggleShuffle}
title="Shuffle"
>
<Shuffle size={14} />
</button>
<button class="control-btn" onclick={handlePrevious} title="Previous">
<SkipBack size={18} />
</button>
<button class="control-btn play" onclick={handlePlayPause} title={playerState.isPlaying ? 'Pause' : 'Play'}>
{#if playerState.isPlaying}
<Pause size={20} />
{:else}
<Play size={20} />
{/if}
</button>
<button class="control-btn" onclick={handleNext} title="Next">
<SkipForward size={18} />
</button>
<button
class="control-btn small"
class:active={repeatMode !== 'off'}
onclick={handleToggleRepeat}
title={repeatMode === 'off' ? 'Repeat' : repeatMode === 'all' ? 'Repeat All' : 'Repeat One'}
>
{#if repeatMode === 'one'}
<Repeat1 size={14} />
{:else}
<Repeat size={14} />
{/if}
</button>
</div>
<!-- Volume Control -->
<div class="volume-control">
<button class="control-btn small" onclick={handleMuteToggle} title={playerState.volume === 0 ? 'Unmute' : 'Mute'}>
{#if playerState.volume === 0}
<VolumeX size={14} />
{:else if playerState.volume < 50}
<Volume1 size={14} />
{:else}
<Volume2 size={14} />
{/if}
</button>
<div
class="volume-slider"
bind:this={volumeRef}
onmousedown={handleVolumeMouseDown}
role="slider"
tabindex="0"
aria-valuenow={playerState.volume}
aria-valuemin={0}
aria-valuemax={100}
>
<div class="volume-track">
<div class="volume-fill" style="width: {playerState.volume}%"></div>
</div>
<div class="volume-thumb" style="left: {playerState.volume}%"></div>
</div>
</div>
</div>
</div>
</div>
@@ -186,87 +352,72 @@
.miniplayer {
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
background: linear-gradient(135deg, rgba(26, 26, 30, 0.98) 0%, rgba(38, 38, 45, 0.98) 100%);
background: linear-gradient(135deg, #1a1a1f 0%, #252530 100%);
border-radius: 12px;
color: white;
user-select: none;
overflow: hidden;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
border: 1px solid rgba(255, 255, 255, 0.1);
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
border: 1px solid rgba(255, 255, 255, 0.08);
}
.miniplayer.dragging {
cursor: grabbing;
}
.header {
display: flex;
justify-content: flex-end;
align-items: center;
gap: 4px;
padding: 4px 6px;
/* Album Art Section */
.artwork-section {
width: 150px;
height: 150px;
flex-shrink: 0;
cursor: grab;
background: rgba(0, 0, 0, 0.2);
position: relative;
}
.header:active {
.artwork-section:active {
cursor: grabbing;
}
.header-btn {
display: flex;
align-items: center;
justify-content: center;
width: 18px;
height: 18px;
background: transparent;
border: none;
color: rgba(255, 255, 255, 0.5);
cursor: pointer;
border-radius: 4px;
transition: all 0.15s ease;
}
.header-btn:hover {
background: rgba(255, 255, 255, 0.1);
color: rgba(255, 255, 255, 0.8);
}
.header-btn.close:hover {
background: rgba(255, 100, 100, 0.3);
color: #ff6b6b;
}
.content {
display: flex;
align-items: center;
gap: 10px;
padding: 6px 12px 8px;
flex: 1;
}
.artwork {
width: 48px;
height: 48px;
border-radius: 6px;
overflow: hidden;
flex-shrink: 0;
background: rgba(255, 255, 255, 0.05);
}
.artwork img {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: 12px 0 0 12px;
}
.artwork-placeholder {
width: 100%;
height: 100%;
background: linear-gradient(135deg, #333 0%, #222 100%);
background: linear-gradient(135deg, #2a2a35 0%, #1f1f28 100%);
display: flex;
align-items: center;
justify-content: center;
color: rgba(255, 255, 255, 0.3);
border-radius: 12px 0 0 12px;
}
/* Content Section */
.content-section {
flex: 1;
display: flex;
flex-direction: column;
padding: 12px 16px;
min-width: 0;
}
/* Header */
.header {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: 8px;
cursor: grab;
}
.header:active {
cursor: grabbing;
}
.track-info {
@@ -276,16 +427,17 @@
}
.title {
font-weight: 500;
font-size: 13px;
font-weight: 600;
font-size: 14px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: #fff;
line-height: 1.3;
}
.artist {
font-size: 11px;
font-size: 12px;
color: rgba(255, 255, 255, 0.6);
white-space: nowrap;
overflow: hidden;
@@ -293,19 +445,121 @@
margin-top: 2px;
}
.controls {
.window-controls {
display: flex;
gap: 4px;
flex-shrink: 0;
margin-left: 8px;
}
.window-btn {
display: flex;
align-items: center;
justify-content: center;
width: 24px;
height: 24px;
background: rgba(255, 255, 255, 0.08);
border: none;
color: rgba(255, 255, 255, 0.6);
cursor: pointer;
border-radius: 6px;
transition: all 0.15s ease;
}
.window-btn:hover {
background: rgba(255, 255, 255, 0.15);
color: rgba(255, 255, 255, 0.9);
}
.window-btn.restore:hover {
background: rgba(99, 102, 241, 0.3);
color: #818cf8;
}
/* Progress Section */
.progress-section {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 10px;
}
.time {
font-size: 10px;
font-family: var(--font-mono, monospace);
font-variant-numeric: tabular-nums;
color: rgba(255, 255, 255, 0.5);
min-width: 32px;
}
.time.remaining {
text-align: right;
}
.progress-bar {
flex: 1;
height: 20px;
display: flex;
align-items: center;
cursor: pointer;
position: relative;
}
.progress-track {
width: 100%;
height: 3px;
background: rgba(255, 255, 255, 0.15);
border-radius: 2px;
overflow: hidden;
}
.progress-fill {
height: 100%;
background: linear-gradient(90deg, #6366f1 0%, #818cf8 100%);
border-radius: 2px;
transition: width 100ms linear;
}
.progress-thumb {
position: absolute;
top: 50%;
width: 10px;
height: 10px;
background: white;
border-radius: 50%;
transform: translate(-50%, -50%);
opacity: 0;
transition: opacity 150ms ease;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
.progress-bar:hover .progress-thumb {
opacity: 1;
}
.progress-bar:hover .progress-track {
height: 4px;
}
/* Controls Row */
.controls-row {
display: flex;
justify-content: space-between;
align-items: center;
}
.playback-controls {
display: flex;
align-items: center;
gap: 4px;
flex-shrink: 0;
}
.control-btn {
display: flex;
align-items: center;
justify-content: center;
width: 28px;
height: 28px;
width: 32px;
height: 32px;
background: transparent;
border: none;
color: rgba(255, 255, 255, 0.8);
@@ -323,24 +577,70 @@
transform: scale(0.95);
}
.control-btn.small {
width: 26px;
height: 26px;
}
.control-btn.active {
color: #818cf8;
}
.control-btn.play {
width: 32px;
height: 32px;
background: rgba(255, 255, 255, 0.15);
width: 38px;
height: 38px;
background: rgba(255, 255, 255, 0.12);
margin: 0 4px;
}
.control-btn.play:hover {
background: rgba(255, 255, 255, 0.25);
background: rgba(255, 255, 255, 0.2);
transform: scale(1.05);
}
.progress-container {
/* Volume Control */
.volume-control {
display: flex;
align-items: center;
gap: 6px;
}
.volume-slider {
width: 60px;
height: 20px;
display: flex;
align-items: center;
cursor: pointer;
position: relative;
}
.volume-track {
width: 100%;
height: 3px;
background: rgba(255, 255, 255, 0.1);
background: rgba(255, 255, 255, 0.15);
border-radius: 2px;
overflow: hidden;
}
.progress-bar {
.volume-fill {
height: 100%;
background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 100%);
transition: width 0.25s linear;
background: rgba(255, 255, 255, 0.6);
border-radius: 2px;
}
.volume-thumb {
position: absolute;
top: 50%;
width: 8px;
height: 8px;
background: white;
border-radius: 50%;
transform: translate(-50%, -50%);
opacity: 0;
transition: opacity 150ms ease;
}
.volume-slider:hover .volume-thumb {
opacity: 1;
}
</style>