From b5b6f251a7df5935004d8accc96f3d6e7399629e Mon Sep 17 00:00:00 2001 From: Tio <143533040+AgustioMaitimu@users.noreply.github.com> Date: Wed, 13 May 2026 12:41:54 +0700 Subject: [PATCH] feat: add toggles for exclusive fullscreen karaoke and no background --- Localizable.xcstrings | 9 +++++++ Lyric Fever.xcodeproj/project.pbxproj | 4 ++-- LyricFever/KaraokeSettings.swift | 24 +++++++++++++++---- .../Support Files/UserDefaultStorage.swift | 6 +++++ LyricFever/ViewModel.swift | 3 ++- .../Views/KaraokeView/FloatingPanel.swift | 14 ++++++++++- .../Views/KaraokeView/KaraokeView.swift | 15 ++++++++---- 7 files changed, 63 insertions(+), 12 deletions(-) diff --git a/Localizable.xcstrings b/Localizable.xcstrings index 8cd6d4f..b4a37c9 100644 --- a/Localizable.xcstrings +++ b/Localizable.xcstrings @@ -261,6 +261,7 @@ } }, "Album Name" : { + "extractionState" : "stale", "localizations" : { "zh-Hans" : { "stringUnit" : { @@ -372,6 +373,7 @@ } }, "Artist Name" : { + "extractionState" : "stale", "localizations" : { "zh-Hans" : { "stringUnit" : { @@ -1327,6 +1329,7 @@ } }, "Lyric Provider" : { + "extractionState" : "stale", "localizations" : { "zh-Hans" : { "stringUnit" : { @@ -1528,6 +1531,9 @@ } } } + }, + "No background at all" : { + }, "No Translation ☹️" : { "localizations" : { @@ -2358,6 +2364,9 @@ } } } + }, + "Show Karaoke window over exclusive fullscreen apps (e.g. certain games)" : { + }, "Show lyrics (⌘ + H)" : { "localizations" : { diff --git a/Lyric Fever.xcodeproj/project.pbxproj b/Lyric Fever.xcodeproj/project.pbxproj index 1026c9e..ad233de 100644 --- a/Lyric Fever.xcodeproj/project.pbxproj +++ b/Lyric Fever.xcodeproj/project.pbxproj @@ -428,7 +428,7 @@ CURRENT_PROJECT_VERSION = 3.3; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_ASSET_PATHS = ""; - DEVELOPMENT_TEAM = 38TP6LZLJ5; + DEVELOPMENT_TEAM = 9ASBJ87RVR; ENABLE_APP_SANDBOX = YES; ENABLE_HARDENED_RUNTIME = YES; ENABLE_PREVIEWS = YES; @@ -467,7 +467,7 @@ CURRENT_PROJECT_VERSION = 3.3; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_ASSET_PATHS = ""; - DEVELOPMENT_TEAM = 38TP6LZLJ5; + DEVELOPMENT_TEAM = 9ASBJ87RVR; ENABLE_APP_SANDBOX = YES; ENABLE_HARDENED_RUNTIME = YES; ENABLE_PREVIEWS = YES; diff --git a/LyricFever/KaraokeSettings.swift b/LyricFever/KaraokeSettings.swift index fc73f75..700afcd 100644 --- a/LyricFever/KaraokeSettings.swift +++ b/LyricFever/KaraokeSettings.swift @@ -17,6 +17,8 @@ struct KaraokeSettingsView: View { @AppStorage("karaokeModeHoveringSetting") var karaokeModeHoveringSetting: Bool = false @AppStorage("karaokeShowMultilingual") var karaokeShowMultilingual: Bool = true @AppStorage("karaokeTransparency") var karaokeTransparency: Double = 50 + @AppStorage("karaokeShowOverFullscreen") var karaokeShowOverFullscreen: Bool = false + @AppStorage("karaokeNoBackground") var karaokeNoBackground: Bool = false var colorBinding: Binding { Binding { @@ -39,18 +41,30 @@ struct KaraokeSettingsView: View { Text("Show multilingual lyrics when translating in Karaoke window") } .toggleStyle(.checkbox) + Toggle(isOn: $karaokeShowOverFullscreen) { + Text("Show Karaoke window over exclusive fullscreen apps (e.g. certain games)") + } + .toggleStyle(.checkbox) .padding(.bottom, 20) Text("Karaoke Background Appearance") .font(.system(size: 15, weight: .bold)) - Toggle(isOn: $karaokeUseAlbumColor) { - Text("Use album color for Karaoke window") + Toggle(isOn: $karaokeNoBackground) { + Text("No background at all") } .toggleStyle(.checkbox) - if !karaokeUseAlbumColor { - ColorPicker("Set a background color", selection: colorBinding, supportsOpacity: false) + + Group { + Toggle(isOn: $karaokeUseAlbumColor) { + Text("Use album color for Karaoke window") + } + .toggleStyle(.checkbox) + if !karaokeUseAlbumColor { + ColorPicker("Set a background color", selection: colorBinding, supportsOpacity: false) + } } + .disabled(karaokeNoBackground) Text("Opacity Level: \(Int(karaokeTransparency))%") CompactSlider(value: $karaokeTransparency, in: 1...100, step: 5) { Text("Opacity Level:") @@ -75,6 +89,8 @@ struct KaraokeSettingsView: View { karaokeUseAlbumColor = true viewmodel.userDefaultStorage.karaokeShowMultilingual = true viewmodel.userDefaultStorage.karaokeTransparency = 50 + viewmodel.userDefaultStorage.karaokeNoBackground = false + viewmodel.userDefaultStorage.karaokeShowOverFullscreen = false viewmodel.karaokeFont = NSFont.boldSystemFont(ofSize: 30) // viewmodel.karaokeFontSize = 30 colorBinding.wrappedValue = Color(.sRGB, red: 0.98, green: 0.0, blue: 0.98) diff --git a/LyricFever/Support Files/UserDefaultStorage.swift b/LyricFever/Support Files/UserDefaultStorage.swift index 5821d02..89ad61d 100644 --- a/LyricFever/Support Files/UserDefaultStorage.swift +++ b/LyricFever/Support Files/UserDefaultStorage.swift @@ -52,6 +52,12 @@ class UserDefaultStorage { // User setting: hide karaoke on hover @ObservableUserDefault(.init(key: "karaokeModeHoveringSetting", defaultValue: false, store: .standard)) @ObservationIgnored var karaokeModeHoveringSetting: Bool + + @ObservableUserDefault(.init(key: "karaokeShowOverFullscreen", defaultValue: false, store: .standard)) + @ObservationIgnored var karaokeShowOverFullscreen: Bool + + @ObservableUserDefault(.init(key: "karaokeNoBackground", defaultValue: false, store: .standard)) + @ObservationIgnored var karaokeNoBackground: Bool #endif // @DefaultsKey(userDefaultsKey: "spDcCookie") diff --git a/LyricFever/ViewModel.swift b/LyricFever/ViewModel.swift index 7eb6658..a1eb317 100644 --- a/LyricFever/ViewModel.swift +++ b/LyricFever/ViewModel.swift @@ -24,7 +24,8 @@ import MediaRemoteAdapter static let shared = ViewModel() // Apple Music Tahoe broken AppleScript workaround - let musicController = MediaController(bundleIdentifier: "com.apple.Music") +// let musicController = MediaController(bundleIdentifier: "com.apple.Music") + let musicController = MediaController() // var appleMusicUniqueIdentifier: String? var currentlyPlaying: String? diff --git a/LyricFever/Views/KaraokeView/FloatingPanel.swift b/LyricFever/Views/KaraokeView/FloatingPanel.swift index 8d8bd96..0492dfd 100644 --- a/LyricFever/Views/KaraokeView/FloatingPanel.swift +++ b/LyricFever/Views/KaraokeView/FloatingPanel.swift @@ -42,6 +42,15 @@ struct FloatingPanelModifier: ViewModifier { panel?.fadeOut() } } + .onChange(of: ViewModel.shared.userDefaultStorage.karaokeShowOverFullscreen) { + if ViewModel.shared.userDefaultStorage.karaokeShowOverFullscreen { + panel?.level = .screenSaver + panel?.collectionBehavior.insert(.fullScreenAuxiliary) + } else { + panel?.level = .mainMenu + panel?.collectionBehavior.remove(.fullScreenAuxiliary) + } + } .onChange(of: ViewModel.shared.userDefaultStorage.karaoke) { if !ViewModel.shared.userDefaultStorage.karaoke { panel?.close() @@ -86,9 +95,12 @@ class FloatingPanel: NSPanel { defer: true) isFloatingPanel = true - level = .mainMenu + level = ViewModel.shared.userDefaultStorage.karaokeShowOverFullscreen ? .screenSaver : .mainMenu collectionBehavior.insert(.canJoinAllSpaces) + if ViewModel.shared.userDefaultStorage.karaokeShowOverFullscreen { + collectionBehavior.insert(.fullScreenAuxiliary) + } titleVisibility = .hidden titlebarAppearsTransparent = true isMovableByWindowBackground = false diff --git a/LyricFever/Views/KaraokeView/KaraokeView.swift b/LyricFever/Views/KaraokeView/KaraokeView.swift index 2b35121..81bde61 100644 --- a/LyricFever/Views/KaraokeView/KaraokeView.swift +++ b/LyricFever/Views/KaraokeView/KaraokeView.swift @@ -33,6 +33,7 @@ struct KaraokeView: View { @AppStorage("karaokeShowMultilingual") var karaokeShowMultilingual: Bool = true @AppStorage("karaokeUseAlbumColor") var karaokeUseAlbumColor: Bool = true @AppStorage("fixedKaraokeColorHex") var fixedKaraokeColorHex: String = "#2D3CCC" + @AppStorage("karaokeNoBackground") var karaokeNoBackground: Bool = false func currentWords(for currentlyPlayingLyricsIndex: Int) -> String { if !viewmodel.romanizedLyrics.isEmpty { @@ -94,13 +95,19 @@ struct KaraokeView: View { .padding(10) .padding(.horizontal, 10) .background { - currentAlbumArt - .transition(.opacity) - .opacity(karaokeTransparency/100) + if !karaokeNoBackground { + currentAlbumArt + .transition(.opacity) + .opacity(karaokeTransparency/100) + } } // .drawingGroup() .background( - VisualEffectView().ignoresSafeArea() + Group { + if !karaokeNoBackground { + VisualEffectView().ignoresSafeArea() + } + } ) .cornerRadius(16) .onHover { hover in