tmux-python / tmux-python/tmuxp

Eval python code

Open
#771 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
4.6k
Forks
248
Avg merge
2h 13m
Merged PRs (30d)
1

Description

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"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the plugin-system issues #530 and #628, then compare the related tmuxp run-script proposal in #772. Define how the YAML pane.eval and pane.eval_script entries should execute the shown Python run(pane) function, and consider the issue complete when both examples work alongside the existing command entries.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.