0
I Use This!
Activity Not Available

Project Summary

The simple way"Bash simple curses" give you some basic functions to quickly create some windows on you terminal as Xterm, aterm, urxvt...

An example is given: bashbar. Bashbar is a monitoring bar that you can integrate in tiling desktop (Xmonad, WMii...)

The goal of Bash Simple Curses is not done (not yet) to create very complete windows. It is only done to create some colored windows and display informations into.

You are using Bash simple curses ? Please Click on following button !

.gadget-title {
margin-bottom: 2px;
}

function resizeIframeHandler(opt_height) {
var elem = document.getElementById(this.f);
if (!elem) return;
if (!opt_height) {
elem.style.height = undefined;
}
else {
opt_height = Math.max(10, opt_height);
elem.style.height = opt_height + 'px';
}
}
gadgets.rpc.register("resize_iframe", resizeIframeHandler);

gadgets.rpc.register('set_title', function(title) {
var elem = document.getElementById(this.f + '_title');
if (elem) {
elem.innerHTML = gadgets.util.escape(title);
}
});

Why ?Because bash is very usefull, there are command to do whatever you want. With curses you can create a little bar to display informations every second, you can change an output command to display a report...

So, we need an easy and usefull library to quickly create this kind of views. This is why you can try Bash Simple Curses

Example: the bashbarBash bar is the given example that show system informations. You only have to resize your terminal window and place it on left or right. This screenshot is made on Xmonad:

this is the code used:

#!/bin/bash

. `dirname $0`/simple_curses.sh

main (){
window "`hostname`" "red"
append "`date`"
addsep
append_tabbed "Up since|`uptime | cut -f1 -d"," | sed 's/^ *//' | cut -f3- -d" "`" 2 "|"
append_tabbed "Users:`uptime | cut -f2 -d"," | sed 's/^ *//'| cut -f1 -d" "`" 2
append_tabbed "`awk '{print "Load average:" $1 " " $2 " " $3}' < /proc/loadavg`" 2
endwin

window "Memory usage" "red"
append_tabbed `cat /proc/meminfo | awk '/MemTotal/ {print "Total:" $2/1024}'` 2
append_tabbed `cat /proc/meminfo | awk '/MemFree/ {print "Used:" $2/1024}'` 2
endwin

window "Processus taking memory and CPU" "green"
for i in `seq 2 6`; do
append_tabbed "`ps ax -o pid,rss,pcpu,ucmd --sort=-cpu,-rss | sed -n "$i,$i p" | awk '{printf "%s: %smo: %s%%" , $4, $2/1024, $3 }'`" 3
done
endwin

window "Last kernel messages" "blue"
dmesg | tail -n 10 > /tmp/deskbar.dmesg
while read line; do
append_tabbed "$line" 1 "~"
done < /tmp/deskbar.dmesg
rm -f /tmp/deskbar.dmesg
endwin

window "Inet interfaces" "grey"
_ifaces=$(for inet in `ifconfig | cut -f1 -d " " | sed -n "/./ p"`; do ifconfig $inet | awk 'BEGIN{printf "%s", "'"$inet"'"} /adr:/ {printf ":%s\n", $2}'|sed 's/adr://'; done)
for ifac in $_ifaces; do
append_tabbed "$ifac" 2
done
endwin
}
main_loop 1Another Examplethis capture shows you that you can do whatever you want:

Code is:

#!/bin/bash

source $(dirname $0)/simple_curses.sh

main(){
window "Test 1" "red" "33%"
append "First simple window"
endwin

col_right
move_up

window "Test 2" "red" "33%"
append "Multiline is allowed !!!\nLike this :)"
append "This is a new col here."
endwin

window "Test 3" "red" "33%"
append "We can had some text, log..."
endwin
window "Test 4" "grey" "33%"
append "Example using command"
append "`date`"
append "I only ask for date"
endwin

col_right
move_up
window "Test 5" "red" "34%"
append "We can add some little windows... rememeber that very long lines are wrapped to fit window !"
endwin

window "Little" "green" "12%"
append "this is a simple\nlittle window"
endwin
col_right
window "Other window" "blue" "22%"
append "And this is\nanother little window"
endwin

}
main_loopHow nice !And just with libcaca "img2txt" command, you can have fun:

Cool, isn't it ?

Tags

bash curses monitoring ncurses terminal

In a Nutshell, bashsimplecurses...

 No code available to analyze

Open Hub computes statistics on FOSS projects by examining source code and commit history in source code management systems. This project has no code locations, and so Open Hub cannot perform this analysis

Is this project's source code hosted in a publicly available repository? Do you know the URL? If you do, click the button below and tell us so that Open Hub can generate statistics! It's fast and easy - try it and see!

Add a code location

BSD 4-clause (University of California-Specific)
Permitted

Commercial Use

Modify

Distribute

Place Warranty

Forbidden

Use Trademarks

Hold Liable

Required

Include Copyright

Include License

These details are provided for information only. No information here is legal advice and should not be used as such.

All Licenses

This Project has No vulnerabilities Reported Against it

Did You Know...

  • ...
    Black Duck offers a free trial so you can discover if there are open source vulnerabilities in your code
  • ...
    by exploring contributors within projects, you can view details on every commit they have made to that project
  • ...
    55% of companies leverage OSS for production infrastructure
  • ...
    you can subscribe to e-mail newsletters to receive update from the Open Hub blog

 No code available to analyze

Open Hub computes statistics on FOSS projects by examining source code and commit history in source code management systems. This project has no code locations, and so Open Hub cannot perform this analysis

Is this project's source code hosted in a publicly available repository? Do you know the URL? If you do, click the button below and tell us so that Open Hub can generate statistics! It's fast and easy - try it and see!

Add a code location

Community Rating

Be the first to rate this project
Click to add your rating
   Spinner
Review this Project!
Sample ohloh analysis