GTK gui in bash.
sudo apt-get install libgtk-3-dev libxml2-dev
make all strip
When not using the debian package to install (see below), a typical local install can be achieved very simply like this:
sudo ln -fs $(pwd)/gtk-wrap /usr/local/bin/gtk-wrap
fpm is required, see Installation — fpm - packaging made simple 1.9.0 documentation
git is used for the versionning, dpkg-dev for dependencies analysis, and lintian is recommanded for final checking.
sudo apt-get install git dpkg-dev lintian
make deb
Create Your gui in Glade(GtkBuilder) and use it in your shell scripts.
EXAMPLE 1:
-
create Your GUI in Glade, name signal handler You're going to use
-
create Your bash script, name functions the same as signal handlers in Your Glade project
#!/bin/bash on_button1_clicked(){ #do something on button clicked signal } gtk_wrap -f a.glade | while read line do eval $line done
EXAMPLE 2: Simple calculator
-
create Glade project with 3 textview widgets and one button
-
name button clicked signal as on_button1_clicked
#!/bin/bash on_button1_clicked(){ echo "textview1 get" echo "textview2 get" read a read b c=$((a + b)) echo "textview3 set $c" } > inpipe < outpipe gtk_wrap -f b.glade -i inpipe -o outpipe | while read line do eval $line done
or, simplified using automatic variable assignment feature:
#!/bin/bash
on_button1_clicked(){
echo "textview3 set $((textview1+textview2))"
} > inpipe
gtk_wrap -f b.glade -i inpipe | while read line
do
eval $line
doneFull examples including glade files included in the DEMO folder.