tmux socket api
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
Is there any way I can control a tmux server and send commands to it like switching to a specific window in a session, or make some queries about the panes through the socket it creates?
I've looked into libtmux for python and it appears to be lacking in some ways. Is there an official reference for the tmux api where I could look? The official tmux package on my distro contains only a single tmux binary.
Is there any way other than reading the source to find out how one can control tmux through its socket?
Are there any other terminal multiplexers which make it easy/ are intended to make it easy?
tmux socket unix-sockets
add a comment |Â
up vote
2
down vote
favorite
Is there any way I can control a tmux server and send commands to it like switching to a specific window in a session, or make some queries about the panes through the socket it creates?
I've looked into libtmux for python and it appears to be lacking in some ways. Is there an official reference for the tmux api where I could look? The official tmux package on my distro contains only a single tmux binary.
Is there any way other than reading the source to find out how one can control tmux through its socket?
Are there any other terminal multiplexers which make it easy/ are intended to make it easy?
tmux socket unix-sockets
Not asked for, but for reference: Thetmux
source code is available at github.com/tmux/tmux
â Kusalananda
Apr 16 at 9:59
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
Is there any way I can control a tmux server and send commands to it like switching to a specific window in a session, or make some queries about the panes through the socket it creates?
I've looked into libtmux for python and it appears to be lacking in some ways. Is there an official reference for the tmux api where I could look? The official tmux package on my distro contains only a single tmux binary.
Is there any way other than reading the source to find out how one can control tmux through its socket?
Are there any other terminal multiplexers which make it easy/ are intended to make it easy?
tmux socket unix-sockets
Is there any way I can control a tmux server and send commands to it like switching to a specific window in a session, or make some queries about the panes through the socket it creates?
I've looked into libtmux for python and it appears to be lacking in some ways. Is there an official reference for the tmux api where I could look? The official tmux package on my distro contains only a single tmux binary.
Is there any way other than reading the source to find out how one can control tmux through its socket?
Are there any other terminal multiplexers which make it easy/ are intended to make it easy?
tmux socket unix-sockets
edited Apr 16 at 9:55
asked Apr 10 at 13:00
saga
869119
869119
Not asked for, but for reference: Thetmux
source code is available at github.com/tmux/tmux
â Kusalananda
Apr 16 at 9:59
add a comment |Â
Not asked for, but for reference: Thetmux
source code is available at github.com/tmux/tmux
â Kusalananda
Apr 16 at 9:59
Not asked for, but for reference: The
tmux
source code is available at github.com/tmux/tmuxâ Kusalananda
Apr 16 at 9:59
Not asked for, but for reference: The
tmux
source code is available at github.com/tmux/tmuxâ Kusalananda
Apr 16 at 9:59
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
3
down vote
accepted
It is not difficult to do the tasks you ask using python-tmux.
E.g. if you start a new server with session name foo
tmux new-session -s foo
you can attach to it via python tmux (assuming the python library is installed) from ipython via
import libtmux
server = libtmux.Server()
session = server.find_where( "session_name": "foo" )
Then you can watch in your tmux window the action of commands e.g.
session.cmd("send-keys","x")
will send a keystroke "x". The pane list you asked for can be queried via
session.cmd("list-panes").stdout
and you can switch to a specific window (say nr. 1) with
session.cmd("select-window","-t","1").stdout
You do not have to read the source code of tmux to learn this. All these commands are documented in the man page of tmux. If this is not sufficient for you, you need to be more specific what you mean by python-libtmux being "lacking in some way".
How do I send control characters? According to tmux man pageC-
will be interpreted as ctrl. libtmux passes it as a literal.
â saga
Apr 16 at 10:48
The point I was trying to make is that I couldn't find the api to talk to a tmux server anywhere on the net. It also suggests that tmux wasn't supposed to be scriptable.
â saga
Apr 16 at 10:53
1
Man page: "if the string is not recognised as a key, it is sent as a series of characters". That is,session.cmd("send-keys","C-a","x")
will send Ctrl-a, x, whereassession.cmd("send-keys","C-ax")
will sendC
,-
,a
,x
. Also note that you cannot useC-b
to send the prefix key to tmux, it will be received by the app inside the terminal.
â alphanum
Apr 16 at 11:28
Apparently also the python bindings talk to tmux only via the binary. Presumably the socket api is not indended to be used by other programs. I would try to ask about this on the tmux mailing list groups.google.com/forum/#!forum/tmux-users
â alphanum
Apr 16 at 11:40
I still have a comment on the part about controlling tmux directly through its socket. Presumably the best way to achieve this would be to refactor tmux into a official library/API+program structure. This would necessitate developers to keep the bindings up to date (and hopefully stable). If you were to start implementing your own custom bindings from studying the source code you might run into having to deal with changes in tmux internal protocols on a regular basis. Perhaps the official developers are open to discussions on this, if say, it may be required for performance reasons,etc.
â alphanum
Apr 23 at 14:09
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
It is not difficult to do the tasks you ask using python-tmux.
E.g. if you start a new server with session name foo
tmux new-session -s foo
you can attach to it via python tmux (assuming the python library is installed) from ipython via
import libtmux
server = libtmux.Server()
session = server.find_where( "session_name": "foo" )
Then you can watch in your tmux window the action of commands e.g.
session.cmd("send-keys","x")
will send a keystroke "x". The pane list you asked for can be queried via
session.cmd("list-panes").stdout
and you can switch to a specific window (say nr. 1) with
session.cmd("select-window","-t","1").stdout
You do not have to read the source code of tmux to learn this. All these commands are documented in the man page of tmux. If this is not sufficient for you, you need to be more specific what you mean by python-libtmux being "lacking in some way".
How do I send control characters? According to tmux man pageC-
will be interpreted as ctrl. libtmux passes it as a literal.
â saga
Apr 16 at 10:48
The point I was trying to make is that I couldn't find the api to talk to a tmux server anywhere on the net. It also suggests that tmux wasn't supposed to be scriptable.
â saga
Apr 16 at 10:53
1
Man page: "if the string is not recognised as a key, it is sent as a series of characters". That is,session.cmd("send-keys","C-a","x")
will send Ctrl-a, x, whereassession.cmd("send-keys","C-ax")
will sendC
,-
,a
,x
. Also note that you cannot useC-b
to send the prefix key to tmux, it will be received by the app inside the terminal.
â alphanum
Apr 16 at 11:28
Apparently also the python bindings talk to tmux only via the binary. Presumably the socket api is not indended to be used by other programs. I would try to ask about this on the tmux mailing list groups.google.com/forum/#!forum/tmux-users
â alphanum
Apr 16 at 11:40
I still have a comment on the part about controlling tmux directly through its socket. Presumably the best way to achieve this would be to refactor tmux into a official library/API+program structure. This would necessitate developers to keep the bindings up to date (and hopefully stable). If you were to start implementing your own custom bindings from studying the source code you might run into having to deal with changes in tmux internal protocols on a regular basis. Perhaps the official developers are open to discussions on this, if say, it may be required for performance reasons,etc.
â alphanum
Apr 23 at 14:09
add a comment |Â
up vote
3
down vote
accepted
It is not difficult to do the tasks you ask using python-tmux.
E.g. if you start a new server with session name foo
tmux new-session -s foo
you can attach to it via python tmux (assuming the python library is installed) from ipython via
import libtmux
server = libtmux.Server()
session = server.find_where( "session_name": "foo" )
Then you can watch in your tmux window the action of commands e.g.
session.cmd("send-keys","x")
will send a keystroke "x". The pane list you asked for can be queried via
session.cmd("list-panes").stdout
and you can switch to a specific window (say nr. 1) with
session.cmd("select-window","-t","1").stdout
You do not have to read the source code of tmux to learn this. All these commands are documented in the man page of tmux. If this is not sufficient for you, you need to be more specific what you mean by python-libtmux being "lacking in some way".
How do I send control characters? According to tmux man pageC-
will be interpreted as ctrl. libtmux passes it as a literal.
â saga
Apr 16 at 10:48
The point I was trying to make is that I couldn't find the api to talk to a tmux server anywhere on the net. It also suggests that tmux wasn't supposed to be scriptable.
â saga
Apr 16 at 10:53
1
Man page: "if the string is not recognised as a key, it is sent as a series of characters". That is,session.cmd("send-keys","C-a","x")
will send Ctrl-a, x, whereassession.cmd("send-keys","C-ax")
will sendC
,-
,a
,x
. Also note that you cannot useC-b
to send the prefix key to tmux, it will be received by the app inside the terminal.
â alphanum
Apr 16 at 11:28
Apparently also the python bindings talk to tmux only via the binary. Presumably the socket api is not indended to be used by other programs. I would try to ask about this on the tmux mailing list groups.google.com/forum/#!forum/tmux-users
â alphanum
Apr 16 at 11:40
I still have a comment on the part about controlling tmux directly through its socket. Presumably the best way to achieve this would be to refactor tmux into a official library/API+program structure. This would necessitate developers to keep the bindings up to date (and hopefully stable). If you were to start implementing your own custom bindings from studying the source code you might run into having to deal with changes in tmux internal protocols on a regular basis. Perhaps the official developers are open to discussions on this, if say, it may be required for performance reasons,etc.
â alphanum
Apr 23 at 14:09
add a comment |Â
up vote
3
down vote
accepted
up vote
3
down vote
accepted
It is not difficult to do the tasks you ask using python-tmux.
E.g. if you start a new server with session name foo
tmux new-session -s foo
you can attach to it via python tmux (assuming the python library is installed) from ipython via
import libtmux
server = libtmux.Server()
session = server.find_where( "session_name": "foo" )
Then you can watch in your tmux window the action of commands e.g.
session.cmd("send-keys","x")
will send a keystroke "x". The pane list you asked for can be queried via
session.cmd("list-panes").stdout
and you can switch to a specific window (say nr. 1) with
session.cmd("select-window","-t","1").stdout
You do not have to read the source code of tmux to learn this. All these commands are documented in the man page of tmux. If this is not sufficient for you, you need to be more specific what you mean by python-libtmux being "lacking in some way".
It is not difficult to do the tasks you ask using python-tmux.
E.g. if you start a new server with session name foo
tmux new-session -s foo
you can attach to it via python tmux (assuming the python library is installed) from ipython via
import libtmux
server = libtmux.Server()
session = server.find_where( "session_name": "foo" )
Then you can watch in your tmux window the action of commands e.g.
session.cmd("send-keys","x")
will send a keystroke "x". The pane list you asked for can be queried via
session.cmd("list-panes").stdout
and you can switch to a specific window (say nr. 1) with
session.cmd("select-window","-t","1").stdout
You do not have to read the source code of tmux to learn this. All these commands are documented in the man page of tmux. If this is not sufficient for you, you need to be more specific what you mean by python-libtmux being "lacking in some way".
edited Apr 16 at 10:34
answered Apr 16 at 10:27
alphanum
1594
1594
How do I send control characters? According to tmux man pageC-
will be interpreted as ctrl. libtmux passes it as a literal.
â saga
Apr 16 at 10:48
The point I was trying to make is that I couldn't find the api to talk to a tmux server anywhere on the net. It also suggests that tmux wasn't supposed to be scriptable.
â saga
Apr 16 at 10:53
1
Man page: "if the string is not recognised as a key, it is sent as a series of characters". That is,session.cmd("send-keys","C-a","x")
will send Ctrl-a, x, whereassession.cmd("send-keys","C-ax")
will sendC
,-
,a
,x
. Also note that you cannot useC-b
to send the prefix key to tmux, it will be received by the app inside the terminal.
â alphanum
Apr 16 at 11:28
Apparently also the python bindings talk to tmux only via the binary. Presumably the socket api is not indended to be used by other programs. I would try to ask about this on the tmux mailing list groups.google.com/forum/#!forum/tmux-users
â alphanum
Apr 16 at 11:40
I still have a comment on the part about controlling tmux directly through its socket. Presumably the best way to achieve this would be to refactor tmux into a official library/API+program structure. This would necessitate developers to keep the bindings up to date (and hopefully stable). If you were to start implementing your own custom bindings from studying the source code you might run into having to deal with changes in tmux internal protocols on a regular basis. Perhaps the official developers are open to discussions on this, if say, it may be required for performance reasons,etc.
â alphanum
Apr 23 at 14:09
add a comment |Â
How do I send control characters? According to tmux man pageC-
will be interpreted as ctrl. libtmux passes it as a literal.
â saga
Apr 16 at 10:48
The point I was trying to make is that I couldn't find the api to talk to a tmux server anywhere on the net. It also suggests that tmux wasn't supposed to be scriptable.
â saga
Apr 16 at 10:53
1
Man page: "if the string is not recognised as a key, it is sent as a series of characters". That is,session.cmd("send-keys","C-a","x")
will send Ctrl-a, x, whereassession.cmd("send-keys","C-ax")
will sendC
,-
,a
,x
. Also note that you cannot useC-b
to send the prefix key to tmux, it will be received by the app inside the terminal.
â alphanum
Apr 16 at 11:28
Apparently also the python bindings talk to tmux only via the binary. Presumably the socket api is not indended to be used by other programs. I would try to ask about this on the tmux mailing list groups.google.com/forum/#!forum/tmux-users
â alphanum
Apr 16 at 11:40
I still have a comment on the part about controlling tmux directly through its socket. Presumably the best way to achieve this would be to refactor tmux into a official library/API+program structure. This would necessitate developers to keep the bindings up to date (and hopefully stable). If you were to start implementing your own custom bindings from studying the source code you might run into having to deal with changes in tmux internal protocols on a regular basis. Perhaps the official developers are open to discussions on this, if say, it may be required for performance reasons,etc.
â alphanum
Apr 23 at 14:09
How do I send control characters? According to tmux man page
C-
will be interpreted as ctrl. libtmux passes it as a literal.â saga
Apr 16 at 10:48
How do I send control characters? According to tmux man page
C-
will be interpreted as ctrl. libtmux passes it as a literal.â saga
Apr 16 at 10:48
The point I was trying to make is that I couldn't find the api to talk to a tmux server anywhere on the net. It also suggests that tmux wasn't supposed to be scriptable.
â saga
Apr 16 at 10:53
The point I was trying to make is that I couldn't find the api to talk to a tmux server anywhere on the net. It also suggests that tmux wasn't supposed to be scriptable.
â saga
Apr 16 at 10:53
1
1
Man page: "if the string is not recognised as a key, it is sent as a series of characters". That is,
session.cmd("send-keys","C-a","x")
will send Ctrl-a, x, whereas session.cmd("send-keys","C-ax")
will send C
, -
, a
, x
. Also note that you cannot use C-b
to send the prefix key to tmux, it will be received by the app inside the terminal.â alphanum
Apr 16 at 11:28
Man page: "if the string is not recognised as a key, it is sent as a series of characters". That is,
session.cmd("send-keys","C-a","x")
will send Ctrl-a, x, whereas session.cmd("send-keys","C-ax")
will send C
, -
, a
, x
. Also note that you cannot use C-b
to send the prefix key to tmux, it will be received by the app inside the terminal.â alphanum
Apr 16 at 11:28
Apparently also the python bindings talk to tmux only via the binary. Presumably the socket api is not indended to be used by other programs. I would try to ask about this on the tmux mailing list groups.google.com/forum/#!forum/tmux-users
â alphanum
Apr 16 at 11:40
Apparently also the python bindings talk to tmux only via the binary. Presumably the socket api is not indended to be used by other programs. I would try to ask about this on the tmux mailing list groups.google.com/forum/#!forum/tmux-users
â alphanum
Apr 16 at 11:40
I still have a comment on the part about controlling tmux directly through its socket. Presumably the best way to achieve this would be to refactor tmux into a official library/API+program structure. This would necessitate developers to keep the bindings up to date (and hopefully stable). If you were to start implementing your own custom bindings from studying the source code you might run into having to deal with changes in tmux internal protocols on a regular basis. Perhaps the official developers are open to discussions on this, if say, it may be required for performance reasons,etc.
â alphanum
Apr 23 at 14:09
I still have a comment on the part about controlling tmux directly through its socket. Presumably the best way to achieve this would be to refactor tmux into a official library/API+program structure. This would necessitate developers to keep the bindings up to date (and hopefully stable). If you were to start implementing your own custom bindings from studying the source code you might run into having to deal with changes in tmux internal protocols on a regular basis. Perhaps the official developers are open to discussions on this, if say, it may be required for performance reasons,etc.
â alphanum
Apr 23 at 14:09
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f436772%2ftmux-socket-api%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Not asked for, but for reference: The
tmux
source code is available at github.com/tmux/tmuxâ Kusalananda
Apr 16 at 9:59