Add setting to disable OS media player APIs
This commit is contained in:
+13
-9
@@ -191,14 +191,16 @@ func StartupApp(appName, displayAppName, appVersion, appVersionTag, latestReleas
|
|||||||
}
|
}
|
||||||
|
|
||||||
// OS media center integrations
|
// OS media center integrations
|
||||||
// Linux MPRIS
|
if a.Config.Application.EnableOSMediaPlayerAPIs {
|
||||||
a.setupMPRIS(displayAppName)
|
// Linux MPRIS
|
||||||
// MacOS MPNowPlayingInfoCenter
|
a.setupMPRIS(displayAppName)
|
||||||
InitMPMediaHandler(a.PlaybackManager, func(id string) (string, error) {
|
// MacOS MPNowPlayingInfoCenter
|
||||||
a.ImageManager.GetCoverThumbnail(id) // ensure image is cached locally
|
InitMPMediaHandler(a.PlaybackManager, func(id string) (string, error) {
|
||||||
return a.ImageManager.GetCoverArtUrl(id)
|
a.ImageManager.GetCoverThumbnail(id) // ensure image is cached locally
|
||||||
})
|
return a.ImageManager.GetCoverArtUrl(id)
|
||||||
// Windows SMTC is initialized from main once we have a window HWND.
|
})
|
||||||
|
// Windows SMTC is initialized from main once we have a window HWND.
|
||||||
|
}
|
||||||
|
|
||||||
a.startConfigWriter(a.bgrndCtx)
|
a.startConfigWriter(a.bgrndCtx)
|
||||||
|
|
||||||
@@ -458,7 +460,9 @@ func (a *App) Shutdown() {
|
|||||||
if a.ipcServer != nil {
|
if a.ipcServer != nil {
|
||||||
a.ipcServer.Shutdown(a.bgrndCtx)
|
a.ipcServer.Shutdown(a.bgrndCtx)
|
||||||
}
|
}
|
||||||
a.MPRISHandler.Shutdown()
|
if a.MPRISHandler != nil {
|
||||||
|
a.MPRISHandler.Shutdown()
|
||||||
|
}
|
||||||
if a.WinSMTC != nil {
|
if a.WinSMTC != nil {
|
||||||
a.WinSMTC.Shutdown()
|
a.WinSMTC.Shutdown()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ type AppConfig struct {
|
|||||||
DisableDPIDetection bool
|
DisableDPIDetection bool
|
||||||
EnableAutoUpdateChecker bool
|
EnableAutoUpdateChecker bool
|
||||||
RequestTimeoutSeconds int
|
RequestTimeoutSeconds int
|
||||||
|
EnableOSMediaPlayerAPIs bool
|
||||||
|
|
||||||
FontNormalTTF string
|
FontNormalTTF string
|
||||||
FontBoldTTF string
|
FontBoldTTF string
|
||||||
@@ -192,6 +193,7 @@ func DefaultConfig(appVersionTag string) *Config {
|
|||||||
Language: "auto",
|
Language: "auto",
|
||||||
EnableAutoUpdateChecker: true,
|
EnableAutoUpdateChecker: true,
|
||||||
RequestTimeoutSeconds: 15,
|
RequestTimeoutSeconds: 15,
|
||||||
|
EnableOSMediaPlayerAPIs: true,
|
||||||
},
|
},
|
||||||
AlbumPage: AlbumPageConfig{
|
AlbumPage: AlbumPageConfig{
|
||||||
TracklistColumns: []string{"Artist", "Time", "Plays", "Favorite", "Rating"},
|
TracklistColumns: []string{"Artist", "Time", "Plays", "Favorite", "Rating"},
|
||||||
|
|||||||
@@ -91,13 +91,15 @@ func main() {
|
|||||||
mainWindow.Controller.DoConnectToServerWorkflow(defaultServer)
|
mainWindow.Controller.DoConnectToServerWorkflow(defaultServer)
|
||||||
}
|
}
|
||||||
|
|
||||||
mainWindow.Window.(driver.NativeWindow).RunNative(func(ctx any) {
|
if myApp.Config.Application.EnableOSMediaPlayerAPIs {
|
||||||
// intialize Windows SMTC
|
mainWindow.Window.(driver.NativeWindow).RunNative(func(ctx any) {
|
||||||
if runtime.GOOS == "windows" {
|
// intialize Windows SMTC
|
||||||
hwnd := ctx.(driver.WindowsWindowContext).HWND
|
if runtime.GOOS == "windows" {
|
||||||
myApp.SetupWindowsSMTC(hwnd)
|
hwnd := ctx.(driver.WindowsWindowContext).HWND
|
||||||
}
|
myApp.SetupWindowsSMTC(hwnd)
|
||||||
})
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
fyneApp.Lifecycle().SetOnEnteredForeground(windowStartupTasks)
|
fyneApp.Lifecycle().SetOnEnteredForeground(windowStartupTasks)
|
||||||
|
|
||||||
|
|||||||
@@ -76,6 +76,7 @@
|
|||||||
"Edit Playlist": "Edit Playlist",
|
"Edit Playlist": "Edit Playlist",
|
||||||
"Edit server": "Edit server",
|
"Edit server": "Edit server",
|
||||||
"Enable LrcLib lyrics fetcher": "Enable LrcLib lyrics fetcher",
|
"Enable LrcLib lyrics fetcher": "Enable LrcLib lyrics fetcher",
|
||||||
|
"Enable OS media player integration": "Enable OS media player integration",
|
||||||
"Enable system tray": "Enable system tray",
|
"Enable system tray": "Enable system tray",
|
||||||
"Enabled": "Enabled",
|
"Enabled": "Enabled",
|
||||||
"Enter": "Enter",
|
"Enter": "Enter",
|
||||||
|
|||||||
@@ -562,11 +562,18 @@ func (s *SettingsDialog) createAdvancedTab() *container.TabItem {
|
|||||||
widget.NewLabel("MB"),
|
widget.NewLabel("MB"),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
osMediaAPIs := widget.NewCheck(lang.L("Enable OS media player integration"), func(b bool) {
|
||||||
|
s.config.Application.EnableOSMediaPlayerAPIs = b
|
||||||
|
s.setRestartRequired()
|
||||||
|
})
|
||||||
|
osMediaAPIs.Checked = s.config.Application.EnableOSMediaPlayerAPIs
|
||||||
|
|
||||||
return container.NewTabItem(lang.L("Advanced"), container.NewVBox(
|
return container.NewTabItem(lang.L("Advanced"), container.NewVBox(
|
||||||
multi,
|
multi,
|
||||||
sslSkip,
|
sslSkip,
|
||||||
update,
|
update,
|
||||||
lrclib,
|
lrclib,
|
||||||
|
osMediaAPIs,
|
||||||
imgCacheCfg,
|
imgCacheCfg,
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user