diff -Nru xfce4-dockbarx-plugin-0.3.1/debian/changelog xfce4-dockbarx-plugin-0.4.1/debian/changelog --- xfce4-dockbarx-plugin-0.3.1/debian/changelog 2014-06-20 08:56:43.000000000 +0000 +++ xfce4-dockbarx-plugin-0.4.1/debian/changelog 2015-09-08 11:06:09.000000000 +0000 @@ -1,3 +1,33 @@ +xfce4-dockbarx-plugin (0.4.1-1~webupd8~trusty2) trusty; urgency=medium + + * New upstream release + * Depend on python-dbus + * Removed fix-old-bg-methods.patch (applied upstream) + * Use valac-0.28 for Wily only + + -- Alin Andrei Wed, 19 Aug 2015 12:12:37 +0200 + +xfce4-dockbarx-plugin (0.4-1~webupd8~trusty1) trusty; urgency=medium + + * New upstream release + * Depend on python-dbus + * Added fix-old-bg-methods.patch + + -- Alin Andrei Wed, 12 Aug 2015 12:15:57 +0200 + +xfce4-dockbarx-plugin (0.3.1-0~webupd8~vivid1) vivid; urgency=medium + + * Upload for Vivid + * Build with Vala 0.16 (0.14 not available for Vivid) + + -- Alin Andrei Wed, 11 Mar 2015 14:18:39 +0200 + +xfce4-dockbarx-plugin (0.3.1-0~webupd8~utopic0) utopic; urgency=medium + + * Upload for Utopic + + -- Alin Andrei Thu, 11 Sep 2014 11:27:49 +0200 + xfce4-dockbarx-plugin (0.3.1-0~webupd8~trusty0) trusty; urgency=medium * new upstream bugfix release diff -Nru xfce4-dockbarx-plugin-0.3.1/debian/control xfce4-dockbarx-plugin-0.4.1/debian/control --- xfce4-dockbarx-plugin-0.3.1/debian/control 2014-06-20 08:57:50.000000000 +0000 +++ xfce4-dockbarx-plugin-0.4.1/debian/control 2015-09-08 11:05:46.000000000 +0000 @@ -2,12 +2,12 @@ Section: xfce Priority: optional Maintainer: Alin Andrei -Build-Depends: debhelper, libvala-0.14-dev, valac-0.14, libglib2.0-dev, libgtk2.0-dev, xfce4-panel-dev, dockbarx-dockx, dockbarx +Build-Depends: debhelper, libvala-0.16-dev, valac-0.16, libglib2.0-dev, libgtk2.0-dev, xfce4-panel-dev, dockbarx-dockx, dockbarx Standards-Version: 3.9.5 -Homepage: http://xfce-look.org/content/show.php?content=157865 +Homepage: https://github.com/TiZ-EX1/xfce4-dockbarx-plugin Package: xfce4-dockbarx-plugin Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, dockbarx (> 0.90) +Depends: ${shlibs:Depends}, ${misc:Depends}, dockbarx (> 0.90), python-dbus Description: DockBarX plugin for Xfce This is a DockBarX plugin for the Xfce panel diff -Nru xfce4-dockbarx-plugin-0.3.1/debian/copyright xfce4-dockbarx-plugin-0.4.1/debian/copyright --- xfce4-dockbarx-plugin-0.3.1/debian/copyright 2013-03-29 14:14:01.000000000 +0000 +++ xfce4-dockbarx-plugin-0.4.1/debian/copyright 2015-08-12 09:16:38.000000000 +0000 @@ -1,10 +1,10 @@ This work was packaged for Debian by: - Alin Andrei on Fri, 29 Marc 2013 20:01:44 +0200 + Alin Andrei on Fri, 29 Mar 2013 20:01:44 +0200 It was downloaded from: - http://xfce-look.org/content/show.php?content=157865 + https://github.com/TiZ-EX1/xfce4-dockbarx-plugin Upstream Author(s): @@ -12,7 +12,7 @@ Copyright: - Copyright (C) 2013 Trent McPheron (TiZ) + Copyright (C) 2015 Trent McPheron (TiZ) License: @@ -22,7 +22,7 @@ The Debian packaging is: - Copyright (C) 2013 Alin Andrei + Copyright (C) 2015 Alin Andrei and is licensed under the GPL version 3, see "/usr/share/common-licenses/GPL-3" diff -Nru xfce4-dockbarx-plugin-0.3.1/debian/patches/fix-old-bg-methods.patch xfce4-dockbarx-plugin-0.4.1/debian/patches/fix-old-bg-methods.patch --- xfce4-dockbarx-plugin-0.3.1/debian/patches/fix-old-bg-methods.patch 1970-01-01 00:00:00.000000000 +0000 +++ xfce4-dockbarx-plugin-0.4.1/debian/patches/fix-old-bg-methods.patch 2015-08-13 13:54:59.000000000 +0000 @@ -0,0 +1,23 @@ +From 66ec8273f3454ced306cd41abe7ac62e83dc357f Mon Sep 17 00:00:00 2001 +From: Trent McPheron +Date: Wed, 12 Aug 2015 09:54:16 -0400 +Subject: [PATCH] Fix the thing where I broke the old bg methods. Oops. :x + +--- + src/xfce4-dockbarx-plug.py | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/xfce4-dockbarx-plug.py b/src/xfce4-dockbarx-plug.py +index b46f26e..1b97bfb 100755 +--- a/src/xfce4-dockbarx-plug.py ++++ b/src/xfce4-dockbarx-plug.py +@@ -158,6 +158,9 @@ def destroy (self, widget, data=None): + # Init the variables to default values. + socket = 0 + config = "" ++bus = None ++xfconf = None ++prop = None + + # Then check the arguments for them. + if "-s" in sys.argv: diff -Nru xfce4-dockbarx-plugin-0.3.1/debian/patches/series xfce4-dockbarx-plugin-0.4.1/debian/patches/series --- xfce4-dockbarx-plugin-0.3.1/debian/patches/series 2014-06-17 08:53:20.000000000 +0000 +++ xfce4-dockbarx-plugin-0.4.1/debian/patches/series 2015-08-19 09:12:23.000000000 +0000 @@ -1 +1,2 @@ #dockbarx-0.91-compatibility.patch +#fix-old-bg-methods.patch diff -Nru xfce4-dockbarx-plugin-0.3.1/debian/source/format xfce4-dockbarx-plugin-0.4.1/debian/source/format --- xfce4-dockbarx-plugin-0.3.1/debian/source/format 2012-11-23 18:23:22.000000000 +0000 +++ xfce4-dockbarx-plugin-0.4.1/debian/source/format 2015-09-08 09:08:04.000000000 +0000 @@ -1 +1 @@ -3.0 (quilt) +3.0 (native) diff -Nru xfce4-dockbarx-plugin-0.3.1/.gitignore xfce4-dockbarx-plugin-0.4.1/.gitignore --- xfce4-dockbarx-plugin-0.3.1/.gitignore 2014-06-19 21:10:45.000000000 +0000 +++ xfce4-dockbarx-plugin-0.4.1/.gitignore 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ -build -.waf* -.lock-waf_linux_build -*.geany -xfce4-dockbarx-plugin*.tar.bz2 diff -Nru xfce4-dockbarx-plugin-0.3.1/README xfce4-dockbarx-plugin-0.4.1/README --- xfce4-dockbarx-plugin-0.3.1/README 2014-06-19 21:10:45.000000000 +0000 +++ xfce4-dockbarx-plugin-0.4.1/README 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -xfce4-dockbarx-plugin, v0.3.1 ------------------------------ - -xfce4-dockbarx-plugin is free software. Please see the file COPYING for details. -For building and installation instructions please see the INSTALL file. For -information on the authors of this program, see AUTHORS and THANKS. - -xfce4-dockbarx-plugin is a pair of programs, one in Vala and one in Python, that -work together to embed DockbarX into xfce4-panel. See THANKS for details on -DockbarX. Because this is not a port and just grabs the pre-existing DockbarX, -you immediately benefit from any updates made to DBX, and already have all the -pre-existing functionality. - -The old version of this plugin tried to blend in with the panel, and due to -limitations with the Vala bindings for Xfconf, could only blend in with panel-0. -You were pretty much out of luck if panel-0 didn't exist. - -The new version uses manual configuration to determine background styling. -When you first start the plugin, a dialog will appear that will allow you to -configure the way the background is drawn. You can then configure it to blend -in with the panel it's on... or you can even choose for it *not* to blend in! -Since you can choose for it not to blend in, you can also expand it if you want. -The plugin will automatically detect panel orientation and screen position, and -communicates this info to the python DBX plug. Whenever the configuration is -changed, the plug is restarted. - -This plugin includes a DockbarX theme called Mouse, created by me for use with -xfce4-panel (but should work fine on Gnome/Mate panels, AWN, or DockX). There -are two variant versions for varying levels of x/ythickness on the panel widgets -to make them match up nicely. If a theme gives panel widgets differing -x/ythickness, its author is a sick bastard. - -Enjoy using DockbarX on Xfce! :) diff -Nru xfce4-dockbarx-plugin-0.3.1/README.md xfce4-dockbarx-plugin-0.4.1/README.md --- xfce4-dockbarx-plugin-0.3.1/README.md 2014-06-19 21:10:45.000000000 +0000 +++ xfce4-dockbarx-plugin-0.4.1/README.md 2015-09-04 13:25:32.000000000 +0000 @@ -1,5 +1,5 @@ # xfce4-dockbarx-plugin -### ver. 0.3.1 +### ver. 0.4.1 ## About xfce4-dockbarx-plugin xfce4-dockbarx-plugin is free software. Please see the file COPYING for details. For building and installation instructions please see the INSTALL file. For information on the authors of this program, see AUTHORS and THANKS. @@ -11,6 +11,8 @@ When you first start the plugin, a dialog will appear that will allow you to configure the way the background is drawn. You can then configure it to blend in with the panel it's on... or you can even choose for it *not* to blend in! Since you can choose for it not to blend in, you can also expand it if you want. The plugin will automatically detect panel orientation and screen position, and will save that to the config file, which is shared between both the socket and the plug. Whenever the configuration is changed, the plug is restarted. +You can avoid having to manually configure your background by using the panel blend mode, new and default as of 0.4. This makes use of xfconf's dbus interface and python-dbus to retrieve information about the panel background, and also connects to a signal and update it whenever it changes. However, there is still one gotcha; namely, if you use the image style, you still need to make sure the offset is properly configured if you have an image that necessitates it. + ## Any extras? This plugin includes a DockbarX theme called Mouse, created by me for use with xfce4-panel (but should work fine on Gnome/Mate panels, AWN, or DockX). There are two variant versions for varying levels of x/ythickness on the panel widgets to make them match up nicely. If a theme gives different panel widgets differing x/ythickness, its author is a sick bastard. diff -Nru xfce4-dockbarx-plugin-0.3.1/src/dockbarx.vala xfce4-dockbarx-plugin-0.4.1/src/dockbarx.vala --- xfce4-dockbarx-plugin-0.3.1/src/dockbarx.vala 2014-06-19 21:10:45.000000000 +0000 +++ xfce4-dockbarx-plugin-0.4.1/src/dockbarx.vala 2015-09-04 13:25:32.000000000 +0000 @@ -34,7 +34,7 @@ // Fields and props. private Gtk.Socket socket; private ulong socket_id; - private bool starting_dbx = false; + private bool starting_dbx = true; public uint8 bgmode { get; set; } public Gdk.Color color; // Can't be a property. public uint8 alpha { get; set; } @@ -59,7 +59,7 @@ keyfile.load_from_data(""" [Xfce4DockbarX] config=false - mode=0 + mode=2 color=#3c3c3c alpha=100 image= @@ -116,6 +116,7 @@ save.connect(save_config); // Start DBX if it's been configured. + starting_dbx = false; show_all(); if (config) start_dockbarx(); else configure_plugin(); @@ -126,7 +127,8 @@ if (!starting_dbx) { starting_dbx = true; try { - Process.spawn_command_line_sync("pkill -f xfce4-dockbarx-plug"); + Process.spawn_command_line_sync( + "pkill -f 'python.*xfce4-dockbarx-plug'"); } catch { var d = new MessageDialog(null, 0, MessageType.ERROR, ButtonsType.OK, "Failed to stop DockbarX plug."); @@ -138,7 +140,7 @@ try { Process.spawn_command_line_async("/usr/bin/env python2 " + "/usr/share/xfce4/panel/plugins/xfce4-dockbarx-plug " + - @"-s $socket_id -c $file"); + @"-s $socket_id -c $file -i $unique_id"); } catch { var d = new MessageDialog(null, 0, MessageType.ERROR, ButtonsType.OK, "Failed to start DockbarX plug."); diff -Nru xfce4-dockbarx-plugin-0.3.1/src/preferences.vala xfce4-dockbarx-plugin-0.4.1/src/preferences.vala --- xfce4-dockbarx-plugin-0.3.1/src/preferences.vala 2014-06-19 21:10:45.000000000 +0000 +++ xfce4-dockbarx-plugin-0.4.1/src/preferences.vala 2015-09-04 13:25:32.000000000 +0000 @@ -28,6 +28,7 @@ private RadioButton top_radio; private RadioButton color_radio; private RadioButton image_radio; + private RadioButton blend_radio; private ColorButton color_button; private HScale alpha_scale; private FileChooserButton image_button; @@ -57,6 +58,8 @@ color_radio = new RadioButton.with_label(null, "Solid color"); image_radio = new RadioButton.with_label_from_widget( color_radio, "Background image"); + blend_radio = new RadioButton.with_label_from_widget( + image_radio, "Blend with panel"); color_button = new ColorButton(); alpha_scale = new HScale.with_range(0, 100, 1); alpha_scale.value_pos = PositionType.RIGHT; @@ -114,7 +117,8 @@ image_table.attach(offset_spin, 1, 2, 1, 2, AttachOptions.EXPAND | AttachOptions.FILL, 0, 0, 0); image_frame.add(image_table); - + + // Asseemble the size box. var size_box = new HBox(false, 2); size_box.pack_start(new Label("Max size:")); size_box.pack_start(max_size_spin); @@ -124,6 +128,7 @@ if (!plugin.free_orient) { content.pack_start(orient_frame); } + content.pack_start(blend_radio); content.pack_start(color_frame); content.pack_start(image_frame); content.pack_start(size_box); @@ -138,6 +143,7 @@ top_radio.active = plugin.orient == "top" || plugin.orient == "right"; color_radio.active = plugin.bgmode == 0; image_radio.active = plugin.bgmode == 1; + blend_radio.active = plugin.bgmode == 2; color_button.color = plugin.color; alpha_scale.set_value(plugin.alpha); image_button.set_filename(plugin.image); @@ -160,10 +166,13 @@ } }); color_radio.toggled.connect(() => { - plugin.bgmode = color_radio.active ? 0 : 1; + plugin.bgmode = color_radio.active ? 0 : blend_radio.active ? 2 : 1; }); image_radio.toggled.connect(() => { - plugin.bgmode = image_radio.active ? 1 : 0; + plugin.bgmode = image_radio.active ? 1 : blend_radio.active ? 2 : 0; + }); + blend_radio.toggled.connect(() => { + plugin.bgmode = blend_radio.active ? 2 : color_radio.active ? 0 : 1; }); color_button.color_set.connect(() => { plugin.color = color_button.color; diff -Nru xfce4-dockbarx-plugin-0.3.1/src/xfce4-dockbarx-plug.py xfce4-dockbarx-plugin-0.4.1/src/xfce4-dockbarx-plug.py --- xfce4-dockbarx-plugin-0.3.1/src/xfce4-dockbarx-plug.py 2014-06-19 21:10:45.000000000 +0000 +++ xfce4-dockbarx-plugin-0.4.1/src/xfce4-dockbarx-plug.py 2015-09-04 13:25:32.000000000 +0000 @@ -18,29 +18,22 @@ # You should have received a copy of the GNU General Public License # along with dockbar. If not, see . -from dockbarx.log import * +from dockbarx.log import *; log_to_file() import sys -import io -import os -import subprocess -import time -log_to_file() sys.stderr = StdErrWrapper() sys.stdout = StdOutWrapper() +import io import traceback -# Wait for just one second, make sure config files and the like get settled. -time.sleep(1) - import pygtk pygtk.require("2.0") import gtk import cairo -import gobject +import dbus import dockbarx.dockbar as db -from dockbarx.common import Globals from ConfigParser import SafeConfigParser +from optparse import OptionParser # A very minimal plug application that loads DockbarX @@ -50,30 +43,188 @@ __gsignals__ = {"expose-event": "override"} # Constructor! - def __init__ (self, socket, cairo_pattern, orient, max_size, expand): + def __init__ (self): + # Init the variables to default values. + self.bus = None + self.xfconf = None + self.prop = None + section = "Xfce4DockbarX" + + # Then check the arguments for them. + parser = OptionParser() + parser.add_option("-s", "--socket", default = 0, help = "Socket ID") + parser.add_option("-c", "--config", default = "", help = "Config file") + parser.add_option("-i", "--plugin_id", default = -1, help = "Plugin ID") + (options, args) = parser.parse_args() + + # Sanity checks. + if options.socket == 0: + sys.exit("This program needs to be run by the XFCE DBX plugin.") + if options.config == "": + sys.exit("Forgetting something? You need a configuration file.") + if options.plugin_id == -1: + sys.exit("We need to know the plugin id of the DBX socket.") + # Set up the window. - gtk.Plug.__init__(self, socket) - self.pattern = cairo_pattern - self.max_size = max_size - self.expand = expand - self.set_name("Xfce4DockBarXPlug") + gtk.Plug.__init__(self, int(options.socket)) self.connect("destroy", self.destroy) + self.get_settings().connect("notify::gtk-theme-name",self.theme_changed) self.set_app_paintable(True) gtk_screen = gtk.gdk.screen_get_default() colormap = gtk_screen.get_rgba_colormap() if colormap is None: colormap = gtk_screen.get_rgb_colormap() self.set_colormap(colormap) + + # This should cause the widget to get themed like a panel. + self.set_name("Xfce4PanelDockBarX") + self.show() + + # First, load the configuration file. + # Default config. + default_conf = """ +[Xfce4DockbarX] +config=false +mode=0 +color=#3c3c3c +alpha=100 +image= +offset=0 +max_size=0 +orient=bottom +expand=false +""" + keyfile = SafeConfigParser(allow_no_value=True) + try: + keyfile.readfp(io.BytesIO(default_conf)) + keyfile.read(options.config) + + # Read the config. + self.mode = keyfile.getint(section, "mode") + self.orient = keyfile.get(section, "orient") + self.offset = keyfile.getint(section, "offset") + except: + traceback.print_exc() + sys.exit("Couldn't load config.") + + # Let's make sure our parameters are actually valid. + if not (self.orient == "bottom" or self.orient == "top" or + self.orient == "down" or self.orient == "up" or + self.orient == "left" or self.orient == "right"): + sys.exit("Orient must be bottom, top, left, or right.") + + # Change it to DBX-specific terminology. + if self.orient == "bottom": self.orient = "down" + if self.orient == "top": self.orient = "up" + + # Color parameters. + if self.mode == 0: + try: + alpha = keyfile.getint(section, "alpha") + except: + sys.exit("Alpha must be 0 for transparent to 100 for opaque.") + try: + color = gtk.gdk.color_parse(keyfile.get(section, "color")) + self.color_pattern(color, alpha); + except: + traceback.print_exc() + sys.exit("Color must be specified in hex: #rrggbb.") + + # Image parameters. + elif self.mode == 1: + self.image_pattern(keyfile.get(section, "image")) + + # Fancy new panel blend mode which uses DBus! + elif self.mode == 2: + self.bus = dbus.SessionBus() + self.xfconf = dbus.Interface(self.bus.get_object( + "org.xfce.Xfconf", "/org/xfce/Xfconf"), "org.xfce.Xfconf") + self.prop = [k for (k, v) in + self.xfconf.GetAllProperties("xfce4-panel", "/panels").iteritems() + if "plugin-ids" in k and int(options.plugin_id) in v][0][:-10] + self.pattern_from_dbus() + self.bus.add_signal_receiver(self.xfconf_changed, "PropertyChanged", + "org.xfce.Xfconf", "org.xfce.Xfconf", "/org/xfce/Xfconf") + + else: + sys.exit("Mode must be 0 for color, 1 for image, or 2 for blend.") + + # Size parameters. + try: + self.max_size = keyfile.getint(section, "max_size") + if self.max_size == 0: self.max_size = 4096 + except: + traceback.print_exc() + sys.exit("Max_size must be a positive integer.") + try: + self.expand = keyfile.getboolean(section, "expand") + except: + traceback.print_exc() + sys.exit("Expand must be true or false.") + # Load and insert DBX. self.dockbar = db.DockBar(self) - self.dockbar.set_orient(orient) + self.dockbar.set_orient(self.orient) self.dockbar.set_expose_on_clear(True) self.dockbar.load() self.add(self.dockbar.get_container()) self.dockbar.set_max_size(self.max_size) self.show_all() + + # Create a cairo pattern from given color. + def color_pattern (self, color, alpha): + if gtk.gdk.screen_get_default().get_rgba_colormap() is None: alpha = 100 + self.pattern = cairo.SolidPattern(color.red_float, color.green_float, + color.blue_float, alpha / 100.0) - def readd_container(self, container): + # Create a cairo pattern from given image. + def image_pattern (self, image): + try: + surface = cairo.ImageSurface.create_from_png(image) + self.pattern = cairo.SurfacePattern(surface) + self.pattern.set_extend(cairo.EXTEND_REPEAT) + except: + traceback.print_exc() + sys.exit("Couldn't load png image.") + try: + tx = self.offset if self.orient in ("up", "down") else 0 + ty = self.offset if self.orient in ("left", "right") else 0 + matrix = cairo.Matrix(x0=tx, xy=ty) + self.pattern.set_matrix(matrix) + except: + traceback.print_exc() + sys.exit("Image offset must be an integer.") + + # Convenience method. + def get_xfconf_panel (self, prop): + return self.xfconf.GetProperty("xfce4-panel", self.prop + prop) + + # Create a pattern from dbus. + def pattern_from_dbus (self): + style = self.get_xfconf_panel("background-style") + if style == 2: + image = self.get_xfconf_panel("background-image") + self.image_pattern(image) + elif style == 1: + col = self.get_xfconf_panel("background-color") + alpha = self.get_xfconf_panel("background-alpha") + self.color_pattern(gtk.gdk.Color(col[0], col[1], col[2]), alpha) + else: + style = self.get_style() + alpha = self.get_xfconf_panel("background-alpha") + self.color_pattern(style.bg[gtk.STATE_NORMAL], alpha) + + def xfconf_changed (self, channel, prop, val): + if channel != "xfce4-panel": return + if self.prop not in prop: return + self.pattern_from_dbus() + self.queue_draw() + + def theme_changed (self, obj, prop): + self.pattern_from_dbus() + self.queue_draw() + + def readd_container (self, container): # Dockbar calls back with this function when it is reloaded # since the old container has been destroyed in the reload # and needs to be added again. @@ -100,146 +251,9 @@ def destroy (self, widget, data=None): gtk.main_quit() -# Init the variables to default values. -socket = 0 -config = "" - -# Then check the arguments for them. -if "-s" in sys.argv: - i = sys.argv.index("-s") + 1 - try: - socket = int(sys.argv[i]) - except: - raise -if "-c" in sys.argv: - i = sys.argv.index("-c") + 1 - try: - config = sys.argv[i] - except: - raise - -# If you try to run this by itself, you're bad and you should feel bad. -if socket == 0: - sys.exit("Stop it. This program needs to be run by the XFCE embed plugin.") - -# You also need a configuration file, you bad program user. -if config == "": - sys.exit("Forgetting something? You need a configuration file.") - -# First, load the configuration file. -# Default config. -default_conf = """ -[Xfce4DockbarX] -config=false -mode=0 -color=#3c3c3c -alpha=100 -image= -offset=0 -max_size=0 -orient=bottom -expand=false -""" - -# Scope crap. -mode = 0 -color = "#3c3c3c" -alpha = 100 -image = "" -offset = 0 -max_size = 0 -expand = False -orient = "bottom" -cairo_pattern = None -section = "Xfce4DockbarX" - -keyfile = SafeConfigParser(allow_no_value=True) -try: - keyfile.readfp(io.BytesIO(default_conf)) - keyfile.read(config) - - # Read the config. - mode = keyfile.getint(section, "mode") - orient = keyfile.get(section, "orient") -except: - traceback.print_exc() - sys.exit("Couldn't load config.") - -# Let's make sure our parameters are actually valid. -if not (orient == "bottom" or orient == "top" or - orient == "left" or orient == "right"): - sys.exit("Orient must be bottom, top, left, or right.") - -# Change it to DBX-specific terminology. -if orient == "bottom": orient = "down" -if orient == "top": orient = "up" - -# Color parameters. -if mode == 0: - try: - alpha = keyfile.getint(section, "alpha") - except: - sys.exit("Alpha must be between 0 for transparent and 100 for opaque.") - try: - # Ungraceful, but easy. Sue me. - c = keyfile.get(section, "color") - if c[0] == "#": c = c[1:] - split = "" - size = 0.0 - if len(c) == 3: - split = (c[0:1], c[1:2], c[2:3]) - size = 15.0 - if len(c) == 6: - split = (c[0:2], c[2:4], c[4:6]) - size = 255.0 - if len(c) == 9: - split = (c[0:3], c[3:6], c[6:9]) - size = 4095.0 - if len(c) == 12: - split = (c[0:4], c[4:8], c[8:12]) - size = 65535.0 - cl = [(int(x, 16) / 65535.0) for x in split] - if gtk.gdk.screen_get_default().get_rgba_colormap() is None: alpha = 100 - cairo_pattern = cairo.SolidPattern(cl[0], cl[1], cl[2], alpha / 100.0) - except: - traceback.print_exc() - sys.exit("Color must be specified in hex: red, green, blue.") - -# Image parameters. -elif mode == 1: - try: - image = keyfile.get(section, "image") - surface = cairo.ImageSurface.create_from_png(image) - cairo_pattern = cairo.SurfacePattern(surface) - cairo_pattern.set_extend(cairo.EXTEND_REPEAT) - except: - traceback.print_exc() - sys.exit("Couldn't load png image.") - try: - offset = keyfile.getint(section, "offset") - tx = offset if orient in ("up", "down") else 0 - ty = offset if orient in ("left", "right") else 0 - matrix = cairo.Matrix(x0=tx, xy=ty) - cairo_pattern.set_matrix(matrix) - except: - traceback.print_exc() - sys.exit("Image offset must be an integer.") -else: - sys.exit("Mode must be 0 for color or 1 for image.") - -# Size parameters. -try: - max_size = keyfile.getint(section, "max_size") - if max_size == 0: max_size = 4096 -except: - traceback.print_exc() - sys.exit("Max_size must be a positive integer.") -try: - expand = keyfile.getboolean(section, "expand") -except: - traceback.print_exc() - sys.exit("Expand must be true or false.") - -# Anyways, time to start DBX! -dockbarxplug = DockBarXFCEPlug(socket, cairo_pattern, orient, max_size, expand) -gtk.main() +# Start DBX. +if __name__ == '__main__': + # Wait for just one second, make sure config files and the like get settled. + import time; time.sleep(1) + dbx = DockBarXFCEPlug() + gtk.main() diff -Nru xfce4-dockbarx-plugin-0.3.1/wscript xfce4-dockbarx-plugin-0.4.1/wscript --- xfce4-dockbarx-plugin-0.3.1/wscript 2014-06-19 21:10:45.000000000 +0000 +++ xfce4-dockbarx-plugin-0.4.1/wscript 2015-09-04 13:25:32.000000000 +0000 @@ -22,7 +22,7 @@ # For creating a source archive. APPNAME = 'xfce4-dockbarx-plugin' -VERSION = '0.3.1' +VERSION = '0.4.1' # Required waf stuff. top = '.'