Add terminal awareness ingredient. #15

Open
wants to merge 7 commits into
from

Conversation

Projects
None yet
4 participants
Owner

zyga commented Sep 5, 2015

This rather huge patch adds the terminal awareness ingredient. This
ingredient implements terminal emulator fingerprinting coupled with a
look-aside table of features and their implementation status for each of
the multiple supported terminal emulator programs.

Extensive care was taken to support virtually everything that is
actually used out there in the field.

The list of detected, mainstream terminals includes:

  • cmd.exe on Windows
  • Apple's Terminal.app on OS X
  • Gnome Terminal
  • KDE Konsole
  • X11 xterm
  • Linux console (think vt1-6)

The list of niche terminals also supported includes:

  • iTerm on OS X
  • aterm
  • eterm
  • pterm
  • rxvt
  • terminator
  • terminology

In addition the following terminal multiplexers are supported:

  • screen
  • tmux

Lastly all remote terminals connected over SSH are identified as such
but the true nature of the terminal is not known.

This patch also contains an interesting example, examples/terminal.py.
Running this program with the "check" subcommand will create a visual
"test case" that shows all the information that guacamole managed to
find out along with a breakdown for all of the features and their
status. This can be used to validate if something works as expected.
Unfortunately it is a out-of-band knowledge so it will have to be
updated over time.

Signed-off-by: Zygmunt Krynicki zygmunt.krynicki@canonical.com

Add terminal awareness ingredient.
This rather huge patch adds the terminal awareness ingredient. This
ingredient implements terminal emulator fingerprinting coupled with a
look-aside table of features and their implementation status for each of
the multiple supported terminal emulator programs.

Extensive care was taken to support virtually everything that is
actually used out there in the field.

The list of detected, mainstream terminals includes:
 - cmd.exe on Windows
 - Apple's Terminal.app on OS X
 - Gnome Terminal
 - KDE Konsole
 - X11 xterm
 - Linux console (think vt1-6)

The list of niche terminals also supported includes:
 - iTerm on OS X
 - aterm
 - eterm
 - pterm
 - rxvt
 - terminator
 - terminology

In addition the following terminal multiplexers are supported:
 - screen
 - tmux

Lastly all remote terminals connected over SSH are identified as such
but the true nature of the terminal is not known.

This patch also contains an interesting example, examples/terminal.py.
Running this program with the "check" subcommand will create a visual
"test case" that shows all the information that guacamole managed to
find out along with a breakdown for all of the features and their
status. This can be used to validate if something works as expected.
Unfortunately it is a out-of-band knowledge so it will have to be
updated over time.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Owner

zyga commented Sep 5, 2015

Linux console on Ubuntu 14.04.3 (with kernel 3.13) has incorrect classification of ansi-text-blink-slow

guacamole-terminal-linux-3 13

@zyga zyga referenced this pull request Sep 5, 2015

Open

Add better tools for working with colors #6

4 of 4 tasks complete
Owner

zyga commented Sep 5, 2015

OS X 10.7 with Apple Terminal (everything OK)
osx-10 7-terminal-app

OS X 10.7 with iTerm 2 (everything OK)
osx-10 7-iterm2

Owner

zyga commented Sep 5, 2015

But oddly enough Ubuntu 12.04.5 (with 3.13.0) kernel has different behavior than 14.04.3 as ansi-text-blink-slow is not broken.

guacamole-terminal-linux-3 13-precise

kissiel commented Sep 5, 2015

screen shot 2015-09-06 at 00 07 07

On OSX 10.10.5 Blinking stuff was blinking :)
Owner

zyga commented Sep 6, 2015

On Ubuntu 15.10 gnome-terminal didn't get its version identification right.
guacamole-terminal-gnome-wily

On the same version of Ubuntu, the linux console is far more capable, doing native nearest-color transformations. In practice rainbow example works without the color controller patches!

guacamole-terminal-linux-4 2-wily

Owner

zyga commented Sep 6, 2015

Gnome terminal issue was traced to localized output of --version. This is now fixed.

Owner

zyga commented Sep 6, 2015

Windows XP works correctly (as if that was top priority ;-)
guacamole-windows-xp-cmd

Owner

zyga commented Sep 6, 2015

Windows 10 works okay but only in cmd.exe. Powershell seems to be unsupported by colorama. Until we do native windows support that's okay (one problem at a time).

guacamole-windows-10-cmd

guacamole-windows-10-powershell

Owner

zyga commented Sep 6, 2015

It would help if someone could tell me how to identify powershell though. We could at least say everything is unsupported for now.

Gnome Terminal over an SSH connection is identified as being over SSH, but leaves a lot of (apparently correctly supported) statuses as "unknown".

image

Owner

zyga commented Sep 6, 2015

@stuartlangridge yes that is expected. With all kinds of remote connections (I didn't test mosh yet, actually, mmm) we cannot know what the host is doing and what is really supports. It might be ssh from linux console or from windows xp, it might be gnome-terminal on latest version of gnome. Those differ entirely and there's no way to say.

In a follow-up from this I will prepare patches for most important terminals to set TERM_PROGRAM and TERM_PROGRAM_VERSION and for ssh to forward those across. This would allow guacamole to know what is on the other side but it's a long process and I'm not sure if upstreams will want to accept my patches.

zyga added some commits Sep 6, 2015

Fix version parsing for Gnome Terminal
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Add flag for terminal multiplexers to ignore TERM_PROGRAM{,_VERSION}
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Owner

zyga commented Sep 6, 2015

OS X needs process tree traversal to understand screen and tmux correctly.

hrw commented Sep 6, 2015

XFCE4 Terminal recognized as Konsole:

xfceterminal

It was run from Konsole:

konsole

hrw commented Sep 6, 2015

XTerm started from Konsole:

xterm

Owner

zyga commented Sep 6, 2015

@hrw Thanks for checking. I'll add support for XFCE. I was quite surprised that xterm started from konsole was mis-identified though. I will look into that. Thanks again :)

hrw commented Sep 6, 2015

rxvt-unicode:
rxvt-unicode

Owner

zyga commented Sep 6, 2015

Uuuuh, I wasn't expecting a crasher! Damn, looking now.

hrw commented Sep 6, 2015

XTerm started from XFCE4 menu:

xterm2

XFCE4 terminal started from XFCE4 menu:
1

Fix crash on unset version
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>

hrw commented Sep 6, 2015

Crash when started from gVim:
3

Owner

zyga commented Sep 6, 2015

I've pushed a fix for version. Can you re-run it where it used to crash? That will help me fix everything and get the profiles right.

Owner

zyga commented Sep 6, 2015

@hrw In XTerm 319, was blinking working? It looks like older xterm was supporting dim (for me it worked on 312) but it stopped to work on 319.

hrw commented Sep 6, 2015

All started from XFCE menu:

xfce4-terminal (no blink)
10

xterm (with blink-slow working when window is active)
11

rxvt-unicode (both blink-fast and blink-slow blink fast nevermind is window active or not)
12

Owner

zyga commented Sep 6, 2015

Wow, this is the first time I've seen both blinks to work! Fantastic. Can you help me with one more thing: for unknown terminals please tell me what the executable is called and what the output of the --version (or similar) command is. I specifically need to know the executable name and how to check for its version string.

hrw commented Sep 6, 2015

Tmux in Konsole - blink-slow works when window active

13

hrw commented Sep 6, 2015

00:06 hrw@puchatek:guacamole$ xfce4-terminal --version
xfce4-terminal 0.6.3 (Xfce 4.12)

Copyright (c) 2003-2012
Zespół twórców Xfce. Wszystkie prawa zastrzeżone.

Autor: Benedikt Meurer benny@xfce.org
i Nick Schermer nick@xfce.org.

Proszę zgłaszać błędy na adres http://bugzilla.xfce.org/.

hrw commented Sep 6, 2015

00:08 hrw@puchatek:guacamole$ urxvt -version
urxvt: "version": unknown or malformed option.
rxvt-unicode (urxvt) v9.21 - released: 2014-12-31
options: perl,xft,styles,combining,blink,encodings=eu+vn+jp+jp-ext+kr+zh+zh-ext,fade,transparent,tint,pixbuf,XIM,frills,selectionscrolling,wheel,slipwheel,smart-resize,cursorBlink,pointerBlank,scrollbars=plain+rxvt+NeXT+xterm
Usage: urxvt [-help] [--help]
[-display string] [-tn string] [-geometry geometry] [-C] [-iconic]
[-cd string] [-dockapp] [-/+rv] [-/+ls] [-mc number] [-/+j] [-/+ss] [-/+ptab]
[-/+sb] [-/+sr] [-/+st] [-sbt number] [-/+si] [-/+sk] [-/+sw] [-/+ip] [-/+tr]
[-tint color] [-sh number] [-blr HxV] [-fade number] [-fadecolor color]
[-/+ut] [-/+vb] [-/+tcw] [-/+insecure] [-/+uc] [-/+bc] [-/+pb] [-bg color]
[-fg color] [-hc color] [-cr color] [-pr color] [-pr2 color] [-bd color]
[-pixmap file[;geom]] [-icon file] [-fn fontname] [-fb fontname]
[-fi fontname] [-fbi fontname] [-/+is] [-im name] [-pt style]
[-imlocale string] [-imfont fontname] [-name string] [-title string]
[-n string] [-sl number] [-embed windowid] [-depth number] [-visual number]
[-/+override-redirect] [-pty-fd fileno] [-/+hold] [-w number] [-b number]
[-/+bl] [-lsp number] [-letsp number] [-/+sbg] [-mod modifier] [-/+ssc]
[-/+ssr] [-pe string] [-e command arg ...]

zyga added some commits Sep 6, 2015

Add missing comment
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Add support for XFCE4 Terminal
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Owner

zyga commented Sep 6, 2015

@hrw XFCE4 Terminal should work now

hrw commented Sep 6, 2015

Detected Terminal: XFCE4 Terminal, version 0.6.3

Owner

zyga commented Sep 6, 2015

Fantastic, thanks!

Can you confirm that urxvt -help prints the version number?

hrw commented Sep 6, 2015

It does. On stderr.

Add support for urxvt
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Owner

zyga commented Sep 6, 2015

Can you re-run with urxvt and just check if anything is mis-detected now. (No need for more screenshots)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment