Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Terminal.app behaves like a dtterm window UNIX
For some unknown reason I ran vttest on Terminal.app and instead of behaving only like a VT100 / xterm window, the emulation seems to pick up on Digital's dtterm escape sequences as well.

Comparing the VT100 and dtterm entries with "infocmp," and examining the actual keyboard codes for function keys, shows Terminal.app behaving more like dtterm than vt100.

With vttest it's clear to see that Terminal.app does support color; however, the background/foreground colors seem to be reversed as far as the proper escape sequences go. Nonetheless, lynx (Fink dist) and emacs work just fine with TERM set to "dtterm". Reversing the Background / Normal Color settings in the preferences makes vttest look right but for casual use the defaults fare better.

A nice feature of dtterm: it's possible to resize and dock the window and raise/lower the z-level programmatically. Here are some examples:
  alias hide 'echo -n "^[[2t"'
alias lower 'echo -n "^[[6t"'
alias raise 'echo -n "^[[5t"'
alias 42x80 'echo -n "^[[8;42;80t"'
alias maxh 'echo -n "^[[3;0;t^[[8;0;80t"'
alias maxw 'echo -n "^[[3;0;t^[[8;24;0t"'
alias maxhw 'echo -n "^[[3;0;t^[[8;0;0t"'
With "lower," it's possible to have a window behind others that still has keyboard focus...

How about this for a "make" alias:
  alias makebg 'hide; make !*; raise'
"vttest -l" outputs the various escape codes used in the tests to vttest.log.

[Editor's note: I must admit this is well beyond my knowledge of the Terminal, but I was able to make most of these work by first creating the aliases in my aliases.mine file, and then setting my tcsh terminal type to 'dtterm' with setenv TERM dtterm. To enter the aliases, you need to realize that ^[ is a Control-Open Bracket. You can type this in vi by hitting Control-V Control-Open Bracket, followed by the rest of the text. The author of this hint also has a page of other useful Terminal tricks...]
    •    
  • Currently 3.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[7,212 views]  

Terminal.app behaves like a dtterm window | 5 comments | Create New Account
Click here to return to the 'Terminal.app behaves like a dtterm window' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Escape
Authored by: signals on Jan 24, '03 09:11:37AM

Just FYI, not only is ^[ a Control-[, but it is also an escape. You can insert escapes by hitting Control-V then pressing the escape key while in insert mode in vi.

One minor annoyance with these echo aliases for terminal control is that if you do somehting like "alias" by itself, or "cat .bashrc" each of the Terminal.app aliases executes and the window bounces all over the screen. (At least it does in bash.)

-Signals



[ Reply to This | # ]
Escape
Authored by: erikh on Jan 07, '05 11:17:07PM

For just this reason, bash has an escape 'escape macro' (how's that for recursion!) in it's overloaded 'echo' as \e. I would be surprised if tcsh doesn't have an equivalent function.



[ Reply to This | # ]
audio capture
Authored by: o5jive on Feb 06, '03 03:13:24PM

capture audio using Terminal..

http://members.cox.net/shaffersys/audio_tools.tgz



[ Reply to This | # ]
Terminal.app behaves like a dtterm window
Authored by: EatingPie on Jan 06, '05 02:34:40PM

The above link does not work. If there is such a program, it seems worthy of a hint all by itself.

Another dtterm sequence can set window position.

echo -n "^[[3;480;1t"

This puts the window at position 480/1 (horizontal/vertical), ie the top of your screen, near the middle.

-Pie

---
-Pie
<http://www.storybytes.com>



[ Reply to This | # ]
Terminal.app behaves like a dtterm window
Authored by: erikh on Jan 07, '05 11:20:17PM

Unfortunately, iTerm doesn't seem to support dtterm sequences.

This is a great tip though, even if I will only use Terminal.app rarely.



[ Reply to This | # ]