I installed the latest stable release of ConEmu. I opened a Cygwin shell and used SSH to connect to a remote computer. I ran Byobu on the remote computer. I noticed that its status bar would shift upward, overwriting the entire screen after some time.
This problem is documented here. The solution suggested by the ConEmu creator is to use the ConEmu/msys terminal connector plugin. Using this connector is however a bit complicated. But, according to this post, it has been rolled into ConEmu starting with the 170705 release. I checked and found that the stable release I had installed was 161206. The stable release was years behind!
Seeing no recent stable version available, I opted to download a preview release from here. This release was dated later than 170705. byobu worked fine through SSH from Cygwin after that!
I SSH into a Ubuntu computer from a Windows computer using PuTTY. I run tmux (actually byobu which runs tmux underneath) and at a shell inside tmux I find that the left and right arrow keys do not work. They are actually detected as shift+left and shift+right arrow keys inside tmux.
This problem has been discussed here. One of the suggested solutions was to add
set enable-keypad on to
~/.inputrc. That did not seem to work for me.
However, the above bug report also mentioned that this was a bug in tmux and it was fixed in tmux 2.4. So, I used this tmux PPA and updated the tmux 2.1 shipping in Ubuntu 16.04 to a tmux 2.6. The arrow key problem disappeared.
I use Byobu (which is a wrapper on Tmux) to maintain shell sessions on the many servers I login to. I connect, disconnect and reconnect to the same Tmux sessions on these servers. When I reconnect back to an existing Tmux session, a new value is assigned to the
DISPLAY environment variable. If I create a new Tmux session, by opening a new split or tab, then Tmux sets the new
DISPLAY value correctly for that session. However, existing Tmux sessions have their old
DISPLAY value which gives the familiar
cannot open display error. I can find out the new
DISPLAY value and set it manually in the existing session, but that is cumbersome.
I found a simple solution to this problem. Whenever I SSH to a server, I save the new
DISPLAY assigned to this server in a
.display.txt file in the home directory. For example, this can be done in
echo $DISPLAY > ~/.display.txt
To pick up the new
DISPLAY value from this file in existing sessions, create a shell alias or function that you can call when you realize that the environment variable is wrong.
For example, for Fish shell, I added a
~/.config/fish/functions/set_display.fish file with these lines:
set --export DISPLAY (cat ~/.display.txt)
When I need to update
DISPLAY, I just call
set_display at the shell! 🙂
Tried with: Byobu 5.74, Tmux 1.8 and Fish 2.2.0
I use Byobu on remote computers which I have connected to using SSH. I typically use many vertical and horizontal splits and tabs. If a program in my current pane starts writing a huge amount of text to the terminal, Byobu becomes unresponsive. That is, I cannot switch panes or even kill the runaway command!
Byobu is just a wrapper on Tmux, so we need to fix this problem in Tmux. Whenever Tmux gets a trigger sequence (like newline), it modifies the pane. If it is caught in a loop of modifying the pane, it will not get a chance to process input from the user, like control sequences to switch panes or
Thankfully, Tmux has a rate limiting feature and it is active by default. We just need to tinker with its values to make our user experience more responsive.
When the rate of triggers is above a threshold, we can ask Tmux to redraw the pane instead of just modifying it. This redraw also gives it a chance to process user input at that moment. This trigger threshold is set in the
c0-change-trigger configuration option. The default is 250. That is, only if the number of trigger sequences is more than 250 per millisecond, Tmux will switch to redrawing instead of modifying the pane. To make Tmux (or Byobu) responsive, we need to lower this trigger threshold.
This solves the first problem, that is you will be able to switch away from the pane where text is being vomited. But if you want to comfortably type in the other panes, you cannot. This is because the vomiting pane is being redrawn too frequently. To fix this, we need to increase the redraw interval. This is controlled by the
c0-change-interval configuration option and its default value is to redraw every 100 milliseconds.
To make Tmux responsive, I added these lines to my
~/.byobu/.tmux.conf modifying the above two options:
set -g c0-change-trigger 20
set -g c0-change-interval 1000
Tried with: Byobu 5.77, Tmux 1.8 and Ubuntu 14.04
Byobu has support for a long list of keyboard shortcuts. The full list of keybindings can be found listed in
/usr/share/byobu/keybindings/f-keys.tmux. However, you may find that one or more of those do not work. For example, I found that pressing
Shift+F1 to view help and pressing
Ctrl+F2 to do a horizontal split did not work.
There are many reasons why Byobu is not receiving or failing on executing the hotkey you are pressing.
One possibility is that your desktop environment, window manager or terminal program is already using that keyboard shortcut. You will need to disable those keyboard shortcuts for it to work in Byobu. This was how I got
Ctrl+F2 working in Byobu.
Here are some places where you can check:
- XFCE: Check in Keyboard -> Application Shortcuts. Also check in Window Manager -> Keyboard.
- KDE: Check in Global Keyboard Shortcuts.
Another possibility is that Byobu is receiving the keybinding you pressed, but it is executing a shell command that is failing.
This was the case for
Shift-F1 to fail, the culprit was my Fish shell. The command executed by this hotkey can be seen in
/usr/share/byobu/keybindings/f-keys.tmux. It is executing a command that will work only in Sh or Bash.
To override this, I created a
~/.byobu/keybindings.tmux, copied the line and edited to add a
sh -c prefix to it so that it used the correct shell.
Tried with: Byobu 5.74 and Ubuntu 14.04
I like to have Fish as my default shell in Byobu. I add these lines to my
set -g default-shell /usr/bin/fish
set -g default-command /usr/bin/fish
Note that Byobu will set the
SHELL environment variable to the above path. That is, even if you want to set
SHELL to something else in your shell’s init file, that will be overridden by Byobu.
Tried with: Byobu 5.74 and Ubuntu 14.04
In Byobu, you will find that many mouse operations work just like in a raw terminal emulator. For example, you can select content by holding down the left-button and moving the mouse. And pasting by pressing the middle-button. However, you will find that the mouse operations are not Byobu-aware or Tmux-aware. For example, you can select text that spans across two split views.
Byobu/Tmux has support for mouse operations. When enabled, the mouse operations seem more natural and aware of the split views and windows of Byobu/Tmux. For example, it can be useful to use the mouse for operations such as selecting a split, resizing a split and for scrolling the console content to view history. However, note that such mouse support is turned off by default.
- To toggle mouse support, press
Alt+F12. (If it does not work, check if the keyboard shortcut is set for something else by your window manager.) When mouse support is on, the mouse cursor turns into an arrow. When it is off, the mouse cursor is an I-beam. When you toggle, you can see that
Mouse: ON or
Mouse: OFF is displayed at the bottom of Byobu.
To select a split window, just click anywhere inside it using the mouse.
To resize a split window, select the split and then drag its thick orange borders.
To scroll the content of a window, select the window and use the mouse scroller to scroll up and down. You will notice that the scrolling is split-aware. Only the console output inside a split will scroll, not the entire terminal contents.
To enable mouse support by default for all these operations, add these lines to your
# Enable mouse support including scrolling
set -g mouse on
# Versions prior to 2.1 may want this too:
set -g mouse-utf8 on
Restart Byobu to see the effect.
- One side-effect of enabling mouse in Byobu is that you might find that the middle-click to paste might not work in some terminal emulators like XTerm. You can toggle the mouse support to paste in such situation.
Tried with: Byobu 5.77 and Ubuntu 14.04
When running a training program, that might take hours to complete, I like to run it in the background. However, it should keep running even if I kill my current shell. I should be able to bring it back to the foreground and check its console output and then send it back to background. I should be able to do this any number of times.
The solution that fulfilled these requirements was to run the program in a new Byobu session. This is how I do it:
- From my current shell, I launch a new Byobu session and start the program I want to run from its shell:
The advantage of this setup is that Byobu is not the child of my shell, but rather of the desktop
lightdm process. So, it will keep running even if my terminal is hung or killed. It also enables me to see the console output of the program anytime I want.
Tried with: Byobu 5.74, TMux 1.8 and Ubuntu 14.04
Byobu is a user friendly terminal multiplexer built around tmux.
There is no byobu package in Cygwin, but installing it from source is easy:
$ ./configure --prefix="$HOME/installs/byobu"
$ make install
- Add the installed
bin directory to your
PATH environment variable at the shell or permanently in your bashrc:
$ export PATH="$HOME/installs/byobu/bin:$PATH"
You can now run
byobu at the shell. You will notice that there will be some errors when it looks for Linux programs that are either not installed or not available on Cygwin. Also, the configuration user interface does not appear since that needs
python-newt which is not available for Cygwin. Some of the function key combinations might also not work cause it is Windows.
Tried with: Byobu 5.125 and Cygwin 2.10
By default, Byobu lets its terminal windows occupy all the available real estate. Sometimes, it is convenient to have two shell sessions in Byobu that are side-by-side. This is possible in Byobu by creating a vertical split or a horizontal split.
This splits the current window into two vertically or horizontally. In a vertical split, the current session is maintained in the left split, while a new shell session is opened in the right split. In a horizontal split, the current session is maintained in the top split, while a new session is opened in the bottom split.
The keyboard shortcuts for creating and switching between splits:
- Ctrl + F2: Create a vertical split
- Shift + F2: Create a horizontal split
- Shift + F3 and Shift + F4: Switch forward and backward between the splits
You can see these keyboard shortcuts defined in the
/usr/share/byobu/keybindings/f-keys.tmux file. You can override or change them in your own
Tried with: Byobu 5.106, Tmux 2.1 and Ubuntu 16.04 LTS