tmuxp icon indicating copy to clipboard operation
tmuxp copied to clipboard

Eval python code

Open tony opened this issue 3 years ago • 0 comments

In addition to our plugin system #530 #628

We can allow inserting of scripts into "commands"

pane.eval

windows:
  panes:
  - shell_command:
    - eval: >
      def run(pane):
          # total access up the tree
          window = pane.window
          session = pane.window.session
          server = pane.window.server.server

          pane.send_keys(f'echo "ran this by hand in {window.window_name} of {session.session_name} in {server}', enter=True)
    - cmd: echo "hello"

pane.eval_script

See also tmuxp run-script #772

script.sh:

def run(pane):
    # total access up the tree
    window = pane.window
    session = pane.window.session
    server = pane.window.server.server

    pane.send_keys(f'echo "ran this by hand in {window.window_name} of {session.session_name} in {server}', enter=True)
windows:
  panes:
  - shell_command:
    - eval_script: script.py
    - cmd: echo "hello"

tony avatar Mar 28 '22 10:03 tony