Skip to content

abecadel/gtkwrap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gtkwrap

GTK gui in bash.

Build / Install

prerequisites

sudo apt-get install libgtk-3-dev libxml2-dev

build and install locally

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

build debian package

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

Usage

Create Your gui in Glade(GtkBuilder) and use it in your shell scripts.

EXAMPLE 1:

  1. create Your GUI in Glade, name signal handler You're going to use

  2. 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

  1. create Glade project with 3 textview widgets and one button

  2. 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
  done

Full examples including glade files included in the DEMO folder.

About

GTK gui in bash.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •