Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable URI Scheme handler for ssh:// #2847

Closed
rtgibbons opened this issue Jul 11, 2020 · 3 comments
Closed

Enable URI Scheme handler for ssh:// #2847

rtgibbons opened this issue Jul 11, 2020 · 3 comments

Comments

@rtgibbons
Copy link

Is your feature request related to a problem? Please describe.
When trying to open SSH connections from external applications; They'll send the URI ssh://user@server:port , Using SwiftDefaultApps (newer RCDefaultApps) I can switch the ssh:// handler to kitty but it just opens the last use window and not doesn't connect.

Describe the solution you'd like
Please add the ability to associate kitty with ssh:// and provide option to use existing window; use new window or use new tab.

Describe alternatives you've considered
I thought about building an AppleScript to implement as a work around; but it doesn't appear to have Dictionary to be able to manipulate the windows.

@kovidgoyal
Copy link
Owner

I dont know what you are asking for. If you want to open kitty running
ssh, just run

kitty ssh ssh://whatever

If you want a single executable that takes ssh:// urls just create a
simple wrapper script named kitty-ssh or whatever

#!/bin/sh
exec /Applications/kitty.app/Contents/MacOS/kitty ssh "$@"

and put it somewhere in your PATH and chmod +x it

@rtgibbons
Copy link
Author

I want kitty to register itself as a handler for the URL scheme ssh:// - Applications will use the default handler for ssh:// to open up ssh connections instead of just default to the Terminal.app. Or even as the system default terminal application; But i'm not sure if macOS has that anywhere to be defined.

The problem with the script as you have it above is it opens up another instance of Kitty.app , not a window of an existing Kitty.app. I'll look some more as an interim solution.

The goal of having this built into Kitty is control how the handler responds to the existing session (new window, tab, session, etc). But to allow other apps to integrate with Kitty without having every app write custom code to make that work.

By default Terminal.app registers itself as application for

URL Schemes

  • x-man-page
  • telnet
  • ssh

Uniform Type Identifiers
Editor

  • public.directory
  • com.apple.resolvable
  • com.apple.terminal.session
  • com.apple.bundle
  • com.apple.terminal.settings
    Shell
  • com.apple.terminal.shell-script
  • public.unix-executable

Having kitty being able to register and handle each of these is the request. The primary ones for my day to day use are ssh://, com.apple.terminal.session, com.apple.terminal.shell-script and public.unix-executable. Iterm2 actually creates and handles even more. Let me know if I can provide more info.

@kovidgoyal
Copy link
Owner

kovidgoyal commented Jul 12, 2020

If you want to open a new window running ssh or whatever, use remote
control. https://sw.kovidgoyal.net/kitty/remote-control.html
in your shell script wrapper. In particular the launch command https://sw.kovidgoyal.net/kitty/remote-control.html#kitty-launch

Or if you dont want to use remote control, use --single-instance which will cause each invocation to open in a new OS window rather than a new kitty.app

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

No branches or pull requests

2 participants