393 lines
10 KiB
Python
393 lines
10 KiB
Python
import os
|
|
import subprocess
|
|
|
|
from libqtile import qtile
|
|
from libqtile.lazy import lazy
|
|
from qtile_extras import widget
|
|
from qtile_extras.widget.decorations import RectDecoration
|
|
|
|
from .get_theme import colors
|
|
from .widget_defaults import widget_defaults
|
|
|
|
dark_widgets = {
|
|
"decorations" : [
|
|
RectDecoration(
|
|
colour = colors['color11'],
|
|
filled = True,
|
|
radius = 10,
|
|
padding_y = 4,
|
|
group = True
|
|
)
|
|
]
|
|
}
|
|
|
|
light_widgets = {
|
|
"decorations" : [
|
|
RectDecoration(
|
|
colour = colors['color15'],
|
|
filled = True,
|
|
radius = 10,
|
|
padding_y = 4,
|
|
group = True
|
|
)
|
|
]
|
|
}
|
|
|
|
mid_widgets = {
|
|
"decorations" : [
|
|
RectDecoration(
|
|
colour = colors['color1'],
|
|
filled = True,
|
|
radius = 10,
|
|
padding_y = 4,
|
|
group = True
|
|
)
|
|
]
|
|
}
|
|
|
|
def init_widgets(monitor):
|
|
widgets_list = [
|
|
widget.Sep(
|
|
linewidth = 0,
|
|
padding = 5
|
|
),
|
|
widget.Sep(
|
|
linewidth = 0,
|
|
padding = 10,
|
|
**dark_widgets
|
|
),
|
|
widget.TextBox(
|
|
font="FontAwesome6Free",
|
|
fontsize=14,
|
|
foreground=colors['color15'],
|
|
text="",
|
|
**dark_widgets
|
|
),
|
|
# qtile button
|
|
widget.TextBox(
|
|
font="Fira Code Nerd Font Bold",
|
|
fontsize = 12,
|
|
foreground=colors['color15'],
|
|
text="Qtile",
|
|
mouse_callbacks={
|
|
'Button1' : lazy.spawn('rofi -show drun'),
|
|
},
|
|
**dark_widgets
|
|
),
|
|
# separators with curved sections
|
|
widget.Sep(
|
|
linewidth = 0,
|
|
padding = 10,
|
|
**dark_widgets
|
|
),
|
|
widget.Sep(
|
|
linewidth = 0,
|
|
padding = 10,
|
|
),
|
|
widget.Sep(
|
|
linewidth = 0,
|
|
padding = 10,
|
|
**light_widgets
|
|
),
|
|
# memory icon
|
|
widget.TextBox(
|
|
text='',
|
|
font="FontAwesome6Free",
|
|
fontsize=12,
|
|
foreground=colors['color0'],
|
|
margin=0,
|
|
padding=5,
|
|
**light_widgets
|
|
),
|
|
# memory percentage
|
|
widget.Memory(
|
|
foreground=colors['color0'],
|
|
format='{MemPercent}%',
|
|
measure_mem="M",
|
|
margin=0,
|
|
padding=0,
|
|
**widget_defaults,
|
|
**light_widgets
|
|
),
|
|
# separator
|
|
widget.Sep(
|
|
foreground=colors['color0'],
|
|
padding=10,
|
|
size_percent=60,
|
|
**light_widgets
|
|
),
|
|
# cpu icon
|
|
widget.TextBox(
|
|
text='',
|
|
font="FontAwesome6Free",
|
|
fontsize=12,
|
|
foreground=colors['color0'],
|
|
margin=0,
|
|
padding=5,
|
|
**light_widgets
|
|
),
|
|
# cpu percentage
|
|
widget.CPU(
|
|
foreground=colors['color0'],
|
|
format='{load_percent}%',
|
|
margin=0,
|
|
padding=0,
|
|
**widget_defaults,
|
|
**light_widgets
|
|
),
|
|
# separator
|
|
widget.Sep(
|
|
foreground=colors['color0'],
|
|
padding=10,
|
|
size_percent=60,
|
|
**light_widgets
|
|
),
|
|
# temperature icon
|
|
widget.TextBox(
|
|
text='',
|
|
font="FontAwesome6Free",
|
|
fontsize=12,
|
|
foreground=colors['color0'],
|
|
padding=5,
|
|
**light_widgets
|
|
),
|
|
# thermal sensor
|
|
widget.ThermalSensor(
|
|
foreground=colors['color0'],
|
|
**widget_defaults,
|
|
**light_widgets
|
|
),
|
|
# separators to close module and open next
|
|
widget.Sep(
|
|
linewidth = 0,
|
|
padding = 10,
|
|
**light_widgets
|
|
),
|
|
widget.Sep(
|
|
linewidth = 0,
|
|
padding = 10
|
|
),
|
|
widget.Sep(
|
|
linewidth = 0,
|
|
padding = 10,
|
|
**light_widgets
|
|
),
|
|
# sun icon
|
|
widget.TextBox(
|
|
text='',
|
|
font="FontAwesome6Free",
|
|
fontsize=12,
|
|
foreground=colors['color0'],
|
|
**light_widgets
|
|
),
|
|
# brightness percentage
|
|
widget.GenPollText(
|
|
foreground=colors['color0'],
|
|
func=lambda: subprocess.check_output(f"{os.path.expanduser('~')}/.config/qtile/scripts/brightness.sh").decode("utf-8").strip(),
|
|
update_interval=30,
|
|
**widget_defaults,
|
|
**light_widgets
|
|
),
|
|
# separator
|
|
widget.Sep(
|
|
foreground=colors['color0'],
|
|
padding=10,
|
|
size_percent=60,
|
|
**light_widgets
|
|
),
|
|
# audio icon
|
|
widget.TextBox(
|
|
font="FontAwesome6Free",
|
|
fontsize=12,
|
|
foreground=colors['color0'],
|
|
text="",
|
|
**light_widgets
|
|
),
|
|
# volume percentage
|
|
widget.Volume(
|
|
foreground=colors['color0'],
|
|
get_volume_command = f"{os.path.expanduser('~')}/.config/qtile/scripts/volume.sh",
|
|
**widget_defaults,
|
|
**light_widgets
|
|
),
|
|
# close module, separator, open next module
|
|
widget.Sep(
|
|
linewidth = 0,
|
|
padding = 10,
|
|
**light_widgets
|
|
),
|
|
widget.Sep(
|
|
linewidth = 0,
|
|
padding = 10
|
|
),
|
|
widget.Sep(
|
|
linewidth = 0,
|
|
padding = 10,
|
|
**mid_widgets
|
|
),
|
|
# current layout icon
|
|
widget.CurrentLayoutIcon(
|
|
foreground=colors['color15'],
|
|
scale=0.50,
|
|
**mid_widgets
|
|
),
|
|
# current layout
|
|
widget.CurrentLayout(
|
|
foreground=colors['color15'],
|
|
**widget_defaults,
|
|
**mid_widgets
|
|
),
|
|
# separators
|
|
widget.Sep(
|
|
linewidth = 0,
|
|
padding = 10,
|
|
**mid_widgets
|
|
),
|
|
widget.Sep(
|
|
linewidth = 0,
|
|
padding = 10
|
|
),
|
|
# groups/workspaces
|
|
widget.GroupBox(
|
|
active=colors['color15'],
|
|
borderwidth = 2,
|
|
foreground=colors['color15'],
|
|
disable_drag=True,
|
|
font="FontAwesome6Free",
|
|
fontsize=11,
|
|
hide_unused=False,
|
|
highlight_color=['#00000000', '#00000000'],
|
|
highlight_method="line",
|
|
inactive=colors['color0'],
|
|
this_current_screen_border=colors['color0'],
|
|
this_screen_border=colors['color15'],
|
|
other_current_screen_border=colors['color1'],
|
|
other_screen_border=colors['color0'],
|
|
urgent_method = "line",
|
|
use_mouse_wheel=False,
|
|
**dark_widgets
|
|
),
|
|
# separator
|
|
widget.Sep(
|
|
linewidth = 0,
|
|
padding = 10,
|
|
**dark_widgets
|
|
),
|
|
widget.Sep(
|
|
linewidth = 0,
|
|
padding = 10
|
|
),
|
|
|
|
widget.Sep(
|
|
linewidth = 0,
|
|
padding = 10,
|
|
**light_widgets
|
|
),
|
|
# browser
|
|
widget.TextBox(
|
|
foreground=colors['color0'],
|
|
font="FontAwesome6Free",
|
|
fontsize=12,
|
|
text='',
|
|
mouse_callbacks={
|
|
'Button1' : lazy.spawn("firefox --new-window"),
|
|
},
|
|
**light_widgets
|
|
),
|
|
# filebrowser
|
|
widget.TextBox(
|
|
foreground=colors['color0'],
|
|
font="FontAwesome6Free",
|
|
fontsize=12,
|
|
text='',
|
|
mouse_callbacks={
|
|
'Button1' : lazy.spawn('nautilus'),
|
|
},
|
|
**light_widgets
|
|
),
|
|
widget.Sep(
|
|
linewidth = 0,
|
|
padding = 10,
|
|
**light_widgets
|
|
),
|
|
widget.Sep(
|
|
linewidth = 0,
|
|
padding = 10
|
|
),
|
|
widget.Sep(
|
|
linewidth = 0,
|
|
padding = 10,
|
|
**dark_widgets
|
|
),
|
|
widget.Clock(
|
|
foreground=colors['color15'],
|
|
font="Fira Code Nerd Font Bold",
|
|
fontsize=12,
|
|
format=' %b %d | %I:%M %p',
|
|
mouse_callbacks={
|
|
'Button1' : lazy.spawn('wlogout'),
|
|
},
|
|
**dark_widgets
|
|
),
|
|
widget.Sep(
|
|
linewidth = 0,
|
|
padding = 15,
|
|
**dark_widgets
|
|
),
|
|
widget.Sep(
|
|
linewidth = 0,
|
|
padding = 5
|
|
),
|
|
]
|
|
|
|
if qtile.core.name == "x11":
|
|
clipboard = widget.TextBox(
|
|
foreground=colors['color0'],
|
|
font="FontAwesome6Free",
|
|
fontsize=12,
|
|
text='',
|
|
mouse_callbacks={
|
|
'Button1' : lazy.spawn(f"{os.path.expanduser('~')}/.config/qtile/scripts/greenclip.sh"),
|
|
},
|
|
**light_widgets
|
|
)
|
|
|
|
screenshot = widget.TextBox(
|
|
foreground=colors['color0'],
|
|
font="FontAwesome6Free",
|
|
fontsize=12,
|
|
text='',
|
|
mouse_callbacks={
|
|
'Button1' : lazy.spawn('flameshot launcher'),
|
|
},
|
|
**light_widgets
|
|
)
|
|
|
|
elif qtile.core.name == "wayland":
|
|
clipboard = widget.TextBox(
|
|
foreground=colors['color0'],
|
|
font="FontAwesome6Free",
|
|
fontsize=12,
|
|
text='',
|
|
mouse_callbacks={
|
|
'Button1' : lazy.spawn(f"{os.path.expanduser('~')}/.config/qtile/scripts/clipboard.sh"),
|
|
},
|
|
**light_widgets
|
|
)
|
|
|
|
screenshot = widget.TextBox(
|
|
foreground=colors['color0'],
|
|
font="FontAwesome6Free",
|
|
fontsize=12,
|
|
text='',
|
|
mouse_callbacks={
|
|
'Button1' : lazy.spawn(f"{os.path.expanduser('~')}/.config/qtile/scripts/grim.sh"),
|
|
},
|
|
**light_widgets
|
|
)
|
|
|
|
#widgets_list.insert(50, clipboard)
|
|
#widgets_list.insert(51, screenshot)
|
|
|
|
return widgets_list
|