cal upowerwidget only for internal batteries

This commit is contained in:
Daniel Mevec 2023-01-23 08:13:03 +01:00
parent 7ababa5e3d
commit f1910ef417

View file

@ -15,13 +15,13 @@ from qtile_extras.widget import UPowerWidget
from qtile_extras.widget.decorations import PowerLineDecoration
from qutils import get_num_screens, get_network_interface, Colors
from qutils import get_num_screens, get_network_interface, get_batteries, Colors
mod = "mod4" # Sets mod key to SUPER/WINDOWS
myTerm = "alacritty"
myBrowser = "firefox"
sound_ctrl = "pavucontrol"
update_distro_key = "Arch"
sound_ctrl = "cinnamon-settings sound"
update_distro_key = "Ubuntu"
keys = [
# ## The essentials
@ -159,11 +159,7 @@ def init_widgets_list():
}
widgets_list = [
# widget.Image(
# filename = "~/.config/qtile/icons/python-white.png",
# scale = "False",
# mouse_callbacks = {'Button1': lambda: qtile.cmd_spawn(myTerm)}
# ),
# widget.Image(filename = "~/.config/qtile/icons/python-white.png"),
widget.TextBox(
text=u'\ue73c',
foreground=Colors.fg,
@ -181,7 +177,7 @@ def init_widgets_list():
borderwidth=3,
active=Colors.fg,
inactive=Colors.grey,
# rounded=False,
rounded=False,
highlight_color=Colors.orange,
highlight_method="line",
this_current_screen_border=Colors.blue,
@ -219,23 +215,6 @@ def init_widgets_list():
padding=5,
**powerline,
),
UPowerWidget(
background=Colors.yellow,
foreground=Colors.bg,
border_colour=Colors.bg,
border_critical_colour=Colors.red,
border_charge_colour=Colors.blue,
fill_critical=Colors.red,
fill_low=Colors.red,
fill_normal=Colors.bg2,
text_charging='({percentage:.0f}%) {ttf}',
text_discharging='({percentage:.0f}%) {tte}',
spacing=10,
**powerline,
),
# widget.Battery(
# battery=0,
# fmt=' {}',
@ -249,19 +228,6 @@ def init_widgets_list():
# foreground=Colors.bg,
# **powerline,
# ),
# widget.Battery(
# battery=1,
# fmt=' {}',
# charge_char=u'\uf583',
# discharge_char=u'\uf57d',
# empty_char=u'\uf582',
# full_char=u'\uf578',
# unknown_char=u'\uf590',
# format='{char} {percent:2.0%} {hour:d}:{min:02d}',
# background=Colors.yellow,
# foreground=Colors.bg,
# **powerline,
# ),
widget.ThermalSensor(
foreground=Colors.bg,
background=Colors.orange,
@ -296,7 +262,6 @@ def init_widgets_list():
**powerline,
),
widget.Net(
# bash script to get the active network interface: ip
interface=get_network_interface(),
format='{down} ↓↑ {up}',
prefix='M',
@ -311,6 +276,27 @@ def init_widgets_list():
padding=5
),
]
upw_kwargs = {
"background": Colors.yellow,
"foreground": Colors.bg,
"border_colour": Colors.bg,
"border_critical_colour": Colors.red,
"border_charge_colour": Colors.blue,
"fill_critical": Colors.red,
"fill_low": Colors.red,
"fill_normal": Colors.bg2,
"text_charging": '({percentage:.0f}%) {ttf}',
"text_discharging": '({percentage:.0f}%) {tte}',
"spacing": 10,
}
upw_kwargs.update(powerline)
widgets_list[8:8] = [UPowerWidget(battery_name=battery, **upw_kwargs) for battery in get_batteries()]
return widgets_list