From b2c5ad96cb678509188b5cdd543e9b18614e1e0b Mon Sep 17 00:00:00 2001 From: Bryan Schumaker Date: Sat, 30 Oct 2010 13:42:45 -0400 Subject: [PATCH] PLUGIN: wm_tweaks.py This plugin will change the window title and icon whenever a song changes. --- plugins/wm_tweaks.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 plugins/wm_tweaks.py diff --git a/plugins/wm_tweaks.py b/plugins/wm_tweaks.py new file mode 100644 index 00000000..43d178fb --- /dev/null +++ b/plugins/wm_tweaks.py @@ -0,0 +1,30 @@ +# Bryan Schumaker (10/30/2010) + +import ocarina +libsaria = ocarina.libsaria +lib_find_id = libsaria.collection.lib_find_id +lib_get_attr = libsaria.collection.lib_get_attr +invite = libsaria.event.invite + +def reset(*args): + ocarina.set_window_icon("images/ocarina.png") + ocarina.set_window_title(ocarina.__vers__) + +def tweak_icon(file): + if file != None: + ocarina.set_window_icon(file) + +def tweak_title(filepath): + if filepath != None: + id = lib_find_id(filepath) + title = lib_get_attr(id, "title") + ocarina.set_window_title(title) + +def start(): + invite("PRELOAD", reset) + invite("POSTLOAD", tweak_title) + invite("POSTGETART", tweak_icon) + + +def stop(): + pass