Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import i3ipc
- i3 = i3ipc.Connection()
- # define colors
- focus_bg_color = "#008b8b"
- bg_color = "#556b2f"
- inactive_bg_color = "#393939"
- text_color = "#f3f4f5"
- inactive_text_color = "#676E7D"
- urgent_bg_color = "#E53935"
- seperator_color = "#cae1ff"
- seperator_text_color = "#393939"
- def lemon_escape(ws):
- return ws.replace(':', '\\:')
- def lemon_click(ws):
- return "%{A:i3-msg workspace "+lemon_escape(ws)+":}"+ws+"%{A}"
- def decorate_normal(ws):
- return "%{B"+bg_color+"} "+lemon_click(ws)+" %{B-}"
- def decorate_urgent(ws):
- return "%{B"+urgent_bg_color+"} "+lemon_click(ws)+" %{B-}"
- def decorate_focused(ws):
- return "%{B"+focus_bg_color+"} "+lemon_click(ws)+" %{B-}"
- def print_workspaces():
- workspaces = i3.get_workspaces()
- output0=[]
- output1=[]
- for i in workspaces:
- if i['focused']==True:
- tmp = decorate_focused(i['name'])
- elif i['urgent']==True:
- tmp = decorate_urgent(i['name'])
- else:
- tmp = decorate_normal(i['name'])
- if i['output']=="LVDS1":
- if i['name'] != "♪:Music":
- output0.append(tmp)
- else:
- output0.insert(0,tmp)
- else:
- if i['name'] != "♪:Music":
- output1.append(tmp)
- else:
- output1.insert(0,tmp)
- print("WS%{B"+seperator_color+"}%{F"+seperator_text_color+"} %{F-}"+"".join(output0)+"%{B"+seperator_color+"}%{F"+seperator_text_color+"} %{F-}"+"".join(output1))
- print_workspaces()
- def on_workspace_focus(self, e):
- print_workspaces()
- # Show current mode
- def on_mode_change(self, event):
- out = event.change
- if out != "default":
- print ("EV"+out+" ")
- else:
- print ("EV")
- i3.on('workspace::', on_workspace_focus)
- i3.on('mode::', on_mode_change)
- i3.main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement