From 10f1b48834fbcc2fbf05b2112075d38436830ae4 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Tue, 10 Jan 2017 12:08:17 +0100 Subject: cleanup --- bin/i3ws | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100755 bin/i3ws (limited to 'bin/i3ws') diff --git a/bin/i3ws b/bin/i3ws deleted file mode 100755 index a1c487a..0000000 --- a/bin/i3ws +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env python3 -from functools import partial -import json -from subprocess import check_output -import sys - -def get_unique(func, wss): - return list(set(map(func, wss))) - -def get_unique_key(key, wss): - return get_unique(lambda ws: ws[key], wss) - -def show_workspace(ws): - color = 'f00' if ws['urgent'] else \ - '00fcff' if ws['focused'] else \ - '6aa3f8' if ws['visible'] else \ - '777' - return '%s' % (color, ws['name']) - -def show_output(wss, op): - wss = list(filter(lambda ws: ws['output'] == op, wss)) - wss.sort(key=lambda ws: ws['name']) - - return op + ' ' + ' '.join(map(show_workspace, wss)) - -def main(): - i3ws = check_output(['i3-msg', '-t', 'get_workspaces']).decode('utf-8') - wss = json.loads(i3ws) - - outputs = sorted(get_unique_key('output', wss)) - print(' * '.join(map(partial(show_output, wss), outputs))) - -if __name__ == '__main__': - main() - -- cgit v1.2.3