aboutsummaryrefslogtreecommitdiffstats
path: root/xpybar/config/mylid.py
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-06-26 13:18:37 +0200
committerMattias Andrée <maandree@kth.se>2021-06-26 13:18:37 +0200
commit3e21f6d13c0a70db95fec8b5a71b758223ff4293 (patch)
tree6d6d2eddb243935007ce1e316c61470224f93df0 /xpybar/config/mylid.py
parentAdd inputrc for readline + m (diff)
downloaddotfiles-3e21f6d13c0a70db95fec8b5a71b758223ff4293.tar.gz
dotfiles-3e21f6d13c0a70db95fec8b5a71b758223ff4293.tar.bz2
dotfiles-3e21f6d13c0a70db95fec8b5a71b758223ff4293.tar.xz
Add xpybar
Signed-off-by: Mattias Andrée <maandree@kth.se>
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)