Skip to content

Instantly share code, notes, and snippets.

@pyrho
Created March 23, 2020 16:11
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pyrho/d2f4fe152eb8113b1956edd6d7456862 to your computer and use it in GitHub Desktop.
Save pyrho/d2f4fe152eb8113b1956edd6d7456862 to your computer and use it in GitHub Desktop.
Alfred Kitty custom terminal integration
on alfred_script(q)
do shell script "/Applications/Kitty.app/Contents/MacOS/kitty @ --to unix:/tmp/mykitty new-window --new-tab"
tell application "kitty" to activate
tell application "System Events" to keystroke q
tell application "System Events"
key code 36 -- enter key
end tell
end alfred_script
@pyrho
Copy link
Author

pyrho commented Mar 23, 2020

@SebastienWae
Copy link

Thanks, I had some issue with your solution because it's not working when Kitty is not already running (which is normal) but weirdly it also wasn't working when it was simply minimised, so I took your idea of using Kitty remote control and added on to it, it's not perfect but so far I had no issue.
https://gist.github.com/SebastienWae/4211d4b2b4c8abde449d69bf9c40175f

@pyrho
Copy link
Author

pyrho commented Jun 8, 2020

Glad that it helped :) Thanks for letting me know.

@CodeCorrupt
Copy link

I started from this and dug into it a bit and found an alternative solution that works a bit better for me. Figured I'd share here

on alfred_script(q)
 tell application "kitty" to activate
 -- Note: For me, installing with Homebrew, `kitty` was lowercase
 do shell script "/Applications/kitty.app/Contents/MacOS/kitty @ --to=unix:/tmp/alfred_kitty.sock launch --hold --type=os-window \"" & q & "\""
end alfred_script

@pyrho
Copy link
Author

pyrho commented Jul 1, 2022

Thank you for sharing this with us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment