You are not logged in.
I'm working on a script to save/restore OB and GTK theme configs, and although it is working OK, I can't find how to refresh the GTK theme with a command. Usually you would select and apply it with lxappearance, but how to do it without the gui?
The relevant gtk config files are in place (I think!), and the OB theme changes OK, but the gtk theme doesn't refresh.
"openbox --reconfigure/--restart" isn't doing it, and I don't want to use the gui or logout/login.
Any suggestions?
Last edited by damo (2015-05-09 16:27:57)
Offline
Never found anything. After some research, I wrote this for waldorf/wheezy using python 2 (2.7). Untested in jessie or with python3:
#!/usr/bin/python
# gtkreload
def usage():
print """\
Usage: gtkreload
Signal applications to reload gtk, usually to apply a new theme."""
exit()
import sys, gtk
if len(sys.argv) >= 2:
usage()
events=gtk.gdk.Event(gtk.gdk.CLIENT_EVENT)
data=gtk.gdk.atom_intern("_GTK_READ_RCFILES", False)
events.data_format=8
events.send_event=True
events.message_type=data
events.send_clientmessage_toall()
Call it "gtkreload", add execute permission, shebang invokes python interpreter.
Last edited by cpoakes (2015-05-09 15:26:32)
programming and administering unix since 1976 (BSD, System III, Xenix, System V, Linux)
Offline
Thanks cp Glad to know it isn't just me being thick!
I'll play with that code, thanks
EDIT: Works a treat!!
Last edited by damo (2015-05-09 16:07:58)
Offline
Using @cpoakes python code in a function within a bash script - it does the job
function reloadGTK(){
python - <<END
import sys, gtk
if len(sys.argv) >= 2:
usage()
events=gtk.gdk.Event(gtk.gdk.CLIENT_EVENT)
data=gtk.gdk.atom_intern("_GTK_READ_RCFILES", False)
events.data_format=8
events.send_event=True
events.message_type=data
events.send_clientmessage_toall()
END
}
Offline
Nice adaptation to the shell. Doesn't need the "sys" import or the "if..usage()" lines:
function reloadGTK(){
python - <<END
import gtk
events=gtk.gdk.Event(gtk.gdk.CLIENT_EVENT)
data=gtk.gdk.atom_intern("_GTK_READ_RCFILES", False)
events.data_format=8
events.send_event=True
events.message_type=data
events.send_clientmessage_toall()
END
}
programming and administering unix since 1976 (BSD, System III, Xenix, System V, Linux)
Offline
Thanks
Offline
$ aptitude show filename
Package: gtk-theme-switch
State: not installed
Version: 2.1.0-2
Priority: optional
Section: x11
Maintainer: Denis Briand <denis@narcan.fr>
Architecture: amd64
Uncompressed Size: 111 k
Depends: libatk1.0-0 (>= 1.20.0), libc6 (>= 2.2.5), libcairo2 (>= 1.2.4), libfontconfig1 (>= 2.8.0),
libfreetype6 (>= 2.2.1), libglib2.0-0 (>= 2.16.0), libgtk2.0-0 (>= 2.8.0), libpango1.0-0 (>= 1.14.0)
Conflicts: gtk-theme-switch
Description: GTK+ theme switching utility
Utilities to easily switch GTK+ themes that can be run from the console, and has an optional GUI dock and theme
preview. It can install themes downloaded from gtk.themes.org as well straight from the tarball.
Homepage: http://gna.org/projects/gtk-theme-switch/
Last edited by Sector11 (2015-05-10 13:39:53)
Offline
Last edited by cpoakes (2015-05-10 03:29:15)
programming and administering unix since 1976 (BSD, System III, Xenix, System V, Linux)
Offline
Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: acrobat