right bar restructuring (powerline style)

This commit is contained in:
paul-loedige
2020-12-12 04:13:42 +01:00
parent 909cf2d1f4
commit d8e4a0c41e
17 changed files with 205 additions and 140 deletions
+203 -138
View File
@@ -6,6 +6,7 @@ from libqtile import layout, bar, widget
from libqtile.config import Key, Drag, Click, Group, Screen
from libqtile.command import lazy
#region defines
term = 'termite'
focus_color = '#bd93f9'
@@ -13,34 +14,29 @@ border_width = 2
mod = 'mod4'
#region colors
foreground_color = ['#f8f8f2','#f8f8f2']
light_foreground_color = ['#f8f8f2','#f8f8f2']
dark_foreground_color = ['#282a36','#282a36']
background_color0 = ['#000000','#000000']
background_color8 = ['#4d4d4d','#4d4d4d']
base_color = ['#101010','#101010']
# red
red_color1 = ['#ff5555','#ff5555']
red_color9 = ['#ff6e67','#ff6e67']
red_color = ['#df253f','#df253f']
light_red_color = ['#ff5555','#ff5555']
# green
green_color2 = ['#50fa7b','#50fa7b']
green_color10 = ['#5af78e','#5af78e']
green_color = ['#53a93f','#53a93f']
light_green_color = ['#50fa7b','#50fa7b']
#orange
orange_color = ['#f57900','#f57900']
# yellow
yellow_color3 = ['#f1fa8c','#f1fa8c']
yellow_color11 = ['#f4f99d','#f4f99d']
yellow_color = ['#f1fa8c','#f1fa8c']
#blue
blue_color4 = ['#bd93f9','#bd93f9']
blue_color12 = ['#caa9fa','#caa9fa']
blue_color = ['#7197e7','#7197e7']
# purple
purple_color = ['#bd93f9','#bd93f9']
# magenta
magenta_color5 = ['#ff79c6','#ff79c6']
magenta_color13 = ['#ff92d0','#ff92d0']
magenta_color = ['#ff79c6','#ff79c6']
# cyan
cyan_color6 = ['#8be9fd','#8be9fd']
cyan_color14 = ['#9aedfe','#9aedfe']
# white
white_color7 = ['#bfbfbf','#bfbfbf']
white_color15 = ['#e6e6e6','#e6e6e6']
cyan_color = ['#8be9fd','#8be9fd']
#endregion
#endregion
@@ -201,154 +197,223 @@ class MemoryC(widget.base.ThreadedPollText):
return self.format.format(**val)
#endregion
#region widgets
#region Powerline
def powerline_arrow(direction, color1, color2,size):
if direction == "r":
return [
widget.TextBox(
text=u"\ue0b0",
foreground=color1,
background=color2,
fontsize=size,
borderwidth=0,
padding=0
),
widget.Sep(padding=5, linewidth=0, background=color2),
]
else:
return [
widget.TextBox(
text=u"\ue0b2",
foreground=color2,
background=color1,
fontsize=size,
borderwidth=0,
padding=0
),
]
#endregion
#region Volume_widget
def vloume_widget(prev_color,color,size,fontsize):
return[
*powerline_arrow('l',prev_color,color,size),
widget.Volume(
foreground=dark_foreground_color,
background=color,
emoji=True,
fontsize=fontsize,
),
widget.Volume(
foreground=dark_foreground_color,
background=color,
fontsize=fontsize,
padding=0
),
widget.TextBox(" ",background=color),
]
#endregion
#region Pacman_widget
def pacman_widget(prev_color,color,size,fontsize):
return[
*powerline_arrow('l',prev_color,color,main_bar_height),
widget.Image(
filename='~/.config/qtile/icons/pacman.png',
margin=5,
background=color,
),
widget.CheckUpdates(
colour_have_updates=dark_foreground_color,
background=color,
fontsize=fontsize,
display_format="{updates}",
mouse_callbacks = {'Button1': lambda qtile: qtile.cmd_spawn(term + ' -e "sudo pacman -Syu"')},
),
]
#endregion
#region System_widgets
def System_widgets(prev_color,last_color,size,fontsize):
return [
*powerline_arrow('l',prev_color,red_color,size),
widget.Image(
filename='~/.config/qtile/icons/temp.png',
margin=5,
background=red_color,
),
widget.ThermalSensor(
foreground=dark_foreground_color,
background=red_color,
fontsize=fontsize,
tag_sensor='Tctl',
),
*powerline_arrow('l',red_color,green_color,size),
widget.Image(
filename='~/.config/qtile/icons/cpu.png',
margin=5,
background=green_color,
),
widget.CPU(
foreground=dark_foreground_color,
background=green_color,
fontsize=fontsize,
format='{load_percent}% @ {freq_current}GHz',
mouse_callbacks = {'Button1': lambda qtile: qtile.cmd_spawn(term + ' -e htop')},
),
*powerline_arrow('l',green_color,orange_color,size),
widget.Image(
filename='~/.config/qtile/icons/ram.png',
background=orange_color,
margin=-10
),
MemoryC(
foreground=dark_foreground_color,
background=orange_color,
fontsize=fontsize,
format=" {MemUsed}GB({MemPercent}%) | {SwapUsed}GB({SwapPercent}%)",
mouse_callbacks = {'Button1': lambda qtile: qtile.cmd_spawn(term + ' -e htop')},
),
*powerline_arrow('l',orange_color,last_color,size),
widget.Image(
filename='~/.config/qtile/icons/network.png',
background=blue_color,
margin=5
),
widget.Net(
background=last_color,
foreground=dark_foreground_color,
fontsize=fontsize,
fmt='{:.9}',
format='{down}',
),
widget.Net(
background=last_color,
foreground=dark_foreground_color,
fontsize=fontsize,
fmt='{:.9}',
format='{up}',
),
]
#endregion
#region End_widgets
def end_widgets(prev_color,size,fontsize):
return [
*powerline_arrow('l',prev_color,magenta_color,size),
widget.Clock(
foreground=dark_foreground_color,
background=magenta_color,
fontsize=fontsize,
format='%Y-%m-%d'
),
*powerline_arrow('l',magenta_color,base_color,size),
widget.Clock(
font='dseg7 classic bold',
fontsize=16,
format='%H:%M'
),
]
#endregion
#endregion
#region Bars and Widgets
widget_defaults = dict(
background=base_color,
font='Ubuntu Mono',
fontsize=15,
padding=3,
)
extension_defaults = widget_defaults.copy()
main_bar_fontsize=20
seperator=widget.Sep(linewidth=3,padding=10)
main_bar_fontsize=22
main_bar_height=28
secondary_bar_height=24
secondary_bar_fontsize=18
main_bar = bar.Bar([
widget.CurrentLayoutIcon(),
widget.GroupBox(
fontsize=main_bar_fontsize,
urgent_border=red_color1,
urgent_text=red_color1,
this_current_screen_border=blue_color12,
this_screen_border=blue_color12,
urgent_border=red_color,
urgent_text=red_color,
this_current_screen_border=purple_color,
this_screen_border=purple_color,
),
widget.Image(
filename='~/.config/qtile/icons/archlinux-logo-small.png',
margin=5,
background=blue_color
),
*powerline_arrow('r',blue_color,base_color,main_bar_height),
widget.Prompt(fontsize=main_bar_fontsize),
widget.WindowName(fontsize=16),
widget.Systray(fontsize=main_bar_fontsize),
seperator,
widget.Volume(
fontsize=main_bar_fontsize,
foreground=cyan_color14,
padding=0
),
widget.Volume(
emoji=True,
fontsize=main_bar_fontsize,
foreground=cyan_color14,
padding=0
),
seperator,
widget.TextBox(
"",
fonsize=main_bar_fontsize,
foreground=red_color1,
mouse_callbacks = {'Button1': lambda qtile: qtile.cmd_spawn(term + ' -e "sudo pacman -Sy"')},
),
widget.CheckUpdates(
fontsize=main_bar_fontsize,
display_format="{updates} Updates",
colour_have_updates=red_color1,
mouse_callbacks = {'Button1': lambda qtile: qtile.cmd_spawn(term + ' -e "sudo pacman -Syu"')},
),
seperator,
widget.CPU(
fontsize=main_bar_fontsize,
format='CPU: {load_percent}% @ {freq_current}GHz',
foreground=green_color10,
mouse_callbacks = {'Button1': lambda qtile: qtile.cmd_spawn(term + ' -e htop')},
),
seperator,
MemoryC(
fontsize=main_bar_fontsize,
format="RAM: {MemUsed}GB({MemPercent}%)",
foreground=blue_color12,
mouse_callbacks = {'Button1': lambda qtile: qtile.cmd_spawn(term + ' -e htop')},
),
MemoryC(
fontsize=main_bar_fontsize,
format="Swap: {SwapUsed}GB({SwapPercent}%)",
foreground=magenta_color13,
mouse_callbacks = {'Button1': lambda qtile: qtile.cmd_spawn(term + ' -e htop')},
),
seperator,
widget.NetGraph(
fontsize=main_bar_fontsize,
border_width=0.5,
line_width=2,
border_color=yellow_color11,
graph_color=yellow_color11
),
widget.Clock(
fontsize=main_bar_fontsize,
format='%Y-%m-%d'
),
widget.Clock(
font='dseg7 classic bold',
fontsize=16,
format='%H:%M'
),
],26)
*vloume_widget(base_color,blue_color,main_bar_height,main_bar_fontsize),
*System_widgets(blue_color,blue_color,main_bar_height,main_bar_fontsize),
*pacman_widget(blue_color,red_color,main_bar_height,main_bar_fontsize),
*end_widgets(red_color,main_bar_height,main_bar_fontsize),
],main_bar_height)
#left bar
left_bar = bar.Bar([
widget.CurrentLayoutIcon(),
widget.GroupBox(
urgent_border=red_color1,
urgent_text=red_color1,
this_current_screen_border=blue_color12,
this_screen_border=blue_color12,
urgent_border=red_color,
urgent_text=red_color,
this_current_screen_border=purple_color,
this_screen_border=purple_color,
),
widget.WindowName(),
seperator,
widget.Volume(
foreground=cyan_color14,
padding=0
),
widget.Volume(
emoji=True,
foreground=cyan_color14,
padding=0
),
seperator,
widget.Clock(
format='%Y-%m-%d'
),
widget.Clock(
font='dseg7 classic bold',
fontsize=12,
format='%H:%M'
),
],24)
*vloume_widget(base_color,blue_color,secondary_bar_height,secondary_bar_fontsize),
*end_widgets(blue_color,secondary_bar_height,secondary_bar_fontsize)
],secondary_bar_height)
top_bar = bar.Bar([
widget.CurrentLayoutIcon(),
widget.GroupBox(
urgent_border=red_color1,
urgent_text=red_color1,
this_current_screen_border=blue_color12,
this_screen_border=blue_color12,
urgent_border=red_color,
urgent_text=red_color,
this_current_screen_border=purple_color,
this_screen_border=purple_color,
),
widget.WindowName(),
seperator,
widget.Volume(
foreground=cyan_color14,
padding=0
),
widget.Volume(
emoji=True,
foreground=cyan_color14,
padding=0
),
seperator,
widget.Clock(
format='%Y-%m-%d'
),
widget.Clock(
font='dseg7 classic bold',
fontsize=12,
format='%H:%M'
),
],24)
*vloume_widget(base_color,blue_color,secondary_bar_height,secondary_bar_fontsize),
*end_widgets(blue_color,secondary_bar_height,secondary_bar_fontsize)
],secondary_bar_height)
#endregion
#region Screens
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 753 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB