adds generator function for info bar borders
This commit is contained in:
parent
14a62b39ce
commit
ea5ffd79e9
1 changed files with 53 additions and 103 deletions
|
|
@ -10,12 +10,14 @@ from libqtile import layout, bar, widget, hook
|
||||||
from libqtile.lazy import lazy
|
from libqtile.lazy import lazy
|
||||||
from libqtile.utils import guess_terminal
|
from libqtile.utils import guess_terminal
|
||||||
from typing import List # noqa: F401from typing import List # noqa: F401
|
from typing import List # noqa: F401from typing import List # noqa: F401
|
||||||
|
from volume import Volume
|
||||||
|
|
||||||
|
|
||||||
from qutils import get_num_screens
|
from qutils import get_num_screens
|
||||||
|
|
||||||
mod = "mod4" # Sets mod key to SUPER/WINDOWS
|
mod = "mod4" # Sets mod key to SUPER/WINDOWS
|
||||||
myTerm = "alacritty" # My terminal of choice
|
myTerm = "alacritty" # My terminal of choice
|
||||||
myBrowser = "qutebrowser" # My browser of choice
|
myBrowser = "firefox" #"qutebrowser" # My browser of choice
|
||||||
|
|
||||||
class Colors:
|
class Colors:
|
||||||
bg = ["#282828", "#3c3836"] #background
|
bg = ["#282828", "#3c3836"] #background
|
||||||
|
|
@ -163,6 +165,23 @@ widget_defaults = dict(
|
||||||
)
|
)
|
||||||
extension_defaults = widget_defaults.copy()
|
extension_defaults = widget_defaults.copy()
|
||||||
|
|
||||||
|
def widget_border(color_l, color_r, symbol=None):
|
||||||
|
border = [widget.TextBox(
|
||||||
|
text = u'\ue0be',
|
||||||
|
background = color_l,
|
||||||
|
foreground = color_r,
|
||||||
|
padding = 0,
|
||||||
|
fontsize = 26)]
|
||||||
|
if symbol:
|
||||||
|
border.append(widget.TextBox(
|
||||||
|
text = symbol,
|
||||||
|
foreground = Colors.bg,
|
||||||
|
background = color_r,
|
||||||
|
fontsize = 16,
|
||||||
|
width = 15,
|
||||||
|
))
|
||||||
|
return border
|
||||||
|
|
||||||
def init_widgets_list():
|
def init_widgets_list():
|
||||||
widgets_list = [
|
widgets_list = [
|
||||||
# widget.Image(
|
# widget.Image(
|
||||||
|
|
@ -228,9 +247,9 @@ def init_widgets_list():
|
||||||
text = u'\ue0be',
|
text = u'\ue0be',
|
||||||
background = Colors.bg,
|
background = Colors.bg,
|
||||||
foreground = Colors.yellow,
|
foreground = Colors.yellow,
|
||||||
padding = 0,
|
|
||||||
fontsize = 26,
|
fontsize = 26,
|
||||||
width = 24
|
padding = 0,
|
||||||
|
# width = 24
|
||||||
),
|
),
|
||||||
widget.Battery(
|
widget.Battery(
|
||||||
battery = 0,
|
battery = 0,
|
||||||
|
|
@ -243,143 +262,74 @@ def init_widgets_list():
|
||||||
format = '{char} {percent:2.0%} {hour:d}:{min:02d}',
|
format = '{char} {percent:2.0%} {hour:d}:{min:02d}',
|
||||||
background = Colors.yellow,
|
background = Colors.yellow,
|
||||||
foreground = Colors.bg,
|
foreground = Colors.bg,
|
||||||
|
padding = 5,
|
||||||
),
|
),
|
||||||
# widget.Battery(
|
widget.Battery(
|
||||||
# battery = 1,
|
battery = 1,
|
||||||
# fmt = ' {}',
|
fmt = ' {}',
|
||||||
# charge_char = u'\uf583',
|
charge_char = u'\uf583',
|
||||||
# discharge_char = u'\uf57d',
|
discharge_char = u'\uf57d',
|
||||||
# empty_char = u'\uf582',
|
empty_char = u'\uf582',
|
||||||
# full_char = u'\uf578',
|
full_char = u'\uf578',
|
||||||
# unknown_char = u'\uf590',
|
unknown_char = u'\uf590',
|
||||||
# format = '{char} {percent:2.0%} {hour:d}:{min:02d}',
|
format = '{char} {percent:2.0%} {hour:d}:{min:02d}',
|
||||||
# background = Colors.yellow,
|
|
||||||
# foreground = Colors.bg,
|
|
||||||
# ),
|
|
||||||
# widget.Net(
|
|
||||||
# interface = "enp0s31f6",
|
|
||||||
# format = '{down} ↓↑ {up}',
|
|
||||||
# prefix='M',
|
|
||||||
# foreground = Colors.bg,
|
|
||||||
# background = Colors.yellow,
|
|
||||||
# ),
|
|
||||||
widget.TextBox(
|
|
||||||
text = u'\ue0be',
|
|
||||||
background = Colors.yellow,
|
background = Colors.yellow,
|
||||||
foreground = Colors.orange,
|
|
||||||
padding = 0,
|
|
||||||
fontsize = 26,
|
|
||||||
width = 24
|
|
||||||
),
|
|
||||||
widget.TextBox(
|
|
||||||
text = u"\uf8c7",
|
|
||||||
foreground = Colors.bg,
|
foreground = Colors.bg,
|
||||||
background = Colors.orange,
|
padding = 5,
|
||||||
fontsize = 14
|
|
||||||
),
|
),
|
||||||
|
*widget_border(Colors.yellow, Colors.orange, u"\uf8c7"),
|
||||||
widget.ThermalSensor(
|
widget.ThermalSensor(
|
||||||
foreground = Colors.bg,
|
foreground = Colors.bg,
|
||||||
background = Colors.orange,
|
background = Colors.orange,
|
||||||
threshold = 90,
|
threshold = 90,
|
||||||
fmt = ' {}',
|
fmt = ' {}',
|
||||||
|
padding = 5,
|
||||||
),
|
),
|
||||||
widget.TextBox(
|
*widget_border(Colors.orange,Colors.red,u"\uf546"),
|
||||||
text = u'\ue0be',
|
|
||||||
background = Colors.orange,
|
|
||||||
foreground = Colors.red,
|
|
||||||
padding = 0,
|
|
||||||
fontsize = 26,
|
|
||||||
width = 24
|
|
||||||
),
|
|
||||||
widget.TextBox(
|
|
||||||
text = u"\uf546",
|
|
||||||
foreground = Colors.bg,
|
|
||||||
background = Colors.red,
|
|
||||||
fontsize = 16
|
|
||||||
),
|
|
||||||
widget.CheckUpdates(
|
widget.CheckUpdates(
|
||||||
update_interval = 1800,
|
update_interval = 1800,
|
||||||
distro = "Ubuntu",
|
distro = "Arch",
|
||||||
display_format = " {updates}",
|
display_format = " {updates}",
|
||||||
|
no_update_string = " 0",
|
||||||
foreground = Colors.bg,
|
foreground = Colors.bg,
|
||||||
colour_have_updates = Colors.bg,
|
colour_have_updates = Colors.bg,
|
||||||
colour_no_updates = Colors.bg,
|
colour_no_updates = Colors.bg,
|
||||||
# mouse_callbacks = {'Button1': lambda: qtile.cmd_spawn(myTerm + ' -e sudo apt upgrade')},
|
# mouse_callbacks = {'Button1': lambda: qtile.cmd_spawn(myTerm + ' -e sudo apt upgrade')},
|
||||||
background = Colors.red
|
|
||||||
),
|
|
||||||
widget.TextBox(
|
|
||||||
text = u'\ue0be',
|
|
||||||
background = Colors.red,
|
background = Colors.red,
|
||||||
foreground = Colors.purple,
|
padding = 5,
|
||||||
padding = 0,
|
|
||||||
fontsize = 26,
|
|
||||||
width = 24
|
|
||||||
),
|
|
||||||
widget.TextBox(
|
|
||||||
text = u"\uf85a",
|
|
||||||
foreground = Colors.bg,
|
|
||||||
background = Colors.purple,
|
|
||||||
fontsize = 20
|
|
||||||
),
|
),
|
||||||
|
*widget_border(Colors.red,Colors.purple,u"\uf85a"),
|
||||||
widget.Memory(
|
widget.Memory(
|
||||||
foreground = Colors.bg,
|
foreground = Colors.bg,
|
||||||
background = Colors.purple,
|
background = Colors.purple,
|
||||||
mouse_callbacks = {'Button1': lambda: qtile.cmd_spawn(myTerm + ' -e htop')},
|
mouse_callbacks = {'Button1': lambda: qtile.cmd_spawn(myTerm + ' -e htop')},
|
||||||
fmt = '{}',
|
fmt = '{}',
|
||||||
format = '{MemPercent:5.1f} %',
|
format = '{MemPercent:4.1f}%',
|
||||||
),
|
padding = 5,
|
||||||
widget.TextBox(
|
|
||||||
text = u'\ue0be',
|
|
||||||
background = Colors.purple,
|
|
||||||
foreground = Colors.blue,
|
|
||||||
padding = 0,
|
|
||||||
fontsize = 26,
|
|
||||||
width = 24
|
|
||||||
),
|
|
||||||
widget.TextBox(
|
|
||||||
text = u"\ufb19",
|
|
||||||
foreground = Colors.bg,
|
|
||||||
background = Colors.blue,
|
|
||||||
fontsize = 18
|
|
||||||
),
|
),
|
||||||
|
*widget_border(Colors.purple,Colors.blue,u"\ufb19"),
|
||||||
widget.CPU(
|
widget.CPU(
|
||||||
foreground = Colors.bg,
|
foreground = Colors.bg,
|
||||||
background = Colors.blue,
|
background = Colors.blue,
|
||||||
fmt = '{}',
|
fmt = '{}',
|
||||||
format = '{load_percent:5.1f}%',
|
format = '{load_percent:4.1f}%',
|
||||||
|
padding = 5,
|
||||||
),
|
),
|
||||||
widget.TextBox(
|
*widget_border(Colors.blue,Colors.aqua),#u"\uf026"
|
||||||
text = u'\ue0be',
|
widget.Net(
|
||||||
background = Colors.blue,
|
interface = "wlan0",
|
||||||
foreground = Colors.aqua,
|
format = '{down} ↓↑ {up}',
|
||||||
padding = 0,
|
prefix='M',
|
||||||
fontsize = 26,
|
|
||||||
width = 24
|
|
||||||
),
|
|
||||||
widget.TextBox(
|
|
||||||
text = u"\uf026",
|
|
||||||
foreground = Colors.bg,
|
foreground = Colors.bg,
|
||||||
background = Colors.aqua,
|
background = Colors.aqua,
|
||||||
fontsize = 20
|
padding = 5,
|
||||||
),
|
|
||||||
widget.Volume(
|
|
||||||
foreground = Colors.bg,
|
|
||||||
background = Colors.aqua,
|
|
||||||
fmt = '{}',
|
|
||||||
),
|
|
||||||
widget.TextBox(
|
|
||||||
text = u'\ue0be',
|
|
||||||
background = Colors.aqua,
|
|
||||||
foreground = Colors.green,
|
|
||||||
padding = 0,
|
|
||||||
fontsize = 26,
|
|
||||||
width = 24
|
|
||||||
),
|
),
|
||||||
|
*widget_border(Colors.aqua,Colors.green),
|
||||||
widget.Clock(
|
widget.Clock(
|
||||||
foreground = Colors.bg,
|
foreground = Colors.bg,
|
||||||
background = Colors.green,
|
background = Colors.green,
|
||||||
format = "%Y-%m-%d %a %H:%M ",
|
format = "%Y-%m-%d %a %H:%M ",
|
||||||
padding = 5
|
padding = 5,
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
return widgets_list
|
return widgets_list
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue