News for hackers. Stuff that matters.
Re:Black Screen: A modern terminal emulator based on Electron by JulianWasTaken on Saturday September 05, 2015 @08:38PM (#10176467)
One of these seems to pop up every few months, which is great, terminals are old crusty awful things, but it seems like they always die out in development before they can run existing things like Vim which makes them fun POC's and not much else :/
Re:Black Screen: A modern terminal emulator based on Electron by tatterdemalion on Sunday September 06, 2015 @12:19AM (#10176807)
The problem seems to be that they come at things from the wrong direction - you can't run vim without being backwards compatible with at minimum terminfo pages, very likely vim also makes an assumption also that the terminal communicates over a tty, and possibly you may just need to support actual ANSI Escape Codes. You can't run anything else without that either. Running vim should be the first thing this terminal can do.

Just like the web itself, any new teminal client needs to be backwards compatible with the capabilities of prior terminal clients, because programs that run in the terminal expect it. And if your terminal can't run the programs everyone runs in their terminals, no one will adopt your terminal. But many of these projects seem to have no intention of maintaining that backward compatibility. Some, like TermKit, fully conflate the terminal and the shell and even many UNIX utilities.

You can't hope to supplant ANSI compatible terminals when you let them have the enormous advantage of running all the software anyone wants to run in a terminal that already exists. It would be like saying you have a new, better web browser that can't open any existing web pages.

No idea if this particular project has learned from past examples and is backwards compatible or not. (EDIT: It doesn't have a terminfo page, so probably not.)

Re:Black Screen: A modern terminal emulator based on Electron by shockone on Sunday September 06, 2015 @01:22AM (#10176869)
It does indeed support ANSI codes. Not fully compatible with VT100 yet, but that's where I'm moving. Vim is functioning, but there are a lot of bugs. https://dl.dropboxusercontent.com/spa/dlqheu39w0arg9q/xxy316...

The problem with terminfo is that not every tool relies on it. I've seen many examples (hello, exa), when the codes are hard-coded to operate with xterm-256. So, I decided to pretend to be an xterm.

Re:Black Screen: A modern terminal emulator based on Electron by tatterdemalion on Sunday September 06, 2015 @02:03AM (#10176921)
Hey thanks for replying & I hope my comments didn't seem snooty. I've thought a lot about how to solve this problem and was disappointed by the way some past attempts have just ignored the infrastructure that ensconses current terminals. And its a real shame that so many tools just hard-emit ANSI escape codes - there are even some TUI frameworks that do it.

The problem I see is that you seem to have the terminal doing things like fuzzy matching input against PATH executables. But that's the shell's domain. The terminal should just expose commands for adding text items to a drop down under the cursor, and the shell should send the matches to the terminal. And capabilities like this should be clearly defined in a terminfo page (which you should definitely have, even if for non-custom capabilities it uses the same definitions as xterm), so that well-written apps can send this information if and only if those capabilities are defined.

Of course this is a huge challenge, because if you do it this way your terminal doesn't do anything new until someone writes a program to run in it using its extended capabilities. So this creates a chicken and egg problem. But you can't come up with nearly as many interesting things for your terminal to do with cursor dropdowns as everyone in the world can if you're just exposing that in the same way the character grid is exposed.

Re:Black Screen: A modern terminal emulator based on Electron by shockone on Sunday September 06, 2015 @06:34AM (#10177289)
Hey. Not snooty at all. I understand your pain: once I tried to open Vim in this Kickstarter terminal project - Xiki - and was disappointed in the same way.

Perhaps unexpectedly, Black Screen is both a terminal emulator and a shell. I tried hard to avoid going with writing a shell, but the existing ones simply don't fit. It's even hard to know when a child execution has finished. And I want smart autocompletion, so I have to at least extend a shell.

Traditionally these two are separated, and it must be a good design, but my current goal is to prove the concept. Perhaps, later I'll extract the shell.

Re:Black Screen: A modern terminal emulator based on Electron by tatterdemalion on Sunday September 06, 2015 @03:06PM (#10178642)
I think for this to work you just have to create a shell and a terminal, to have a killer app that your terminal is the paltform for (realizing this is what kept me from ever moving on the idea). But my point is that I think the shell component absolutely must communicate with the terminal component over the tty subsystem using an extension of ANSI Escape Codes, defined in a terminfo page, so that the terminal component is only concerned with how the information is displayed, and not what the information is.
Re:Black Screen: A modern terminal emulator based on Electron by shockone on Monday September 07, 2015 @09:13AM (#10181290)
What problems will I face if they don't communicate over a TTY?
Re:Black Screen: A modern terminal emulator based on Electron by coldtea on Sunday September 06, 2015 @06:40AM (#10177298)
The thing is, the web stack is not how to do it (for a prototype, maybe).

As they say above, this thing would halt when you cat a 50MB file.

It takes someone who's familiar with terminals, and can use a language fit for the task (and without too many depenedencies -- so if you built it in Haskell and I need the Platform and half of Cabal to build it, it will never fly -- and it being in Haskell it will not attrack many UNIX hands, who are the people familiar with Terminals most).

So something like C, C++, Rust or Go.

Re:Black Screen: A modern terminal emulator based on Electron by timmy-turner on Sunday September 06, 2015 @07:55AM (#10177398)
No, I think integrating the web stack in a terminal is one of the better options. You'll get a lot of nice things that already work, e.g. serialization (HTML/CSS/JS/JSON), debugging (webkit dev tools, if you use webkit to render you terminal), libraries that are useful for terminal based apps (d3.js) and nice font rendering to only name a few.

`cat 50mbfile` will not halt a web based terminal if you don't keep it all in the scrollback buffer.

Re:Black Screen: A modern terminal emulator based on Electron by ibrahima on Saturday September 05, 2015 @08:52PM (#10176488)
I would really love it if one of these web-based terminals managed to stick around. Just being able to view images in a terminal would be amazing. The trouble with building on web technologies seems to be that the overhead is just too high (eg. Atom) considering how many terminals the average developer has open at a time.

I guess at least since it's based on Electron, it might have more longevity than something built from a cobbled together base. Here's hoping!

Re:Black Screen: A modern terminal emulator based on Electron by kuschku on Saturday September 05, 2015 @08:55PM (#10176495)
But still, even with electron, it’s performance will be horrible.

Several hundred MB RAM usage for a single Terminal window are just not acceptable.

Somehow many devs today write their software under the assumption that a user with 2GB RAM or 4GB RAM will at all times only run one single piece of software.

Re:Black Screen: A modern terminal emulator based on Electron by steckerbrett on Saturday September 05, 2015 @09:32PM (#10176563)
I liked the JavaScript IRC client which uses like 400MB of memory.
Re:Black Screen: A modern terminal emulator based on Electron by kuschku on Sunday September 06, 2015 @09:42AM (#10177604)
Exactly. And this is somehow acceptable, or even "industry standard" today.
Re:Black Screen: A modern terminal emulator based on Electron by willcodeforfoo on Saturday September 05, 2015 @09:34PM (#10176571)
iTerm 2 actually supports images! http://www.iterm2.com/images.html It works pretty well. I wrote a little blog post awhile ago about using it for integration testing: http://kevinmarsh.com/2014/05/07/in-terminal-screenshots-wit...
Re:Black Screen: A modern terminal emulator based on Electron by x0 on Sunday September 06, 2015 @12:57AM (#10176845)
That blog post, very creative. Such a good idea. All I've done with the image integration is show a 128px frown emoji when a script exits wrong.
Re:Black Screen: A modern terminal emulator based on Electron by andrewstuart2 on Saturday September 05, 2015 @08:55PM (#10176494)
Feh is usually good enough for me. There's always catimg too if you really really want it in the terminal and don't care that it'll look terrible.
Re:Black Screen: A modern terminal emulator based on Electron by noobermin on Saturday September 05, 2015 @09:10PM (#10176529)
+1 on feh, although it doesn't work with gifs, and the author isn't planning to implement that support.
Re:Black Screen: A modern terminal emulator based on Electron by whyever on Sunday September 06, 2015 @04:24AM (#10177105)
SVG is also not supported.
Re:Black Screen: A modern terminal emulator based on Electron by jumpwah on Saturday September 05, 2015 @10:33PM (#10176674)
urxvt also supports viewing images (or at least I know that because that's the emulator I use, maybe other emulators also support it)

Like I know ranger has an option for it, but iirc there's also a way to just run a command ala `cat`ing a text file. If you'd like, I can look into it more if you can't already find out how to do it by searching.

Also, people are mentioning feh, I'd like to plug in sxiv (not my program though).

Re:Black Screen: A modern terminal emulator based on Electron by ratboy666 on Sunday September 06, 2015 @04:07AM (#10177081)
xterm supports tektronix vector graphics... And sixel (and regis). You can cat the graphics, and it will display (may have to build xterm from source -- Fedora enables tek, but not sixel, for example). GNU plot supports sixel.
Re:Black Screen: A modern terminal emulator based on Electron by kaoD on Saturday September 05, 2015 @11:24PM (#10176738)
Wow, how? I use urxvt and dindn't know that.
Re:Black Screen: A modern terminal emulator based on Electron by jumpwah on Sunday September 06, 2015 @02:11AM (#10176928)
Sorry for the late reply. I found it, I got the method from this blog post [1] initally. Also see [2].

However, I'm sad to say that when I tried this again rn, it didn't work anymore. (I know for a fact it used to work great because I used to use it.)

The funny thing is, ranger's image preview still works for me (same terminal and everything), so I guess one could start going through the ranger source code to see how they wrap w3mimagedisplay if they really wanted to.

I don't really have the motivation for that though because, although I'm a heavy terminal user (and it would be nice), recently switching to emacs means a lot of my file management can be done with dired (an emacs package). And dired can do image previews quite nicely already [3] (I'm assuming provided you're using GUI emacs^). ^^

^Emacs can fire up terminals inside it anyway, so using GUI emacs is not a problem for me, even though I'm heavily terminal orientated.

^^Although I think I prefer sxiv's thumbnail mode for browsing directories full of images (as opposed to a few here and there).

[1]: http://blog.z3bra.org/2014/01/images-in-terminal.html

[2]: https://github.com/hut/ranger/wiki/Image-Previews

[3]: https://github.com/ralesi/ranger#screencast

Re:Black Screen: A modern terminal emulator based on Electron by aidenn0 on Saturday September 05, 2015 @11:40PM (#10176769)
The ranger file manager, which I use can do image previews in urxvt and claims to also work with iTerm, st and xterm.
Re:Black Screen: A modern terminal emulator based on Electron by Watabou on Saturday September 05, 2015 @09:41PM (#10176580)
You can view images on iTerm 2:

https://db.tt/nO3P7yO6

And yes, iTerm2 also displays animated gifs.

Re:Black Screen: A modern terminal emulator based on Electron by dekz on Saturday September 05, 2015 @10:21PM (#10176655)
What is displaying your "tabs" at the bottom of your terminal?
Re:Black Screen: A modern terminal emulator based on Electron by Watabou on Saturday September 05, 2015 @10:35PM (#10176678)
Yep as steckerbrett mentioned, it's the new Dark style tabs introduced in iTerm nightlies, which you can put it in the bottom. It might be included now in the betas or the stable version, not sure.
Re:Black Screen: A modern terminal emulator based on Electron by steckerbrett on Saturday September 05, 2015 @10:31PM (#10176670)
That's part of iTerm. In appearance, set tab style "bottom" and "dark" to emulate that screenshot.
Re:Black Screen: A modern terminal emulator based on Electron by userbinator on Saturday September 05, 2015 @09:08PM (#10176523)
Just being able to view images in a terminal would be amazing

What are the advantages of that over using a dedicated image viewer program?

Re:Black Screen: A modern terminal emulator based on Electron by sillysaurus3 on Saturday September 05, 2015 @09:29PM (#10176560)
A different programmer is always more creative than yourself. It's an axiom to remember, because when the people with the power to change the tools at our disposal give us better tools, suddenly we can use them to do things they didn't even realize they wanted.

Even giving the ability to set a specific pixel to a specific rgb value would get far. Yes, some programs would get it wrong or would be annoying to use. But think what it would enable. Even at 3 fps, you could still show the user a performance graph of your program, or a flame chart. In the terminal. No extra windows required, no fiddling with GUI frameworks, just "set some pixels to some values."

In the short term, being able to set text to a specific foreground and background rgb would be nice. I'm talking 24-bit color. It turns out that this is not possible across all Unix variants: OS X default Terminal doesn't support 24-bit color for text. And there's no reason why it should be like that. The standards are in place, and they are a straightfoward extension to exiting behavior. The toolmakers just haven't enabled the other makers to use it. Of course, it's because it makes no sense for Apple to waste engineering cycles on that. But that doesn't change that it would be true that if they gave us better tools, we would do more.

The issue is that it has to be a minimum spec that's supported by all platforms. (All Unix platforms would be fine.) Simply writing a program that supports a nonstandard way of setting pixels to values wouldn't cut it. At least at first. That's probably how it has to start, though, in order for others to follow.

Re:Black Screen: A modern terminal emulator based on Electron by TeMPOraL on Saturday September 05, 2015 @09:51PM (#10176606)
Focus and context. You don't have to switch to another application and, presumably, displayed image will stay in terminal output. It would be great for printing out inline performance graphs, or even sparklines.
Re:Black Screen: A modern terminal emulator based on Electron by anthk on Sunday September 06, 2015 @04:21AM (#10177095)
sxiv .

Combine it with dwm :)

Re:Black Screen: A modern terminal emulator based on Electron by egypturnash on Sunday September 06, 2015 @01:18PM (#10178270)
When you check in something that breaks the build, the tests can drop an image of battered, bloody Doomguy directly into your terminal instead of having to go through something like http://squarism.com/2010/05/23/watchr-unit-tests-growl-doomg....
Re:Black Screen: A modern terminal emulator based on Electron by techdragon on Saturday September 05, 2015 @09:11PM (#10176534)
cat tmp.png

"Yep that looks like it's right"

git add tmp.png

Re:Black Screen: A modern terminal emulator based on Electron by Jach on Saturday September 05, 2015 @10:28PM (#10176663)
Whoopee, you saved one keystroke (`eom tmp.png` "Yep, looks good. Presses Escape") and if you become interested in any data from previous commands' output you'll have to scroll up more / live with a larger window than otherwise because now you've got an image sucking up n rows in your terminal.
Re:Black Screen: A modern terminal emulator based on Electron by klibertp on Sunday September 06, 2015 @09:55AM (#10177645)
Look at IPython and DrRacket to see why inline images can be useful in REPLs. With DrRacket you can not only view, but also create and combine images one step at the time, always seeing the latest form of it. And then you naturally end up with a script for doing the transformations needed to get your desired result.

In short: the time savings introduced by shortening the feedback loop tend to add up. There is a reason why Web developers now use auto-reloading solutions, despite the fact that it saves "just one keystroke" (F5 in this case).

Re:Black Screen: A modern terminal emulator based on Electron by Jach on Sunday September 06, 2015 @04:15PM (#10178859)
Oh, I'm all for interactive development, one of the reasons I prefer dynamic languages is precisely that, I just don't think the utility of having a static (or animated, or auto-reloading ((!) changing output in a non-ncurses shell?!) image in the shell is that useful compared to the engineering effort and what feels to me the loss of the shell's essential character. ncurses is about the limit of having enough control to make a game vs. having something that isn't a shell interface anymore. The shell isn't a monolithic IDE which you only run one instance of, the closest analogy I use is "vim+Linux are my IDE" and terminal windows are just windows to interface with my "IDE" that I can run any time. eom theoretically supports auto image reloading, though other viewers definitely do. When I edit LaTeX files, I do so in vim, and have the PDF open in evince/atril to the side which auto-refreshes when I save the file (if I set up vim to run latexmk on save, otherwise it's just an extra command I do). This is just the same when doing ClojureScript development -- your IDE doesn't necessarily reload and try to support all the features of a browser, the programmer just uses an actual browser to the side and you use whatever IDE or text editor you like and a file monitor manages the auto-reloading stuff.
Re:Black Screen: A modern terminal emulator based on Electron by scintill76 on Saturday September 05, 2015 @11:29PM (#10176747)
For easier use, you could even alias `cat` to run `file` first, then pass to your image viewer or whatever if it's not a text file.
Re:Black Screen: A modern terminal emulator based on Electron by userbinator on Saturday September 05, 2015 @11:15PM (#10176728)
You may be diappointed to know that Windows' cmd.exe will automatically open the default associated program, so all you need to do is enter the filename if you've associated image files with a default viewer:

http://superuser.com/questions/246825/open-file-from-the-com...

(I suppose a similar thing could be done on *nix with a suitably modified execlp()/execvp().)

Re:Black Screen: A modern terminal emulator based on Electron by geofft on Sunday September 06, 2015 @12:21AM (#10176811)
Freedesktop systems get you an 'xdg-open' command (there's also 'gnome-open' for GNOME, and 'open' for Mac OS X).

On Linux you should be able to wire up binfmt_misc, the plugin system for execve, to xdg-open.

Re:Black Screen: A modern terminal emulator based on Electron by kuschku on Sunday September 06, 2015 @09:46AM (#10177618)
kde-open exists, too ;)
Re:Black Screen: A modern terminal emulator based on Electron by dkns on Sunday September 06, 2015 @01:01PM (#10178194)
If I understand you correctly you can also do this in zsh: https://grml.org/zsh/zsh-lovers.html although not automatically.
Re:Black Screen: A modern terminal emulator based on Electron by nine_k on Saturday September 05, 2015 @09:23PM (#10176548)
This use-case is reasonable, but it still requires a dedicated interface for diffing.
Re:Black Screen: A modern terminal emulator based on Electron by Watabou on Saturday September 05, 2015 @09:49PM (#10176598)
You could just make your own external difftool that displays the two images side by side, and add that in to ~/.gitconfig.

Then you could just call that external difftool when comparing images:

    git difftool --tool img-diff 
Just an example.
Re:Black Screen: A modern terminal emulator based on Electron by garbal on Sunday September 06, 2015 @10:25AM (#10177731)
Lighter faster version of Ipython/Jupyter.
Re:Black Screen: A modern terminal emulator based on Electron by fanf2 on Monday September 07, 2015 @03:20AM (#10180427)
You can view images in an xterm, though it relies on X11's lack of partitioning. Xterm sets an environment variable containing its window handle, so child processes can use that to draw in xterm's window. w3m-img (an in-terminal graphical web browser and file viewer) uses this trick.
Re:Black Screen: A modern terminal emulator based on Electron by scotchio on Saturday September 05, 2015 @08:44PM (#10176475)
> One of these seems to pop up every few months

Do you --or anyone reading this-- have a list of these? I would love to check them all out actually (not that I don't get your point).

Re:Black Screen: A modern terminal emulator based on Electron by ivank on Saturday September 05, 2015 @08:51PM (#10176485)
Re:Black Screen: A modern terminal emulator based on Electron by xnzakg on Saturday September 05, 2015 @08:46PM (#10176478)
Well, there's Finalterm that doesn't exactly seem to like vim.
Re:Black Screen: A modern terminal emulator based on Electron by otabdeveloper on Sunday September 06, 2015 @07:52AM (#10177392)
> terminals are old crusty awful things

Not really, they're just poorly documented. They're based on ad-hoc standards that are scattered across many outdated documents.

It'd be nice if somebody could actually pull all that together and publish one comprehensible document that is readable and up-to-date.