Skip to content

Instantly share code, notes, and snippets.



Forked from elentok/fl
Last active Nov 29, 2020
What would you like to do?
Open current directory in forklift
# Open current directory in forklift
# Adapted from
# Adapted from comment
# Added optional path argument and removed using the clipboard buffer.
set -e
if [ -z "$@" ]; then
pushd $@ > /dev/null
echo $absPath
popd > /dev/null
if application "ForkLift" is not running then
# This will launch Forklift if it's not running
# (But it's not making it the frontmost/focused application)
activate application "ForkLift"
# We wait 1 second so that we're pretty sure ForkLift did launch
delay 1
end if
# Give focus to ForkLift
activate application "ForkLift"
set canOpenTab to "unknown"
tell application "System Events"
tell process "ForkLift"
# Open new window if none, or new tab if there is one open
set canOpenTab to enabled of menu item 2 of menu 1 of menu bar item "File" of menu bar 1
if canOpenTab is true then
keystroke "t" using {command down}
keystroke "n" using {command down}
end if
# Using ForkLift's "Go to Folder"
keystroke "g" using {command down, shift down}
# keystroke "v" using {command down}
keystroke "$absPath"
keystroke return
end tell
end tell
) | osascript

This comment has been minimized.

Copy link

@berk-can berk-can commented Jun 22, 2019

Gotta admit you are brilliant, thank you so much


This comment has been minimized.

Copy link

@ApolloTang ApolloTang commented Nov 22, 2020

thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment