Discussion:
Interfacing with tmux through other languages without shell commands? Libevent? Shared libraries?
(too old to reply)
Tony Narlock
2015-04-29 15:19:48 UTC
Permalink
Greetings,

I notice that tmux uses libevent. I maintain a project for interfacing with
tmux through Python. It's pretty robust, essentially it lets you control
tmux servers, sessions, windows and panes as tmux objects [1+2].

This is the only external language binding I've seen with tmux:
-
https://github.com/redbrain/cython-book/blob/master/chapter3/tmux-project/tmux-1.8/cmdpython.pyx
-
https://github.com/redbrain/cython-book/blob/master/chapter3/tmux-project/tmux-1.8/cmdpython.pxd

The issue I have is portability. Typically tmux installed via a package
manager doesn't have access to a tmux.h. I think that would be necessary to
interact with the tmux socket?

Is there a way to interact with tmux *without* subprocess / shell? Such as
through libevent?

Is there any intention of optional bindings for tmux for other languages?
Shared lib headers? What would be the implications of adding / not adding
that?

[1]: http://tmuxp.readthedocs.org/en/latest/quickstart_python.html
[2]: http://tmuxp.readthedocs.org/en/latest/api.html
Nicholas Marriott
2015-04-29 16:23:17 UTC
Permalink
Hi

You can use tmux control mode.
Post by Tony Narlock
Greetings,
I notice that tmux uses libevent. I maintain a project for interfacing
with tmux through Python.** It's pretty robust, essentially it lets you
control tmux servers, sessions, windows and panes as tmux objects [1+2].
-
[1]https://github.com/redbrain/cython-book/blob/master/chapter3/tmux-project/tmux-1.8/cmdpython.pyx
-
[2]https://github.com/redbrain/cython-book/blob/master/chapter3/tmux-project/tmux-1.8/cmdpython.pxd
The issue I have is portability. Typically tmux installed via a package
manager doesn't have access to a tmux.h. I think that would be necessary
to interact with the tmux socket?
Is there a way to interact with tmux *without* subprocess / shell? Such as
through libevent?
Is there any intention of optional bindings for tmux for other languages?
Shared lib headers?** What would be the implications of adding / not
adding that?
[1]:**[3]http://tmuxp.readthedocs.org/en/latest/quickstart_python.html
[2]:**[4]http://tmuxp.readthedocs.org/en/latest/api.html
References
Visible links
1. https://github.com/redbrain/cython-book/blob/master/chapter3/tmux-project/tmux-1.8/cmdpython.pyx
2. https://github.com/redbrain/cython-book/blob/master/chapter3/tmux-project/tmux-1.8/cmdpython.pxd
3. http://tmuxp.readthedocs.org/en/latest/quickstart_python.html
4. http://tmuxp.readthedocs.org/en/latest/api.html
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
tmux-users mailing list
https://lists.sourceforge.net/lists/listinfo/tmux-users
Tony Narlock
2015-04-29 18:24:55 UTC
Permalink
Here are the notifications that I need:

- When an active pane is changed
- When window layouts changed
- When new pane is added to a window
- When a client detaches from a session
- Any changes for anything in the FORMATS info of a session/window/pane (I
suppose just the delta)

As it stands, in my third party application, I have to keep querying for
FORMATS manually.

Is there a way for control mode to listen to any of these? Is there any
plan to introduce any of them next release? If they're not in line to be
implemented, do any of these notifications like things I could attempt to
make a patch for?

(Resending this to you and the list)

On Wed, Apr 29, 2015 at 11:23 AM, Nicholas Marriott <
Post by Nicholas Marriott
Hi
You can use tmux control mode.
Post by Tony Narlock
Greetings,
I notice that tmux uses libevent. I maintain a project for interfacing
with tmux through Python.** It's pretty robust, essentially it lets
you
Post by Tony Narlock
control tmux servers, sessions, windows and panes as tmux objects
[1+2].
Post by Tony Narlock
-
[1]
https://github.com/redbrain/cython-book/blob/master/chapter3/tmux-project/tmux-1.8/cmdpython.pyx
Post by Tony Narlock
-
[2]
https://github.com/redbrain/cython-book/blob/master/chapter3/tmux-project/tmux-1.8/cmdpython.pxd
Post by Tony Narlock
The issue I have is portability. Typically tmux installed via a
package
Post by Tony Narlock
manager doesn't have access to a tmux.h. I think that would be
necessary
Post by Tony Narlock
to interact with the tmux socket?
Is there a way to interact with tmux *without* subprocess / shell?
Such as
Post by Tony Narlock
through libevent?
Is there any intention of optional bindings for tmux for other
languages?
Post by Tony Narlock
Shared lib headers?** What would be the implications of adding / not
adding that?
[1]:**[3]
http://tmuxp.readthedocs.org/en/latest/quickstart_python.html
Post by Tony Narlock
[2]:**[4]http://tmuxp.readthedocs.org/en/latest/api.html
References
Visible links
1.
https://github.com/redbrain/cython-book/blob/master/chapter3/tmux-project/tmux-1.8/cmdpython.pyx
Post by Tony Narlock
2.
https://github.com/redbrain/cython-book/blob/master/chapter3/tmux-project/tmux-1.8/cmdpython.pxd
Post by Tony Narlock
3. http://tmuxp.readthedocs.org/en/latest/quickstart_python.html
4. http://tmuxp.readthedocs.org/en/latest/api.html
------------------------------------------------------------------------------
Post by Tony Narlock
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
tmux-users mailing list
https://lists.sourceforge.net/lists/listinfo/tmux-users
Thomas Adam
2015-04-29 18:34:35 UTC
Permalink
Post by Tony Narlock
- When an active pane is changed
- When window layouts changed
- When new pane is added to a window
- When a client detaches from a session
- Any changes for anything in the FORMATS info of a session/window/pane (I
suppose just the delta)
Notify support handles this.
Post by Tony Narlock
As it stands, in my third party application, I have to keep querying for
FORMATS manually.
Correct.
Post by Tony Narlock
Is there a way for control mode to listen to any of these? Is there any plan
Have you actually tried it? The point here is for this library to
monitor the output from control mode and act accordingly.

-- Thomas Adam
Tony Narlock
2015-04-29 19:08:06 UTC
Permalink
Post by Thomas Adam
Post by Tony Narlock
- When an active pane is changed
- When window layouts changed
- When new pane is added to a window
- When a client detaches from a session
- Any changes for anything in the FORMATS info of a session/window/pane
(I
Post by Tony Narlock
suppose just the delta)
Notify support handles this.
Post by Tony Narlock
As it stands, in my third party application, I have to keep querying for
FORMATS manually.
Correct.
Post by Tony Narlock
Is there a way for control mode to listen to any of these? Is there any
plan
Have you actually tried it? The point here is for this library to
monitor the output from control mode and act accordingly.
I'm using 1.9 on Debian, here is the behavior I see:

Control mode is opened, however I don't get notifications for any of the
above. I only really see layout-change when new sessions are made.

My intuition (and needs) expects that control mode should be notified of
all the server's notifications, regardless of which session a control mode
is "attached" to.

For layout-change, I don't get notifications for resizing panes or
switching layouts.
Post by Thomas Adam
-- Thomas Adam
Loading...