fitztrev / shuttle

A simple shortcut menu for macOS
http://fitztrev.github.io/shuttle/
MIT License
4.55k stars 393 forks source link

How to use warp terminal to run my cmd? #282

Open zhangyc310 opened 2 years ago

zhangyc310 commented 2 years ago

I like shuttle, it helped me. Now I try warp terminal , and It looks great. Now shuttle support iterm and term to run my cmd . How to use warp terminal to run my cmd? May some one help me ?

stefanocurnis commented 2 years ago

Also looking for this. Did you find any solution?

rickbakker commented 1 year ago

I also recently downloaded Warp. Tried to change the iterm.app to warp.app but it's not opening the command in Warp. Instead it's opening in the default terminal instead. Anyone got a fix for that? I see there is also no recent updates to Shuttle which is a shame. Is this something we gotta code ourselfs?

j-like-jeff commented 1 year ago

I'm also looking for using Warp but found no solution.

j-like-jeff commented 1 year ago

Okay got it working..

here is my solution:

.shuttle.json

"terminal": "Terminal.app",

I wrote a custom AppleScript to open warp. Shuttle uses AppleScripts to do that.

warp.applescript

--for testing uncomment the "on run" block
--on run
--  set argsCmd to "ps aux | grep [s]creen"
--  set argsTheme to "Homebrew"
--  set argsTitle to "Custom title"
--  scriptRun(argsCmd, argsTheme, argsTitle)
--end run

on scriptRun(argsCmd, argsTheme, argsTitle)
    set withCmd to (argsCmd)
    set withTheme to (argsTheme)
    set theTitle to (argsTitle)
    CommandRun(withCmd, withTheme, theTitle)
end scriptRun

on CommandRun(withCmd, withTheme, theTitle)
    tell application "Warp"
            activate
            tell application "System Events"
                tell process "Warp"
                    keystroke "t" using command down
                end tell
            end tell
            tell application "System Events"
                tell process "Warp"
                    delay 0.5
                    keystroke withCmd
                    delay 0.5
                    key code 36
                end tell
            end tell

    end tell
end CommandRun

after that you need to replace the old termimal scripts with the new ones:

#!/bin/bash
echo "compiling applescripts for OS X terminal..."
osacompile -o /Applications/Shuttle.app/Contents/Resources/terminal-new-window.scpt -x warp.applescript
osacompile -o /Applications/Shuttle.app/Contents/Resources/terminal-current-window.scpt -x warp.applescript
osacompile -o /Applications/Shuttle.app/Contents/Resources/terminal-new-tab-default.scpt -x warp.applescript
chmod +x compile.sh
./compile.sh

You need to add access for shuttle in your system preferences to use it. Now my shuttle is working fine with warp.

Here you can find the old ones again: Github

I forked the Repo with spotlight search integration. When I have enough time I will add Warp to the config Option and release a new build. But not today. This workarround should helps for the moment.

EDIT:

Here is my warp release and changes:

https://github.com/j-like-jeff/shuttle/releases/tag/v1.30-warp

remove old shuttle version, remove it from security panel in system settings, install the new version and add new security preferences for shuttle.

warp Shuttle.app.zip

Currently I check for Spotlight Integration. It is working but got a strange error with (null) on search and my programming time in objective-c is a long time ago.. maybe @ObladiObladaLifeGoesOn can help.

Bildschirm­foto 2023-02-06 um 20 44 27

rickbakker commented 1 year ago

That does the job pretty well :) Thanks for your effort!