Split macOS player mode into window toggle + floating control

Replace the three-way macOS Player Mode picker (Separate Window /
Floating Window / Inline) with a single 'Play in a separate window'
toggle in Playback settings, and move the always-on-top choice to a
pin button in the player's top bar (window mode only).

Floating was really a transient window property (NSWindow.level), not
a peer of the window/inline structural choice — so it belongs on a live
control, not in Settings. The pin state persists across sessions.

- Replace MacPlayerMode enum with macPlayerSeparateWindow /
  macPlayerFloating bool settings
- Branch runtime presentation and window level off the two bools
- Add pin.fill/pin toggle to MacOSPlayerControlsView top bar
- Update localization; drop obsolete playerMode strings and enum tests
This commit is contained in:
Arkadiusz Fal
2026-05-30 12:42:18 +02:00
parent 64ca1c10d9
commit 2f2e436fe2
10 changed files with 85 additions and 129 deletions

View File

@@ -45,7 +45,8 @@ enum SettingsKey: String, CaseIterable {
case resolveShortLinksEnabled
// Platform-specific
case macPlayerMode
case macPlayerSeparateWindow
case macPlayerFloating
case playerSheetAutoResize
case listStyle
@@ -136,7 +137,8 @@ enum SettingsKey: String, CaseIterable {
/// in both UserDefaults and iCloud, so each platform family syncs independently.
var isPlatformSpecific: Bool {
switch self {
case .preferredQuality, .cellularQuality, .allowSoftwareDecodedFormats, .macPlayerMode, .listStyle,
case .preferredQuality, .cellularQuality, .allowSoftwareDecodedFormats,
.macPlayerSeparateWindow, .macPlayerFloating, .listStyle,
// Home layout different UI paradigms per platform
.homeShortcutOrder, .homeShortcutVisibility, .homeShortcutLayout, .homeShortcutCardStyle,
.homeShortcutColorfulPalette, .homeShortcutCustomPaletteColors,

View File

@@ -68,14 +68,30 @@ extension SettingsManager {
#endif
#if os(macOS)
var macPlayerMode: MacPlayerMode {
/// Whether the expanded player opens in a separate window (vs. an inline sheet).
/// Default is `true`.
var macPlayerSeparateWindow: Bool {
get {
if let cached = _macPlayerMode { return cached }
return MacPlayerMode(rawValue: string(for: .macPlayerMode) ?? "") ?? .window
if let cached = _macPlayerSeparateWindow { return cached }
return bool(for: .macPlayerSeparateWindow, default: true)
}
set {
_macPlayerMode = newValue
set(newValue.rawValue, for: .macPlayerMode)
_macPlayerSeparateWindow = newValue
set(newValue, for: .macPlayerSeparateWindow)
}
}
/// Whether the separate player window floats above other windows (always on top).
/// Toggled live from the player's top-bar pin button and remembered across sessions.
/// Default is `false`.
var macPlayerFloating: Bool {
get {
if let cached = _macPlayerFloating { return cached }
return bool(for: .macPlayerFloating, default: false)
}
set {
_macPlayerFloating = newValue
set(newValue, for: .macPlayerFloating)
}
}

View File

@@ -201,37 +201,6 @@ enum DownloadQuality: String, CaseIterable, Codable, Sendable {
}
}
// MARK: - macOS Player Mode
#if os(macOS)
enum MacPlayerMode: String, CaseIterable, Codable {
case window
case floatingWindow
case inline
var displayName: String {
switch self {
case .window: return String(localized: "settings.playback.macOS.playerMode.window")
case .floatingWindow: return String(localized: "settings.playback.macOS.playerMode.floatingWindow")
case .inline: return String(localized: "settings.playback.macOS.playerMode.inline")
}
}
/// Whether this mode uses a separate window (vs sheet/inline)
var usesWindow: Bool {
switch self {
case .window, .floatingWindow: return true
case .inline: return false
}
}
/// Whether the window should float above other windows
var isFloating: Bool {
self == .floatingWindow
}
}
#endif
// MARK: - Haptic Feedback
/// Intensity levels for haptic feedback.

View File

@@ -72,7 +72,8 @@ final class SettingsManager {
var _preferPortraitBrowsing: Bool?
#endif
#if os(macOS)
var _macPlayerMode: MacPlayerMode?
var _macPlayerSeparateWindow: Bool?
var _macPlayerFloating: Bool?
var _playerSheetAutoResize: Bool?
#endif
@@ -456,7 +457,8 @@ final class SettingsManager {
_syncSearchHistory = nil
_searchHistoryLimit = nil
#if os(macOS)
_macPlayerMode = nil
_macPlayerSeparateWindow = nil
_macPlayerFloating = nil
_playerSheetAutoResize = nil
#endif
// miniPlayerShowVideo and miniPlayerVideoTapAction moved to preset