You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I also removed the sh wrapper that is used only because hotkey accepts a single command.
The first line is quite simple. It checks whether there is a Kitty process running, and if there isn't, the second line is evaluated to start Kitty.
It runs Kitty like a deamon to let you always reuse the Kitty singleton rather than create a new process. -1 for single instance, --detach to make it detach from the sh wrapper so the latter can exit after these commands, --start-as hidden to hide the OS window, and -o allow_remote_control=socket-only --listen-on unix:@kitty for remote control (will explain latter). You probably also want --session none if you have startup session set in your configuration.
If your sleep implementation supports sleep infinity, you may put it at the end of the kitty command, so the "background window" will sleep instead of starting a shell. This could reduce the wasted memory usage, especially shells could have memory leak. A random large number also works if infinity isn't supported, since your computer probably won't be up for 292 billion years.
And the third line tries to focus the last used window because I don't want to have multiple OS windows opened; you can remove this line if you don't like that, or maybe do other things. It needs remote control to allow kitten @ to control the Kitty process, so I set Unix socket above; you can also set these in your config file instead of overwritting by CLI. The state:focused is true for the last focused window even after you no longer focus on Kitty, so you'll be able to go back where you were, and the not id:1 excludes the first window in the hidden OS window.
Then, the fourth line launches an OS window of Kitty if there isn't one (kitten @ fails if such window doesn't exist).
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I want to share how I launch Kitty faster on my laptop. Hope this helps you too.
TL;DR Set a hotkey (if you like) to run the following command:
sh -c 'ps -C kitty >/dev/null || kitty -1 --detach --start-as hidden -o allow_remote_control=socket-only --listen-on unix:@kitty; kitten @ --to unix:@kitty focus-window -m "not id:1 and state:focused" 2>/dev/null || kitty -1'It's a bit long so I split it into few lines to explain the intent here. Though it's mostly useless if you read the documentation.
I also removed the
shwrapper that is used only because hotkey accepts a single command.The first line is quite simple. It checks whether there is a Kitty process running, and if there isn't, the second line is evaluated to start Kitty.
It runs Kitty like a deamon to let you always reuse the Kitty singleton rather than create a new process.
-1for single instance,--detachto make it detach from theshwrapper so the latter can exit after these commands,--start-as hiddento hide the OS window, and-o allow_remote_control=socket-only --listen-on unix:@kittyfor remote control (will explain latter). You probably also want--session noneif you have startup session set in your configuration.If your
sleepimplementation supportssleep infinity, you may put it at the end of thekittycommand, so the "background window" will sleep instead of starting a shell. This could reduce the wasted memory usage, especially shells could have memory leak. A random large number also works ifinfinityisn't supported, since your computer probably won't be up for 292 billion years.And the third line tries to focus the last used window because I don't want to have multiple OS windows opened; you can remove this line if you don't like that, or maybe do other things. It needs remote control to allow
kitten @to control the Kitty process, so I set Unix socket above; you can also set these in your config file instead of overwritting by CLI. Thestate:focusedis true for the last focused window even after you no longer focus on Kitty, so you'll be able to go back where you were, and thenot id:1excludes the first window in the hidden OS window.Then, the fourth line launches an OS window of Kitty if there isn't one (
kitten @fails if such window doesn't exist).All reactions