I'm using Tmux / Vim on Mac OSX and I like to split the windows for testing and development. I would like to know if its possible to dock safari or another browser inside a tmux window so I would have code on the left side and the browser on the right.
Cheers!
If you can make the browser show in your terminal, then the answer to your question is YES. otherwise: NO.
From tmux homepage:
tmux is a terminal multiplexer
What is a terminal multiplexer? It lets you switch easily between several
programs in one terminal, detach them (they keep running in the background) and
reattach them to a different terminal.
Notable web browsers you could actually use in the terminal are elinks, w3m or for a complete graphical interface, NetSurf.
Related
I have a tmux session running in PuTTY, and I have tmux configured to use vim keybindings. I want to be able to use the visual highlight mode that vim keybindings provide (shift+V I believe), highlight some text, and then copy it to my Windows 10 clipboard. Is this possible?
I assume you are running tmux remotely.
If so, then for this to work you need a terminal that supports OSC 52. From a quick look at the putty code it doesn't appear to, so you will not be able to do this with putty.
However, you could try a different terminal that does support it, like mintty - it looks like you just need to turn its AllowSetSelection option on. IIRC mintty defaults to TERM=xterm, so if your tmux is new enough and you turn this option on, it should just work.
If it doesn't work, you need to check that Ms is set in the terminal-overrides option for the TERM you have outside tmux, and that the tmux set-clipboard option is set to on or external.
I have a nice window in my tmux session that has a number of panes nicely arranged. Is it possible to duplicate a session, preserving the current panes layout?
Check out some of the tmux plugins. tmux-resurrect allows you to save then later restore a set of windows and even the commands running there (out of a limited set you can configure). You may want to start by first installing the Tmux Plugin Manager that it mentions in the guide if you want to easily try out other plugins.
I use awesome wm with an external monitor on my laptop but sometimes I move and take the laptop only.
My question is: what happens with the clients opened in the external monitor when I disconnect it to move the laptop?
Is there a way to make awesome remember the layout of the screens? currently I'm using arandr every time I plug the screen but it is very annoying to do that every time I move the laptop.
In general any tips about how to handle a setup with an external display and a laptop is what I'm looking for.
Thanks!
Check out autorandr
It's been working perfectly for me when plugging/unplugging monitors.
EDIT:
Here's an example of how I used autorandr (on Ubuntu)
git clone https://github.com/wertarbyte/autorandr.git
cd autorandr
make deb
dpkg -i autorandr*.deb
Save my current config (no monitors)
autorandr --save mobile
Plug in additional monitor (and configure your settings)
autorandr --save multi
It should now automatically detect and apply the correct configurations when devices are plugged/unplugged. This works via a udev rule:
cat /lib/udev/rules.d/40-monitor-hotplug.rules
ACTION=="change", SUBSYSTEM=="drm", RUN+="/bin/systemctl start --no-block autorandr.service"
Nothing happens! All your applications stay open as they were when you had your monitor connected. When you reconnect the monitor everythingi will still be the same.
Take note that this means that you can still go with your mous on the disconnected screen. Your mouse will simply disappear ath the edge of your monitor because awesome still thinks that there are two screens.
If you want awesome to realize that there is only one screen remaining you have to reload the awesome-config. Once you do that, all open clients will be distributed according to your client rules on the available tags.
I am using the latest stable version of iTerm2 (2.0) with the latest Homebrew build of tmux (1.9a). Unfortunately, my keybindings as declared in .tmux.conf do not work with the iTerm2/tmux combo in "integrated mode" (i.e. when iTerm2 takes over the management of tmux windows and panes). I tried different prefixes (C-b, M-a) as well as different key mappings in iTerm, but to no avail.
Is this indeed an iTerm bug? Or is my expectation that the .tmux.conf keybindings would be carried over to iTerm a false one? Even my tmux command prefix (M-a) does not work!
You may view my tmux configuration file at https://gist.github.com/453ab63c42df976bc2be.
Someone reported a similar bug at iTerm2 Tmux Integration Default Keybindings not working in 2015. The response from the developer George Nachman suggests that keybindings are not supported:
One of the main goals of the tmux integration is that you use iTerm2's
keystrokes, not tmux's. If there's a specific workflow that you can't
accomplish natively, let me know--there is a lot of power in the
ability to remap keys in iTerm2.
As of this change in iTerm2, you can now set a Leader key / prefix in the iTerm2 config which will forward to tmux. You still can't bring up the tmux command prompt, but you can create new windows, panes, etc, and my custom keybinds appear to be in working order.
You can configure the shortcut in Prefs > Keys > Key Bindings > Leader... Once you define a leader, the tmux key combos will become available. I recommend cmd-B as the leader for muscle memory and because cmd-B isn't otherwise in use.
This is what it should look like, note my prefix is the ` key but you should set this to whatever your tmux prefix binding is.
As of this writing the feature is only in the nightly build of iTerm2, so you'll be running alpha code, but assuming nothing goes wrong it should be included in the next stable release (or 3.5beta6).
edit: Ben's answer that this is unsupported is correct. My advice does not apply to "integrated mode".
Make sure you don't have conflicting key mappings in iTerm, that your option key is set to Meta, and that you've tmux source ~/.tmux.conf after your changes (the config is only loaded by the server, so you have to restart all sessions or re-source). Also, if you're using Karabiner or another hotkey remapper, it could be interfering in some way.
You're starting with a rather extensive config - I'd start with a one line config for testing purposes.
I got tmuxinator to work with iTerm2 the following: https://stackoverflow.com/a/19747819/1009332
However, each tab initially opens in a different window. Is there any way to attach to an existing tmux session using tabs rather than new windows?
There's some more info about this cool feature here: https://code.google.com/p/iterm2/wiki/TmuxIntegration
My motivation for this was:
1. copy/paste/find locks the process in tmux, whereas with iterm2, you can find in a tail of logs and not lock the process.
2. key bindings are simpler in iTerm2.
3. I like tmuxinator to start many shell windows (tabs) when doing rails web development, so that my stdout of different processes goes to different windows, rather than mixing together when using foreman.
It is an option in iTerm2: Preferences > general Open tmux windows as native tabs in a new window, but you have to disconnect then reconnect.
Solution found here