11 ms·
Show HN: Termipal – native micro-GUIs for shell scripts and command line apps
- johnzim 9y agoI really like this idea! Maybe it's the Christmas season but I was feeling a little wistful for the old days of fun little OS X utilities. This is a beaut :)
- DenisM 9y agoNeeds more examples certainly. Still, nice work!
- arximboldi 9y agoLooks a lot like the good ol' zenity: https://help.gnome.org/users/zenity/3.24/ https://help.gnome.org/users/zenity/3.24/
- egwynn 9y agoWhich (IIRC) is like xdialog for gtk, which is like dialog for X11.
- Gracana 9y agoMy favorite of these is Commando for the Macintosh Programmer's Workshop. http://web.uvic.ca/~ncs/406/HTML/Targeting_MacOS/images/IDE140_ToolServer.fm.anc7.gif http://web.uvic.ca/~ncs/406/HTML/Targeting_MacOS/images/IDE1...
- vthriller 9y agoThere's also alternative to the `dialog` called `whiptail`.
- shakna 9y agoWhich is a proof of concept around newt [0], which is a C library you can use. [0] https://pagure.io/newt https://pagure.io/newt
- matttproud 9y agoSee also: CDE's DtKsh, which has had support for this for decades. http://www.brendangregg.com/dtkshdemos.html http://www.brendangregg.com/dtkshdemos.html http://www.osnews.com/story/18969/pt_VII_CDE/page1/ http://www.osnews.com/story/18969/pt_VII_CDE/page1/
- swsieber 9y agoWell, that's quite nifty. I never knew OS X had it's own javascript engine / component.
- deleted 9y ago[deleted]
- robterrell 9y agoYep, it's been there a while: rterrell$ /System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc >>> for (var i=0; i<10; i++) { print("Hello World!", i); } Hello World! 0 Hello World! 1 Hello World! 2 Hello World! 3 Hello World! 4 Hello World! 5 Hello World! 6 Hello World! 7 Hello World! 8 Hello World! 9 undefined >>> Edit to add: the submission reminds me of the old "Commando" for MPW. Very cool.
- lloeki 9y agoWell, while I did know JSC was a standalone thing (a framework, rather) on macOS, notably due to its presence in AppleScript Editor, I did not know it had a REPL readily available, and that the jsc interpreter works for shebangs too!
- robterrell 9y agoI found out about it when using Cappuccino -- on mac os x it would build much faster using jsc instead of narwhal. For about a week after that I tried writing shell scripts using the jsc shebang... but it ended up being a lot more painful than I imagined.
- saagarjha 9y agoIt's called JavaScriptCore and it's part of iOS as well.
- poyu 9y agoCool links regarding JS in OSX * [JXA Cookbook](https://github.com/JXA-Cookbook/JXA-Cookbook https://github.com/JXA-Cookbook/JXA-Cookbook) * [JavaScript OS X App Examples](https://github.com/tylergaw/js-osx-app-examples https://github.com/tylergaw/js-osx-app-examples)
- tbodt 9y agoThis is written by the same guy who wrote Electrino, which was supposed to be a lightweight Electron replacement but never really caught on. So I'm not surprised that this has a lot of code from Electrino in the core. This is a great way to use the idea of Electrino for something that doesn't require many years of work to become useful.
- pavlov 9y agoYes, that's me! I feel a bit sad that I was unable to put in the work to bring Electrino forward. There was a lot of interest, but I just couldn't find any more extra time between existing paying work and family. As you say, Electrino is a multi-year commitment because of the sheer number of APIs needed to support the apps that are already out there. I made Termipal because I found myself writing a bunch of crappy shell scripts for various tasks, and having real UI with dropdowns and buttons made the scripts much more usable.
- kaoD 9y agoHey! I just discovered Electrino from this thread and no wonder it grabbed a lot of interest! I didn't even consider the idea and now I want it. I used to be a native dev (from when native meant desktop OS :P) and switched to web apps just for UI development convenience, then node-webkit came. I still use both nw.js and Electron (though I admit I kinda like nw.js more, IPC is a PITA) but, even though I love the development experience, I absolutely hate the end user experience. Can you elaborate on why is Electrino a multi-year commitment? I guess I can see why if you meant Electrino as a drop-in replacement of Electron. Did you consider scaling down the features a bit? Just bundle a native webview + Node.js, add some kind of IPC and let userland do the rest. Would this be achievable or am I missing something that makes it way harder than I imagine? EDIT: After scanning my own comment I see why... the idea is to not bundle Node.js and instead use the native JS engine which does not include Node APIs nor leverages the NPM ecosystem.
- topher200 9y agoLooks interesting! The website could use some more screenshots showing off what's possible.
- deckar01 9y agoI didn't even notice that it was in use on the splash image. I thought the terminal was just setting on top of another app window.
- sam0x17 9y agoTLDR: doesn't work on linux
- magic_beans 9y agoIt's not meant to.
- sam0x17 9y agoThen it should say that in the title
- duck 9y ago> For maximum convenience, Termipal automatically attaches to the bottom edge of your terminal window. What does Termipal do if you have terminal full screen?
- satysin 9y agoWould be kinda cool if, on a MacBook Pro, it moved the Termipal UI onto the TouchBar :)
- pavlov 9y agoI like that -- that's definitely what it should do, and maybe not even very hard because there's so few UI elements.
- pavlov 9y agoIt actually didn't occur to me to try that until now. Looks like it doesn't work because it's a different process and its window can't be composited on top of the fullscreen app. I don't know if there's a workaround -- maybe there's a way to move it into the desktop space occupied by the fullscreen Terminal?
- solarkraft 9y agoThe finished product is definitely not for me, but the ideas are neat.
- empath75 9y agoThis looks super interesting, but is there api documentation some where? Is there a way for it to output a shell command directly or can it only print?
- pavlov 9y agoSorry, I haven't written any API documentation yet. Basically there's a handful of Node + Electron APIs implemented, and a new "microUI" module for managing the UI. The example scripts show pretty much all there is to microUI at this point. For invoking shell commands, it would probably be best to just implement Node's child_process module? Adding more APIs is in general not difficult -- it's harder to decide what to prioritize.
- hultner 9y agoLooks nifty, however I’m mostly always running my terminals either in full- or split screen. How would this work in these cases? Does it work from within a tmux-session? A neat feature would be a dialog (the tui cursors one) fallback, I.e. when working over SSH.
- twobyfour 9y agoPretty neat. I don't suppose this works with iTerm2?
- pavlov 9y agoAFAIK it works with iTerm. It attaches to the focus window on the app that launched it, so it should be terminal-agnostic.
- gaius 9y agoWhat use cases does this have that Tcl/Tk doesn't?
- pavlov 9y agoI feel like I don't really know Tk well enough to give a satisfactory answer. Does it use native Cocoa widgets these days? I recall that wasn't the case years ago, at least. Anyway, Termipal's benefits are: * Native Cocoa widgets * No dependencies (uses system JavaScript framework) * Attaches to host terminal window to minimize UI transitions. It's designed for tiny non-intrusive GUIs invoked as part of a script. Tk probably shines for more complex dialogs.
- neil1023 9y agoThe site is down. Maybe due to too much traffic.
- svmegatron 9y agoNice!!
- skanga 9y agoSomething like this but portable across Linux/Win/Mac would be pretty cool.
- pharrington 9y agoI just use Scalafx with a Scala REPL. Unfortunately I don't know offhand of anything else outside of the JVM ecosystem that's as simple and portable.
- thomastjeffery 9y agoInstead of writing a terminal emulator specific gui, maybe someone could write an ncurses based shell wrapper. The whole problem is that shells are REPLs, and REPLs are not the best method of interaction. This idea could probably be taken even farther.
- eat_veggies 9y agoHeads up: the text cuts off on ultrawide https://i.imgur.com/p64kvl0.png https://i.imgur.com/p64kvl0.png
- willcodeforfoo 9y agoFor the Mac there's also Pashua: https://www.bluem.net/en/projects/pashua/ https://www.bluem.net/en/projects/pashua/ which lets you generate a GUI for shell scripts.
- oxguy3 9y agoAh, finally someone did this! I've had this same idea for forever but never got around to implementing it.
- rsync 9y agoThings like this (terminal add-ons like graphical layers and image viewers and so on) are only going to end badly. What's so special about the terminal is the immunity the user has to hostile character strings. When I view a webpage in lynx or read an email in (al)pine, there is no string that could be injected to harm me - I am immune to viruses and javascript and weird CSS and so on. I can open up an infected document or view a phishing email. In short, the well-behaved terminal does nothing but display text in your character set. It does not interpret and it does not execute and it certainly doesn't call GUI APIs to draw buttons and display videos. This is a door best left unopened ...
- chungy 9y agoPretending that terminal or command line applications are immune to a very common mode of attack, even to them, is itself dangerous thinking. This could potentially add a new attack surface, sure, but don't think that without it, exploits aren't possible.
- pwdisswordfish2 9y agoWho is writing those exploits? He is citing a reduced attack surface that is easier to manage. Not "immunity". It is a choice between being low hanging fruit or not being low hanging fruit. With enough effort, any fruit is accessible. However it is immature internet forum behavior to chide someone for choosing not to be low hanging fruit.
- egwynn 9y agoI’m not sure I follow you. Unless I’ve read it totally wrong, this thing is basically just xdialog for macOS with some fancy dress-up. I don’t see how it exposes a novel attack vector.
- ohazi 9y ago> What's so special about the terminal is the immunity the user has to hostile character strings. I have a handful of escape codes that beg to differ...
- 9y ago
- _sdegutis 9y agoIn a similar vein, I wrote choose[1] which I thought was very novel at the time, since it is a command line utility that pops up a native GUI (for fuzzy matching) and takes its input from stdin, lets the user choose an item by interacting with the native GUI, and spits output onto stdout. I thought it was the coolest idea since you can integrate it with any CLI that can launch apps and read/write to standard input/output, including vim and emacs. [1]: https://github.com/sdegutis/choose https://github.com/sdegutis/choose
- pwdisswordfish2 9y ago"The Unix command line is powerful... But interactivity isn't its strong suit." Right. The reason I use the command line is because I do not want to waste time and energy "interacting" with the computer. That is what Microsoft Windows, and mobile phone touchscreen based OS are for. GUIs are for interacting. The command line is non-interactive. That is its strong suit. Tell the computer precisely what to do, including all the steps, start the process(es) and then sit back and let them run. The only reason command line is used interactively is because GUIs are just so bad. The command line becomes the refuge for those weary of painfully slow and cumbersome GUIs. But it was never meant as a replacement. It is only because so many GUIs are so painful for interactive computer use that the command line becomes more appealing -- even for interactive tasks. Robust, reliable, lightening fast GUIs are few and far between. I leave it to the reader to fill in the reasons. If robust, reliable, fast GUIs were more abundant, then projects like this would not exist. There would be little interest in using the command line interactively.