oxidane / tmuxomatic Goto Github PK
View Code? Open in Web Editor NEWIntelligent tmux session management
Intelligent tmux session management
Definitely a feature request and as this issues section is so clean I feel bad about raising it here. But here goes anyway :)
I have been configuring different sessions for different scenarios and often find myself adding the same windows in multiple sessions. Also I sometimes run multiple sessions when working on more than one thing. However starting multiple sessions (starting new terminals!) and switching sessions is a bit clumsy. So I have a potential solution to both these problems.
It would be nice if when I run tmuxomatic from inside a session it just added the windows from the session file to the current session. I imagine it would make sense if it only added windows that did not already exist (keyed by name).
To be honest I'm new to tmux and tmuxomatic (which I think is awesome, thanks!) and I may eventually figure out how this can be done. But if you can think of a quick way to do this that would be cool :)
As a bonus feature it might be cool if you could start tmuxomatic with multiple session files and it similarly merged the window lists :)
As the final icing on the cake perhaps an include directive could be added so that session files could include other session files with similar merged results.
I had some other ideas about namespacing window names instead of ignoring duplicates but that may be overkill for now and can be implemented in my session files if i want.
Until windowgram has a opensource license, tmuxomatic ist not packageable by a distribution.
When running the example from session demo
I get the following error:
(xenial)brett@localhost:~$ tmuxomatic example
Running new session, "tmuxomatic_example"...
Error on line 15: An error occurred in tmux: invalid option: quiet
The first time I run the file a standard tmux window opens, and that is it. If I try to run tmuxomatic example
again, then I get the above error.
tmuxomatic 2.18
tmux 2.6
So I cloned this and gave it a whirl and it blows up for me, because the latest version of tmux homebrew install is 1.9a and the version check doesn't like the 'a' in there.
# /usr/bin/python3 --version
Python 3.4.1
# uname -a
Darwin My-Mac-mini.local 13.3.0 Darwin Kernel Version 13.3.0: Tue Jun 3 21:27:35 PDT 2014; root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64
# tmux -V
tmux 1.9a
Notice the "a" in the version.
# cd ~/code/tools/tmuxomatic
# git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
# ls -l /usr/local/bin/tmuxomatic
lrwxr-xr-x 1 root admin 44 21 Jul 16:01 /usr/local/bin/tmuxomatic -> ~/code/tools/tmuxomatic/tmuxomatic
# tmuxomatic -vvvv session_example
Traceback (most recent call last):
File "/usr/local/bin/tmuxomatic", line 1333, in <module>
main()
File "/usr/local/bin/tmuxomatic", line 1209, in main
for p, q in zip( version_listint(tmux_rep), version_listint(tmux_req) ):
File "/usr/local/bin/tmuxomatic", line 1208, in <lambda>
version_listint = lambda version_string: [int(x) for x in version_string.split(".")]
File "/usr/local/bin/tmuxomatic", line 1208, in <listcomp>
version_listint = lambda version_string: [int(x) for x in version_string.split(".")]
ValueError: invalid literal for int() with base 10: '9a'
A quick check of what that code is doing is trying to split the version number up and check the numerical value. I'd look for a way to do that that doesn't assume version numbers of tmux are always numeric/semantic for now.
So, old school way to fix this is to use the 1.9 branch, not 1.9a using homebrew...
# brew versions tmux
Warning: brew-versions is unsupported and may be removed soon.
Please use the homebrew-versions tap instead:
https://github.com/Homebrew/homebrew-versions
1.9a git checkout 29f9a44 /usr/local/Library/Formula/tmux.rb
1.9 git checkout fcb3161 /usr/local/Library/Formula/tmux.rb
1.8 git checkout c356bf7 /usr/local/Library/Formula/tmux.rb
1.7 git checkout 2de0838 /usr/local/Library/Formula/tmux.rb
1.6 git checkout f4a0f44 /usr/local/Library/Formula/tmux.rb
1.5 git checkout 1ffde14 /usr/local/Library/Formula/tmux.rb
1.4 git checkout 2e82661 /usr/local/Library/Formula/tmux.rb
1.3 git checkout 0a56d33 /usr/local/Library/Formula/tmux.rb
1.2 git checkout 585ee08 /usr/local/Library/Formula/tmux.rb
1.1 git checkout af6d133 /usr/local/Library/Formula/tmux.rb
1.0 git checkout a82e823 /usr/local/Library/Formula/tmux.rb
# cd $(brew --prefix)
# git checkout fcb3161 Library/Formula/tmux.rb
# brew install tmux
==> Downloading http://downloads.sourceforge.net/project/tmux/tmux/tmux-1.9/tmux-1.9.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/tmux/1.9 --sysconfdir=/usr/local/etc
==> make install
==> Caveats
Example configurations have been installed to:
/usr/local/Cellar/tmux/1.9/share/tmux/examples
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
==> Summary
/usr/local/Cellar/tmux/1.9: 15 files, 632K, built in 30 seconds
# tmux -V
tmux 1.9
# cd ~/code/tools/tmuxomatic
# tmuxomatic session_example
[... now works fine... ]
The python3
command path may change based on each user configuration, maybe it would be nicer to use /usr/bin/env python3
as a shebang?
PS: At first I was a little bit confused by reading the readme and looking at the example, but running it was really obvious ๐
I'm using Linux and Solaris and on the latter platform the terminal size guessing "get_xterm_dimensions_wh" does not seem to work correctly:
$ uname -a
SunOS x4-2l-qfs 5.11 11.1 i86pc i386 i86pc
$ python3 -V
Python 3.3.2
$ tmuxomatic session_example
unknown mode: size
Traceback (most recent call last):
File "tmuxomatic", line 1377, in
main()
File "tmuxomatic", line 1261, in main
user_wh = get_xterm_dimensions_wh() # Screen dimensions
File "tmuxomatic", line 359, in get_xterm_dimensions_wh
rows, columns = os.popen("stty size", "r").read().split()
ValueError: need more than 0 values to unpack
"stty size" does not work (unsupported). Would it be possible to use "tput cols" and "tput rows" instead?
Cheers
Additionally, if both pane-base-index and base-index are set to anything other than 0 tmuxomatic throws an error.
I have both pane-base-index and base-index set to 1 in my .tmux.conf file and this is what I get if I run tmuxomatic with -vvvv flag:
...
(4) cd ~ ; /usr/bin/tmux new-session -d -s tmuxomatic_session_flexample -n "test1"
(4) /usr/bin/tmux set-option -t tmuxomatic_session_flexample quiet on
(4) /usr/bin/tmux set-option -t tmuxomatic_session_flexample allow-rename off
(4) /usr/bin/tmux set-option -t tmuxomatic_session_flexample automatic-rename off
(4) /usr/bin/tmux select-pane -t 0
Error on line 19: An error occurred in tmux: session not found: 0
Is there a reason this installs to /usr/local/Program/tmuxomatic?
I performed a standard 'pip install tmuxomatic'
I think it would be nice to have a shebang line at the top of the configs, so you have to type less.
#!/usr/bin/env tmuxomatic
Hi! Is there a way to create a tmuxomatic config so that the specified paths are relative to the PWD when tmuxomatic is invoked?
My use case is creating a layout for a project that will be used by different devs on different machines, where the installation path of the project might vary.
Ideally we could do something like: dir .
or dir ./subproject
.
I'm happy to make a pull request for this, but I first wanted to check if this is already supported. Thanks!
Hey,
With this layout:
11112222
11112222
33333333
33333333
33333333
33333333
33333333
33333333
44445555
44445555
66887777
66887777
I get a small offset between panes 8 and 7 that should not be there, here is a screenshot:
I know my resolution is ridiculous, I hope it's not what's causing the bug?
Also I noticed that tmuxomatic does not split panes the same way as tmux. Using a simple layout like just 12
results in a difference of 1 column compared to splitting the window manually in tmux. Is this expected?
Thanks in advance, and thanks for building this. When this is fixed I'll use tmuxomatic every day.
Would you be open to allowing users the ability to specify the session name, rather than grabbing it from the filename? If no session name was specified in the file, it could then default to the filename.
For example:
#--------------------------------------------------------------------------------------
#
# Simple two window example (session_example)
#
#--------------------------------------------------------------------------------------
session example
window example_one # A new window begins like this, spaces in names allowed
AAAAAAvvvvvXXXXXTTTT # The windowgram, defines the shapes and positions of panes
jjjQQQQQQQuuuuuuTTTT # Make your own, any size and arrangement, 62 panes maximum
jjjQQQQQQQuuuuuuTTTT
...
I'd like to have the possibility to define a path in an environment variable that allows to have the sessions stored at a specific place.
If you like the idea, I will implement it.
I have the following tmuxomatic file
window dotfiles-windows
AAB
foc
dir ~/development/dotfiles-windows/
A run vim README.md
B run git status
A foc
This fails with the following error
Error on line 7: Windowgram parsing error for window serial 2: Windowgram must contain valid identifiers: [0-9a-zA-Z]
It seems that the directory name causes the problem because it contains the text window
as a substring
Hello,
I've tried to install tmuxomatic from PyPI (on Linux) and it seems that installation path is incorrect
$ pip3 install --user tmuxomatic
Downloading/unpacking tmuxomatic
Downloading tmuxomatic-1.0.17.tar.gz
Running setup.py (path:/tmp/pip_build_nineseconds/tmuxomatic/setup.py) egg_info for package tmuxomatic
Installing collected packages: tmuxomatic
Running setup.py install for tmuxomatic
Successfully installed tmuxomatic
Cleaning up...
$ which tmuxomatic
tmuxomatic not found
$ find ~/.local/ -name "*tmuxomatic*" -type d
/home/nineseconds/.local/lib/python3.4/site-packages/tmuxomatic-1.0.17.egg-info
$ ls /home/nineseconds/.local/lib/python3.4/site-packages/tmuxomatic-1.0.17.egg-info
dependency_links.txt installed-files.txt PKG-INFO SOURCES.txt top_level.txt
$ find ~/.local/ -name tmuxomatic -type f
/home/nineseconds/.local/Program/tmuxomatic
Basically with pip --user
it has to be installed into ~/.local/bin/tmuxomatic
so it seems there is some problem with setup.py
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.