Closed devth closed 4 years ago
Well macOS makes things difficult. But lets see what we can do. For (1) simply add 2>&1 >/dev/null & to the command line.
For (2) I would suggest using a more powerful window manager such as chunkWM or similar and putting your kitty sessions on individual workspaces (this is how I personally work in linux). However, another possibility is to use the kitty remote control protocol to switch sessions. You will need to write a small script that runs kitty @ ls
lists out the windows, asks the user for their choice and then runs kitty @ focus-window chosen-id
Feel free to post if you have more questions.
Great idea, I'll play with remote control. Thanks!
Oh and for (2) you would be even better of writing a custom kitten, that way no need to even bother with remote control. https://sw.kovidgoyal.net/kitty/kittens/custom.html
It's not possible to set the title of the kitty window to be something other than kitty
, right? I'm guessing that's an OS level thing.
kitty --title sets the window title, but the macOS switcher probably wont use it.
Oh and the simplest thing for you to do is to have only a single instance of kitty with multiple top level OS windows and switch between them with cmd+`
kitty --title sets the window title, but the macOS switcher probably wont use it.
Right, macOS switcher does not use it
Oh and the simplest thing for you to do is to have only a single instance of kitty
For some reason this does not work if I create the window with my zsh helper:
function kits() {
session=$@
kitty \
--session ~/.dotfiles/config/kitty/session/${session}.conf \
--start-as fullscreen \
--title {session} \
--listen-on unix:/tmp/kitty-${session} \
</dev/null &>/dev/null &
}
Instead this creates a whole new instance of kitty
. But If i simply use cmd+n
to create a new window, then it does not create a new instance, which is desirable. Can remote control create a new window with a session?
On Tue, Mar 10, 2020 at 11:08:56AM -0700, Trevor Hartman wrote:
Oh and the simplest thing for you to do is to have only a single instance of kitty
For some reason this does not work if I create the window with my zsh helper:
function kits() { session=$@ kitty \ --session ~/.dotfiles/config/kitty/session/${session}.conf \ --start-as fullscreen \ --title {session} \ --listen-on unix:/tmp/kitty-${session} \ </dev/null &>/dev/null & }
Instead this creates a whole new instance of
kitty
. But If i simply usecmd+n
to create a new window, then it does not create a new instance, which is desirable. Can remote control create a new window with a session?
yes it can, though not with a session file, but every command in the session file has its remote control equivalent, so use thos edirectly in a script.
Ang you dot need to use remote control for this either. Just use --single-instance
I stumbled on this thread a little while back, as I was also interested in the session switcher functionality of tmux. Anyway, I started building a thing: https://github.com/guysherman/kittymux
Since this thread still comes up in the first results when searching for "tmux sessions in kitty", I thought I'd share what I've come up with. Following @kovidgoyal's recommendations I used custom kittens, with os windows treated as sessions.
By default sessions are numbered starting from 0, but you can assign them a name like in tmux, and you can switch between sessions using the following UI:
The implementation is quite rough and tailored to my workflow (I don't need feature parity with the original tmux session switcher), but I've been using it for a week and I don't miss tmux anymore. If anybody's interested the code is here, with the relevant parts being
ctrl+cmd+s
to mimic tmux's default binding. Most of the code handles the tabs preview, but the rest is pretty simple.ctrl+cmd+$
.Session names are kept in ~/.kitty-sessions.json
, and I use the following session file to clear old session names when kitty starts:
launch sh -c "echo '{}' > $HOME/.kitty-sessions.json"
new_os_window
focus_os_window
@kimlai thank you for custom kittens ❤️ It helped me to replace tmux workflow completely.
One thing I still missing though is fuzzy search in the session switcher. Maybe one day I will implement it and share it with you : )
Context
I've been using kitty casually for about a year. I previously used tmux + tmuxinator + vim + zsh as my IDE. Though I love tmux's functionality, it is insanely slow on macOS for some reason that no one seems to be able to figure out; I had to abandon it.
Last year's experiment was to see if I could replace tmux with neovim and its terminal support. This worked fairly well but had some bugs and downsides so I'm re-evaluating. I tried tmux again: it's still incredibly slow. Then I realized kitty has a lot of the features I'm after and am now on a quest to see how closely it can resemble my old amazing (but slow) tmux/tmuxinator setup.
Using kitty tabs for multiple instances of vim+terminals for a single "project". For example, an open source chat bot I work on, Yetibot, might have 3 tabs for different components of the project like this (actually it has a lot more than 3 tabs):
Using kitty sessions per project. So I'll have a session for Yetibot that might look like:
and another project would have its own multi-tab config. This is a super nice and flexible way to be able to hack on a project with all related components, terminals, and automation setup.
An important part of my IDE is the ability to send keys from vim to a terminal. I usually like to have 2 terminals and an editor on every tab. 1 term might run a repl and the other's available for everything else. Currently I hacked together a vimscript thing (despite using vim for over a decade I can't vimscript):
Questions
Main things I'm missing and still trying to figure are:
Quickly launching new sessions
I did a zsh thing to help:
But this results in an active process in the terminal that launched it:
I want to be able to launch new sessions from anywhere without imparting a parent/child relationship or seeing log output of the session.
Quickly switching between running sessions
tmux had a built in session switcher utility which I could map to a hotkey. It looked something like this:
In kitty, every time I launch a session I end up with another unidentifiable kitty instance which turns my app switcher menu into something like this:
Is there a better way? I very much liked the tmux session switcher.
Thanks
Thank you for this amazing project. After recently diving much more in depth to the issues and docs I'm thoroughly impressed with kitty's capabilities. And best of all, it's blazing fast. ⚡️
This is possibly related to https://github.com/kovidgoyal/kitty/issues/391