850975eb78908e8272e42685da8b5ced3a428c97

Author
Johan Kaving <johan@kaving.se>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

Add support for ForkLift 3 (#6490)

This adds support for ForkLift 3, which uses a different
application id and also uses a popover instead of a sheet for
entering the directory to go to.

This also improves the handling of different versions of ForkLift,
by first choosing any currently running instance, and if none is
running starting the newest available version.

Fixes #6565.

Diff

This diff is truncated to protect this page.

  1diff --git a/plugins/forklift/forklift.plugin.zsh b/plugins/forklift/forklift.plugin.zsh
  2index 692ca5790710d88c2e154e28243b549092c1c34a..274c4a822ab467b880d8d8dd9c00d26a01861c7e 100644
  3--- a/plugins/forklift/forklift.plugin.zsh
  4+++ b/plugins/forklift/forklift.plugin.zsh
  5@@ -1,6 +1,6 @@
  6 # Open folder in ForkLift.app or ForkLift2.app from console
  7 # Author: Adam Strzelecki nanoant.com, modified by Bodo Tasche bitboxer.de
  8-#         Updated to support ForkLift2 by Johan Kaving
  9+#         Updated to support ForkLift 2 and ForkLift 3 by Johan Kaving
 10 #
 11 # Usage:
 12 #   fl [<folder>]
 13@@ -24,46 +24,84 @@ function fl {
 14   fi
 15   osascript 2>&1 1>/dev/null <<END
 16 
 17-    try
 18-      tell application "Finder"
 19-        set appName to name of application file id "com.binarynights.ForkLift2"
 20-      end tell
 21-    on error err_msg number err_num
 22-      tell application "Finder"
 23-        set appName to name of application file id "com.binarynights.ForkLift"
 24-      end tell
 25-    end try
 26+  try
 27+    tell application "Finder"
 28+        set forkLift3 to name of application file id "com.binarynights.ForkLift-3"
 29+    end tell
 30+  on error err_msg number err_num
 31+    set forkLift3 to null
 32+  end try
 33+  try
 34+    tell application "Finder"
 35+        set forkLift2 to name of application file id "com.binarynights.ForkLift2"
 36+    end tell
 37+  on error err_msg number err_num
 38+    set forkLift2 to null
 39+  end try
 40+  try
 41+    tell application "Finder"
 42+        set forkLift to name of application file id "com.binarynights.ForkLift"
 43+    end tell
 44+  on error err_msg number err_num
 45+    set forkLift to null
 46+  end try
 47 
 48-    if application appName is running
 49-      tell application appName
 50+  if forkLift3 is not null and application forkLift3 is running then
 51+    tell application forkLift3
 52         activate
 53-      end tell
 54-    else
 55-      tell application appName
 56+        set forkLiftVersion to version
 57+    end tell
 58+  else if forkLift2 is not null and application forkLift2 is running then
 59+    tell application forkLift2
 60         activate
 61-      end tell
 62-      repeat until application appName is running
 63-        delay 1
 64-      end repeat
 65-      tell application appName
 66+        set forkLiftVersion to version
 67+    end tell
 68+  else if forkLift is not null and application forkLift is running then
 69+    tell application forkLift
 70         activate
 71-      end tell
 72+        set forkLiftVersion to version
 73+    end tell
 74+  else
 75+    if forkLift3 is not null then
 76+        set appName to forkLift3
 77+    else if forkLift2 is not null then
 78+        set appName to forkLift2
 79+    else if forkLift is not null then
 80+        set appName to forkLift
 81     end if
 82+    
 83+    tell application appName
 84+        activate
 85+        set forkLiftVersion to version
 86+    end tell
 87+    repeat until application appName is running
 88+        delay 1
 89+    end repeat
 90+    tell application appName
 91+        activate
 92+    end tell
 93+  end if
 94 
 95-    tell application "System Events"
 96-      tell application process "ForkLift"
 97+  tell application "System Events"
 98+    tell application process "ForkLift"
 99         try
100-          set topWindow to window 1
101+            set topWindow to window 1
102         on error
103-          keystroke "n" using command down
104-          set topWindow to window 1