bar styling
This commit is contained in:
+164
-18
@@ -166,42 +166,188 @@ floating_layout = layout.Floating(
|
|||||||
])
|
])
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Custom_Widgets
|
||||||
|
class MemoryC(widget.base.ThreadedPollText):
|
||||||
|
orientations = widget.base.ORIENTATION_HORIZONTAL
|
||||||
|
defaults = [
|
||||||
|
("format", "{MemUsed}GB/{MemTotal}GB", "Formatting for field names."),
|
||||||
|
("update_interval", 1.0, "Update interval for the Memory"),
|
||||||
|
]
|
||||||
|
|
||||||
|
def __init__(self, **config):
|
||||||
|
super().__init__(**config)
|
||||||
|
self.add_defaults(MemoryC.defaults)
|
||||||
|
|
||||||
|
def tick(self):
|
||||||
|
self.update(self.poll())
|
||||||
|
return self.update_interval
|
||||||
|
|
||||||
|
def poll(self):
|
||||||
|
mem = psutil.virtual_memory()
|
||||||
|
swap = psutil.swap_memory()
|
||||||
|
val = {}
|
||||||
|
val["MemUsed"] = mem.used // 1024 // 1024 // 102.4 / 10
|
||||||
|
val["MemTotal"] = mem.total // 1024 // 1024 // 102.4 / 10
|
||||||
|
val["MemPercent"] = mem.percent
|
||||||
|
val["MemFree"] = mem.free // 1024 // 1024 // 102.4 / 10
|
||||||
|
val["Buffers"] = mem.buffers // 1024 // 1024 // 102.4 / 10
|
||||||
|
val["Active"] = mem.active // 1024 // 1024 // 102.4 / 10
|
||||||
|
val["Inactive"] = mem.inactive // 1024 // 1024 // 102.4 / 10
|
||||||
|
val["Shmem"] = mem.shared // 1024 // 1024 // 102.4 / 10
|
||||||
|
val["SwapTotal"] = swap.total // 1024 // 1024 // 102.4 / 10
|
||||||
|
val["Swapfree"] = swap.free // 1024 // 1024 // 102.4 / 10
|
||||||
|
val["SwapUsed"] = swap.used // 1024 // 1024 // 102.4 / 10
|
||||||
|
val["SwapPercent"] = swap.percent
|
||||||
|
return self.format.format(**val)
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Bars and Widgets
|
#region Bars and Widgets
|
||||||
widget_defaults = dict(
|
widget_defaults = dict(
|
||||||
font='Ubuntu Mono',
|
font='Ubuntu Mono',
|
||||||
fontsize=14,
|
fontsize=15,
|
||||||
padding=3,
|
padding=3,
|
||||||
)
|
)
|
||||||
extension_defaults = widget_defaults.copy()
|
extension_defaults = widget_defaults.copy()
|
||||||
|
|
||||||
|
main_bar_fontsize=20
|
||||||
|
|
||||||
|
seperator=widget.Sep(linewidth=3,padding=10)
|
||||||
|
|
||||||
main_bar = bar.Bar([
|
main_bar = bar.Bar([
|
||||||
widget.CurrentLayoutIcon(),
|
widget.CurrentLayoutIcon(),
|
||||||
widget.GroupBox(),
|
widget.GroupBox(
|
||||||
widget.Prompt(),
|
fontsize=main_bar_fontsize,
|
||||||
widget.WindowName(),
|
urgent_border=red_color1,
|
||||||
widget.Systray(),
|
urgent_text=red_color1,
|
||||||
widget.TextBox("Vol:"),
|
this_current_screen_border=blue_color12,
|
||||||
widget.Volume(),
|
this_screen_border=blue_color12,
|
||||||
widget.CheckUpdates(),
|
),
|
||||||
widget.CPU(format='CPU: {load_percent}% @ {freq_current}GHz'),
|
widget.Prompt(fontsize=main_bar_fontsize),
|
||||||
# MemoryC(format="RAM: {MemUsed}GB ({MemPercent}%)"),
|
widget.WindowName(fontsize=16),
|
||||||
# MemoryC(format="Swap: {SwapUsed}GB ({SwapPercent}%)"),
|
widget.Systray(fontsize=main_bar_fontsize),
|
||||||
widget.NetGraph(),
|
seperator,
|
||||||
widget.Clock(format='%Y-%m-%d %H:%M'),
|
widget.Volume(
|
||||||
],24)
|
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)
|
||||||
|
|
||||||
|
#left bar
|
||||||
left_bar = bar.Bar([
|
left_bar = bar.Bar([
|
||||||
widget.CurrentLayoutIcon(),
|
widget.CurrentLayoutIcon(),
|
||||||
widget.GroupBox(),
|
widget.GroupBox(
|
||||||
|
urgent_border=red_color1,
|
||||||
|
urgent_text=red_color1,
|
||||||
|
this_current_screen_border=blue_color12,
|
||||||
|
this_screen_border=blue_color12,
|
||||||
|
),
|
||||||
widget.WindowName(),
|
widget.WindowName(),
|
||||||
widget.Clock(format='%Y-%m-%d %H:%M'),
|
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)
|
],24)
|
||||||
|
|
||||||
top_bar = bar.Bar([
|
top_bar = bar.Bar([
|
||||||
widget.CurrentLayoutIcon(),
|
widget.CurrentLayoutIcon(),
|
||||||
widget.GroupBox(),
|
widget.GroupBox(
|
||||||
|
urgent_border=red_color1,
|
||||||
|
urgent_text=red_color1,
|
||||||
|
this_current_screen_border=blue_color12,
|
||||||
|
this_screen_border=blue_color12,
|
||||||
|
),
|
||||||
widget.WindowName(),
|
widget.WindowName(),
|
||||||
widget.Clock(format='%Y-%m-%d %H:%M'),
|
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)
|
],24)
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user