This commit is contained in:
2026-02-24 21:42:25 +01:00
parent 875c80027d
commit 54d01ddad3
34 changed files with 481 additions and 298 deletions

127
assets/popups/calendar.py Normal file
View File

@@ -0,0 +1,127 @@
import subprocess
from libqtile import qtile
from qtile_extras import widget
from qtile_extras.popup.toolkit import (
PopupRelativeLayout,
PopupWidget,
)
from colors import gruvbox_dark
# https://discord.com/channels/955163559086665728/1166312212223250482/1322614846155657370
# check for this PR to change back the code with the message contents to the prev code of the widget:
# PopupWidget(
# pos_x=0.051,
# pos_y=0.415,
# height=0.6,
# width=0.9,
# widget=widget.GenPollCommand(
# cmd="cal",
# shell=True,
# font='mono',
# fontsize=20,
# markup=False,
# # background=gruvbox_dark["blue"],
# )
def parse_cal():
process = subprocess.run(
"cal",
capture_output=True,
text=True,
)
body = process.stdout.strip()
lines = body.splitlines()
maxlen = max(len(l) for l in lines)
output = []
for line in body.splitlines():
if len(line) < maxlen:
line += " " * (maxlen - len(line))
output.append(line)
return "\n".join(output).strip("\n")
def calendar(qtile):
layout = PopupRelativeLayout(
qtile,
rows=7,
cols=9,
width=300,
height=310,
opacity=0.8,
hide_on_mouse_leave=True,
close_on_click=False,
border_width=0,
background=gruvbox_dark["bg0_soft"],
controls=[
PopupWidget(
pos_x=0,
pos_y=0,
height=0.2,
width=0.9,
v_align="middle",
h_align="center",
widget=widget.Wttr(fontsize=40, format="%c"),
),
PopupWidget(
pos_x=0.3,
pos_y=0.05,
height=0.05,
width=0.9,
v_align="middle",
h_align="center",
widget=widget.Wttr(
font="Open Sans Bold", fontsize=18, format="Actual: %t"
),
),
PopupWidget(
pos_x=0.3,
pos_y=0.12,
height=0.05,
width=0.9,
widget=widget.Wttr(font="Open Sans", fontsize=14, format="Feels: %f"),
),
PopupWidget(
pos_x=0.05,
pos_y=0.2,
height=0.05,
width=0.9,
widget=widget.Wttr(
font="Open Sans", fontsize=14, format="Wind: %w Prec: %p"
),
),
PopupWidget(
pos_x=0.05,
pos_y=0.25,
height=0.11,
width=0.9,
widget=widget.Wttr(
font="Open Sans Bold",
fontsize=14,
format="City: %l", # \nFeel;%f Wind: %w'
),
),
PopupWidget(
pos_x=0.051,
pos_y=0.38,
height=0.6,
width=0.9,
widget=widget.GenPollText(
func=parse_cal,
font="mono",
fontsize=20,
markup=False,
),
),
],
)
layout.show(
relative_to=3,
relative_to_bar=True,
y=3,
x=-3,
)

31
assets/popups/monitor.py Normal file
View File

@@ -0,0 +1,31 @@
from libqtile import qtile
from qtile_extras import widget
from qtile_extras.popup.toolkit import (
PopupRelativeLayout,
PopupWidget,
)
from colors import gruvbox_dark
def monitor(qtile):
layout = PopupRelativeLayout(
qtile,
rows=7,
cols=9,
width=600,
height=420,
opacity=0.8,
hide_on_mouse_leave=True,
close_on_click=False,
border_width=0,
background=gruvbox_dark["bg0_soft"],
controls=[],
)
layout.show(
relative_to=5,
relative_to_bar=True,
# y=3,
# x=-3,
)

View File

@@ -0,0 +1,129 @@
from colors import gruvbox_dark
from qtile_extras.popup.toolkit import (
PopupRelativeLayout,
PopupImage,
PopupText,
PopupSlider,
)
image = "/home/cerberus/.config/qtile/assets/images/no_cover.svg"
MPRIS2_LAYOUT = PopupRelativeLayout(
None,
width=400,
height=200,
opacity=0.7,
background=gruvbox_dark["bg0_soft"],
hide_on_mouse_leave=True,
controls=[
PopupText(
"",
name="title",
font="Open Sans Bold",
fontsize=18,
pos_x=0.35,
pos_y=0.1,
width=0.55,
height=0.14,
h_align="left",
v_align="top",
),
PopupText(
"",
name="artist",
font="Open Sans Medium",
fontsize=14,
pos_x=0.35,
pos_y=0.24,
width=0.55,
height=0.14,
h_align="left",
v_align="middle",
),
PopupText(
"",
name="album",
font="Open Sans",
fontsize=14,
pos_x=0.35,
pos_y=0.38,
width=0.55,
height=0.14,
h_align="left",
v_align="bottom",
),
PopupImage(
name="artwork",
filename=image,
pos_x=0.1,
pos_y=0.1,
width=0.21,
height=0.42,
),
PopupSlider(
name="progress", pos_x=0.1, pos_y=0.6, width=0.8, height=0.1, marker_size=0
),
PopupText(
name="previous",
text="󰙤",
fontsize=30,
mask=True,
pos_x=0.125,
pos_y=0.8,
width=0.15,
height=0.1,
v_align="middle",
h_align="center",
highlight_method="text",
foreground=gruvbox_dark["fg0"],
highlight=gruvbox_dark["green"],
),
PopupText(
name="play_pause",
text="󰐎",
fontsize=30,
mask=True,
pos_x=0.325,
pos_y=0.8,
width=0.15,
height=0.1,
v_align="middle",
h_align="center",
highlight_method="text",
foreground=gruvbox_dark["fg0"],
highlight=gruvbox_dark["green"],
),
PopupText(
name="stop",
text="",
fontsize=30,
mask=True,
pos_x=0.525,
pos_y=0.8,
width=0.15,
height=0.1,
v_align="middle",
h_align="center",
highlight_method="text",
foreground=gruvbox_dark["fg0"],
highlight=gruvbox_dark["green"],
),
PopupText(
name="next",
text="󰙢",
fontsize=30,
mask=True,
pos_x=0.725,
pos_y=0.8,
width=0.15,
height=0.1,
v_align="middle",
h_align="center",
highlight_method="text",
foreground=gruvbox_dark["fg0"],
highlight=gruvbox_dark["green"],
),
],
close_on_click=False,
)

50
assets/popups/network.py Normal file
View File

@@ -0,0 +1,50 @@
from libqtile import qtile
from libqtile.lazy import lazy
from colors import gruvbox_dark
from qtile_extras.popup.menu import (
PopupMenu,
PopupMenuItem,
PopupMenuSeparator,
)
items = [
PopupMenuItem(
show_icon=False,
text="󰛳 Network Manager",
font="Open Sans",
fontsize=16,
can_focus=True,
highlight_method="text",
foreground=gruvbox_dark["fg0"],
highlight=gruvbox_dark["green"],
mouse_callbacks={"Button1": lazy.spawn("nm-connection-editor")},
),
PopupMenuSeparator(),
PopupMenuItem(
show_icon=False,
text="󰐚 Wireguard",
font="Open Sans",
fontsize=16,
highlight_method="text",
can_focus=True,
foreground=gruvbox_dark["fg0"],
highlight=gruvbox_dark["green"],
mouse_callbacks={"Button1": lazy.spawn("wireguird")},
),
]
def network_menu(qtile):
layout = PopupMenu.generate(
qtile,
pos_x=100,
pos_y=100,
width=225,
opacity=0.7,
menuitems=items,
background=gruvbox_dark["bg0_soft"],
)
layout.show(relative_to=1, relative_to_bar=True, y=136, x=220)

View File

@@ -0,0 +1,71 @@
from libqtile.lazy import lazy
from colors import gruvbox_dark
from qtile_extras.popup.toolkit import (
PopupRelativeLayout,
PopupText,
)
# qtile/resources/themes/colors.py
def power_menu(qtile):
layout = PopupRelativeLayout(
qtile,
width=800,
height=250,
opacity=0.7,
# border=gruvbox_dark["red"],
# border_width=3,
background=gruvbox_dark["bg0_soft"],
initial_focus=None,
controls=[
PopupText(
# Lock betterlockscreen --lock blur
text="",
fontsize=80,
pos_y=0,
pos_x=0.1,
width=0.2,
height=1,
mouse_callbacks={"Button1": lazy.spawn("betterlockscreen --lock blur")},
highlight_method="text",
highlight=gruvbox_dark["green"],
),
PopupText(
# Hybrid Sleep systemctl hybrid-sleep
text="󰒲",
fontsize=80,
pos_y=0,
pos_x=0.32,
width=0.2,
height=1,
mouse_callbacks={"Button1": lazy.spawn("systemctl hybrid-sleep")},
highlight_method="text",
highlight=gruvbox_dark["yellow"],
),
PopupText(
# Hibernate systemctl hibernate
text="",
fontsize=80,
pos_y=0,
pos_x=0.55,
width=0.2,
height=1,
mouse_callbacks={"Button1": lazy.spawn("systemctl hibernate")},
highlight_method="text",
highlight=gruvbox_dark["orange"],
),
PopupText(
# Power off systemctl poweroff
text="",
fontsize=80,
pos_y=0,
pos_x=0.8,
width=0.2,
height=1,
mouse_callbacks={"Button1": lazy.spawn("systemctl poweroff")},
highlight_method="text",
highlight=gruvbox_dark["red"],
),
],
)
layout.show(relative_to=5, relative_to_bar=True, hide_on_timeout=5)

View File

@@ -0,0 +1,92 @@
from pydoc import importfile
from libqtile import qtile
from libqtile.lazy import lazy
from colors import gruvbox_dark
from qtile_extras.popup.toolkit import (
PopupRelativeLayout,
PopupImage,
PopupText,
)
def powermenu_2(qtile):
layout = PopupRelativeLayout(
qtile,
width=170,
height=50,
opacity=0.7,
hide_on_mouse_leave=True,
close_on_click=False,
border_width=0,
background=gruvbox_dark["bg0_soft"],
controls=[
PopupText(
# Lock
text="",
fontsize=22,
pos_x=0.07,
pos_y=0.05,
height=0.8,
width=0.2,
can_focus=True,
v_align="middle",
h_align="center",
highlight_method="text",
foreground=gruvbox_dark["fg0"],
highlight=gruvbox_dark["green"],
mouse_callbacks={"Button1": lazy.spawn("betterlockscreen --lock blur")},
),
PopupText(
# Reboot
text="",
fontsize=22,
pos_x=0.3,
pos_y=0.05,
height=0.8,
width=0.2,
can_focus=True,
v_align="middle",
h_align="center",
highlight_method="text",
foreground=gruvbox_dark["fg0"],
highlight=gruvbox_dark["green"],
mouse_callbacks={"Button1": lazy.spawn("systemctl reboot")},
),
PopupText(
# Suspend
text="󰒲",
fontsize=22,
pos_x=0.54,
pos_y=0.05,
height=0.8,
width=0.2,
can_focus=True,
v_align="middle",
h_align="center",
highlight_method="text",
foreground=gruvbox_dark["fg0"],
highlight=gruvbox_dark["green"],
mouse_callbacks={"Button1": lazy.spawn("systemctl suspend")},
),
PopupText(
# Shutdown
text="",
fontsize=22,
pos_x=0.78,
pos_y=0.05,
height=0.8,
width=0.2,
can_focus=True,
v_align="middle",
h_align="center",
highlight_method="text",
foreground=gruvbox_dark["fg0"],
highlight=gruvbox_dark["green"],
mouse_callbacks={"Button1": lazy.spawn("systemctl poweroff")},
),
],
)
layout.show(relative_to=1, relative_to_bar=True, y=136, x=30)

61
assets/popups/settings.py Normal file
View File

@@ -0,0 +1,61 @@
from libqtile import qtile
from libqtile.lazy import lazy
from colors import gruvbox_dark
from qtile_extras.popup.menu import (
PopupMenu,
PopupMenuItem,
PopupMenuSeparator,
)
items = [
PopupMenuItem( # Wallpaper setting
show_icon=False,
text=" 󰸉 Nitrogen Wallpaper",
font="Open Sans",
fontsize=16,
can_focus=True,
highlight_method="text",
foreground=gruvbox_dark["fg0"],
highlight=gruvbox_dark["green"],
mouse_callbacks={"Button1": lazy.spawn("nitrogen")},
),
PopupMenuSeparator(),
PopupMenuItem( # Arandr
show_icon=False,
text=" 󰹑 Arandr Display",
font="Open Sans",
fontsize=16,
can_focus=True,
highlight_method="text",
foreground=gruvbox_dark["fg0"],
highlight=gruvbox_dark["green"],
mouse_callbacks={"Button1": lazy.spawn("arandr")},
),
PopupMenuSeparator(),
PopupMenuItem( # VS-Code qtile config
show_icon=False,
text="  Qtile Config",
font="Open Sans",
fontsize=16,
can_focus=True,
highlight_method="text",
foreground=gruvbox_dark["fg0"],
highlight=gruvbox_dark["green"],
mouse_callbacks={"Button1": lazy.spawn("code /home/cerberus/.config/")},
),
]
def settings(qtile):
layout = PopupMenu.generate(
qtile,
pos_x=100,
pos_y=100,
width=225,
opacity=0.7,
menuitems=items,
background=gruvbox_dark["bg0_soft"],
)
layout.show(relative_to=1, relative_to_bar=True, y=75, x=325)

185
assets/popups/start_menu.py Normal file
View File

@@ -0,0 +1,185 @@
from libqtile import qtile
from libqtile.lazy import lazy
from qtile_extras import widget
from qtile_extras.popup.toolkit import (
PopupRelativeLayout,
PopupImage,
PopupText,
PopupWidget,
)
from colors import gruvbox_dark
from assets.popups.settings import settings
from assets.popups.network import network_menu
from assets.popups.powermenu_sub import powermenu_2
from assets.popups.monitor import monitor
def start_menu(qtile):
layout = PopupRelativeLayout(
qtile,
width=350,
height=150,
opacity=0.7,
hide_on_mouse_leave=True,
close_on_click=False,
border_width=0,
background=gruvbox_dark["bg0_soft"],
controls=[
# Row 1
PopupImage(
# Qtile logo
pos_x=0,
pos_y=0,
height=0.3,
width=0.3,
mask=True,
colour=gruvbox_dark["blue"],
filename="/home/cerberus/.config/qtile/assets/images/standby_rotated_.png",
),
PopupWidget(
# Welcome banner, fetching user name from $USER
pos_x=0.241,
pos_y=0.12,
height=0.15,
width=0.8,
widget=widget.GenPollCommand(
foreground=gruvbox_dark["orange"],
cmd="echo Welcome $USER",
shell=True,
font="Open Sans Bold",
fontsize=20,
width=250,
scroll=True,
),
),
# PopupText(
# # Steam Gamemode (Controller)
# pos_x=0,
# pos_y=0,
# width=0.3,
# height=0.3,
# can_focus=True,
# v_align="middle",
# h_align="center",
# background=gruvbox_dark["green"],
# ),
PopupText(
# Steam Gamemode (Controller)
text="󰊴",
fontsize=34,
pos_x=0.271,
pos_y=0.4,
width=0.34,
height=0.2,
can_focus=True,
v_align="middle",
h_align="center",
highlight_method="text",
foreground=gruvbox_dark["fg0"],
highlight=gruvbox_dark["green"],
background=gruvbox_dark["bg2"],
mouse_callbacks={
"Button1": lazy.spawn("steam steam://open/bigpicture")
},
),
PopupText(
# Settings
text="",
fontsize=22,
pos_x=0.631,
pos_y=0.4,
width=0.34,
height=0.2,
can_focus=True,
v_align="middle",
h_align="center",
highlight_method="text",
foreground=gruvbox_dark["fg0"],
highlight=gruvbox_dark["green"],
background=gruvbox_dark["bg2"],
mouse_callbacks={"Button1": lazy.function(settings)},
),
PopupText(
# Power-Menu Popup
text="󱖘",
fontsize=24,
pos_x=0.035,
pos_y=0.7,
width=0.22,
height=0.2,
can_focus=True,
v_align="middle",
h_align="center",
highlight_method="text",
foreground=gruvbox_dark["fg0"],
highlight=gruvbox_dark["green"],
background=gruvbox_dark["bg2"],
mouse_callbacks={"Button1": lazy.function(powermenu_2)},
),
PopupText(
# Bluetooth
text="󰨇",
fontsize=22,
pos_x=0.271,
pos_y=0.7,
width=0.22,
height=0.2,
can_focus=True,
v_align="middle",
h_align="center",
highlight_method="text",
foreground=gruvbox_dark["fg0"],
highlight=gruvbox_dark["green"],
background=gruvbox_dark["bg2"],
mouse_callbacks={"Button1": lazy.function(monitor)},
),
PopupText(
# Network Popup
text="󰌘",
fontsize=24,
pos_x=0.511,
pos_y=0.7,
width=0.22,
height=0.2,
can_focus=True,
v_align="middle",
h_align="center",
highlight_method="text",
foreground=gruvbox_dark["fg0"],
highlight=gruvbox_dark["green"],
background=gruvbox_dark["bg2"],
mouse_callbacks={"Button1": lazy.function(network_menu)},
),
PopupText(
# Audiocontrol
text="",
fontsize=24,
pos_x=0.75,
pos_y=0.7,
width=0.22,
height=0.2,
can_focus=True,
v_align="middle",
h_align="center",
highlight_method="text",
foreground=gruvbox_dark["fg0"],
highlight=gruvbox_dark["green"],
background=gruvbox_dark["bg2"],
mouse_callbacks={"Button1": lazy.spawn("pavucontrol")},
),
PopupText(
# "extras"
text="extras",
font="Open Sans Bold",
foreground=gruvbox_dark["fg2"],
fontsize=10,
pos_x=0.055,
pos_y=0.57,
height=0.05,
width=0.15,
),
],
)
layout.show(relative_to=1, relative_to_bar=True, y=3, x=3)

View File

@@ -0,0 +1,37 @@
from colors import gruvbox_dark
from qtile_extras.popup.toolkit import PopupRelativeLayout, PopupText, PopupSlider
VOL_POPUP = PopupRelativeLayout(
width=150,
height=150,
opacity=0.7,
background=gruvbox_dark["bg0_soft"],
controls=[
PopupText(
text="",
fontsize=60,
foreground=gruvbox_dark["fg1"],
pos_x=0,
pos_y=0,
height=0.8,
width=0.8,
v_align="middle",
h_align="center",
),
PopupSlider(
name="volume",
pos_x=0.1,
pos_y=0.7,
width=0.8,
height=0.2,
colour_below=gruvbox_dark["blue"],
bar_border_margin=1,
bar_size=8,
marker_size=0,
end_margin=0,
),
],
)