Comments (26)
Perhaps you could have a new hash config item under the tabs hash that specifies exit key-presses for how to quit that particular window? Then a separate tmux command to issue the various tmux send-keys. (I don't know if this is any more graceful than what you suggested, but, at least it's customisable).
Example:
tabs:
- shell:
panes:
- #
exit:
- exit Enter
- server:
panes:
- rails s
exit:
- C-c
- exit Enter
- database:
panes:
- rails db
exit:
- .quit Enter
- exit Enter
So if the session was called APP, then you'd just have to wrap together a bunch of commands similar to:
tmux send-keys -t APP:shell exit Enter
tmux send-keys -t APP:server C-c
tmux send-keys -t APP:server exit Enter
tmux send-keys -t APP:database .quit Enter
tmux send-keys -t APP:database exit Enter
from tmuxinator.
+1, tmux-safekill
from tmuxinator.
+1
from tmuxinator.
It would be great if tmuxinator is closing files opened with vi. IMO that could be a default behaviour.
from tmuxinator.
In the same related feature, having a post
parameter similar to pre
to trigger some events before closing the session would be really great.
from tmuxinator.
This seems like a popular feature that I'd really want to add. However the way tmux wrappers work typically (including tmuxinator) is outputting a set of shell commands that starts the tmux session, attaching you to the started session and then exiting. tmuxinator has then no knowledge of the tmux process.
Because of this, as far as I can see, there are two ways to approach this given the way tmux works:
- Have a persistent process that runs in the background that can monitor the state of active tmux sessions and run the specified commands when a pane / window gets closed. This would be a lot of work and I really wouldn't want to go down this route. (I'd love to be proven otherwise; pull requests welcome).
- An alternative would be to close sessions via a
tmuxinator close window <name>
ortmuxinator close pane
command. This could work but is quite a bit more cumbersome.
If anyone else has suggestions I'd love to hear other ways to to tackle this.
from tmuxinator.
Wow.. sorry, the 'space indentation' I had in that comment did not apparently come through at all :(
from tmuxinator.
That's not a bad idea @xntrik. It'd have to be a top level item in the config though: So:
tabs:
- editor: vim
- logs: tail -f log/development.log
- console:
panes:
- bundle exec rails console
- mysql database
post_tab:
- editor: :wq
- logs: C-c
- console:
panes:
- exit
- \q
This would close all applications provided each pane/window had the process running in them. After that we can close all the windows via tmux kill-window
or tmux kill-pane
.
Couple of things though:
- If a process doesn't exit cleanly because the specified exit command didn't work for some reason, the process will be killed ungracefully once the kill pane/window command is issued
- If
post_tab
is defined, exit commands would have to be provided for all panes/windows.
Thoughts?
from tmuxinator.
I think that looks pretty good.
I can't imagine many people would actually use this functionality. I guess it's whether or not you'd see this method is better than having no method.
from tmuxinator.
I edit the config yml files often, and every time I do, I'd like to start fresh by killing the edited project and restarting it. So this would be very useful for me.
from tmuxinator.
I'm gonna tag this for 0.8.0. It'll require a bit more thought but I think it is doable.
from tmuxinator.
👍 for post_tab
, neat feature. Don't mind using tmuxinator close window/pane/session
vs tmux kill-pane/window/session
.
I'd love to also see a general post
config like the pre
configuration as well. I just set up a tmuxinator session that sets up a bunch of sshfs mount points in pre
and I'd love to execute a command when the tmuxinator session is done (i.e. pkill sshfs
).
from tmuxinator.
Isn't this similar to Issue #87?
from tmuxinator.
@ramonjavaier yes it is.
from tmuxinator.
This feature would be really helpful. I run a rails server in one of the panes and if it doesnt get shut down properly, the next time I have to manually kill the rails process and delete the pid file
from tmuxinator.
+1
from tmuxinator.
+1 # This feature would be extra sweet. Subbing for winning.
from tmuxinator.
👍
from tmuxinator.
+1
from tmuxinator.
+1
from tmuxinator.
+1
from tmuxinator.
👍
from tmuxinator.
+1
from tmuxinator.
After thinking about this, I decided that tmuxinator was the wrong place for this feature to live. So I implemented it as a tmux plugin. Please check it out and let me know what you think. https://github.com/jlipps/tmux-safekill
from tmuxinator.
Closing in favour of jlipps/tmux-safekill.
from tmuxinator.
If you get here because tmux
is not reliably killing rails server
, you should know that it does reliably kill heroku local
. Sometimes, I use rails server
to run byebug
, but now I always try to use heroku local
in a tmux YML file.
from tmuxinator.
Related Issues (20)
- Does not work with tmux 3.3 HOT 3
- Use of `alias` in the completion file
- Need help!!! HOT 1
- Command is not executed in tmux - WSL2 HOT 2
- Is startup_pane a string? HOT 2
- Tmuxinator sets pane title via .yml file with original tmux manual solution
- `tmuxinator new --local` should preset `.` as root, instead of `~/`
- Return of 'Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated' HOT 1
- Can make tmuxinator to open a terminal for each declared window? HOT 1
- Select focused pane for each window
- Incorrectly Character Parsing on ERB Parameter
- Dependency ruby-thor is updated; this breaks tmuxinator on distros where ruby-thor has been updated HOT 4
- Call for Maintainers HOT 4
- Block `tmuxinator start` until all `pre_window` have run? HOT 5
- Support for TMUX 3.4 HOT 2
- Tmux version 3.4 should be supported but isn't HOT 3
- Pane Titles Bugs (Parsing + Not Setting Multiple) HOT 1
- on_project_stop schema has type of string, when array or string can be parsed by tmuxinator HOT 3
- Unable to successfully run tmuxinator on macOS Sonoma 14.4.1 HOT 33
- Unable to get layout to appear on both MacOS & Ubuntu HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tmuxinator.