Skip to content
A Terminator plugin which attempts to figure out your current host, and apply a certain theme.
Python Makefile
Branch: master
Clone or download
Pull request Compare This branch is 2 commits ahead, 7 commits behind GratefulTony:master.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
assets Added Debian stuff Nov 28, 2015
debian Add dash in hostname Dec 7, 2015
files/usr/share/terminator/terminatorlib/plugins Add dash in hostname Dec 7, 2015
.gitignore Added Debian stuff Nov 28, 2015
LICENSE Create LICENSE Nov 28, 2015
Makefile update makefile Nov 28, 2015
README.md Update README.md Nov 28, 2015

README.md

Terminator HostWatch Plugin

This plugin monitors the last line (PS1) of each terminator terminal, and applies a host-specific profile if the hostname is changed.

As of now, the plugin simply parses the PS1-evaluated last line and matches it against the regex [^@]+@(\w+) (e.g. to match user@host).

Profiles

Installation

Debian-based systems:

  1. Either download a .deb-file from the release page
  2. Or: Add my Debian/APT archive:
wget -qO - http://archive.philippheckel.com/apt/Release.key | sudo apt-key add -
sudo sh -c "echo deb http://archive.philippheckel.com/apt/release/ release main > /etc/apt/sources.list.d/archive.philippheckel.com.list"
sudo apt-get update
sudo apt-get install terminator-hostwatch

Other Linux systems:
Put the host_watch.py in /usr/share/terminator/terminatorlib/plugins/ or ~/.config/terminator/plugins/. Then create a profile in Terminator to match your hostname. If you have a server that displays user@myserver ~ $, for instance, create a profile called myserver.

Configuration

For now, the only setting you can change is the regex patterns the plugin will react on. The default pattern is [^@]+@(\w+) (e.g. user@host). To change that, add this to your .config/terminator/config file and adjust the regexes accordingly:

[plugins]
  [[HostWatch]]
    patterns = "[^@]+@(\w+):([^#]+)#", "[^@]+@(\w+) .+ \$"

Development

Development resources for the Python Terminator class and the 'libvte' Python bindings can be found here:

For terminal.* methods, see:

For terminal.get_vte().* methods, see:

Debugging

To debug the plugin, start Terminator from another terminal emulator like this:

$ terminator --debug-classes=HostWatch

That should give you output like this:

   HostWatch::check_host: switching to profile EMEA0014, because line 'pheckel@EMEA0014 ~ $ ' matches pattern '[^@]+@(\w+)'
   HostWatch::check_host: switching to profile kartoffel, because line 'root@kartoffel:~# ' matches pattern '[^@]+@(\w+)'
   ...

Authors

The plugin was developed by GratefulTony (https://github.com/GratefulTony/TerminatorHostWatch), and extended by Philipp C. Heckel (https://github.com/binwiederhier/TerminatorHostWatch).

License

The plugin is licensed as GPLv2 only.

You can’t perform that action at this time.