XFCE-PANEL-PLUGIN development using Python/Javascript – Part 3

1
3 min read

As in the last blog, we get to know about Gtk Socket and Gtk Plug in two different programming language that was C and Python. So moving forward in our process, now we will move forward toward installation process of panel plugin.

I and my mentor decided to move forward with waf installation process, there were few reason to chose this method. As our focus is on beginner that are trying to develop XFCE panel plugin, so we decided to make whole process more simpler through waf installation process. Wscript is the main installation file, best thing about this is, it is easy to understand.

So Inside a waf installation file there are main file for installation i.e ‘waf‘ and ‘wscript’.

‘waf’ is an generated file so you don’t have to do much with this generated file. All installation operations will be performed through ‘wscript’ file.

In general, every project consist of several phases, that mostly contain following steps, On these steps concept, whole ‘waf’ installation is based on.

  • configure: it is used configure the project and find the location of the prerequisites, for example if you want to load c compiler you can define over this step.
  • build: it is used to transform the source files into build files
  • install: used to install the build files
  • uninstall: used for un-installation of the build files
  • dist: create an archive of the source files
  • clean: remove the build files.

Interested to learn more about ‘waf’ installation process, visit to the given link https://waf.io/apidocs/tutorial.html

so to give you better understanding, Here I am attaching one small code snippet for wscript file as an example.

APPNAME = 'Enter your plugin name'
VERSION = 'Enter your plugin version'

top = '.'
out = 'build'

def options (ctx):
	ctx.load('compiler_c')

def configure (ctx):
	ctx.load('compiler_c')
	args = '--cflags – libs'
	ctx.check_cfg(package = 'gtk+-3.0', atleast_version = '3.22',
		uselib_store = 'GTK', mandatory = True, args = args)


def build (ctx):
	ctx.program(
		features     = 'c cshlib',
		is_lib       = True,
		source       = ctx.path.ant_glob('panel-plugin/*.c'),
		packages     = 'gtk+-3.0',
		target       = 'sample-plugin',
		install_path = '${LIBDIR}/xfce4/panel/plugins/',
		uselib       = 'GTK',
		)
	
	ctx(
		features = 'subst',
		source = 'panel-plugin/sample.desktop.in',
		target = 'panel-plugin/sample.desktop')
		
	ctx.install_files(
		'usr/share/xfce4/panel/plugins/',
		'panel-plugin/sample.desktop')

def checkinstall (ctx):
    ctx.exec_command('checkinstall – pkgname=' + APPNAME +
     ' – pkgversion=' + VERSION + ' – provides=' + APPNAME +
     ' – deldoc=yes – deldesc=yes – delspec=yes – backup=no' +
     ' – exclude=/home -y ./waf install')

Hint: if you are getting confused with ctx don’t worry about it just an variable name you can replace ctx with your custom variable name also.

So Now time have come to introduce you with simple Xfce sample plugin Gitlab repo, Work is still in a process but you can still test it out.

Xfce Panel Sample Plugin Gitlab repo through Gtk Socket and GtkPlug Approach.

https://gitlab.xfce.org/vishal2612200/gio-xfce-panel-plugin-samples

If you find any issues or have any suggestion, Don’t forget to open issue on the repo 🙂

Choose your Reaction!
Leave a Comment