added theme and widgets to screens

This commit is contained in:
2025-08-17 14:46:12 +02:00
parent 0e103467a1
commit e301413fc2
22 changed files with 848 additions and 8 deletions

View File

@@ -4,9 +4,11 @@ from libqtile import qtile, bar
from libqtile.backend.wayland.inputs import InputConfig from libqtile.backend.wayland.inputs import InputConfig
from libqtile.config import Screen from libqtile.config import Screen
from themes.colors import gruvbox_dark
from modules.keys import keys, mouse from modules.keys import keys, mouse
from modules.groups import groups from modules.groups import groups
from modules.widgets import widgets from modules.widgets import widgets_main, widgets_portrait, widgets_media
# Application definitions # Application definitions
apps = { apps = {
@@ -22,8 +24,8 @@ screens = [
# Left screen # Left screen
Screen( Screen(
top=bar.Bar( top=bar.Bar(
widgets, widgets_media,
background="#000000", background=gruvbox_dark["bg0_hard"],
opacity=0.75, opacity=0.75,
size=32, size=32,
margin=[3, 3, 0, 3], margin=[3, 3, 0, 3],
@@ -32,8 +34,8 @@ screens = [
# Center screen # Center screen
Screen( Screen(
top=bar.Bar( top=bar.Bar(
widgets, widgets_main,
background="#000000", background=gruvbox_dark["bg0_hard"],
opacity=0.75, opacity=0.75,
size=32, size=32,
margin=[3, 3, 0, 3], margin=[3, 3, 0, 3],
@@ -42,8 +44,8 @@ screens = [
# Right screen # Right screen
Screen( Screen(
top=bar.Bar( top=bar.Bar(
widgets, widgets_portrait,
background="#000000", background=gruvbox_dark["bg0_hard"],
opacity=0.75, opacity=0.75,
size=32, size=32,
margin=[3, 3, 0, 3], margin=[3, 3, 0, 3],
@@ -58,6 +60,12 @@ layout_defaults = dict(
grow_amount=2, grow_amount=2,
) )
widget_defaults = dict(
font="Open Sans",
fontsize=22,
foreground=gruvbox_dark["fg1"],
)
# Essentials # Essentials
keys = keys keys = keys
mouse = mouse mouse = mouse

View File

@@ -1 +1,24 @@
from libqtile import widget from libqtile.lazy import lazy
from qtile_extras import widget
from qtile_extras.widget.groupbox2 import GroupBoxRule
from config import widget_defaults
from themes.colors import gruvbox_dark
from plugins.notifications import Notifier
from popups import start_menu
widgets_media = [
widget.TextBox(
text="",
fontsize=24,
foreground=gruvbox_dark["blue"],
mouse_callbacks={"Button1": lazy.function(start_menu)},
**widget_defaults,
),
]
widgets_main = []
widgets_portrait = []

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

135
qtile/popups/calendar.py Normal file
View File

@@ -0,0 +1,135 @@
import subprocess
from libqtile import qtile
from qtile_extras import widget
from qtile_extras.popup.toolkit import (PopupRelativeLayout,
PopupWidget,
)
from res.themes.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
qtile/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 res.themes.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,125 @@
from res.themes.colors import gruvbox_dark
from qtile_extras.popup.toolkit import (
PopupRelativeLayout,
PopupImage,
PopupText,
PopupSlider
)
image='/home/cerberus/.config/qtile/res/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,
)

48
qtile/popups/network.py Normal file
View File

@@ -0,0 +1,48 @@
from libqtile import qtile
from libqtile.lazy import lazy
from res.themes.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)

70
qtile/popups/powermenu.py Normal file
View File

@@ -0,0 +1,70 @@
from libqtile.lazy import lazy
from res.themes.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,90 @@
from pydoc import importfile
from libqtile import qtile
from libqtile.lazy import lazy
from res.themes.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)

59
qtile/popups/settings.py Normal file
View File

@@ -0,0 +1,59 @@
from libqtile import qtile
from libqtile.lazy import lazy
from res.themes.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)

186
qtile/popups/start_menu.py Normal file
View File

@@ -0,0 +1,186 @@
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 res.themes.colors import gruvbox_dark
from popups.settings import settings
from popups.network import network_menu
from popups.powermenu_sub import powermenu_2
from 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/res/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,40 @@
from res.themes.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,
),
],
)

25
qtile/themes/colors.py Normal file
View File

@@ -0,0 +1,25 @@
# --------------------------------------------------------
# Gruvbox Dark Theme Colors
# --------------------------------------------------------
gruvbox_dark = {
"bg0_hard": "#1d2021", # Background, hard
"bg0_soft": "#32302f", # Background, soft
"bg0_normal": "#282828", # Background, normal
"bg1": "#3c3836", # Secondary background
"bg2": "#504945", # Background, darker
"bg3": "#665c54", # Background, lighter
"bg4": "#7c6f64", # Background, lightest
"fg0": "#fbf1c7", # Foreground, light
"fg1": "#ebdbb2", # Foreground, normal
"fg2": "#d5c4a1", # Foreground, slightly dark
"fg3": "#bdae93", # Foreground, dark
"red": "#cc241d", # Red
"orange": "#d65d0e", # Orange
"yellow": "#d79921", # Yellow
"green": "#98971a", # Green
"aqua": "#689d6a", # Aqua
"blue": "#458588", # Blue
"purple": "#b16286" # Purple
}