Skip to content

Commit

Permalink
Add trigger for iTerm commands
Browse files Browse the repository at this point in the history
  • Loading branch information
SpencerCDixon committed Oct 26, 2023
1 parent b314902 commit f78f109
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
8 changes: 8 additions & 0 deletions iterm-command/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# iTerm Command

Run any command via iTerm when joining a specific room.

Arguments of the script:

- `ROOM_NAME` - stringified name
- `COMMAND` - what you want executed in the iTerm window
Binary file added iterm-command/assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions iterm-command/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "iTerm Command",
"description": "Run any command via iTerm when joining a room.",
"platforms": ["macos"],
"language": "bash"
}
33 changes: 33 additions & 0 deletions iterm-command/room-joined
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash

COMMAND="echo 'Replace me'"
ROOM_NAME="Standup"

if [ -z "$TUPLE_HOOK_IS_SELF" ]; then
exit 0
fi

if [ "$ROOM_NAME" != "$TUPLE_TRIGGER_ROOM_NAME" ]; then
exit 0
fi


osascript <<END
tell application "iTerm"
activate
if (count of windows) = 0 then
set newWindow to (create window with default profile)
else
set newWindow to current window
end if
tell newWindow
set newTab to (create tab with default profile)
tell newTab
tell current session
write text "${COMMAND}"
end tell
end tell
end tell
end tell
END

0 comments on commit f78f109

Please sign in to comment.