Live data from Hacker News

Scripting tmux

arp242.net

1–10 of 20 posts

Re: Scripting tmux

#2
Despite using tmux for years, even having written scripts for nested sessions that I use each day, I hadn't noticed the CLI was missing long options. Kind of crazy.

Re: Scripting tmux

#3
I wrote libtmux (https://libtmux.git-pull.com) as a way to control tmux via python objects.

In the backend, it's all tmux CLI commands.

tmuxp (https://tmuxp.git-pull.com), similar to tmuxinator, uses libtmux under the hood to build workspaces from a yaml/json file: https://github.com/tmux-python/tmuxp/blob/master/tmuxp/works...

Despite that, I've found some people prefer just using plain tmux scripting (https://twitter.com/bitprophet/status/561356905843392514). Aside: That's Jeff Forcier, creator of fabric (http://www.fabfile.org/)

Through tmux's formats (http://man7.org/linux/man-pages/man1/tmux.1.html#FORMATS), you can about any info you'd like on your workspace.

An area I don't know about is -C (control mode). libtmux could technically use it to get live updates rather than inefficiently and possibly needlessly querying session/window/pane info to keep objects up to date. Apparently iterm2's tmux integration uses it.

Re: Scripting tmux

#4
I use Tmux for starting 4 Bhyve VM's on FreeBSD via rc.local. It really like it better than screen or daemon processes. Nice for large compiling jobs on remote machines too.

Re: Scripting tmux

#5
post #3

I wrote libtmux ( https://libtmux.git-pull.com ) as a way to control tmux via python objects. In the backend, it's all tmux CLI commands. tmuxp ( https://tmuxp.git-pull.com ), similar to tmuxinator, uses libtmux under the hood to build workspaces from a yaml/json file: https://github.com/tmux-python/tmuxp/blob/master/tmuxp/works... Despite that, I've found some people prefer just using plain tmux scripting ( https://…

This is awesome. I had to hack together some scripts to implement workspace building and tmuxp looks like it might have saved me a lot of headache!

Re: Scripting tmux

#6
Have been looking for a while, but does anyone know if there is there anything like which-key for tmux?

which-key on vim has been great in making sure, I use new features, I add to my config file.

Re: Scripting tmux

#7
This comment was posted using tmux scripting, as follows:

    set -x
    send(){ tmux send "$@";}       
    send 'links -no-connect https://news.ycombinator.com/login?goto=news' ;
    send c-m; sleep 2;
    send 3xblah c-m $HNPASSWORD c-m c-m c-m; sleep 2;
    send Escape; sleep 1; send V S; sleep 1;
    send 'scripting tmux' c-m Down Down Down Down Down Down c-m;
    send Escape; sleep 1; send V S; sleep 1;
    send 'add comment' c-m Up;
    send 'This comment was posted using tmux scripting, as follows: ' c-m; 
    a=$(sed '5,18!d' $0); sleep 2;
    send "$a"; sleep 2; send c-m c-m Down c-m;

Re: Scripting tmux

#8
post #6

Have been looking for a while, but does anyone know if there is there anything like which-key for tmux? which-key on vim has been great in making sure, I use new features, I add to my config file.

Prefix + ? will show you the current key map; it is searchable like normal text.

Not utterly comfortable, but helps most of the time.

Re: Scripting tmux

#9
Just this night I was thinking if whether tmux scripting could be abused to get it to work like zmodem. Sending files from the system with the tmux session to whatever machine one had sshd into (and ideally the other direction as well).

Anyone know of this or a better approach?

Re: Scripting tmux

#10
post #7

This comment was posted using tmux scripting, as follows: set -x send(){ tmux send "$@";} send 'links -no-connect https://news.ycombinator.com/login?goto=news' ; send c-m; sleep 2; send 3xblah c-m $HNPASSWORD c-m c-m c-m; sleep 2; send Escape; sleep 1; send V S; sleep 1; send 'scripting tmux' c-m Down Down Down Down Down Down c-m; send Escape; sleep 1; send V S; sleep 1; send 'add comment' c-m Up; send 'This comment…

A tmux/HN quine, or at least something close to it. This deserves to go into some sort of hall of fame.
Post reply on HN