A simple curses library made in bash to draw terminal interfaces
  • Shell 92.8%
  • Makefile 7.2%
Find a file
Patrice Ferlet 006b9cafd4
Merge pull request #67 from sunjc826/enhancements
Refactor variables, add text right align setting, add input reader
2024-07-16 22:09:14 +02:00
docs Add one more tip 2023-05-21 14:40:32 +02:00
examples Refactor variables, add text right align setting, add input reader 2024-05-13 21:50:36 +08:00
.gitignore Better dist generation 2023-05-20 10:58:35 +02:00
.shellcheckrc Refactor variables, add text right align setting, add input reader 2024-05-13 21:50:36 +08:00
AUTHORS Add myself to AUTHORS 2022-06-28 12:38:33 +12:00
INSTALL Fixup LICENCE, and installation documentation 2023-05-21 13:56:38 +02:00
LICENSE Fixup LICENCE, and installation documentation 2023-05-21 13:56:38 +02:00
Makefile Fixup LICENCE, and installation documentation 2023-05-21 13:56:38 +02:00
mkdocs.yml Add examples and tips 2023-05-21 11:31:54 +02:00
README.md Update README.md 2024-07-16 22:06:29 +02:00
simple_curses.sh Merge pull request #67 from sunjc826/enhancements 2024-07-16 22:09:14 +02:00
tux.gif Add tux.gif and changes on wintest to show how to add images with libcaca. So nice :) 2009-06-08 12:22:33 +00:00

Bash Simple Curses

Documentation Status FOSSA Status

Bash Simple Curses gives you some basic functions to quickly create windows on your terminal.

An example is given: bashbar. Bashbar is a monitoring bar that you can integrate into tiling window managers.

The (unfinished) goal of Bash Simple Curses is to create windows. It is only intended to create colored windows and display information into. But, with a little tips, you can also make it interactive.

To use this library, you have to import simple_curses.sh into your bash script, like so:


#!/bin/bash

# import library, please check path
#source /usr/lib/simple_curses.sh
source /usr/local/lib/simple_curses.sh

# You must create a "main" function:
main () {
    # Your code here, here we add some windows and text
    window "title" "color"
    append "Text..."
    endwin
}

# Then, execute the loop every second ( -t 1 => 1s)
main_loop -t 1

That's all.

Example

#!/bin/bash
source simple_curses.sh

main(){
    # create a window
    window "Example" "blue" "50%"
        append "Hello world"
        addsep
        append "The date command"
        append_command "date"
    endwin

    # move on the next column
    col_right

    # and create another window
    window "Example 2" "red" "50%"
        append "Hello world"
        addsep
        append "The date command"
        append_command "date"
    endwin
}
main_loop

Simple example

Install

There are several possibilities to use the library. We recommend to copy simple_curses.sh inside your project and to "source" it.

But, if you want to make it available for the entire system, or for local user, you can use the make install command:

# install inside the system
# in /usr/local/lib
sudo make install

# for local user, no need to use sudo, but change the PREFIX
make install PREFIX=~/.local/lib

You can then uninstall the library file:

sudo make uninstall
make uninstall PREFIX=~/.local/bin

License

FOSSA Status