feat: hide running Cocoa receiver from the Dock
This commit is contained in:
parent
c2f67c4781
commit
28748df3c1
2 changed files with 14 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
||||||
from collections.abc import Callable, Coroutine
|
from collections.abc import Callable, Coroutine
|
||||||
from typing import Literal
|
from typing import Literal
|
||||||
|
|
||||||
|
from AppKit import NSApplication, NSApplicationActivationPolicyAccessory
|
||||||
from MediaPlayer import (
|
from MediaPlayer import (
|
||||||
MPChangePlaybackPositionCommandEvent,
|
MPChangePlaybackPositionCommandEvent,
|
||||||
MPMusicPlaybackStatePlaying,
|
MPMusicPlaybackStatePlaying,
|
||||||
|
@ -42,6 +43,9 @@ class CocoaNowPlayingReceiver(Receiver):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
async def start(self, player: Player) -> None:
|
async def start(self, player: Player) -> None:
|
||||||
|
NSApplication.sharedApplication().setActivationPolicy_(
|
||||||
|
NSApplicationActivationPolicyAccessory
|
||||||
|
)
|
||||||
self.cmd_center = MPRemoteCommandCenter.sharedCommandCenter()
|
self.cmd_center = MPRemoteCommandCenter.sharedCommandCenter()
|
||||||
self.info_center = MPNowPlayingInfoCenter.defaultCenter()
|
self.info_center = MPNowPlayingInfoCenter.defaultCenter()
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,16 @@ from typing import Final, Literal
|
||||||
|
|
||||||
from Foundation import CGSize
|
from Foundation import CGSize
|
||||||
|
|
||||||
|
NSApplicationActivationPolicyRegular: Final = 0
|
||||||
|
NSApplicationActivationPolicyAccessory: Final = 1
|
||||||
|
NSApplicationActivationPolicyProhibited: Final = 2
|
||||||
|
NSApplicationActivationPolicy = Literal[0, 1, 2]
|
||||||
|
|
||||||
|
class NSApplication:
|
||||||
|
@staticmethod
|
||||||
|
def sharedApplication() -> NSApplication: ...
|
||||||
|
def setActivationPolicy_(self, policy: NSApplicationActivationPolicy) -> bool: ...
|
||||||
|
|
||||||
# There are many other operations available but we only actually use copy, so we don't need all of them here.
|
# There are many other operations available but we only actually use copy, so we don't need all of them here.
|
||||||
NSCompositingOperationClear: Final = 0
|
NSCompositingOperationClear: Final = 0
|
||||||
NSCompositingOperationCopy: Final = 1
|
NSCompositingOperationCopy: Final = 1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue