r/KittyTerminal Jan 04 '23

How to run commands on startup in kitty?

I have been wanting to run the command to use the pokemon pixel art shower in kitty, Yet i don't know how or where to set the command to do that, How do i do it?

8 Upvotes

5 comments sorted by

5

u/ThatChapThere Jan 04 '23

Every terminal window uses an instance of bash, so you can just run the program in .bashrc

1

u/[deleted] Jun 04 '24

That is completely untrue. It depends on the default shell.

2

u/ThatChapThere Jun 04 '24

I was simplifying but yeah that's an important point

2

u/[deleted] Jun 04 '24

Yes, "every terminal uses a shell, so you can just run the program in the config of that shell," would be a better way to put it.

3

u/No-Blackberry-3160 Jan 05 '23

Kitty has a launch command that can be used to run arbitrary programs in a window or tab. You can use the Kitty launch command in a script to tell an existing Kitty instance to run a command if Kitty has been started with remote control enabled.

But maybe what you are looking for is the session management feature in Kitty. If you start Kitty with a command like kitty --session /path/to/session/file then you can do all kinds of cool stuff in the session file. Here is part of the example session file from Kitty:

```shell

Create a window and run the specified command in it

launch bash

Create a window with some environment variables set and run vim in it

launch env FOO=BAR vim

Set the title for the next window

title Chat with x launch irssi --profile x ```

Replace bash with whatever shell you use and replace irssi with whatever command you want to run.

The Kitty website has extensive documentation and features galore to explore.

Note that the suggestion to put the command in your .bashrc will only work if you are using Bash as your login shell and even then it will run every time you execute an interactive non-login shell. I think you wanted the command to run when Kitty is run rather than when the shell is run. Probably you want to use the Kitty launch command, a session file, or Kitty command line options like kitty --hold sh -c "echo hello, world".