This program provides an interactive pop-up UI within the Bash shell and is written entirely in Bash. Currently it provides a convenient way of browsing history and files which are appended to the prompt.
-
Minimal dependencies: Requires only a relatively dated version of Bash v4.1.17 and a commonly available terminal (e.g. PuTTY).
-
Intuative UI: Scrollable browsing and selection of the filesystem and Bash history.
-
Simple configuration: UI based configuration of the color theme, panel dimensions, and hotkey.
-
Powerful terminal graphics: Supports UTF8 graphic characters, 256 color display, calculations in the HSV colorspace, and animations with color gradients.
The below steps will help you quickly install and start the program.
-
Confirm that you have a supported terminal and Bash version as indicated in Prerequisites.
-
Extract the the contents of the distribution zip file.
Important: The file should not be extracted on Windows because of differences in execute permissions and line endings.
$ unzip bash-ui-master.zip
-
Modify the .bashrc and add a line to source the bui-setup.sh script. You may need to modify the path in the below example.
Important: bui-setup.sh just binds the hotkey and should not be excuted directly.
$ source ~/bash-ui/src/bui-setup.sh Installing Bash-UI hotkey: => [B
-
Re-start your Bash session.
-
At the prompt hit the
down arrow
key (this is the default hotkey). You should see a panel with your Bash history like in the above screenshot. At this point you can proceed to the Walkthrough section.
- Bash v4.1.17 or later.
- Terminal must be capable of and configured for:
- 256 color XTerm support or better
- UTF-8 graphic characters (default characters supported by PuTTY are acceptable)
- MobaXterm v8.6 or higher
- PuTTY v0.67 or higher: should be configured with Unicode and 256 color support.
- In Window->Translation select Use Unicode line drawling code points.
- In Window->Colours select Allow terminal to use xterm 256-colour mode.
- iTerm2
- MacOS Terminal
The MacOS default bash version (as of Mojave) is 3.2.57 that you can confirm:
$ echo $BASH_VERSION
3.2.57(1)-release
If you see this version you will need to install an updated bash. Install Homebrew if you do not already have and then install a new bash:
$ brew update && brew install bash
This will not change your default shell located at /bin/bash
. You can launch the new shell as follows. We use the -l
option to launch a login shell because MacOS does not normally use the .bashrc
file.
$ /usr/local/bin/bash -l
$ echo $BASH_VERSION
5.0.11(1)-release
Optionally, you can make the new shell the default for new sessions:
$ sudo bash -c 'echo /usr/local/bin/bash >> /etc/shells'
$ chsh -s /usr/local/bin/bash
This section assumes that you have a running version of Bash-UI. Invoke the hotkey (default is down arrow
) to launch the panel.
Use the right arrow
to navigate to highlight the config option in the menu bar. Use the down arrow
to navigate to one of the 3 configuration menus.
The config menus are used to edit the configuration file located at $HOME/.bui_settings.
-
Theme: Allows you to change the color scheme of the interface. 256-color themes are indicated with HSV 216. Arrow keys preview the theme and
enter
orspace
saves. -
Dimensions: Allows you to change the dimensions of the panel. Hit the
down arrow
to highlight one of the sliders. Use theleft arrow
andright arrow
s to adjust andenter
to save. -
Hotkey: Allows you to change the activation hotkey (default is
down arrow
). The change will be effective when the program exits. Use the arrow keys to navigate andenter
orspace
to save.
The Bash history screen allows you to browse previous commands and copy them to the prompt. Use the
arrow keys to highlight a command. When you hit enter
the application will exit and append the
command to the existing prompt.
The file browser screen allows you to graphically navigate the filesystem. When you select a file
its relative path will be appended to the existing prompt. Use the up arrow
and down arrow
keys
to navigate and hit enter
to select.
Warning: The credits panel will eat your CPU but there are some fun animations.
Some people prefer to be lazy and not memorize key sequences. Also, a scrollable and selectable view of content can be as fast or faster for simple tasks.
Many corporate environments can be very restrictive and it is not always possible or worth the effort to install complex dependencies. One objective of this tool is that it be easy to run everywhere.
interface?
Using curses with a program like tput would be far too slow. For example a static panel needs to be rendered sub-second and can require dozens of terminal control sequences. This would not be possible without calls to integrated shell functions.
There are plans for a screen that would allow the user to select the primary termal foreground and background in the HSV colorspace. This would help with default ANSI colors that are harsh and ugly. Other suggestions are appreciated.
Other enhancements are planned that will provide simple examples of how to use the scripts as an external API.
A simulation of 2 pendulums for the X and Y axis is computed and the output is written to a temporary "alpha" buffer. For each frame the alpha sprite will read values from this buffer, map its value to a colormap, print the color, and decrement the value.
Bash is an interface used daily by hundreds of thousands of developers and engineers and I did not see good examples of UI integration that were easily accessible. It was an experiment to push the limits of the console interface to understand what is possible and see how it could enhance the daily experience.
The Bash language has a lot of limitations (e.g. poor performance, no floating point math, no HSV colorspace, and no variable references or UTF-8 support until more recent versions) and there were few examples to start with. Working around this took some inventing but it was a fun challenge.
-
When a hotkey is modified in the configuration panel the old binding is not immediately restored upon exit. Restarting the Bash session will correct this.
-
The CTRL-C or kill signal is not always handled properly while viewing the animation on the credits panel due to a Bash bug. This can leave the terminal in a bad state. Restarting the Bash session will correct this.
-
If the height of the screen is adjusted in the Dims panel it can be set larger then the visible area of the screen.
- COLORS.md: A technical description of the RGB and HSV color manipulations of Bash UI.
- ORACP: An Oracle database utility by the same author.
- Terminals Are Sexy: List of graphical text utilities.
- Code page 437: Unicode characters supported by PuTTY.
- XTerm Termal Codes: Complete reference
- Console Virtual Terminal Sequences: Microsoft docs highlighting common termial codes.
This program is licensed under GNU Lesser General Public License v3.0 only. Some rights reserved. See LICENSE.