powerline/segments/bspwm.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from powerline.lib.shell import run_cmd | |
## Reusing tmux highlight groups for now | |
highlight_groups = { | |
'O': 'window:current', | |
'o': 'window', | |
'F': 'window:current', | |
'f': 'window', | |
'U': 'bell_status', | |
'u': 'bell_status' | |
} | |
def workspaces(pl): | |
## Couldn't figure out how to take advantage of --subscribe | |
status = run_cmd(pl, ['bspc', 'control', '--get-status']) | |
state = [] | |
for desktop in status.rstrip().split(':')[1:-1]: | |
contents = desktop[1:] | |
if desktop[0] == 'O': | |
contents += '*' | |
elif desktop[0] == 'o': | |
contents += '-' | |
state.append( | |
{ | |
'contents': contents, | |
'highlight_groups': [highlight_groups[desktop[0]]], | |
'draw_inner_divider': True | |
} | |
) | |
return state |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment