From 3e21f6d13c0a70db95fec8b5a71b758223ff4293 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 26 Jun 2021 13:18:37 +0200 Subject: Add xpybar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- xpybar/config/mylid.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 xpybar/config/mylid.py (limited to 'xpybar/config/mylid.py') 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) -- cgit v1.2.3-70-g09d2