Add support for Linux terminals
ORESoftware opened this issue · comments
nice work, I am writing a library and the library writes out log files and I give the user the option to tail those files. Instead of making the user find those files and then write a command four times to tail each one, my library just has a single command and without any args will open up the four windows on the behalf of the user.
however, the problems I have are:
- these are 4 separate Terminal.app windows, which aren't very cool
- the windows aren't sized right (ideally, maximized)
- they don't have proper titles in the window titlebar, they are all titled the same, so it's impossible to easily differentiate between them
- I get this weird situation* after I hit control+c in the terminal window:
Please let me know if you think your lib can help - I would also really love to see *nix support and full support for iTerm2! thanks!
*they way I open up new windows is with:
I run this with a node child_process:
#!/usr/bin/env bash
open -a Terminal.app `dirname $0`/tail.sh
which in term runs this:
#!/usr/bin/env bash
tail -F ${FILE_TO_TAIL}
Generally:
I'm unclear on what you mean by *nix support.
As for iTerm2 support: it is complete, but it isn't currently covered by automated tests; if I get bug reports about iTerm2, I will implement such tests.
Just to be clear: ttab
is a CLI, not a library.
Specifically:
- The Ctrl+C behavior you're seeing means that
Terminal.app
is configured not to automatically close the terminal window when the shell that's running it exits (is terminated), or not to close it if it exited with a nonzero exit code; go toPreferences > Profiles > (active profile) > Shell
to change the behavior; pickingClose the window
should always close the terminal window, whether the shell exited "cleanly" (exit code0
) or not. - Multiple calls such as
ttab -t tail1 "$(dirname "$0")/tail.sh"
(-t
sets the tab title) should give you the tabs you desire, except thatttab
has no support for setting window sizes; however, if you size the window you callttab
from to your liking before callingttab
, then all the tabs you create will have the same size (because they'll be created in the same window).
@ORESoftware: We can revisit, if you have follow-up questions, but I'm closing this for now.
Sorry I didn't respond earlier - what I meant was - I was requesting support for gnome-terminal or some other terminal that is on *nix. I feel like if you support OSX terminals like Terminal.app or iTerm2, that you might as well support different terminals on MacOS as well as Linux terminals (all I know is gnome-terminal, but I am sure there are many more).
For example, I am writing a library and I would like to use ttab as part of my library, but my lib needs to support Windows, MacOS and *nix. Unfortunately, incorporating ttab won't be a great idea because then I need to have separate support for Windows and *nix. I am sure supporting Windows might be more of a reach, but supporting *nix would be great, otherwise I doubt I will use ttab :/
It would indeed be nice to be cross-platform, but that's a huge task that I'm not willing to take on in the foreseeable future.
While ttab
is a Bash script, it uses AppleScript behind the scenes to control the Terminal.app and iTerm2, though it's currently solely OSX-based.
By *nix I assume you mean the Linux world (since you mention gnome-terminal), so I've changed the title accordingly. If you really wanted to cover all flavors of terminals in the Unix world, the task would be Herculean.
The only realistic option I see is to focus on one terminal in the Linux world that is guaranteed to be there, but I'm not even sure there is such a thing.
To summarize: I'm not taking this on anytime soon, if ever, but I'll leave the issue open with the 'suggestion' and 'help wanted' labels.
Yeah I totally understand that most of the work involved is interacting with terminal application itself as you say, no problem at all, I may use ttab anyone for OSX support.
v0.7.0 has been released with Gnome Terminal support - https://www.npmjs.com/package/ttab; see the manual for details.
Since adding support for additional terminal emulators on Linux is unrealistic, I'm closing this.