[GH-ISSUE #706] Possible solution for refocus and enable_media_control? #418

Closed
opened 2026-03-02 23:47:22 +03:00 by kerem · 1 comment
Owner

Originally created by @llanosrocas on GitHub (Apr 10, 2025).
Original GitHub issue: https://github.com/aome510/spotify-player/issues/706

Is your feature request related to a problem? Please describe.
Yes. As described in the docs, when enable_media_control is enabled, the user needs to manually re-focus the terminal.

Describe the solution you'd like
For macos, there is a built-in tool called osascript used for automation. By using the command:

osascript -e 'tell application "kitty" to activate'

you can bring focus to apps. Maybe it's possible to use this to solve the focus issue on macos?

Describe alternatives you've considered
I've experimented with commands, and this works for me:

(sleep 1 && osascript -e 'tell application "kitty" to activate' > /dev/null 2>&1) &! spotify_player

or as alias:

alias spf="(sleep 1 && osascript -e 'tell application \"kitty\" to activate' > /dev/null 2>&1) &! spotify_player"

I will test it over the next several days, though.

Additional context

zsh 5.9
kitty 0.41.1
spotify_player 0.20.4
Macos Ventura 13.7.5
Originally created by @llanosrocas on GitHub (Apr 10, 2025). Original GitHub issue: https://github.com/aome510/spotify-player/issues/706 **Is your feature request related to a problem? Please describe.** Yes. As described in the [docs](https://github.com/aome510/spotify-player/blob/master/docs/config.md#media-control), when `enable_media_control` is enabled, the user needs to manually re-focus the terminal. **Describe the solution you'd like** For macos, there is a built-in tool called [osascript](https://ss64.com/mac/osascript.html) used for automation. By using the command: ```sh osascript -e 'tell application "kitty" to activate' ``` you can bring focus to apps. Maybe it's possible to use this to solve the focus issue on macos? **Describe alternatives you've considered** I've experimented with commands, and this works for me: ```sh (sleep 1 && osascript -e 'tell application "kitty" to activate' > /dev/null 2>&1) &! spotify_player ``` or as alias: ```sh alias spf="(sleep 1 && osascript -e 'tell application \"kitty\" to activate' > /dev/null 2>&1) &! spotify_player" ``` I will test it over the next several days, though. **Additional context** ``` zsh 5.9 kitty 0.41.1 spotify_player 0.20.4 Macos Ventura 13.7.5 ```
kerem 2026-03-02 23:47:22 +03:00
Author
Owner

@llanosrocas commented on GitHub (Jun 23, 2025):

Just want to share my feedback after several months. It works.

<!-- gh-comment-id:2998092916 --> @llanosrocas commented on GitHub (Jun 23, 2025): Just want to share my feedback after several months. It works.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotify-player#418
No description provided.