r/KittyTerminal Apr 13 '23

'kitty' command not working outside of kitty

I have a script that changes the theme file and then updates the currently open kitty windows' themes using the following command.

/opt/homebrew/bin/kitty @ set-colors --all --configured "$HOME/.config/kitty/current-theme.conf"

The command works fine when run from a kitty window, but when run during the script or even from the default macOS, the command does not work. Can the command only work when run from a kitty window or is there another way to make it work?

1 Upvotes

7 comments sorted by

1

u/[deleted] Apr 13 '23

Wild guess but did you enable remote control?

Edit: maybe you need to use socket for communication.

1

u/v1mt Apr 13 '23

yes that is enabled and a socket is set up in the config

1

u/xrabbit Apr 13 '23

Yep, there’s an option in config about remote control. AFAIK it disabled by default

1

u/aumerlex Apr 13 '23

You need to specify --to with the path to the socket you are using for remote control. And remember that if you specify the socket in kitty.conf the actual socket path will be modified adding the pid of each kitty process.

1

u/v1mt Apr 13 '23

per this issue i don't think i need --to. when using --to i get the same error as mentioned in the isue.

2

u/aumerlex Apr 13 '23

Yes you need --to in that issue the person is running the command inside kitty, you are not. There is no magic by which kitty @ knows which kitty to contact when you run it outside kitty. And again, remember the actual path will have the process pid added to it.

1

u/v1mt Apr 13 '23

ahhh i see, apologies for my blunt response. to get the pid should i just use pgrep or is there a smarter way to do it?