Skip to content

Commit

Permalink
Merge branch 'f/randr_seg' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
PH111P committed Apr 4, 2018
2 parents 666618d + 482ac05 commit a42b906
Show file tree
Hide file tree
Showing 16 changed files with 478 additions and 515 deletions.
42 changes: 32 additions & 10 deletions powerline/bindings/wm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def get_i3_connection():
conn = i3ipc.Connection()
return conn

def get_randr_outputs():
def get_randr_outputs(d = None, window = None):
'''Return all randr outputs as a list.
Outputs are represented by a dictionary with at least the ``name``, ``width``,
Expand All @@ -72,44 +72,66 @@ def get_randr_outputs():
from Xlib import X, display
from Xlib.ext import randr

d = display.Display()
d = d or display.Display()
s = d.screen()
window = s.root.create_window(0, 0, 1, 1, 1, s.root_depth)
outputs = randr.get_screen_resources(window).outputs
if not window:
window = s.root.create_window(0, 0, 1, 1, 1, s.root_depth)

ress = randr.get_screen_resources(window)
outputs = ress.outputs
primary = randr.get_output_primary(window).output

outputs = [(o, randr.get_output_info(window, o, 0)) for o in outputs]
npos = 0
modes = { }
for mode in ress.modes:
data = mode._data
data['name'] = ress.mode_names[npos:npos + mode.name_length]
npos += data['name_length']
modes[data['id']] = data

outputs = [(o, d.xrandr_get_output_info(o, ress.config_timestamp)) for o in outputs]
outputs = [{
'name': o[1].name,
'crtc': randr.get_crtc_info(window, o[1].crtc, 0) if not o[1].connection else None,
'crtc_id': o[1].crtc,
'crtc': d.xrandr_get_crtc_info(o[1].crtc, ress.config_timestamp)if o[1].crtc else None,
'primary': ' primary' if o[0] == primary else None, # space intended for bw comp
'status': ['on', 'off'][o[1].connection],
'connection': o[1].connection,
'status': ['on', 'off'][o[1].crtc == 0],
'modes': [modes[i] for i in o[1].modes],
'mode_ids': o[1].modes,
'crtcs': o[1].crtcs,
'id': o[0]
} for o in outputs] # only return connectad outputs

outputs = [{
'name': o['name'],
'primary': o['primary'],
'crtc_id': o['crtc_id'],
'x': o['crtc'].x if o['crtc'] else None,
'y': o['crtc'].y if o['crtc'] else None,
'height': o['crtc'].height if o['crtc'] else None,
'width': o['crtc'].width if o['crtc'] else None,
'crtc': o['crtc'],
'status': o['status']
'status': o['status'],
'connection': not o['connection'],
'modes': o['modes'],
'mode_ids': o['mode_ids'],
'crtcs': o['crtcs'],
'id': o['id']
} for o in outputs]

return outputs


def get_connected_randr_outputs(pl):
'''Iterate over randr outputs
'''Iterate over randr outputs. Yields all connected outputs that are not ``off``.
Outputs are represented by a dictionary with at least the ``name``, ``width``,
``height``, ``primary``, ``x`` and ``y`` keys.
'''
try:
for o in get_randr_outputs():
if o['status'] == 'on':
if o['connection'] and o['status'] == 'on':
yield o

except ImportError:
Expand Down
84 changes: 43 additions & 41 deletions powerline/config_files/colorschemes/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,63 +9,65 @@
"level:3_bold": { "fg": "level:3_fg", "bg": "level:3_bg", "attrs": ["bold"] },
"background": "level:3",
"background:divider": "level:3",
"information:additional": "level:3",
"information:regular": "level:3",
"information:highlighted": "level:3_bold",
"information:priority": { "fg": "brightyellow", "bg": "level:3_bg" },
"warning:regular": { "fg": "level:2_fg", "bg": "brightred", "attrs": ["bold"] },

"attached_clients": "level:3",
"battery": "level:3",
"battery:0": "level:3",
"battery:100": { "fg": "red", "bg": "level:3_bg" },
"battery:full": { "fg": "mediumgreen", "bg": "level:3_bg" },
"battery:online": { "fg": "yellow", "bg": "level:3_bg" },
"battery:unknown": { "fg": "yellow", "bg": "level:3_bg" },
"battery_gamify_gradient": { "fg": "white_red", "bg": "level:3_bg" },
"battery_gradient": { "fg": "white_red", "bg": "level:3_bg" },
"clip": "level:2",
"cpu_load_percent": "level:3",
"cpu_load_percent_gradient": { "fg": "green_yellow_orange_red", "bg": "level:3_bg" },
"critical:failure": { "fg": "level:2_fg", "bg": "darkestred" },
"critical:success": { "fg": "level:2_fg", "bg": "darkestgreen" },
"generic_shell": "level:3",
"session": "level:2_bold",
"cwd": "level:2",
"cwd:current_folder": "level:2_bold",
"cwd:divider": "level:2",
"date": "level:2",
"time": "level:1_bold",
"time:divider": "level:1",
"fuzzy_time": "level:1",
"email_alert": { "bg": "level:3_bg", "fg": "brightred", "attrs": ["bold"] },
"email_alert_gradient": { "bg": "level:3_bg", "fg": "yellow_orange_red", "attrs": ["bold"] },
"hostname": "level:1",
"clip": "level:2",
"weather": "level:3",
"weather_temp_gradient": { "fg": "blue_red", "bg": "level:3_bg" },
"weather:condition_hot": { "fg": "khaki1", "bg": "level:3_bg" },
"weather:condition_snowy": { "fg": "skyblue1", "bg": "level:3_bg" },
"weather:condition_rainy": { "fg": "skyblue1", "bg": "level:3_bg" },
"uptime": "level:3",
"environment": "level:3",
"external_ip": "level:3",
"fuzzy_time": "level:1",
"generic_shell": "level:3",
"hostname": "level:1",
"information:additional": "level:3",
"information:highlighted": "level:3_bold",
"information:priority": { "fg": "brightyellow", "bg": "level:3_bg" },
"information:regular": "level:3",
"internal_ip": "level:3",
"network_load": "level:3",
"network_load_gradient": { "fg": "green_yellow_orange_red", "bg": "level:3_bg" },
"output": "level:2",
"player": { "fg": "level:3_fg", "bg": "level:3_bg" },
"quality_gradient": { "fg": "white_red", "bg": "level:3_bg" },
"session": "level:2_bold",
"srot": "level:2",
"superuser": { "fg": "level:1_fg", "bg": "brightred", "attrs": ["bold"] },
"system_load": "level:3",
"system_load_gradient": { "fg": "green_yellow_orange_red", "bg": "level:3_bg" },
"volume_gradient": { "fg": "white_red", "bg": "level:3_bg" },
"quality_gradient": { "fg": "white_red", "bg": "level:3_bg" },
"wireless:gradient": { "fg": "white_red", "bg": "level:3_bg" },
"wireless:none": "level:3",
"environment": "level:3",
"cpu_load_percent": "level:3",
"cpu_load_percent_gradient": { "fg": "green_yellow_orange_red", "bg": "level:3_bg" },
"battery": "level:3",
"battery_gradient": { "fg": "white_red", "bg": "level:3_bg" },
"battery_gamify_gradient": { "fg": "white_red", "bg": "level:3_bg" },
"battery:100": { "fg": "red", "bg": "level:3_bg" },
"battery:0": "level:3",
"battery:online": { "fg": "yellow", "bg": "level:3_bg" },
"battery:full": { "fg": "mediumgreen", "bg": "level:3_bg" },
"battery:unknown": { "fg": "yellow", "bg": "level:3_bg" },
"player": { "fg": "level:3_fg", "bg": "level:3_bg" },
"time": "level:1_bold",
"time:divider": "level:1",
"uptime": "level:3",
"user": "level:1_bold",
"superuser": { "fg": "level:1_fg", "bg": "brightred", "attrs": ["bold"] },
"attached_clients": "level:3",
"vcsinfo": "level:3",
"vcsinfo:branch": "level:3_bold",
"vcsinfo:dirty": { "fg": "brightorange", "bg": "level:3_bg" },
"vcsinfo:clean": { "fg": "brightgreen", "bg": "level:3_bg" },
"vcsinfo:dirty": { "fg": "brightorange", "bg": "level:3_bg" },
"vcsinfo:divider": "level:3",
"cwd": "level:2",
"cwd:current_folder": "level:2_bold",
"cwd:divider": "level:2",
"virtualenv": "level:3",
"srot": "level:2"
"volume_gradient": { "fg": "white_red", "bg": "level:3_bg" },
"warning:regular": { "fg": "level:2_fg", "bg": "brightred", "attrs": ["bold"] },
"weather": "level:3",
"weather:condition_hot": { "fg": "khaki1", "bg": "level:3_bg" },
"weather:condition_rainy": { "fg": "skyblue1", "bg": "level:3_bg" },
"weather:condition_snowy": { "fg": "skyblue1", "bg": "level:3_bg" },
"weather_temp_gradient": { "fg": "blue_red", "bg": "level:3_bg" },
"wireless:gradient": { "fg": "white_red", "bg": "level:3_bg" },
"wireless:none": "level:3"
}
}
5 changes: 0 additions & 5 deletions powerline/config_files/colorschemes/pdb/solarized.json

This file was deleted.

13 changes: 0 additions & 13 deletions powerline/config_files/colorschemes/shell/solarized.json

This file was deleted.

39 changes: 0 additions & 39 deletions powerline/config_files/colorschemes/solarized.json

This file was deleted.

Loading

0 comments on commit a42b906

Please sign in to comment.