★ wanayoo — archive 1999 https://github.com/tmux-python/tmuxp/issues/530Nouvelle recherche | Portail wanayoo
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

Plugin system #530

Open
tony opened this issue Dec 25, 2019 · 0 comments
Open

Plugin system #530

tony opened this issue Dec 25, 2019 · 0 comments

Comments

@tony
Copy link
Member

@tony tony commented Dec 25, 2019

Access Session, Window or Pane object being adjusted.

This would allow hook-like access to tmux session, window, and panes throughout the workspace builder lifecycle.

plugins:
  - 'my_tmuxp_plugin.plugin.TmuxResurrect'
session_name: my session
windows:
- window_name: my window
  layout: tiled
  shell_command_before:
    - cd ~/                    # run as a first command in all panes
  panes:
    - echo pane
    - echo pane

Assume a git repo my_tmuxp_plugin with a directory my_tmuxp_plugin inside it, and a pypi package called my_tmuxp_plugin:

my_tmuxp_plugin/plugin.py:

class TmuxResurrect:
    def before_workspace_builder(self, session):
        # On blank workspace, after session created, but before any windows/panes/commands entered

        # technically, it'd be possible to do any kind of subprocess call here as well

    def before_script(self, session):
        # access to libtmux session object in tmuxp load

   def reattach(self, session):
       # if session_name already live, before reattaching

   def on_window_create(self, window):
        if window.window_name == 'my window':
            # do stuff

   def after_window_finished(self, window):  # after commands stuff commands finally entered
       pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.