Coder Social home page Coder Social logo

jakshin / open-in-iterm Goto Github PK

View Code? Open in Web Editor NEW
19.0 2.0 0.0 6.42 MB

A macOS Finder toolbar app which opens iTerm tabs/windows conveniently

License: GNU General Public License v3.0

Shell 30.64% Makefile 0.49% C 7.73% AppleScript 61.14%
macos finder-toolbar iterm iterm2 applescript

open-in-iterm's Introduction

It's often handy to switch between looking at a folder's contents in Finder, and running command-line utilities in it. You can switch from command line to GUI by running open . to view your shell's working directory in Finder, but the reverse isn't as easy.

That's why this app exists. After installing it as a Finder toolbar button, you can click its icon in (just about) any Finder window to open a new iTerm tab, with your shell's working directory automatically switched to the Finder window's folder. Or you can hold the fn or shift key down as you click, to open the folder in a new iTerm window, instead of a new tab.

If you prefer Apple's Terminal app, see Open in Terminal.

Installation

Step 1: Get the code and build the app

Either clone the repo, or download it and extract the zip file.
Then run build.sh, which will create Open In iTerm.app.

The build script tries to detect whether you have macOS's dark mode enabled, to decide which icon to build the app with, so you may see a popup asking to grant iTerm access to control System Events. If you say no (or if you've previously declined to grant iTerm this access), the build script will use the light-mode icon by default. You can pass the --dark or --light option to the build script to manually select an icon, avoiding the need for the script to try to detect dark mode.

Screenshot of popup

Step 2: Allow automation access

Launch the app for the first time, while holding the fn or shift key down. You'll see a series of popups asking to grant it access to control Finder, System Events, and iTerm. You'll need to allow each, or Open In iTerm won't be able to do its thing:

Screenshot of popup Screenshot of popup Screenshot of popup

If you accidentally don't allow access to any of these apps, you can fix it in System Settings, on the Privacy & Security > Automation screen:

Screenshot of Automation settings

Step 3: Drag the application into your Finder toolbar

Hold the command key down and drag Open In iTerm.app into your Finder toolbar:

Screenshot of holding Command and dragging

Step 4: Install the wrapper script (optional)

A small wrapper script named iterm is also provided, which invokes the app to open a new iTerm tab or window displaying a given directory. This can be handy if you use both Terminal and iTerm. Run iterm --help for usage details.

To innstall the iterm script, copy or symlink it in a directory that's in your shell's path, or add the directory it's in to your path. For example, to create a symlink in /usr/local/bin, run this from the directory containing the script:

[[ -d /usr/local/bin ]] || sudo mkdir -p /usr/local/bin
sudo ln -s "$(pwd -P)/iterm" /usr/local/bin/iterm

Uninstallation

To uninstall the app, hold the command key down and drag its icon out of your Finder toolbar, then delete it.

If you installed the command-line iterm wrapper script, delete it and any symlinks to it.

open-in-iterm's People

Contributors

jakshin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

open-in-iterm's Issues

dark mode

Hi,

Is there a plan to add a dark-themed icon for the macos mojave dark mode?

screenshot 2018-07-20 at 14 22 59

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.