add nord theme and better widget management

This commit is contained in:
0x29a
2025-10-04 23:31:05 +02:00
parent c96bef61cf
commit 10afe674bf

173
config.py
View File

@@ -1,5 +1,5 @@
from libqtile import bar, layout, qtile from libqtile import bar, layout, qtile
from libqtile.config import Click, Drag, Group, Key, Match, Screen from libqtile.config import Click, Drag, Group, Key, Match, Screen, ScratchPad, DropDown
from libqtile.lazy import lazy from libqtile.lazy import lazy
from libqtile.utils import guess_terminal from libqtile.utils import guess_terminal
@@ -27,7 +27,7 @@ keys = [
Key([mod, "shift"], "Return",lazy.layout.toggle_split(),desc="Toggle between split and unsplit sides of stack",), Key([mod, "shift"], "Return",lazy.layout.toggle_split(),desc="Toggle between split and unsplit sides of stack",),
Key([mod], "Return", lazy.spawn(terminal), desc="Launch terminal"), Key([mod], "Return", lazy.spawn(terminal), desc="Launch terminal"),
Key([mod], "Tab", lazy.next_layout(), desc="Toggle between layouts"), Key([mod], "Tab", lazy.next_layout(), desc="Toggle between layouts"),
Key([mod], "q", lazy.window.kill(), desc="Kill focused window"), Key([mod, "shift"], "q", lazy.window.kill(), desc="Kill focused window"),
Key([mod], "f", lazy.window.toggle_fullscreen(), desc="Toggle fullscreen on the focused window",), Key([mod], "f", lazy.window.toggle_fullscreen(), desc="Toggle fullscreen on the focused window",),
Key([mod], "t", lazy.window.toggle_floating(), desc="Toggle floating on the focused window"), Key([mod], "t", lazy.window.toggle_floating(), desc="Toggle floating on the focused window"),
Key([mod, "control"], "r", lazy.reload_config(), desc="Reload the config"), Key([mod, "control"], "r", lazy.reload_config(), desc="Reload the config"),
@@ -62,20 +62,49 @@ for key, group in zip(group_keys, groups):
desc=f"Switch to & move focused window to group {group.name}") desc=f"Switch to & move focused window to group {group.name}")
]) ])
# Add layouts # nord color theme
nord = {
"polar_night_0": "#2E3440",
"polar_night_1": "#3B4252",
"polar_night_2": "#434C5E",
"polar_night_3": "#4C566A",
"snow_storm_0": "#D8DEE9",
"snow_storm_1": "#E5E9F0",
"snow_storm_2": "#ECEFF4",
"frost_0": "#8FBCBB",
"frost_1": "#88C0D0",
"frost_2": "#81A1C1",
"frost_3": "#5E81AC",
"aurora_red": "#BF616A",
"aurora_orange": "#D08770",
"aurora_yellow": "#EBCB8B",
"aurora_green": "#A3BE8C",
"aurora_purple": "#B48EAD",
}
# define layouts
layouts = [ layouts = [
layout.Spiral(margin=10, main_pane="left", new_client_position="after_current"), layout.MonadTall(
layout.Bsp(margin=10, lower_right=True), margin=10,
layout.MonadTall(margin=10), border_width=2,
# layout.Columns(border_focus_stack=["#d75f5f", "#8f3d3d"], border_width=4), layout.Max(), border_focus=nord["frost_0"],
# layout.Stack(num_stacks=2), border_normal=nord["polar_night_3"],
# layout.Matrix(), ),
# layout.MonadWide(), layout.Spiral(
# layout.RatioTile(), margin=10,
# layout.Tile(), border_width=2,
# layout.TreeTab(), border_focus=nord["frost_0"],
# layout.VerticalTile(), border_normal=nord["polar_night_3"],
# layout.Zoomy(), main_pane="left",
new_client_position="after_current",
),
layout.Bsp(
margin=10,
border_width=2,
border_focus=nord["frost_0"],
border_normal=nord["polar_night_3"],
lower_right=True,
),
] ]
widget_defaults = dict( widget_defaults = dict(
@@ -91,26 +120,114 @@ powerline = {
] ]
} }
# configure widgets
screens = [ screens = [
Screen( Screen(
# wallpaper
wallpaper="~/.local/share/wallpaper/wp.png", wallpaper="~/.local/share/wallpaper/wp.png",
wallpaper_mode="fill", wallpaper_mode="fill",
# top bar
top=bar.Bar( top=bar.Bar(
[ [
widget.CurrentLayoutIcon(background="111111", **powerline), # Groups
widget.GroupBox(background="111111", highlight_method='line', hide_unused=True, **powerline), widget.GroupBox(
widget.WindowName(background="000000", **powerline), background=nord["polar_night_1"],
widget.Wlan(background="333333", format="{ipaddr} {essid} {percent:2.0%}", interface="wlp0s20f3", **powerline), highlight_method='line',
widget.Volume(background="111111", fmt="{}", **powerline), inactive=nord["snow_storm_0"],
widget.Battery(background="222222", empty_char="󰂎", discharge_char="󱊢", charge_char="󰂄", full_char="󱊣", format="{char} {percent:2.0%}", **powerline), active=nord["snow_storm_2"],
widget.Clock(background="333333", format="󰃭 %a", **powerline), this_current_screen_border=nord["frost_2"],
widget.Clock(background="444444", format="%H:%M:%S", **powerline), this_screen_border=nord["frost_3"],
widget.QuickExit(background="666666", default_text=" 󰐥 ", countdown_format=" {} ", **powerline), hide_unused=True,
widget.StatusNotifier(background="000000", **powerline), **powerline
),
# Window Name
widget.WindowName(
background=nord["polar_night_2"],
foreground=nord["snow_storm_2"],
max_chars=60,
**powerline
),
# WLAN (click opens nm-applet)
widget.Wlan(
background=nord["polar_night_3"],
foreground=nord["frost_0"],
format="{essid} {percent:2.0%}",
interface="wlp0s20f3",
mouse_callbacks={"Button1": lambda: qtile.spawn("nm-connection-editor")},
**powerline
),
# Volume (click opens pavucontrol)
widget.Volume(
background=nord["polar_night_1"],
foreground=nord["frost_1"],
fmt="{}",
mouse_callbacks={"Button1": lambda: qtile.spawn("pavucontrol")},
**powerline
),
# Battery with condition-based icons
widget.Battery(
background=nord["polar_night_0"],
foreground=nord["aurora_yellow"],
format="{char} {percent:2.0%}",
charge_char="",
discharge_char="",
full_char="",
empty_char="",
update_interval=10,
show_short_text=False,
#mouse_callbacks={"Button1": lambda: qtile.spawn("xfce4-power-manager-settings")},
**powerline
),
# Date + Time
widget.Clock(
background=nord["polar_night_1"],
foreground=nord["snow_storm_1"],
format="󰃭 %a %d %b",
**powerline
),
widget.Clock(
background=nord["polar_night_2"],
foreground=nord["snow_storm_2"],
format="%H:%M",
**powerline
),
# System Tray
widget.StatusNotifier(
background=nord["polar_night_3"],
icon_size=16,
padding=10,
**powerline
),
# Quick Exit with style
widget.QuickExit(
background=nord["aurora_red"],
foreground=nord["snow_storm_2"],
default_text=" Power ",
countdown_format="{}s ",
countdown_start=3,
mouse_callbacks={
# Left: open wlogout GUI (recommended)
"Button1": lambda: qtile.spawn("wlogout"),
# Right: open a simple lock (see lock below)
"Button3": lambda: qtile.spawn("bash -lc \"$(which wlogout) || { echo 'wlogout missing'; }\""),
},
),
# Layout
widget.CurrentLayout(
background=nord["polar_night_0"],
foreground=nord["frost_2"],
mode="icon",
),
], ],
25, 30,
margin=[5, 10, 0, 5], # nice subtle spacing
opacity=0.9,
), ),
), ),
] ]