GithubHelp home page GithubHelp logo

sunjc826 / bashsimplecurses Goto Github PK

View Code? Open in Web Editor NEW

This project forked from metal3d/bashsimplecurses

0.0 0.0 0.0 149 KB

A simple curses library made in bash to draw terminal interfaces

License: BSD 3-Clause "New" or "Revised" License

Shell 92.27% Makefile 7.73%

bashsimplecurses's Introduction

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=~/.loca/bin

License

FOSSA Status

bashsimplecurses's People

Contributors

metal3d avatar markusmikkolainen avatar comigor avatar iksrandeb avatar terminalforlife avatar popey avatar vaporup avatar trng avatar innocentliny avatar arjunadeltoso avatar clawoflight avatar nero avatar pmazein avatar rlegene avatar fossabot avatar maharjun avatar mrjones-plip avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.