NAME

Terminal::Control - Perl extension for identifying the terminal window in use

SYNOPSIS

use Terminal::Identify;

# Get informations about the terminal.

whichterminalami();

Variables in square brackets in the method call are optional. They are in the related method predefined.

In general every method is still accessible from outside the module using the syntax Terminal::Control::method_name.

DESCRIPTION

Preface

The main goal of this module is offering a methods which is able to identify the terminal emulator, which a user uses.

Methods summary

The terminal emulator in use can be identified by the command itself and the aliases.

List of methods

Standard methods

  • whichterminalami()

METHODS

whichterminalami()

Get the name of the terminal emulator, which is in use by the user. First the method tries to fetch the login shell. Next the path to the terminal is determined. Based on this informations the related process to login shell and terminal path is identified. Evaluation of the PPID results in the parents process ID. The command related to this PID is the name of the terminal in use.

Variables in square brackets in the method call are optional. They are in the related method predefined.

ERROR CODES

No error codes yet

EXAMPLES

my $terminal = whichterminalami();
print $term . "\n";

VARIABLES EXPLANATION

No variables yet

NOTES

No notes yet

SYSTEM COMPATIBILITY

The module should work on Linux as well as Unix or Unix-like operating systems in general until something else was shown.

FUNCTIONALITY REQUIREMENT

  • ps

  • users

  • shells

  • passwd

PORTABILITY

The module should work on Linux as well as Unix or Unix-like operating systems in general until something else was shown.

METHOD ALIASES

whichtermami       <=  whichterminalami
which_terminal     <=  whichterminalami
identify_terminal  <=  whichterminalami

TERMINALS TESTED

As described above, terminal emulators or the system console are used to interact with the operating system.

Terminals tested so far with the module:

  • Aterm

  • Eterm

  • Guake Terminal

  • kitty

  • LXTerminal

  • MATE-Terminal

  • ROXTerm

  • Terminology

  • Tilix

  • Xterm

LIMITATIONS

Not known yet

OPEN ISSUES

None so far

KNOWN BUGS

Not known yet

ABSTRACT

The module identifies the terminal which the logged in user is using currently. For this purpose, the login shell and the logged-in users are determined. The Perl script runs in a pseudo terminal shell with its own identification number. This pseudo terminal shell is also identified. Based on this data, the terminal emulator used can be determined.

SEE ALSO

users(1) - Linux manual page

shells(5) - Linux manual page

passwd(5) - Linux manual page

ps(1) - Linux manual page

AUTHOR

Dr. Peter Netz, <ztenretep@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2022 by Dr. Peter Netz

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.30.0 or, at your option, any later version of Perl 5 you may have available.