Kitty: Reload kitty.conf

Created on 13 Jun 2018  路  19Comments  路  Source: kovidgoyal/kitty

Is there a way of reloading the kitty.conf file without restarting kitty?
The use case for this feature would be, for example, to quickly change the colorscheme (from bright to dark).

Most helpful comment

It'd still be useful to be able to reload the kitty.conf file while iterating on configurations. Any chance this is on the upcoming feature list?

All 19 comments

to change colorscheme you can use kitty @ set-colors

Ok, I've enabled remote control and used this command, but the colors still don't change unless I restart kitty.
I've tested 0.11.0.
I've ran the command in kitty.

you should use --all --configured flags to apply colors to all existing and new windows and supply the conf file with colors (your kitty.conf for example).

That worked, thanks!

Not sure why providing the config file (which kitty already knows about) is necessary, but probably will be fixed in the future.

because you can put your coloschemes into separate conf files and source them on demand. or you can just provide a list of colors as commandline arguments. basically, sourcing the default config file is not the only option.

I see.
Maybe not providing any file should fallback to the loaded conf file?

Just for reference, you dont need to enable remote control just to change colors, you can also use terminal escape codes, that work in most terminals, not just kitty https://sw.kovidgoyal.net/kitty/faq.html

And why would you want to change colors back to kitty.conf, since the colors are presumably already set to those in that conf file.

Not sure I understand your question, but basically, I have 2 colorschemes set in kitty.conf and I'd like to switch between them without restarting kitty. Previously, I uncommmented the one I want and commented the other and then restarted kitty. With "@ set-colors" it's just the commenting part :)

Create a second conf file and pass that to @ set-colors, then you dont need to do the commenting part at all.

This is great, thanks!

It'd still be useful to be able to reload the kitty.conf file while iterating on configurations. Any chance this is on the upcoming feature list?

Nope, it is way more effort than it is worth. kitty is far more configurable than pretty much any other terminal emulator, to the extent that even how the OpenGL shaders that kitty uses are compiled depends on kitty.conf

Should I expect kitty @ set-colors to work within tmux? I receive this error:

kitty @ set-colors ~/.config/kitty/themes/ayu_light.conf
Traceback (most recent call last):
  File "Python/runpy.py", line 280, in run_path
  File "Python/runpy.py", line 85, in _run_code
  File "kitty/__main__.py", line 119, in <module>
  File "kitty/__main__.py", line 115, in main
  File "kitty/__main__.py", line 22, in remote_control
  File "kitty/remote_control.py", line 175, in main
  File "kitty/remote_control.py", line 123, in do_io
  File "kitty/remote_control.py", line 103, in recv
TimeoutError: Timed out while waiting to read command response. Make sure you are running this command from within the kitty terminal. If you want to run commands from outside, then you have to setup a socket with the --listen-on command line flag.

macOS 10.15.4
kitty 0.16.0
tmux 3.0a

Edit: Just saw your comment on https://www.bountysource.com/issues/88134667-issuing-remote-control-commands-from-inside-tmux-session

No idea, tmux loves to mess with escape codes it does not understand, so
quite possibly not.

@jesse-c I made kitty @remote_control commands work inside tmux! 馃帀馃帀

I need to implement some hacks because the kitty remote-control program has a direct interaction rather than printing control sequences to stdout; well, but there should be a way to bypass tmux via passthrough sequences. I wish kitty could officially support this by being aware of tmux (@kovidgoyal, what do you think?), but as of now this would be the only way.

Here is the script for you: https://github.com/wookayin/kitty-tmux

On Thu, Mar 26, 2020 at 12:25:06AM -0700, Jongwook Choi wrote:

@jesse-c I made kitty @remote_control commands work inside tmux! 馃帀馃帀

I need to implement some hacks because the kitty remote-control program has a direct interaction rather than printing control sequences to stdout; well, but there should be a way to bypass tmux via passthrough sequences. I wish kitty could officially support this by being aware of tmux (@kovidgoyal, what do you think?), but as of now this would be the only way.

If there is a reliable way to detect tmux other than hacks based on env
vars, sure, otherwise you can always add a command line option to kitty @
to wrap generated escape sequences.

And note that the remote control protocol is actually two way, so you would need to presumably wrap the sequences both ways. Unless tmux only filters them one way for some unfathomable reason. And then there will be the whole tmux inside tux thing, where tmux is not smart enough to not unwrap escape sequences if it is running inside itself. https://github.com/tmux/tmux/issues/846

So that means you will have to wrap things multiple times depending on how many nested tmuxes there are, which you have no way of knowing.

I have enabled remote control, but when I type this command:

kitty @ set-colors --all --configured ~/.config/kitty/kitty.conf

It only changes colors the one terminal I am typing on.

If you're using kitty on Linux, you're probably starting multiple instances. In this case, see https://sw.kovidgoyal.net/kitty/invocation.html#cmdoption-kitty-single-instance.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mihaicristiantanase picture mihaicristiantanase  路  3Comments

jasminabasurita picture jasminabasurita  路  3Comments

Nudin picture Nudin  路  3Comments

hdriqi picture hdriqi  路  3Comments

crocket picture crocket  路  4Comments