aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-04-04 03:52:21 +0200
committerMattias Andrée <maandree@operamail.com>2015-04-04 03:52:21 +0200
commitefe4ff0ca5d236c7d7975ccb708259b9754d4733 (patch)
tree59bf46c7aefc6ee45ee1b2dc9ff45675d00a9543 /src
parentm (diff)
downloadxpybar-efe4ff0ca5d236c7d7975ccb708259b9754d4733.tar.gz
xpybar-efe4ff0ca5d236c7d7975ccb708259b9754d4733.tar.bz2
xpybar-efe4ff0ca5d236c7d7975ccb708259b9754d4733.tar.xz
fix errors in image plugin + begin on launchers
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/image.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/plugins/image.py b/src/plugins/image.py
index ccb8b29..d72e829 100644
--- a/src/plugins/image.py
+++ b/src/plugins/image.py
@@ -109,8 +109,8 @@ class Image:
i = 0
for _i in range(len(buf) // 3):
self.data.append(buf[i])
- self.data.append(buf[i + 1])
self.data.append(buf[i + 2])
+ self.data.append(buf[i + 1])
self.data.append(0)
i += 3
self.data = bytes(self.data)
@@ -154,7 +154,7 @@ class Image:
dname = name.split('/')[0] if '/' in name else None
iname = name.split('/')[-1]
- preferred_size = int((width ** 2 + height ** 2) ** 0.5) if width is not None else None
+ preferred_size = (width + height) // 2 if width is not None else None
def order_themes(themes):
themes, pre, post, state = set(themes), [], [], 0
@@ -169,13 +169,13 @@ class Image:
def order_sizes(sizes):
sizes = [t(lambda : int(s.split('x')[0]), -1) for s in sizes]
if preferred_size is not None:
- high = [s for s in sizes if (s > 0) and (s > preferred_size)]
- low = [s for s in sizes if (s > 0) and (s < preferred_size)]
+ high = [s for s in sizes if (s > 0) and (s >= preferred_size)]
+ low = [s for s in sizes if (s > 0) and (s < preferred_size)]
high.sort()
low.sort()
high = ['%ix%i' % (s, s) for s in high]
low = ['%ix%i' % (s, s) for s in reversed(low)]
- return ['%ix%i' % (preferred_size, preferred_size)] + high + ['scalable'] + low
+ return high + ['scalable'] + low
else:
sizes.sort()
return ['scalable'] + reversed(sizes)