-
Notifications
You must be signed in to change notification settings - Fork 443
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RunCommand: finish WarpTerminal support
- Loading branch information
Showing
6 changed files
with
78 additions
and
38 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,17 @@ | ||
RunCommand | ||
============== | ||
# RunCommand | ||
|
||
Run Terminal Command extension for PopClip. | ||
|
||
One can choose either Terminal or iTerm2. | ||
Runs the selected text as a command in the current Terminal window. | ||
|
||
One can choose either Terminal, iTerm2 or Warp Terminal. | ||
|
||
2 Jun 2015: Separated the two sides into separate actions. Having both apps referenced in one script was causing problems. | ||
|
||
19 Feb 2016: Added third config option to support iTerm2 v2.9 and above, which has breaking AppleScript changes. | ||
|
||
28 Mar 2024: Added fourth config option to support Warp Terminal. | ||
|
||
Credits | ||
------- | ||
Original extension and icon created by [James Smith](https://twitter.com/smithjw/status/244757999665700864). | ||
28 Mar 2024: Removed the legacy iTerm option and added Warp Terminal. | ||
|
||
iTerm option added by [honnix](https://github.com/honnix). | ||
## Credits | ||
|
||
Original extension and icon created by [James Smith](https://twitter.com/smithjw/status/244757999665700864). iTerm option added by [honnix](https://github.com/honnix). Warp support added by Oliver using script from [parterburn](https://gist.github.com/parterburn/e832b9090ee35eb830529de8bd978b82). |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,62 @@ | ||
tell application "Warp" | ||
activate | ||
-- If there are no open windows, open one. | ||
if (count of windows) is less than 1 then | ||
do script "" | ||
end if | ||
set theTab to selected tab in first window | ||
do script "{popclip text}" in theTab | ||
end tell | ||
-- For the latest version: | ||
-- https://gist.github.com/parterburn/e832b9090ee35eb830529de8bd978b82 | ||
|
||
-- Set this property to true to always open in a new window | ||
property open_in_new_window : false | ||
|
||
-- Set this property to false to reuse the current tab | ||
property open_in_new_tab : false | ||
|
||
-- Handlers | ||
on new_window() | ||
tell application "System Events" | ||
tell process "Warp" | ||
keystroke "n" using command down | ||
end tell | ||
end tell | ||
end new_window | ||
|
||
on new_tab() | ||
tell application "System Events" | ||
tell process "Warp" | ||
keystroke "t" using command down | ||
end tell | ||
end tell | ||
end new_tab | ||
|
||
on call_forward() | ||
tell application "Warp" | ||
activate | ||
tell application "System Events" | ||
tell process "Warp" | ||
set frontmost to true | ||
end tell | ||
end tell | ||
end tell | ||
end call_forward | ||
|
||
on send_text(custom_text) | ||
tell application "System Events" | ||
tell process "Warp" | ||
delay 0.5 | ||
keystroke custom_text | ||
delay 0.5 | ||
key code 36 | ||
end tell | ||
end tell | ||
end send_text | ||
|
||
-- Main | ||
|
||
call_forward() | ||
|
||
if open_in_new_window then | ||
new_window() | ||
else if open_in_new_tab then | ||
new_tab() | ||
else | ||
-- Reuse the current tab | ||
end if | ||
|
||
call_forward() | ||
send_text("{popclip text}") |