mirror of
https://github.com/powerline/powerline.git
synced 2025-07-26 23:35:04 +02:00
Some style fixes
This commit is contained in:
parent
97c93fc7c0
commit
8041ea0956
@ -235,13 +235,15 @@ Add the following to your :file:`~/.config/qtile/config.py`:
|
|||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
with i3bar replacement
|
I3 bar
|
||||||
-----------------
|
------
|
||||||
|
|
||||||
.. note:: Until the patch is done in i3, you will need a custom ``i3bar`` build called ``i3bgbar``.
|
.. note:: Until the patch is done in i3, you will need a custom ``i3bar`` build
|
||||||
The source is available `here <https://github.com/S0lll0s/i3bgbar>`_.
|
called ``i3bgbar``. The source is available `here
|
||||||
|
<https://github.com/S0lll0s/i3bgbar>`_.
|
||||||
|
|
||||||
Add the following to your :file:`~/.i3/config`::
|
Add the following to your :file:`~/.i3/config`::
|
||||||
|
|
||||||
bar {
|
bar {
|
||||||
i3bar_command i3bgbar
|
i3bar_command i3bgbar
|
||||||
|
|
||||||
@ -249,4 +251,5 @@ Add the following to your :file:`~/.i3/config`::
|
|||||||
font pango:PowerlineFont 12
|
font pango:PowerlineFont 12
|
||||||
}
|
}
|
||||||
|
|
||||||
where ``i3bgbar`` may be replaced with the path to the custom i3bar binary and ``PowerlineFont`` is any system font with powerline support.
|
where ``i3bgbar`` may be replaced with the path to the custom i3bar binary and
|
||||||
|
``PowerlineFont`` is any system font with powerline support.
|
||||||
|
@ -10,31 +10,34 @@ import time
|
|||||||
import i3
|
import i3
|
||||||
from threading import Lock
|
from threading import Lock
|
||||||
|
|
||||||
name = 'wm'
|
|
||||||
if len( sys.argv ) > 1:
|
if __name__ == '__main__':
|
||||||
|
name = 'wm'
|
||||||
|
if len(sys.argv) > 1:
|
||||||
name = sys.argv[1]
|
name = sys.argv[1]
|
||||||
powerline = Powerline(name, renderer_module='i3bgbar')
|
|
||||||
powerline.update_renderer()
|
|
||||||
|
|
||||||
interval = 0.5
|
powerline = Powerline(name, renderer_module='i3bgbar')
|
||||||
|
powerline.update_renderer()
|
||||||
|
|
||||||
print( '{"version": 1, "custom_workspace": true}' )
|
interval = 0.5
|
||||||
print( '[' )
|
|
||||||
print( ' [[],[]]' )
|
|
||||||
|
|
||||||
lock = Lock()
|
print ('{"version": 1, "custom_workspace": true}')
|
||||||
|
print ('[')
|
||||||
|
print ('\t[[],[]]')
|
||||||
|
|
||||||
def render( event=None, data=None, sub=None ):
|
lock = Lock()
|
||||||
|
|
||||||
|
def render(event=None, data=None, sub=None):
|
||||||
global lock
|
global lock
|
||||||
with lock:
|
with lock:
|
||||||
s = '[\n' + powerline.render(side='right')[:-2] + '\n]\n'
|
s = '[\n' + powerline.render(side='right')[:-2] + '\n]\n'
|
||||||
s += ',[\n' + powerline.render(side='left' )[:-2] + '\n]'
|
s += ',[\n' + powerline.render(side='left')[:-2] + '\n]'
|
||||||
print( ',[\n' + s + '\n]' )
|
print (',[\n' + s + '\n]')
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
sub = i3.Subscription( render, 'workspace' )
|
sub = i3.Subscription(render, 'workspace')
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
start_time = monotonic()
|
start_time = monotonic()
|
||||||
render()
|
render()
|
||||||
time.sleep(max(interval - (monotonic() - start_time), 0.1))
|
time.sleep(max(interval - (monotonic() - start_time), 0.1))
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
# vim:fileencoding=utf-8:noet
|
# vim:fileencoding=utf-8:noet
|
||||||
|
|
||||||
from powerline.renderer import Renderer
|
from powerline.renderer import Renderer
|
||||||
from powerline.colorscheme import ATTR_BOLD, ATTR_ITALIC, ATTR_UNDERLINE
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
|
||||||
class i3bgbarRenderer(Renderer):
|
class i3bgbarRenderer(Renderer):
|
||||||
'''i3bgbar Segment Renderer'''
|
'''i3bgbar Segment Renderer'''
|
||||||
|
|
||||||
@ -15,7 +15,11 @@ class i3bgbarRenderer(Renderer):
|
|||||||
def hl(self, contents, fg=None, bg=None, attr=None):
|
def hl(self, contents, fg=None, bg=None, attr=None):
|
||||||
'''Highlight a segment.'''
|
'''Highlight a segment.'''
|
||||||
|
|
||||||
segment = { "full_text": contents, "separator": False, "separator_block_width": 0 } # no seperators
|
segment = {
|
||||||
|
"full_text": contents,
|
||||||
|
"separator": False,
|
||||||
|
"separator_block_width": 0, # no seperators
|
||||||
|
}
|
||||||
|
|
||||||
if fg is not None:
|
if fg is not None:
|
||||||
if fg is not False and fg[1] is not False:
|
if fg is not False and fg[1] is not False:
|
||||||
@ -23,7 +27,8 @@ class i3bgbarRenderer(Renderer):
|
|||||||
if bg is not None:
|
if bg is not None:
|
||||||
if bg is not False and bg[1] is not False:
|
if bg is not False and bg[1] is not False:
|
||||||
segment['background_color'] = "#{0:06x}".format(bg[1])
|
segment['background_color'] = "#{0:06x}".format(bg[1])
|
||||||
return json.dumps( segment ) + ",\n" # i3bar "pseudo json" requires one line at a time
|
# i3bar "pseudo json" requires one line at a time
|
||||||
|
return json.dumps(segment) + ",\n"
|
||||||
|
|
||||||
|
|
||||||
renderer = i3bgbarRenderer
|
renderer = i3bgbarRenderer
|
||||||
|
@ -1,19 +1,26 @@
|
|||||||
# vim:fileencoding=utf-8:noet
|
# vim:fileencoding=utf-8:noet
|
||||||
|
|
||||||
from powerline.theme import requires_segment_info
|
|
||||||
import i3
|
import i3
|
||||||
|
|
||||||
def calcgrp( w ):
|
|
||||||
|
def calcgrp(w):
|
||||||
group = []
|
group = []
|
||||||
if w['focused']: group.append( 'w_focused' )
|
if w['focused']:
|
||||||
if w['urgent']: group.append( 'w_urgent' )
|
group.append('w_focused')
|
||||||
if w['visible']: group.append( 'w_visible' )
|
if w['urgent']:
|
||||||
group.append( 'workspace' )
|
group.append('w_urgent')
|
||||||
|
if w['visible']:
|
||||||
|
group.append('w_visible')
|
||||||
|
group.append('workspace')
|
||||||
return group
|
return group
|
||||||
|
|
||||||
def workspaces( pl ):
|
|
||||||
|
def workspaces(pl):
|
||||||
'''Return workspace list
|
'''Return workspace list
|
||||||
|
|
||||||
Highlight groups used: ``workspace``, ``w_visible``, ``w_focused``, ``w_urgent``
|
Highlight groups used: ``workspace``, ``w_visible``, ``w_focused``, ``w_urgent``
|
||||||
'''
|
'''
|
||||||
return [ {'contents': w['name'], 'highlight_group': calcgrp( w )} for w in i3.get_workspaces() ]
|
return [{
|
||||||
|
'contents': w['name'],
|
||||||
|
'highlight_group': calcgrp(w)
|
||||||
|
} for w in i3.get_workspaces()]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user