Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terminator new window / new tab behaviour #56

Open
TheNetworkGuy opened this issue Dec 11, 2022 · 0 comments
Open

Terminator new window / new tab behaviour #56

TheNetworkGuy opened this issue Dec 11, 2022 · 0 comments

Comments

@TheNetworkGuy
Copy link

TheNetworkGuy commented Dec 11, 2022

I like opening new tabs for each of my Telnet sessions instead of starting a new window for each device connection.

To accomplish this i've modified the code slightly with 2 changes:

First off i check if the Terminator process is already running. If this is the case, start a new instance for this terminal session.
If there is a Terminator window then open a new tab on this window.

This behavior keeps my environment tidy and clean instead of having 7 different windows. Of course, we all have our preference but i would like to share my code on how I've modified this behavior. I can create a pull request as well but would like to know from the Dev's if this is beneficial to implement as the default for Terminator sessions.

All the next steps are edits in the eve-ng-integration file.

First off after all the imports, import the process_iter function.

from psutil import process_iter

Next up, modify the _terminal_emulator_cmd() function as so:

   def _terminal_emulator_cmd(self):
        if self.override_terminal:
            return self.override_terminal.split()
        elif self._is_command('x-terminal-emulator'):
            # go through a list of all processes
            for proc in process_iter():
                # If there's a match with the process name with Terminator
                if("terminator" in proc.name()):
                    # Start this terminal session with a new tab
                    return ['x-terminal-emulator', '--new-tab', '-e']
            else:
                # Start this terminal session with a new window
                return ['x-terminal-emulator', '-e']
        elif self._current_desktop('cinnamon', 'gnome', 'unity'):
           ...............
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant