
Show HN: Cockpit – create tmux panes and windows with ease - jaisonjustus
http://cockpit.27ae60.com/
======
catern
It'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?

~~~
pjungwir
This 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
I 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

------
_ix
This 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.

~~~
lphnull
what are the pros and cons to using tmux as opposed to say multiple instances
of a terminal emulator split up using ratpoison?

~~~
was_boring
pro: 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.

~~~
tambourine_man
Big con for me: scrolling sucks. Even o latest 2.x, which is indeed better,
but still light years away from native.

~~~
_ix
When you say scrolling, do you mean with something other than a keyboard?

I thought this is something I wanted, but when I finally got around to getting
mouse inputs working the way I thought they should, I realized that mousing
around a terminal is kind of weird. Granted, I still use my mouse for
copy/pasta operations, but I hope to eventually break that habit in time.

What's your workflow with tmux like?

~~~
tambourine_man
Nowadays, it's basically a simple way to let process running after existing
the shell and reattaching later, for me.

But I had much greater ambitions in the past which I've given up mostly due to
scrolling, clearing scrollback inserting a bunch of whitespace instead of
actually clearing, etc.

I scroll with the mouse a lot, it's more tolerable with the keyboard, but it's
still not as good as native interaction.

It also messes with the colors sometimes. For some reason, screen doesn't.

------
joshuamcginnis
Neat. I personally use
[https://github.com/tmuxinator/tmuxinator](https://github.com/tmuxinator/tmuxinator)
for this.

~~~
raphinou
I 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.

------
mmahemoff
Nice 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
Thanks. Your point to show the script is duly noted. It is actually a great
idea. Let me incorporate the suggestion in upcoming updates.

------
vhodges
I 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/tm...](https://github.com/vhodges/dotfiles/blob/master/utils/bin/tmux-
dev) or
[https://github.com/vhodges/dotfiles/blob/master/utils/bin/tm...](https://github.com/vhodges/dotfiles/blob/master/utils/bin/tmux-
rails)

------
spinningarrow
Nice 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!

------
recentdarkness
Please 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
Thank 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.

------
tux1968
How do you create 3 equal sized horizontal windows with Cockpit?

~~~
mileac
It 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.

------
snarain
Great job, this is something that I'd definitely use - especially when I can't
be bothered with installing extra gems.

------
anilgulecha
I 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)

------
timvdalen
Nice 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
Thanks. Good find! I will fix it.

------
oso2k
This is awesome. Side note, you may want to rename your project to avoid a
clash with kubernetes' cockpit UI for kubernetes cluster monitoring.

~~~
mileac
Thanks. 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

------
humanfromearth
There is a bug when you close windows (the round yellow thing remains). Also
can you name the windows?

~~~
mileac
Here 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
The layout seems to be broken on Firefox for Android. The pane with the demo
fully covers the text

~~~
mileac
Thanks for the feedback. I have not thought about this tool being used in
mobiles as my primary focus was for desktop users.

------
rudedogg
I thought about building something like this every time I messed with
tmuxinator layouts. Nice!

~~~
mileac
Thanks.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.

------
Willson50
What I want is iTerm2 hotkeys for tmux so I don't have to remember both.

~~~
shocks
First result on Google:
[http://tangledhelix.com/blog/2012/04/28/iterm2-keymaps-
for-t...](http://tangledhelix.com/blog/2012/04/28/iterm2-keymaps-for-tmux/)

~~~
Willson50
After reading that, the Tmux integration for iterm2 (tmux -CC) seems to work a
lot better. Thanks!

