-
-
Save willeccles/02228fc54c42942531a072318dcaf82b to your computer and use it in GitHub Desktop.
(* 2019-06-07: Added nohup and output redirection to fix a bug with "Open Terminal here" feature. | |
Thanks to @fools-mate for bringing the issue to my attention. *) | |
on alfred_script(q) | |
do shell script "cd ~; nohup /Applications/kitty.app/Contents/MacOS/kitty /bin/bash -c \"source ~/.bashrc && " & q & ";/bin/bash\" > /dev/null 2>&1 &" | |
end alfred_script |
@aahung I am pretty sure this is a kitty preference, and I haven't noticed this issue before. Not sure what to tell you.
If you want to open a new tab within an existing Kitty instance I came up with this: https://gist.github.com/pyrho/d2f4fe152eb8113b1956edd6d7456862, it's a bit more troublesome to set up, but nothing too hard ^^
I just came across this gist as I was trying to set up this functionality in Alfred, however when I tried using it, it kept splitting my active terminal instead of opening a new tab. I did some digging and it turns out that the new-window
command is deprecated, replaced by the launch
command. Here's the snippet that I was able to come up with that opens a new tab instead of splitting the current one.
on alfred_script(q)
tell application "kitty" to activate
tell application "System Events"
repeat until (exists file "/tmp/mykitty.sock")
delay 6
end repeat
end tell
do shell script "/Applications/kitty.app/Contents/MacOS/kitty @ --to unix:/tmp/mykitty.sock launch --type=tab"
tell application "System Events" to keystroke q
tell application "System Events"
key code 36 -- enter key
end tell
end alfred_script
In addition to this, you will need to ensure that allow_remote_control yes
is present in your ~/.config/kitty/kitty.conf
file, and then also create a new file at ~/.config/kitty/macos-launch-services-cmdline
which contains the following:
--listen-on unix:/tmp/mykitty.sock
This macos-launch-services-cmdline
file is specific to the Mac version of kitty and specifies launch arguments to use, which is the only way I was able to get it to create the necessary socket file for remote control.
Current script will open another instance of kitty.app (extra icon in Dock)