8 ms·
Show HN: Cockpit – create tmux panes and windows with ease
- catern 9y agoIt's quite an indictment of the current state of our tooling (not just tmux) that such an application as this is necessary. Why isn't it easy to configure this in tmux itself, and persist the resulting configuration?
- pavel_lishin 9y agoIt's already simple to split panes in tmux, but the ability to persist them sounds like a good Hacktoberfest project.
- unk 9y agothis has already been solved by several plugins. this one works well: https://github.com/tmux-plugins/tmux-resurrect https://github.com/tmux-plugins/tmux-resurrect
- rhinoceraptor 9y agoThe defaults are a little funky but they’re easy enough to change. I have mine so prefix+s splits horizontally and prefix+v splits vertically. And then prefix+(H,J,K,L) resizes.
- pjungwir 9y agoThis doesn't let you persist ad hoc setups, but I have a `~/lib/tmux-code` file that I source from `~/.bash_profile` with entries like this: function ins-code { env_name=code long_name=insurance short_name=ins tmux_session=${short_name}-${env_name} if tmux list-sessions | grep ${tmux_session}; then tmux attach-session -t ${tmux_session} else cd ~/src/${long_name}/backend/app/models && \ tmux new-session -d -s ${tmux_session} && \ tmux rename-window -t ${tmux_session}:1 models cd ~/src/${long_name}/backend/app/controllers && \ tmux new-window -t ${tmux_session}:2 -n controllers cd ~/src/${long_name}/backend/app/views && \ tmux new-window -t ${tmux_session}:3 -n views cd ~/src/${long_name}/backend/app/assets/stylesheets && \ tmux new-window -t ${tmux_session}:4 -n css tmux select-window -t ${tmux_session}:1 && \ tmux -2 attach-session -t ${tmux_session} fi } Then I can just say `ins-code` and it will either launch a new session or attach if it already exists.
- mstipetic 9y agoI highly recommend https://github.com/tmuxinator/tmuxinator https://github.com/tmuxinator/tmuxinator if you haven't tried it, I've actually used it to run whole microservice environments locally and works without a hitch
- mileac 9y agoMy use case for building Cockpit was to easily generate scripts for my different layouts. These scripts I use with https://github.com/fitztrev/shuttle https://github.com/fitztrev/shuttle so I could load my workspace with a single click. I am not sure if this application is necessary. However, I think everyone can find their own use cases.
- nicklaf 9y agoI wonder if there is some sort of inverse relationship between having comprehensive features, thereby being self-contained (think Smalltalk), versus having a continuous dialog with the imperfect outside environment (think perl). I'm sure this is implicit in the famous "Worse is Better" essay, if not explicit. I mean: the author of tmux could have bundled the package with a comprehensive environment. But what really is there, beyond Unix and the browser? If it exists, people haven't heard if it, and even if they had, would just as soon reinvent it. At any rate, the inevitable imperfections and inpedance-mismatch with users' existing workflow / UI would surely invite brutal criticism. (For example, when Plan 9 came up here a few years back, a big chunk of the discussion was about how ugly the GUI seemed to them!)
- deleted 9y ago[deleted]
- joshuamcginnis 9y agoNeat. I personally use https://github.com/tmuxinator/tmuxinator https://github.com/tmuxinator/tmuxinator for this.
- raphinou 9y agoI really like https://github.com/oxidane/tmuxomatic https://github.com/oxidane/tmuxomatic No easier way to configure tmux layouts. Sadly it is not actively developed.
- mileac 9y agoThanks :)
- mileac 9y agoThanks. For me, I wanted scripts, didn't want to install the gem as my layouts were relatively simple and similar. Yes, tmuxinator is quite a tool :)
- Willson50 9y agoWhat I want is iTerm2 hotkeys for tmux so I don't have to remember both.
- rudedogg 9y agoI thought about building something like this every time I messed with tmuxinator layouts. Nice!
- mileac 9y agoThanks.I wanted an easy script creator from my dynamic yet simple layouts, so I thought of building Cockpit. Now, all I do is re-run the script generated from the app.
- mmahemoff 9y agoNice tool. I suggest showing the script beside the window so it can easily be cut-and-pasted. Browser downloading is a hassle especially with tmux on a remote server.
- mileac 9y agoThanks. Your point to show the script is duly noted. It is actually a great idea. Let me incorporate the suggestion in upcoming updates.
- humanfromearth 9y agoThere is a bug when you close windows (the round yellow thing remains). Also can you name the windows?
- mileac 9y agoActually, clicking on the round yellow circle is the way to rename the windows. I will improve the experience in upcoming releases.
- mileac 9y agoHere is an image which details all the icons in Tmux. http://cockpit.27ae60.com/img/demo-configure-ii.png http://cockpit.27ae60.com/img/demo-configure-ii.png Also updated in http://cockpit.27ae60.com/help.html http://cockpit.27ae60.com/help.html
- muxator 9y agoThe layout seems to be broken on Firefox for Android. The pane with the demo fully covers the text
- mileac 9y agoThanks for the feedback. I have not thought about this tool being used in mobiles as my primary focus was for desktop users.
- tux1968 9y agoHow do you create 3 equal sized horizontal windows with Cockpit?
- mileac 9y agoIt is not possible to create 3 equal sized horizontal panes with Cockpit. What I normally do is, create three horizontal splits in Cockpit and in tmux, I use `leader-key space` which makes tmux cycle through available layouts, and in one of them is equal sized horizontal windows.
- _ix 9y agoThis looks really nice! It's not for me, though. Maybe I'm not a very good systems engineer, but I've got a decent .tmux.conf. Between writing automation and trying to make sense of the mess I've inherited, I'm constantly splitting, resizing, and re-adjusting my work space to suit the task at hand.
- pweissbrod 9y ago+1 The mnemonics that come with tmux are short and intuitive enough such that everything ive needed is just a ctrl+b away. Curious what the use case is for this
- wink 9y agoExample where I would have needed this a while ago: After almost every reboot on my laptop I start a tmux with a certain layout with some semi-long-running processes which I want active and not daemonized, I can also not start them at the same time. I start them in a tmux with the layout split into 4 quadrants, then create a single new window so I don't see them all the time and can work there. Took me at least 2h to figure that out, how to split it programmatically and start everything in the correct "corner". Now it's just running a script and not having to anything manually. This would have probably saved me 2h. And I have totally forgotten everything again now, so much for "just a ctrl-b" away. (Using tmux daily, but not in THIS way)
- lphnull 9y agowhat are the pros and cons to using tmux as opposed to say multiple instances of a terminal emulator split up using ratpoison?
- was_boring 9y agopro: use anywhere, including while ssh'd, and share sessions with others. con: not that easy to use -- kind of like vim or emacs. I personally use tmux because it's "one window" and it is supported on every environment I can think of.
- recentdarkness 9y agoPlease try to use a different name this clashes quite with http://cockpit-project.org/ http://cockpit-project.org/ But otherwise it’s a nice tool
- mileac 9y agoThank you. I have a small attachment to the name ‘Cockpit’. Three years ago, me and my friends, we used to spend quite some time in hacking projects or automating our workflow. It was at that time, we created a a tool called ‘Cockpit’ (https://github.com/27AE60/cockpit https://github.com/27AE60/cockpit) for configuring Terminal workspace in Linux. Over the years, I started concentrating on one terminal. And when I shifted to iTerm2 along with Tmux, I wanted to spend less time in configuring workspace and more on my code. Then, I realized, I end up with similar Tmux layouts for most of my prototypes and I wanted to reduce my time in re-loading the projects. I wanted a visual representation of Tmux and flexibility in terms of scripts instead of installing applications. This tool reminded me of my old project and so, I couldn’t think a better name than Cockpit.
- vhodges 9y agoI was using tmuxinator for this, but found that all of my sessions were essentially the same thing except for the name and the working directory. So I just wrote a shell script that takes a directory, using basename for the session name, starting up what ever windows and panes it needs to. I have two variants, one for generic dev stuff (shell and an editor) and the other is for rails work (shell, editor, logs, rails db and a rails c in the last window). https://github.com/vhodges/dotfiles/blob/master/utils/bin/tmux-dev https://github.com/vhodges/dotfiles/blob/master/utils/bin/tm... or https://github.com/vhodges/dotfiles/blob/master/utils/bin/tmux-rails https://github.com/vhodges/dotfiles/blob/master/utils/bin/tm...
- oso2k 9y agoThis is awesome. Side note, you may want to rename your project to avoid a clash with kubernetes' cockpit UI for kubernetes cluster monitoring.
- mileac 9y agoThanks. I've received a similar comment in this thread regarding 'Cockpit' name conflict. I have explained my reasons in reply to the comment by @recentdarkness
- spinningarrow 9y agoNice work. I’ve been using teamocil (https://github.com/remiprev/teamocil https://github.com/remiprev/teamocil) so far (which is doubly nice because its configs can be used with plain iterm via itermocil) but will take a look at this too!
- anilgulecha 9y agoI use tmuxomatic, which is very simple to use with it's visual layout. Works really well. https://github.com/oxidane/tmuxomatic https://github.com/oxidane/tmuxomatic
- snarain 9y agoGreat job, this is something that I'd definitely use - especially when I can't be bothered with installing extra gems.
- timvdalen 9y agoNice application! I found a small bug: When you have an edit field open and try to open another one (command/session name/window name), the second one will just be cleared to blank.
- mileac 9y agoThanks. Good find! I will fix it.