top | item 19475336

iTerm2 beta adds Python API

145 points| 20after4 | 7 years ago |iterm2.com

60 comments

order
[+] j88439h84|7 years ago|reply
Kitty terminal has a Python API too, and it's got images and high performance, etc.

https://sw.kovidgoyal.net/kitty/

[+] daveFNbuck|7 years ago|reply
I tried switching to Kitty last year, but then it stopped working properly with the OSX 10.14 release. It turns out this was a known issue from the beta, but the author decided not to do anything about it until the release [1]. I can't rely on a terminal that's maintained like that.

[1] https://github.com/kovidgoyal/kitty/issues/887#issuecomment-...

[+] gazarullz|7 years ago|reply
Been using kitty on both osx and debian, I am very happy with the performance and out-of-the box features so far.
[+] iconara|7 years ago|reply
On the Example Script page (https://iterm2.com/python-api/tutorial/example.html) it says that the script communicates with the application using websockets ("The underlying implementation uses Google protobuf and websockets"). This makes me think that it could support other languages and ways of scripting it in the future.
[+] bitwize|7 years ago|reply
Wait, web sockets? Why not regular old sockets? Why not restrict it to Unix domain sockets so that only authorized users can talk to the iTerm instance?
[+] saagarjha|7 years ago|reply
Ooh, nice! Been waiting for this for a while; now I can finally change my terminal's theme automatically when the system appearance changes: https://gist.github.com/saagarjha/9a99ed4bc68a37bab097cc6ee8...

Although, I clicked through the status bar stuff and now I can't figure out how to get it back :(

[+] 20after4|7 years ago|reply
Under preferences -> appearance you can choose status bar position: bottom (or top).

Then you can right click on the status bar to get to the editor.

[+] 20after4|7 years ago|reply
One api feature looks especially cool - that is CustomControlSequenceMonitor provides a way to implement custom terminal control sequences and extend the terminal with richer functionality.
[+] akerl_|7 years ago|reply
One thing I’d love to port to this:

I switch between a 4K monitor and my built-in. The same font size definitely doesn’t work between the two of them. I’ve got a script in my .bashrc that checks the resolution of the current monitor and sets the Profile of the session using the older control-code based API, flipping between a profile for each monitor resolution.

With the new API, I can see methods for overriding profile settings on an individual session, but not a method for changing the profile a session is using to another saved profile. Does such a method exist?

[+] jadiofan|7 years ago|reply
iTerm2 is great, thanks to George Nachman for the hard work. I recently installed Mojave from scratch, fresh and clean environment. I'm trying to keep things pretty minimal. I'm giving Terminal (macOS) another shot - so far it's been great. I've only missed split panes but when I really needed I used tmux. Other than that I realize I didn't use much of the functionality offered by iTerm2.

What are the features in iTerm2 that you use the most?

[+] maratc|7 years ago|reply
- Auto-summon of the Password Manager on password prompts

- Grep for things that look like IP address and color them in blue, or errors in red

- Auto-Complete based on the text in terminal

- Broadcast same keypresses into several panes (having SSH sessions to several servers)

- Making an icon jump when a long running command just finished

- etc.etc.

I know people who returned their company-issued X1 Carbons and bought an out-of-pocket MacBooks just so they can use iTerm.

[+] o10449366|7 years ago|reply
Honestly, while it isn't a feature that's unique to iTerm2 by any means, I just appreciate how easy it is to theme the colors and appearance. I used Arch Linux for many years before moving to Mac OS and messing around with urxvt configuration files if I wanted full 256 color or font support was somewhat tedious. It's nice to just have something that's easy to setup and always works and looks the way I want given I'm looking at my terminal for 75% of my day.
[+] mlpinit|7 years ago|reply
Setting the background to the solarized dark or light color pallet works nicely with the same vim pallet setup. I wanted to use this as an example because I don't believe this worked in Terminal last time I tried it. But after a quick google search it seems like you can use Terminal for this setup as well.

Clicking on links in the terminal is a nice feature. If you press cmd + click it opens your browser or finder. I occasionally enjoy this convenience.

There are probably other conveniences that don't come to mind now.

[+] whalesalad|7 years ago|reply
Font ligatures are what’s keeping me on iTerm right now.
[+] ViViDboarder|7 years ago|reply
I tried the same thing a year or so ago and there were a few items that brought me back to iTerm2. They’re going to seem super minor, but I use them often enough that it made a difference.

Text selection is better and customizable. Makes it easier to select things like up addresses with a double click.

Hotkey window is just too damn convenient. I end up using it all the time when I just need to execute one-off commands.

It’s gonna sound super minor, but

[+] Myrmornis|7 years ago|reply
- Hot key to summon/dismiss persistent terminal session

- Ability to create arbitrary handlers for mouse click actions

- Ability to save my configuration in version-controlled JSON

- Autocomplete

- Conventional full screen mode (not the weird MacOS thing that creates a new desktop)

[+] konart|7 years ago|reply
>What are the features in iTerm2 that you use the most?

Quake-like drop-down animation.

[+] monkin|7 years ago|reply
Love it and use it from some time! Scriptable status bar is also awesome feature. :)
[+] sirsuki|7 years ago|reply
both iTerm2 and Terminal.app got so slow that I switched to Hyper which contrary to common sense is blazing fast for me. I’ve also started experimenting with URXVT via XQuartz but the native feel just isn’t there like it is for Hyper.

Who knew Electron apps could out perform native ones (even with GPU acceleration in iTerm2’s case)! I don’t know how or why but in this case it is so.

[+] vimslayer|7 years ago|reply
I don't think the main gripe people have with Electron has ever been performance, V8 is plenty fast after all, it's more about the memory footprint.
[+] CharlesW|7 years ago|reply
> Who knew Electron apps could out perform native ones (even with GPU acceleration in iTerm2’s case)! I don’t know how or why but in this case it is so.

How are you measuring?

[+] frou_dh|7 years ago|reply
Sometimes I've wished that Sublime Text's API used JS so that I didn't have to know Python just for one program.

It seems a waste having to keep a battalion of imperative OO languages in one's head just for incidental use.

[+] pushpop|7 years ago|reply
Learning other languages is not a waste. It actually makes you a better developer.
[+] nkozyra|7 years ago|reply
I understand the concern, but how many scripting languages are really used embedded in applications? It's usually python or Lua.
[+] garmaine|7 years ago|reply
I would say the same about JS, which I've never used once in my life.

Not everything is done in a browser.

[+] bjoli|7 years ago|reply
My favourite language is guile scheme which makes me all too familiar with your feelings.

Not only that: embedding python is a shitty experience compared to embedding lua or guile, and you have to work around the fact that python has no threads and that it is borderline impossible to run multiple independent interpreters in the same process.