Giter VIP home page Giter VIP logo

open-iterm-or-terminal-here...'s Introduction

Open iTerm or Terminal Here...

This project generates an Applescript app that you can put in your Finder toolbar which will open an iTerm or Terminal tab at the current directory.

alt text

alt text

I know there's already a ton of these types of apps out there, but I wanted to make my own anyway :)

Prerequisites

  • If using iTerm, requires at least version 3

Setup

  1. Generate the "Open iTerm Here..." or "Open Terminal Here..." app.
    It will show up in your Applications folder (/Applications).
./generate.sh [iterm|terminal]

For example:

$ ./generate.sh iterm
Preparing to generate 'Open iTerm Here...' app
Putting AppleScript into place
Setting the icon
Reticulating splines
Opening app location in Finder
Done
  1. Click and drag the app into the toolbar area where you want it. On newer versions of OS X, you have to hold down the Command (⌘) key until a green plus sign (+) appears. alt text

(This gif shows the process for the "Open iTerm Here..." app, but it's the same for the "Open Terminal Here..." app)

Using Mac OS X 10.14 Mojave or later?

The app works, but there's some useful security info here.

open-iterm-or-terminal-here...'s People

Contributors

rkanter avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

open-iterm-or-terminal-here...'s Issues

Create a new window instead of a tab?

It would be nice to have the option to always create a new window instead of a new tab.

I changed the AppleScript slightly to allow this:

tell application "Finder"
	if (count of windows) > 0 then
		set thePath to target of front window
	else
		display dialog "There are no open Finder windows." with icon caution buttons {"OK"} with title "Open iTerm Here..."
		return
	end if
end tell

if not (exists thePath) then
	tell application "Finder" to set theName to name of front window
	display dialog "The location of the Finder window \"" & theName & "\" is not a real location (e.g. smart folder, search, network, trash, etc) and cannot opened in iTerm." with icon caution buttons {"OK"} with title "Open iTerm Here..."
	return
end if
set thePath to quoted form of POSIX path of (thePath as alias)

tell application "iTerm"
	-- Handles the case where iTerm is running but has no windows
	set createdWindow to false
	create window with default profile

	tell current session of current window
		write text "cd " & thePath & " && clear"
	end tell

	activate
end tell

And this works for me, but likely this should be packaged up as an option to the generation script...?

macOS Big Sur

I've checked permits, it looks all good but I've that
"Not authorized to send Apple events to Finder.
Not authorized to send Apple events to Finder. (-1743)"

Finder on M1 problem...

Hi,

I also changed the script to open a new window instead of a new tab. It worked fined on my Intel MacBook Pro, but annoyingly I can't drag the app in the Finder toolbar on my Mac mini M1. Anyone have the same problem ? or even better, a solution ?

Thanks :)

Icon

Not really an issue but I made an icon with the same style as others in the toolbar. If some are interested... I don't know where else to put it and too lazy right now to fork.

term.icns.zip

Create new windows if there aren’t any?

Thank you for this nifty little tool! I am quite pleased with it.

I noticed the following:

  • if iTerm is not open at all, the following error message is produced: image
  • if iTerm is open without a window, the new window will always open in the home directory
  • if an iTerm window is open, everything works as expected if an iTerm window exists

If I were to make a wish, I’d like those scenarios to be

  • open iTerm, and a new window in current directory
  • open a new window in current directory
  • open a new tab in current directory (already works).

How can I help?

FWIW – I am running this tool on macOS 10.15.3 (19D76).
Thanks!

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.