Page 1 of 1

pGtk-theme-refresh-1.1 in C Code

Posted: Sun 23 Nov 2014, 05:05
by trio
Hi,

This is a commandline gtk theme setter. I hacked a C code without any C Coding knowledge. And compiled in Quirky :)

I attached binary and source, also a .pet

Version 1.1: add warning if gtkrc supplied doesn't exist, add version

Code: Select all

Usage:
pGtkthemerefresh /path/to/your/gtkrc_theme/gtkrc
example:
pGtkthemerefresh /usr/share/themes/Default/gtk-2.0/gtkrc

WARNING! Be sure the file is a valid gtkrc
Passing no command line arguments will print this message
one glitch, it won't refresh browser's theme (in my case mozilla) on the fly

Regards,

Trio

PS: There's a perl version of it, but can't run in puppy. needs more lib for perl (Gtk2.pm)

Code: Select all

#!/usr/bin/perl
# License: Same as GTK2
use strict;
use warnings;
use Gtk2 '-init';

my $event = Gtk2::Gdk::Event->new("GDK_CLIENT_EVENT");
$event->send_event(1);
$event->window(undef);
$event->message_type(Gtk2::Gdk::Atom->intern("_GTK_READ_RCFILES", 0));
$event->data_format(8);
Gtk2::Gdk::Event->send_clientmessage_toall($event);	
a python version, requires pygtk:

Code: Select all

#!/usr/bin/python

import pygtk

import gtk

events=gtk.gdk.Event(gtk.gdk.CLIENT_EVENT)

data=gtk.gdk.atom_intern("_GTK_READ_RCFILES", True)

events.data_format=8

events.send_event=True

events.message_type=data

events.send_clientmessage_toall()

Posted: Fri 28 Nov 2014, 09:26
by trio
I hacked a C code without any C Coding knowledge. And compiled in Quirky :)

I attached binary and source

Code: Select all

Usage:
pGtkthemerefresh /path/to/your/gtkrc_theme/gtkrc
example:
pGtkthemerefresh /usr/share/themes/Default/gtk-2.0/gtkrc

WARNING! Be sure the file is a valid gtkrc
Passing no command line arguments will print this message
see main post

Posted: Sat 29 Nov 2014, 07:53
by trio
Version 1.1: add warning if gtkrc supplied doesn't exist, add version

download above, please test