Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

libtmux : send tmux commands #369

Unanswered
jjournet asked this question in Q&A
Discussion options

Hello,

Perhaps I missed the point in the documentation, or it is something obvious, but here is my use case:
I have a script (Python with libtmux) creating a session and 2 windows, with 2 panes in the second window. In these 2 panes I'm connecting through SSH to 2 different servers.

All that is working fine (and by the way, libtmux is great to do that), but I want to send a command 'set synchronize-panes on' in the 2nd window to synchronize the 2 panes (I want to send the same commands to both servers)
... and I don't know how to do that

I found this issue, which explains how to send C-b via send_keys, but is it the 'tmuxlib' way ? is there a dedicated function to send tmux commands?

thanks
EDIT1: solution in issue linked is not working for me

You must be logged in to vote

Replies: 1 comment

Comment options

Do you have a code example or minimal reproducible case you've tried? (perhaps to begin: Just use a simple tmux setup locally?)

tmuxp shell

Interestingly, pane.send_keys('C-c', enter=False, suppress_history=False) works

Also this worked: pane.cmd('send-keys', 'C-c')

I tested by having vim in INSERT mode, then sending C-c to the pane:

libtmux.Server().sessions[1].attached_window.panes[0].send_keys('C-c', enter=False, suppress_history=False)

Then I went back into insert mode:

libtmux.Server().sessions[1].attached_window.panes[0].send_keys('C-c', enter=False, suppress_history=False)

Do you have nested tmux sessions? You may need to escape twice

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.