-
Notifications
You must be signed in to change notification settings - Fork 28
feat: add AppleScript support for external control #82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
262ca49
1deeeb9
bd3f90f
b7cc4af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!DOCTYPE dictionary SYSTEM "file://localhost/System/Library/DTDs/sdef.dtd"> | ||
| <dictionary title="Kaset Terminology"> | ||
|
|
||
| <!-- Standard Suite --> | ||
| <suite name="Standard Suite" code="????" description="Common classes and commands for all applications."> | ||
|
|
||
| <command name="quit" code="aevtquit" description="Quit the application."> | ||
| <cocoa class="NSQuitCommand"/> | ||
| </command> | ||
|
|
||
| </suite> | ||
|
|
||
| <!-- Kaset Suite --> | ||
| <suite name="Kaset Suite" code="Kast" description="Commands and classes for controlling Kaset."> | ||
|
|
||
| <!-- Playback Commands --> | ||
| <command name="play" code="Kastplay" description="Start or resume playback."> | ||
| <cocoa class="KasetPlayCommand"/> | ||
| </command> | ||
|
|
||
| <command name="pause" code="Kastpaus" description="Pause playback."> | ||
| <cocoa class="KasetPauseCommand"/> | ||
| </command> | ||
|
|
||
| <command name="playpause" code="Kasttogg" description="Toggle play/pause state."> | ||
| <cocoa class="KasetPlayPauseCommand"/> | ||
| </command> | ||
|
|
||
| <command name="next track" code="Kastnext" description="Skip to the next track."> | ||
| <cocoa class="KasetNextTrackCommand"/> | ||
| </command> | ||
|
|
||
| <command name="previous track" code="Kastprev" description="Go to the previous track."> | ||
| <cocoa class="KasetPreviousTrackCommand"/> | ||
| </command> | ||
|
|
||
| <command name="set volume" code="Kastvolu" description="Set the playback volume."> | ||
| <cocoa class="KasetSetVolumeCommand"/> | ||
| <direct-parameter type="integer" description="Volume level (0-100)."/> | ||
| </command> | ||
|
|
||
| <command name="toggle shuffle" code="Kastshuf" description="Toggle shuffle mode."> | ||
| <cocoa class="KasetToggleShuffleCommand"/> | ||
| </command> | ||
|
|
||
| <command name="cycle repeat" code="Kastrepe" description="Cycle through repeat modes (off, all, one)."> | ||
| <cocoa class="KasetCycleRepeatCommand"/> | ||
| </command> | ||
|
|
||
| <command name="toggle mute" code="Kastmute" description="Toggle mute state."> | ||
| <cocoa class="KasetToggleMuteCommand"/> | ||
| </command> | ||
|
|
||
| <command name="get player info" code="Kastinfo" description="Get current player state as JSON."> | ||
| <cocoa class="KasetGetPlayerInfoCommand"/> | ||
| <result type="text" description="JSON string with player state."/> | ||
| </command> | ||
|
|
||
| <command name="like track" code="Kastlike" description="Like or unlike the current track."> | ||
| <cocoa class="KasetLikeTrackCommand"/> | ||
| </command> | ||
|
|
||
| <command name="dislike track" code="Kastdslk" description="Dislike or undislike the current track."> | ||
| <cocoa class="KasetDislikeTrackCommand"/> | ||
| </command> | ||
|
|
||
| </suite> | ||
|
|
||
| </dictionary> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -88,6 +88,9 @@ struct KasetApp: App { | |
| player.setYTMusicClient(client) | ||
| SongLikeStatusManager.shared.setClient(client) | ||
|
|
||
| // Set shared instance for AppleScript access | ||
| PlayerService.shared = player | ||
|
|
||
| // Create account service | ||
| let account = AccountService(ytMusicClient: client, authService: auth) | ||
|
|
||
|
|
@@ -125,10 +128,12 @@ struct KasetApp: App { | |
| .environment(\.searchFocusTrigger, self.$searchFocusTrigger) | ||
| .environment(\.navigationSelection, self.$navigationSelection) | ||
| .environment(\.showCommandBar, self.$showCommandBar) | ||
| .task { | ||
| // Wire up PlayerService to AppDelegate for dock menu actions | ||
| .onAppear { | ||
| // Wire up PlayerService to AppDelegate for dock menu and AppleScript actions | ||
| // This runs synchronously so AppleScript commands can access playerService immediately | ||
| self.appDelegate.playerService = self.playerService | ||
|
|
||
| } | ||
|
Comment on lines
+131
to
+135
|
||
| .task { | ||
| // Check if user is already logged in from previous session | ||
| await self.authService.checkLoginStatus() | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The XML comments use non-standard syntax for plist files. Plist files typically don't use XML comments within the dictionary. While this may work, consider using standard plist structure without inline comments, or document the AppleScript support in a separate documentation file.