unified laptop and desktop qtile bar
This commit is contained in:
@@ -2,7 +2,7 @@ from libqtile import widget, bar
|
||||
|
||||
from defines import base_color, blue_color
|
||||
from defines import ChassisType, chassis_type
|
||||
from Widgets import Left_widgets, volume_widget, System_widgets, end_widgets, Laptop_widgets
|
||||
from Widgets import Left_widgets, volume_widget, System_widgets, end_widgets
|
||||
|
||||
widget_defaults = dict(
|
||||
background=base_color,
|
||||
@@ -25,14 +25,6 @@ main_bar = bar.Bar([
|
||||
*end_widgets(blue_color,main_bar_height,main_bar_fontsize),
|
||||
],main_bar_height)
|
||||
|
||||
laptop_bar = bar.Bar([
|
||||
*Left_widgets(main_bar_height,main_bar_fontsize,True),
|
||||
widget.Systray(fontsize=main_bar_fontsize),
|
||||
*volume_widget(base_color,blue_color,main_bar_height,main_bar_fontsize),
|
||||
*Laptop_widgets(blue_color,blue_color,main_bar_height,main_bar_fontsize),
|
||||
*end_widgets(blue_color,main_bar_height,main_bar_fontsize),
|
||||
],main_bar_height)
|
||||
|
||||
left_bar = bar.Bar([
|
||||
*Left_widgets(secondary_bar_height,secondary_bar_fontsize),
|
||||
*volume_widget(base_color,blue_color,secondary_bar_height,secondary_bar_fontsize),
|
||||
|
||||
@@ -4,15 +4,10 @@ import numpy as np
|
||||
|
||||
from libqtile.config import Screen
|
||||
|
||||
from Bars import top_bar, left_bar, main_bar,laptop_bar, secondary_bar
|
||||
from Bars import top_bar, left_bar, main_bar, secondary_bar
|
||||
from defines import main_screen_res, top_screen_res
|
||||
|
||||
screens = [
|
||||
# Screen(bottom=top_bar),
|
||||
# Screen(top=left_bar),
|
||||
# Screen(top=main_bar),
|
||||
# Screen(top=laptop_bar)
|
||||
]
|
||||
screens = []
|
||||
|
||||
|
||||
cmd = ['xrandr']
|
||||
@@ -32,7 +27,7 @@ for width, height in screen_resolutions:
|
||||
elif width < height:
|
||||
screens.append(Screen(top=left_bar))
|
||||
elif width == max_width and not defined_main_window:
|
||||
screens.append(Screen(top=laptop_bar))
|
||||
screens.append(Screen(top=main_bar))
|
||||
defined_main_window = True
|
||||
else:
|
||||
screens.append(Screen(top=secondary_bar))
|
||||
@@ -2,6 +2,7 @@ from libqtile import widget
|
||||
|
||||
from defines import base_color, term
|
||||
from defines import blue_color, light_foreground_color, dark_foreground_color, red_color, light_purple_color, purple_color, green_color, orange_color, magenta_color, yellow_color
|
||||
from defines import ChassisType, chassis_type
|
||||
from Custom_Widgets import MemoryC, Mic
|
||||
|
||||
#region Powerline
|
||||
@@ -96,13 +97,28 @@ def volume_widget(prev_color,color,size,fontsize):
|
||||
#endregion
|
||||
|
||||
#region System_widgets
|
||||
def launch_htop(qtile):
|
||||
def launch_htop():
|
||||
qtile.cmd_spawn(term + ' -e htop')
|
||||
launch_htop= {'Button1': launch_htop}
|
||||
|
||||
def System_widgets(prev_color,last_color,size,fontsize):
|
||||
return [
|
||||
*powerline_arrow('l',prev_color,orange_color,size),
|
||||
sys_widgets = []
|
||||
sys_widgets.append(*powerline_arrow('l',prev_color,orange_color,size))
|
||||
# first widget is battery for laptop and cpu temp otherwise
|
||||
if chassis_type == ChassisType.LAPTOP:
|
||||
sys_widgets.append(
|
||||
widget.Battery(
|
||||
foreground=light_foreground_color,
|
||||
background=orange_color,
|
||||
fontsize=fontsize,
|
||||
update_interval=1,
|
||||
format="{char} {percent:2.0%}",
|
||||
low_percentage=0.2,
|
||||
notify_below=True,
|
||||
low_foreground=red_color,
|
||||
)
|
||||
)
|
||||
else:
|
||||
sys_widgets.extend([
|
||||
widget.TextBox(
|
||||
text='',
|
||||
foreground=light_foreground_color,
|
||||
@@ -114,34 +130,37 @@ def System_widgets(prev_color,last_color,size,fontsize):
|
||||
background=orange_color,
|
||||
fontsize=fontsize,
|
||||
tag_sensor='Tctl',
|
||||
mouse_callbacks = launch_htop,
|
||||
),
|
||||
*powerline_arrow('l',orange_color,green_color,size),
|
||||
mouse_callbacks = {"Button1": launch_htop},
|
||||
)
|
||||
])
|
||||
sys_widgets.append(*powerline_arrow('l',orange_color,green_color,size))
|
||||
|
||||
sys_widgets.extend([
|
||||
widget.TextBox(
|
||||
text=' ',
|
||||
foreground=light_foreground_color,
|
||||
background=green_color,
|
||||
fontsize=fontsize+6
|
||||
fontsize=fontsize
|
||||
),
|
||||
widget.CPU(
|
||||
foreground=light_foreground_color,
|
||||
background=green_color,
|
||||
fontsize=fontsize,
|
||||
format='{load_percent}% @ {freq_current}GHz',
|
||||
format='{load_percent}%' if chassis_type == ChassisType.LAPTOP else'{load_percent}% @ {freq_current}GHz',
|
||||
mouse_callbacks = launch_htop,
|
||||
),
|
||||
*powerline_arrow('l',green_color,yellow_color,size),
|
||||
widget.TextBox(
|
||||
text=' ',
|
||||
text='',
|
||||
foreground=light_foreground_color,
|
||||
background=yellow_color,
|
||||
fontsize=fontsize+6
|
||||
fontsize=fontsize
|
||||
),
|
||||
MemoryC(
|
||||
foreground=light_foreground_color,
|
||||
background=yellow_color,
|
||||
fontsize=fontsize,
|
||||
format=" {MemUsed}GB({MemPercent}%) | {SwapUsed}GB({SwapPercent}%)",
|
||||
format='{MemUsed}GB|{SwapUsed}GB' if chassis_type == ChassisType.LAPTOP else'{MemUsed}GB({MemPercent}%) | {SwapUsed}GB({SwapPercent}%)',
|
||||
mouse_callbacks = launch_htop,
|
||||
),
|
||||
*powerline_arrow('l',yellow_color,last_color,size),
|
||||
@@ -149,25 +168,19 @@ def System_widgets(prev_color,last_color,size,fontsize):
|
||||
text=' ',
|
||||
foreground=light_foreground_color,
|
||||
background=blue_color,
|
||||
fontsize=fontsize+6
|
||||
fontsize=fontsize
|
||||
),
|
||||
widget.Net(
|
||||
background=last_color,
|
||||
foreground=light_foreground_color,
|
||||
fontsize=fontsize,
|
||||
fmt='{:.9}',
|
||||
format='{down}↓',
|
||||
prefix='M',
|
||||
format='{down:6.2f}{down_suffix}↓{up:6.2f}{up_suffix}↑',
|
||||
mouse_callbacks = launch_htop,
|
||||
),
|
||||
widget.Net(
|
||||
background=last_color,
|
||||
foreground=light_foreground_color,
|
||||
fontsize=fontsize,
|
||||
fmt='{:.9}',
|
||||
format='{up}↑',
|
||||
mouse_callbacks = launch_htop,
|
||||
),
|
||||
)
|
||||
]
|
||||
)
|
||||
return sys_widgets
|
||||
#endregion
|
||||
|
||||
#region End_widgets
|
||||
@@ -175,7 +188,7 @@ def end_widgets(prev_color,size,fontsize):
|
||||
return [
|
||||
*powerline_arrow('l',prev_color,purple_color,size),
|
||||
widget.TextBox(
|
||||
text=' ',
|
||||
text=' ',
|
||||
foreground=light_foreground_color,
|
||||
background=purple_color,
|
||||
fontsize=fontsize
|
||||
@@ -194,71 +207,3 @@ def end_widgets(prev_color,size,fontsize):
|
||||
),
|
||||
]
|
||||
#endregion
|
||||
|
||||
#region Laptop widgets
|
||||
def Laptop_widgets(prev_color,last_color,size,fontsize):
|
||||
return [
|
||||
*powerline_arrow('l',prev_color,orange_color,size),
|
||||
widget.Battery(
|
||||
foreground=light_foreground_color,
|
||||
background=orange_color,
|
||||
fontsize=fontsize,
|
||||
update_interval=1,
|
||||
format="{char} {percent:2.0%}",
|
||||
low_percentage=0.2,
|
||||
notify_below=True,
|
||||
low_foreground=red_color,
|
||||
),
|
||||
*powerline_arrow('l',orange_color,green_color,size),
|
||||
widget.TextBox(
|
||||
text='',
|
||||
foreground=light_foreground_color,
|
||||
background=green_color,
|
||||
fontsize=fontsize
|
||||
),
|
||||
widget.CPU(
|
||||
foreground=light_foreground_color,
|
||||
background=green_color,
|
||||
fontsize=fontsize,
|
||||
format='{load_percent}%',
|
||||
mouse_callbacks = launch_htop,
|
||||
),
|
||||
*powerline_arrow('l',green_color,yellow_color,size),
|
||||
widget.TextBox(
|
||||
text='',
|
||||
foreground=light_foreground_color,
|
||||
background=yellow_color,
|
||||
fontsize=fontsize
|
||||
),
|
||||
MemoryC(
|
||||
foreground=light_foreground_color,
|
||||
background=yellow_color,
|
||||
fontsize=fontsize,
|
||||
format="{MemUsed}GB|{SwapUsed}GB",
|
||||
mouse_callbacks = launch_htop,
|
||||
),
|
||||
*powerline_arrow('l',yellow_color,last_color,size),
|
||||
widget.TextBox(
|
||||
text='',
|
||||
foreground=light_foreground_color,
|
||||
background=blue_color,
|
||||
fontsize=fontsize
|
||||
),
|
||||
widget.Net(
|
||||
background=last_color,
|
||||
foreground=light_foreground_color,
|
||||
fontsize=fontsize,
|
||||
fmt='{:.9}',
|
||||
format='{down}↓',
|
||||
mouse_callbacks = launch_htop,
|
||||
),
|
||||
widget.Net(
|
||||
background=last_color,
|
||||
foreground=light_foreground_color,
|
||||
fontsize=fontsize,
|
||||
fmt='{:.9}',
|
||||
format='{up}↑',
|
||||
mouse_callbacks = launch_htop,
|
||||
),
|
||||
]
|
||||
#endregion
|
||||
|
||||
Submodule zsh/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting updated: dcc99a8649...e0165eaa73
Submodule zsh/.oh-my-zsh/custom/themes/powerlevel10k updated: cc6ed4be41...d804048efc
Reference in New Issue
Block a user