|
NAMETerm::Detect::Software - Detect terminal (emulator) software and its capabilitiesVERSIONThis document describes version 0.223 of Term::Detect::Software (from Perl distribution Term-Detect-Software), released on 2020-07-10.SYNOPSISuse Term::Detect::Software qw(detect_terminal detect_terminal_cached); my $res = detect_terminal(); die "Not running under terminal!" unless $res->{emulator_engine}; say "Emulator engine: ", $res->{emulator_engine}; say "Emulator software: ", $res->{emulator_software}; say "Unicode support? ", $res->{unicode} ? "yes":"no"; say "Boxchars support? ", $res->{box_chars} ? "yes":"no"; say "Color depth: ", $res->{color_depth}; say "Inside emacs? ", $res->{inside_emacs} ? "yes":"no"; DESCRIPTIONThis module uses several heuristics to find out what terminal (emulator) software the current process is running in, and its capabilities/settings. This module complements other modules such as Term::Terminfo and Term::Encoding.FUNCTIONSdetect_terminal() => HASHREFReturn a hashref containing information about running terminal (emulator) software and its capabilities/settings.Detection method is tried from the easiest/cheapest (e.g. checking environment variables) or by looking at known process names in the process tree. Terminal capabilities is determined using heuristics. Currently Konsole and Konsole-based terminals (like Yakuake) can be detected through existence of environment variables "KONSOLE_DBUS_SERVICE" or "KONSOLE_DBUS_SESSION". xterm is detected through "XTERM_VERSION". XFCE's Terminal is detected using "COLORTERM". The other software are detected via known process names. Terminal capabilities and settings are currently determined via heuristics. Probing terminal configuration files might be performed in the future. Result:
detect_terminal_cached([$flag]) => ANYJust like "detect_terminal()" but will cache the result. Can be used by applications or modules to avoid repeating detection process.FAQWhat is this module for? Why not Term::Terminfo or Term::Encoding?This module was first written for Text::ANSITable so that the latter can provide good defaults when displaying formatted and colored tables, especially on popular terminal emulation software like Konsole (KDE's default terminal), gnome-terminal (GNOME's default), Terminal (XFCE's default), xterm, rxvt.This module works by trying to figure out the terminal emulation software because the information provided by Term::Terminfo and Term::Encoding are sometimes not specific enough. For example, Term::Encoding can return utf-8 when running under rxvt, but since the software currently lacks Unicode support we shouldn't display Unicode characters. Another example is color depth: Term::Terminfo currently doesn't recognize Konsole's 24bit color support and only gives "max_colors" 256. HOMEPAGEPlease visit the project's homepage at <https://metacpan.org/release/Term-Detect-Software>.SOURCESource repository is at <https://github.com/perlancar/perl-Term-Detect-Software>.BUGSPlease report any bugs or feature requests on the bugtracker website <https://rt.cpan.org/Public/Dist/Display.html?Name=Term-Detect-Software>When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. SEE ALSOTerm::TerminfoTerm::Encoding AUTHORperlancar <perlancar@cpan.org>COPYRIGHT AND LICENSEThis software is copyright (c) 2020, 2019, 2015, 2014, 2013 by perlancar@cpan.org.This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Visit the GSP FreeBSD Man Page Interface. |