Saturday, May 12, 2018

Terminator

Terminator (by Chris Jones) is a very convenient command-line GUI middleware. That's because it excels on multiplexing a single GUI window for multiple GNOME terminals. One could try to achieve similar results by simply running GNU screen with multiple (split terminal) regions within a single GNOME terminal but in the end it can't keep up with all the features of a specialized GUI software as Terminator. The main focus of GNU screen is not the GUI thing, but the underlying shell process thing.

Under Solaris 11.3, Terminator is dependent on Python 2 and GTK+ 2:

$ file /usr/bin/terminator
/usr/bin/terminator:    executable /usr/bin/python2.7 script


$ pkg info -r gtk2
          Name: library/desktop/gtk2
       Summary: GTK+ - GIMP toolkit libraries
      Category: Desktop (GNOME)/Libraries
         State: Installed
     Publisher: solaris
       Version: 2.20.1
 Build Release: 5.11
        Branch: 0.175.2.0.0.41.0
Packaging Date: June  9, 2014 11:20:38 PM
          Size: 47.36 MB
          FMRI: pkg://solaris/library/desktop/gtk2@2.20.1,...


$ pkg search -H -r -o pkg.shortfmri *:set:pkg.fmri:python-2? \
  |xargs -l pkg info -r \
  |egrep '(Name|Version|State)'
          Name: runtime/python-24
         State: Not installed (Obsolete)
       Version: 2.4.6
          Name: runtime/python-25
         State: Not installed (Obsolete)
       Version: 2.5.4
          Name: runtime/python-26
         State: Installed
       Version: 2.6.8
          Name: runtime/python-27
         State: Installed
       Version: 2.7.9


$ pkg mediator python
MEDIATOR     VER. SRC. VERSION IMPL. SRC. IMPLEMENTATION
python       vendor    2.7     vendor


Terminator is at version 0.95:

$ pkg info -r terminator
          Name: terminal/terminator
       Summary: Multiple GNOME terminals in one window
   Description: This is a project to produce an efficient way of ...
      Category: Applications/System Utilities
         State: Installed
     Publisher: solaris
       Version: 0.95
 Build Release: 5.11
        Branch: 0.175.3.0.0.26.0
Packaging Date: July  5, 2015 08:34:24 PM
          Size: 1.16 MB
          FMRI: pkg://solaris/terminal/terminator@0.95,...


Basically, it looks like:


I can successfully use my mouse to select a few lines from the left (terminal) without intefering with the terminals on the right. That's not the case with GNU screen regions. This copy/paste activity is frequent enough to become an annoyance if solely using GNU screen. Needless to say the awkward GNU screen scrollback.

But that's just the very beginning.

Of course I can't (and perhaps no one as well) cover all the possibilities. But I can say it's worthwhile to take some time to explore certain features that may be of greatest interest to one's particular case.

Its man pages, terminator(1) and terminator_config(5), are not bad although perhaps not sufficiently comprehensive. The official page doesn't add much either.

The default keybindings are almost enough to me, except that I preferred to customize a few ones in order to help me more easily remind of them. By the way, all tweaks are done by editing the ~/.config/terminator/config file.

For the moment, my configuration is as simple as:

$ cat -n ~/.config/terminator/config
     1    [global_config]
     2      enabled_plugins = ,

     3      title_transmit_fg_color = "#d4c8c8" 
     4      title_transmit_bg_color = "#004d6d"
     5      handle_size = 2
     6      focus = system
     7    [keybindings]
     8      toggle_zoom = <Alt>z
     9      split_horiz = 
<Alt>h
    10      split_vert = 
<Alt>v
    11      group_all =
<Alt>g
    12      ungroup_all =
<Shift><Alt>g
    13      group_tab =
<Alt>t
    14      ungroup_tab =
<Shift><Alt>t
    15    [profiles]
    16      [[default]]
 
    17        background_type = transparent 
    18        background_darkness = 0.8
    19        scrollback_infinite = True 
    20        scroll_on_output = False 
    21        cursor_color = "#4291c6"
    22    [layouts]
    23      [[default]]
    24        [[[child1]]]
    25          type = Terminal
    26          parent = window0
    27        [[[window0]]]
    28          type = Window
    29          parent = ""
    30    [plugins]


I particularly use very frequently my custom key bindings at lines 9 and 10 above. But the default key bindings of <Alt>-arrows and <Ctrl>-<Shift>-arrows are also very convenient for respectively changing and resizing each terminal within the single GUI window. I also consider very convenient the scroll settings on lines 19 and 20 above.

If I have my window split into multiple terminals and they all are at the shell prompt, I could clear all of them more easily with the following keys combination:

<Alt>-g   +   ^L   +   <Shift>-<Alt>-g

One may need to take advantage of backspace_binding and/or delete_binding if one is getting too much trouble configuring the keyboard.

As highlighted on my command-line GUI post, once the main window is split into as many terminals as necessary, one may individually run GNU screen on those considered critical. Nevertheless, this manual process can be somewhat automated with the following terminator configuration alternatives:

  • Under a given [[profile_name]] one may specify:
    (screen will be run on otherwise all children)

    use_custom_command = True
    custom_command = /usr/bin/bash -c "/opt/gnu/bin/screen -RR"

       
  • Under a given [[layout_name]] | [[child_name]] one may specify:
    (screen won't be run under this child)

    command = /usr/bin/bash -c "/opt/gnu/bin/screen -list"

NOTE
The -RR option above seems to be the most adequate. If the main Terminator window is forcibly closed or crashes, the screen sessions will be automatically detached and will be automatically reattached one by one under a new Terminator window.
NOTE
As Terminator and gnome-terminal already integrate in providing infinite scrollback capabilities, it may be adequate to disable the GNU screen scrollback feature for getting a slightly better scollback behavior:

# grep scrollback ~/.screenrc
defscrollback 0
By the way, one may be please to find a GUI configuration dialog-box. In can be launched by right-clicking over the Terminator main window and selecting the Preferences menu item:


It will display the following multi-tabbed configuraiton dialog:



 
One may even create a GNOME launcher:


 And so on and on...