wbond / sublime_terminal

Launch terminals from the current file or the root project folder
https://packagecontrol.io/packages/Terminal
MIT License
600 stars 117 forks source link

How to add Hyper with terminal? #149

Closed felipefialho closed 7 years ago

felipefialho commented 7 years ago

hyper.is

Can you help me?

twolfson commented 7 years ago

It can be configured as with any other Terminal, open Terminal settings via "Preferences > Package Settings > Terminal > Settings – User" and update the entry to hyper:

https://github.com/wbond/sublime_terminal/tree/1.14.0#package-settings

{
  "terminal": "hyper"
}
felipefialho commented 7 years ago

I tested it, but, doesn't work.

screen shot 2016-12-20 at 23 44 41
twolfson commented 7 years ago

Ah, I assumed since hyper was Node.js/Electron based there would be a CLI command on all platforms:

https://github.com/zeit/hyper/blob/1.0.0/package.json

It looks like you are on OS X so you'll need to write up bash script that calls AppleScript to invoke the "Hyper" application. Here's a basic script for Terminal:

https://github.com/wbond/sublime_terminal/blob/1.14.0/Terminal.sh

I'm going to guess Hyper's would look something like:

hyper.sh:

#!/bin/bash

CD_CMD="cd "\\\"$(pwd)\\\"" && clear"
if echo "$SHELL" | grep -E "/fish$" &> /dev/null; then
  CD_CMD="cd "\\\"$(pwd)\\\""; and clear"
fi
osascript<<END
try
    tell application "System Events"
        if (count(processes whose name is "Hyper")) is 0 then
            tell application "Hyper"
                activate
                do script "$CD_CMD"
            end tell
        else
            tell application "Hyper"
                activate
                do script "$CD_CMD"
            end tell
        end if
    end tell
end try
END

Then, update the Terminal settings to call the script:

{
  "terminal": "path/to/hyper.sh"
}

I know Hyper is relatively new but getting a lot of traction. If there's enough requests, I think we would be happy to add a script to this repo :+1: