aboutsummaryrefslogtreecommitdiffstats
path: root/xpybar/config/mylid.py
diff options
context:
space:
mode:
Diffstat (limited to 'xpybar/config/mylid.py')
-rw-r--r--xpybar/config/mylid.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/xpybar/config/mylid.py b/xpybar/config/mylid.py
new file mode 100644
index 0000000..268a860
--- /dev/null
+++ b/xpybar/config/mylid.py
@@ -0,0 +1,32 @@
+# -*- python -*-
+from plugins.lid import Lid
+
+from common import *
+
+class MyLid(Entry):
+ COMPACT = 0
+ LONG = 1
+ TITLED = 2
+ FULL = 3
+
+ def __init__(self, *args, details = 2, **kwargs):
+ self.details = details
+ self.map = [{True : 'o',
+ False : 'c'},
+ {True : 'open',
+ False : 'closed'}]
+ Entry.__init__(self, *args, **kwargs)
+
+ def action(self, col, button, x, y):
+ if button == MIDDLE_BUTTON:
+ self.details ^= MyLid.TITLED
+ self.invalidate()
+ elif button == RIGHT_BUTTON:
+ self.details ^= MyLid.LONG
+ self.invalidate()
+
+ def function(self):
+ prefix = '' if (self.details & MyLid.TITLED) == 0 else 'Lid: '
+ smap = self.map[self.details & MyLid.LONG]
+ state = Lid.is_open()
+ return prefix + ' '.join(smap[state[lid]] for lid in state)