Skip to content

Instantly share code, notes, and snippets.

@geoffeg
Created July 10, 2019 00:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geoffeg/6c44926cbc23c190fd74876aa45c8954 to your computer and use it in GitHub Desktop.
Save geoffeg/6c44926cbc23c190fd74876aa45c8954 to your computer and use it in GitHub Desktop.
#!/bin/bash
password=`~/bin/opfzf`
iTermSessionId=$1
osascript <<END
tell application "iTerm2"
repeat with aWindow in windows
repeat with aTab in tabs of aWindow
repeat with aSession in sessions of aTab
set theSessionId to unique id of aSession
if theSessionId is "$iTermSessionId" then
set targetSession to aSession
set targetTab to aTab
set targetWindow to aWindow
end if
end repeat
end repeat
end repeat
tell targetSession
write text "$password"
end tell
end tell
END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment