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 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 mod = "mod4" # Sets mod key to SUPER/WINDOWS
myTerm = "alacritty" myTerm = "alacritty"
myBrowser = "firefox" myBrowser = "firefox"
sound_ctrl = "pavucontrol" sound_ctrl = "cinnamon-settings sound"
update_distro_key = "Arch" update_distro_key = "Ubuntu"
keys = [ keys = [
# ## The essentials # ## The essentials
@ -159,11 +159,7 @@ def init_widgets_list():
} }
widgets_list = [ widgets_list = [
# widget.Image( # widget.Image(filename = "~/.config/qtile/icons/python-white.png"),
# filename = "~/.config/qtile/icons/python-white.png",
# scale = "False",
# mouse_callbacks = {'Button1': lambda: qtile.cmd_spawn(myTerm)}
# ),
widget.TextBox( widget.TextBox(
text=u'\ue73c', text=u'\ue73c',
foreground=Colors.fg, foreground=Colors.fg,
@ -181,7 +177,7 @@ def init_widgets_list():
borderwidth=3, borderwidth=3,
active=Colors.fg, active=Colors.fg,
inactive=Colors.grey, inactive=Colors.grey,
# rounded=False, rounded=False,
highlight_color=Colors.orange, highlight_color=Colors.orange,
highlight_method="line", highlight_method="line",
this_current_screen_border=Colors.blue, this_current_screen_border=Colors.blue,
@ -219,23 +215,6 @@ def init_widgets_list():
padding=5, padding=5,
**powerline, **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( # widget.Battery(
# battery=0, # battery=0,
# fmt=' {}', # fmt=' {}',
@ -249,19 +228,6 @@ def init_widgets_list():
# foreground=Colors.bg, # foreground=Colors.bg,
# **powerline, # **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( widget.ThermalSensor(
foreground=Colors.bg, foreground=Colors.bg,
background=Colors.orange, background=Colors.orange,
@ -296,7 +262,6 @@ def init_widgets_list():
**powerline, **powerline,
), ),
widget.Net( widget.Net(
# bash script to get the active network interface: ip
interface=get_network_interface(), interface=get_network_interface(),
format='{down} ↓↑ {up}', format='{down} ↓↑ {up}',
prefix='M', prefix='M',
@ -311,6 +276,27 @@ def init_widgets_list():
padding=5 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 return widgets_list