### Example of Readthedocs.io Multilingual URL Source: https://gnome-terminator.readthedocs.io/en/latest/gettinginvolved This example illustrates how readthedocs.io handles multiple languages by directing users to the appropriate URL based on browser HTTP headers. This specific URL points to the German version of the documentation. ```text http://terminator-gtk3.readthedocs.io/de/latest/index.html ``` -------------------------------- ### Sphinx Documentation Build Dependencies (Ubuntu) Source: https://gnome-terminator.readthedocs.io/en/latest/gettinginvolved This command installs the necessary packages, Sphinx and the Sphinx Read the Docs theme, required to build the HTML documentation for the manual. It is specific to Ubuntu 16.04 LTS. ```bash sudo apt-get install python-sphinx python-sphinx-rtd-theme ``` -------------------------------- ### Compare GNOME Terminal and Terminator Startup Performance (Bash) Source: https://gnome-terminator.readthedocs.io/en/latest/faq This snippet demonstrates how to benchmark the startup performance of GNOME Terminal and Terminator using bash commands. It includes commands for both 'warm' and 'cold' starts, measuring execution time. The results indicate that while Terminator might be slightly slower in some scenarios, the performance is largely comparable, especially with GTK3. ```bash idiot@village:~$ time for i in {1..30} ; do gnome-terminal --profile=Quickexit; done real 0m10.606s ``` ```bash idiot@village:~$ time for i in {1..30} ; do terminator -g deletemeconfig -p Quickexit; done GTK2: real 0m11.928s A smidgen slower. GTK3: real 0m10.885s Yeah, basically identical! ``` ```bash sync && echo 3 > /proc/sys/vm/drop_caches idiot@village:~$ time gnome-terminal --profile=Quickexit real 0m7.628s (approx median, there was a strange variance for GT, between 5 and 9 secs) ``` ```bash sync && echo 3 > /proc/sys/vm/drop_caches idiot@village:~$ time terminator -g deletemeconfig -p Quickexit GTK2: real 0m11.390s (median of 3x) GTK3: real 0m11.264s (median of 3x) ``` -------------------------------- ### Example Language Codes for Manual Translation Source: https://gnome-terminator.readthedocs.io/en/latest/gettinginvolved This snippet shows examples of language codes used for translating the Terminator manual. It includes standard codes and regional variations, demonstrating how to structure language folders for internationalization. ```text pt - Portugese pt_BR - Brazilian Portugese ca - Catalan ca@valencia - Catalan (Dialect specific to Valencia?) ``` -------------------------------- ### Start Terminator Debug Server Source: https://gnome-terminator.readthedocs.io/en/latest/advancedusage Launches Terminator with a debug server enabled, indicated by the `-dd` option. This also adds an 'Open Debug Tab' option to the context menu for interactive debugging. ```bash terminator -dd ``` -------------------------------- ### Custom Command Example in Terminator Source: https://gnome-terminator.readthedocs.io/en/latest/preferences Demonstrates how to override the default command in a Terminator terminal, including handling applications that require a shell. It shows how to run a command within bash and how to maintain a shell session after the command completes. ```bash bash -ic bash -ic ; bash ``` -------------------------------- ### Default Help URL for Single Language Source: https://gnome-terminator.readthedocs.io/en/latest/gettinginvolved When only one language is available for the manual, this URL is used by default for the Help shortcut. It points to the index page of the English version of the documentation. ```text http://terminator-gtk3.readthedocs.io/en/latest/index.html ``` -------------------------------- ### Launch Terminator with Debug Output Source: https://gnome-terminator.readthedocs.io/en/latest/advancedusage Starts Terminator with debugging enabled, directing verbose output to the launching terminal. The `-u` option can disable DBus interaction for the debugged instance. ```bash terminator -d terminator -d -u ``` -------------------------------- ### Run Custom Command Non-interactively Source: https://gnome-terminator.readthedocs.io/en/latest/preferences Illustrates running a custom command without an interactive shell. This method may lead to unexpected behavior for applications that require a full shell, as shown with the 'mutt' example. ```bash bash -c mutt ``` -------------------------------- ### Launchpad Bug URL Handler Plugin (Python) Source: https://gnome-terminator.readthedocs.io/en/latest/plugins An example of a URL handler plugin for Terminator that recognizes and processes Launchpad bug report URLs. It defines a regular expression to match the URL format and a callback function to construct the full URL. ```python import re import terminatorlib.plugin as plugin class LaunchpadBugURLHandler(plugin.URLHandler): capabilities = ['url_handler'] handler_name = 'launchpad_bug' match = '\b(lp|LP):?\s?#?[0-9]+(,\s*#?[0-9]+)*\b' def callback(self, url): for item in re.findall(r'[0-9]+', url): return('https://bugs.launchpad.net/bugs/%s' % item) ``` -------------------------------- ### Remotinator Commands Overview (Text) Source: https://gnome-terminator.readthedocs.io/en/latest/advancedusage Lists available Remotinator commands and their actions. Some commands require a UUID, while others do not. ```text Command | Action ---|--- get_tab | Get the UUID of a parent tab get_tab_title | Get the title of a parent tab get_terminals [1] | Get a list of all terminals get_window | Get the UUID of a parent window get_window_title | Get the title of a parent window hsplit | Split the current terminal horizontally new_tab | Open a new tab new_window [1] | Open a new window vsplit | Split the current terminal vertically [1]| _(1, 2)_ These commands **do not** require the UUID. If not marked as such then the command **does** require the UUID. ---|--- ``` -------------------------------- ### Run Custom Command Interactively Source: https://gnome-terminator.readthedocs.io/en/latest/preferences Demonstrates how to run a custom command interactively using bash, ensuring proper shell behavior for applications like 'mutt'. This is crucial for programs that rely on an interactive shell environment. ```bash bash -ic mutt ``` -------------------------------- ### Execute Remotinator Commands (Shell) Source: https://gnome-terminator.readthedocs.io/en/latest/advancedusage Demonstrates how to execute Remotinator commands within a Terminator terminal. Commands can be run directly or by specifying a UUID. ```shell $ remotinator ``` ```shell $ remotinator --uuid ``` ```shell $ TERMINATOR_UUID= remotinator ``` ```shell $ export TERMINATOR_UUID=; remotinator ``` -------------------------------- ### Launch Terminator with a Specific Layout Source: https://gnome-terminator.readthedocs.io/en/latest/advancedusage Opens Terminator with a predefined layout specified by ``. By default, this does not disable DBus; the `-u` option must be explicitly added to disable DBus interaction. ```bash terminator -l terminator -l -u ``` -------------------------------- ### Launch Multiple Terminator GTK2 Instances Source: https://gnome-terminator.readthedocs.io/en/latest/faq This snippet shows how to launch multiple instances of Terminator using the GTK2 backend with a specific configuration file. It's used for comparative memory usage analysis against GNOME Terminal. The `-g` flag specifies a config file, and `-u` might relate to Unicode handling or a specific feature. ```bash idiot@village:~$ terminator -g deletemeconfig & idiot@village:~$ for i in {1..100} ; do terminator -g deletemeconfig -u & done ``` -------------------------------- ### Create Terminator Context Menu Item Plugin (Python) Source: https://gnome-terminator.readthedocs.io/en/latest/plugins This Python code demonstrates how to create a custom context menu item plugin for Terminator. It utilizes Terminator's plugin and configuration APIs to add a new menu option and manage its settings. The plugin defines a `callback` method that is invoked when the menu item is activated. ```python import terminatorlib.plugin as plugin from terminatorlib.config import Config available = ['CustomCommandsMenu'] class CustomCommandsMenu(plugin.MenuItem): capabilities = ['terminal_menu'] config = None def __init__(self): self.config = Config() myconfig = self.config.plugin_get_config(self.__class__.__name__) # Now extract valid data from sections{} def callback(self, menuitems, menu, terminal): menuitems.append(gtk.MenuItem('some jazz')) ``` -------------------------------- ### Launch Multiple GNOME Terminal Instances Source: https://gnome-terminator.readthedocs.io/en/latest/faq This snippet demonstrates how to launch multiple instances of GNOME Terminal in the background. It's used to simulate heavy load and measure memory consumption. No specific dependencies are required beyond a standard Linux environment. ```bash idiot@village:~$ gnome-terminal & idiot@village:~$ for i in {1..100} ; do gnome-terminal & done ``` -------------------------------- ### Launch 100 GNOME Terminal Instances Source: https://gnome-terminator.readthedocs.io/en/latest/faq This command launches 100 instances of GNOME Terminal in the background. It's a basic method to test the memory overhead of the application. ```bash idiot@village:~$ for i in {1..100} ; do gnome-terminal --disable-factory & done ``` -------------------------------- ### Launch 100 Terminator GTK2 Instances Source: https://gnome-terminator.readthedocs.io/en/latest/faq This command launches 100 instances of Terminator (GTK2 version) in the background. It uses a custom configuration file 'deletemeconfig' and the '-u' flag, likely for unique session handling. ```bash idiot@village:~$ for i in {1..100} ; do terminator -g deletemeconfig -u & done ``` -------------------------------- ### Measure System Memory Before and After Terminator GTK2 Instances Source: https://gnome-terminator.readthedocs.io/en/latest/faq This code snippet measures system memory before and after launching multiple Terminator GTK2 instances. Similar to the GNOME Terminal analysis, it uses `sync`, `drop_caches`, and `free` to assess memory, buffer, cache, and swap. The results help determine the memory overhead of Terminator. ```bash root@pinpoint:~# sync && echo 3 > /proc/sys/vm/drop_caches && free total used free shared buffers cached Mem: 3102404 1324492 1777912 4388 152 49688 -/+ buffers/cache: 1274652 1827752 Swap: 3121996 744528 2377468 root@pinpoint:~# sync && echo 3 > /proc/sys/vm/drop_caches && free total used free shared buffers cached Mem: 3102404 1652112 1450292 4756 860 49968 -/+ buffers/cache: 1601284 1501120 Swap: 3121996 744224 2377772 root@pinpoint:~# sync && echo 3 > /proc/sys/vm/drop_caches && free total used free shared buffers cached Mem: 3102404 1305376 1797028 4236 124 42836 -/+ buffers/cache: 1262416 1839988 Swap: 3121996 744116 2377880 Used (used mem -buffers/cache + swap) before start: 2019180 after start : 2345508 = 326328 kbytes, 319 Mbytes / 3.16 MBytes/instance after kill : 2006532 = −12648 kbytes, -12.35 Mbytes recovered (first process) ``` -------------------------------- ### Basic Terminator Plugin Structure (Python) Source: https://gnome-terminator.readthedocs.io/en/latest/plugins Defines the fundamental structure for a Terminator plugin. It requires importing the plugin module, specifying available plugin classes in a list, and defining a class that inherits from a base plugin class. ```python import terminatorlib.plugin as plugin available = ['myfirstplugin'] class myfirstplugin(plugin.SomeBasePluginClass): # etc. ``` -------------------------------- ### Measure System Memory Before, During, and After Terminator GTK3 Instances Source: https://gnome-terminator.readthedocs.io/en/latest/faq This sequence of shell commands measures system memory usage before, after launching, and after killing 100 Terminator GTK3 instances. It employs 'sync', 'drop_caches', and 'free' for memory monitoring. ```bash root@pinpoint:~# sync && echo 3 > /proc/sys/vm/drop_caches && free total used free shared buffers cached Mem: 3102404 1467204 1635200 4816 120 46132 -/+ buffers/cache: 1420952 1681452 Swap: 3121996 751000 2370996 root@pinpoint:~# sync && echo 3 > /proc/sys/vm/drop_caches && free total used free shared buffers cached Mem: 3102404 2848372 254032 7216 960 52652 -/+ buffers/cache: 2794760 307644 Swap: 3121996 750016 2371980 root@pinpoint:~# sync && echo 3 > /proc/sys/vm/drop_caches && free total used free shared buffers cached Mem: 3102404 1483388 1619016 4820 148 46084 -/+ buffers/cache: 1437156 1665248 Swap: 3121996 749828 2372168 Used (used mem -buffers/cache + swap) before start: 2171952 after start : 3544776 = 1372824 kbytes, 1340 Mbytes / 13.41 MBytes/instance after kill : 2186984 = 15032 kbytes, 15 Mbytes not recovered ``` -------------------------------- ### Measure System Memory Before, During, and After Terminator GTK2 Instances Source: https://gnome-terminator.readthedocs.io/en/latest/faq This sequence of shell commands measures system memory usage before, after launching, and after killing 100 Terminator GTK2 instances. It uses 'sync', 'drop_caches', and 'free' to provide memory statistics. ```bash root@pinpoint:~# sync && echo 3 > /proc/sys/vm/drop_caches && free total used free shared buffers cached Mem: 3102404 1313456 1788948 4284 152 43844 -/+ buffers/cache: 1269460 1832944 Swap: 3121996 736844 2385152 root@pinpoint:~# sync && echo 3 > /proc/sys/vm/drop_caches && free total used free shared buffers cached Mem: 3102404 2866552 235852 19484 1084 65408 -/+ buffers/cache: 2800060 302344 Swap: 3121996 736340 2385656 root@pinpoint:~# sync && echo 3 > /proc/sys/vm/drop_caches && free total used free shared buffers cached Mem: 3102404 1317724 1784680 4284 152 43464 -/+ buffers/cache: 1274108 1828296 Swap: 3121996 736304 2385692 Used (used mem -buffers/cache + swap) before start: 2006304 after start : 3536400 = 1530096 kbytes, 1494 Mbytes / 14.94 MBytes/instance after kill : 2010412 = 4108 kbytes, 4 Mbytes not recovered ```