From f1a212b4acebcb184d68876fb4a0921e9094c8ea Mon Sep 17 00:00:00 2001 From: CGH0S7 Date: Thu, 11 Dec 2025 15:52:44 +0800 Subject: [PATCH] sway theme updated --- config | 59 ++++++++++++- waybar/config.jsonc | 7 +- waybar/style.css | 206 ++++++++++++++++++++++++++++++++++++++------ 3 files changed, 244 insertions(+), 28 deletions(-) diff --git a/config b/config index 874ff7c..2ece1ea 100644 --- a/config +++ b/config @@ -24,6 +24,56 @@ set $term foot set $menu "rofi -show drun" set $browser firefox +# ... (previous config) + +### Appearance +# +# Gaps +gaps inner 10 +gaps outer 5 +smart_gaps on + +# Borders +default_border pixel 2 +default_floating_border pixel 2 +hide_edge_borders smart + +# Colors (Catppuccin Mocha Inspired) +set $rosewater #f5e0dc +set $flamingo #f2cdcd +set $pink #f5c2e7 +set $mauve #cba6f7 +set $red #f38ba8 +set $maroon #eba0ac +set $peach #fab387 +set $yellow #f9e2af +set $green #a6e3a1 +set $teal #94e2d5 +set $sky #89dceb +set $sapphire #74c7ec +set $blue #89b4fa +set $lavender #b4befe +set $text #cdd6f4 +set $subtext1 #bac2de +set $subtext0 #a6adc8 +set $overlay2 #9399b2 +set $overlay1 #7f849c +set $overlay0 #6c7086 +set $surface2 #585b70 +set $surface1 #45475a +set $surface0 #313244 +set $base #1e1e2e +set $mantle #181825 +set $crust #11111b + +# class border backgr. text indicator child_border +client.focused $mauve $base $text $rosewater $mauve +client.focused_inactive $overlay0 $base $text $rosewater $overlay0 +client.unfocused $overlay0 $base $text $rosewater $overlay0 +client.urgent $red $base $peach $overlay0 $red +client.placeholder $overlay0 $base $text $overlay0 $overlay0 +client.background $base + ### Output configuration # # Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/) @@ -102,7 +152,7 @@ input * xkb_options caps:escape_shifted_capslock floating_modifier $mod normal # Reload the configuration file - bindsym $mod+Shift+c reload + bindsym $mod+Shift+c exec pkill waybar && swaymsg reload # Exit sway (logs you out of your Wayland session) bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit' @@ -264,4 +314,11 @@ include /etc/sway/config.d/* exec --no-startup-id fcitx5 -d exec --no-startup-id brightnessctl set 2000 exec --no-startup-id /usr/libexec/pipewire-launcher +exec_always mako +# Idle configuration +exec swayidle -w \ + timeout 300 'swaylock -f -c 000000' \ + timeout 600 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' \ + before-sleep 'swaylock -f -c 000000' + seat * hide_cursor 5000 diff --git a/waybar/config.jsonc b/waybar/config.jsonc index 84d8024..32e4609 100644 --- a/waybar/config.jsonc +++ b/waybar/config.jsonc @@ -1,9 +1,12 @@ // -*- mode: jsonc -*- { // "layer": "top", // Waybar at top layer - // "position": "bottom", // Waybar position (top|bottom|left|right) - "height": 30, // Waybar height (to be removed for auto height) + "position": "top", // Waybar position (top|bottom|left|right) + // "height": 30, // Waybar height (to be removed for auto height) // "width": 1280, // Waybar width + "margin-top": 6, + "margin-left": 10, + "margin-right": 10, "spacing": 4, // Gaps between modules (4px) // Choose the order of the modules "modules-left": [ diff --git a/waybar/style.css b/waybar/style.css index 4859cc4..97c06f0 100644 --- a/waybar/style.css +++ b/waybar/style.css @@ -1,40 +1,105 @@ +@define-color base #1e1e2e; +@define-color mantle #181825; +@define-color crust #11111b; + +@define-color text #cdd6f4; +@define-color subtext0 #a6adc8; +@define-color subtext1 #bac2de; + +@define-color surface0 #313244; +@define-color surface1 #45475a; +@define-color surface2 #585b70; + +@define-color overlay0 #6c7086; +@define-color overlay1 #7f849c; +@define-color overlay2 #9399b2; + +@define-color blue #89b4fa; +@define-color lavender #b4befe; +@define-color sapphire #74c7ec; +@define-color sky #89dceb; +@define-color teal #94e2d5; +@define-color green #a6e3a1; +@define-color yellow #f9e2af; +@define-color peach #fab387; +@define-color maroon #eba0ac; +@define-color red #f38ba8; +@define-color mauve #cba6f7; +@define-color pink #f5c2e7; +@define-color flamingo #f2cdcd; +@define-color rosewater #f5e0dc; + * { border: none; border-radius: 0; - /* 设置全局字体,确保图标显示正常 */ - font-family: "Clear Sans", "Maple Mono NF CN", "Font Awesome 7 Free", "Font Awesome 7 Brands", "FontAwesome", Roboto, Helvetica, Arial, sans-serif; + font-family: "Maple Mono NF CN", "Font Awesome 7 Free", Roboto, Helvetica, Arial, sans-serif; font-size: 14px; min-height: 0; } -/* --- 核心:设置 Bar 的背景透明度 --- */ window#waybar { - /* rgba(红, 绿, 蓝, 透明度) */ - /* 0.5 表示半透明,0 表示全透明,1 表示不透明 */ - background-color: rgba(29, 31, 33, 0.7); - color: #ffffff; + background-color: transparent; + color: @text; transition-property: background-color; transition-duration: .5s; } -/* 当 Bar 变得隐形时的样式(如果配置了自动隐藏模式) */ window#waybar.hidden { opacity: 0.2; } -/* --- 模块样式 --- */ +/* Workspaces */ +#workspaces { + background-color: @surface1; + border-radius: 16px; + margin-top: 4px; + margin-bottom: 4px; + padding: 0px 6px; +} + #workspaces button { - padding: 0 5px; + padding: 0 10px; background-color: transparent; - color: #ffffff; + color: @text; + border-radius: 16px; + margin: 4px 0; +} + +#workspaces button:hover { + background-color: @surface2; + color: @text; } #workspaces button.focused { - background-color: #64727D; - box-shadow: inset 0 -3px #ffffff; + color: @base; + background-color: @mauve; } -/* 给各个模块加一点边距和背景色,让它们看起来像“胶囊” */ +#workspaces button.urgent { + color: @base; + background-color: @red; +} + +/* Window Title */ +#window { + background-color: transparent; + color: @text; + border-radius: 16px; + padding: 0 12px; + margin: 0 4px; + max-width: fit-content; /* Ensure it only takes needed width */ +} + +/* Modules Right - Grouped look */ +.modules-right { + margin-top: 4px; + margin-bottom: 4px; + /* background-color: @base; */ + border-radius: 16px; + padding: 0 2px; +} + +/* Individual Module Styling */ #clock, #battery, #cpu, @@ -45,22 +110,113 @@ window#waybar.hidden { #network, #pulseaudio, #tray, -#mode, +#mpd, #idle_inhibitor { - padding: 0 10px; - margin: 4px 2px; - color: #ffffff; - background-color: rgba(255, 255, 255, 0.1); /* 模块自己的半透明背景 */ - border-radius: 10px; /* 圆角 */ + padding: 0 12px; + margin: 0 4px; + color: @text; /* Changed to @text for better contrast with @surface1 and consistency */ + background-color: @surface1; /* Changed to @surface1 */ + border-radius: 16px; +} + +/* Specific Module Colors */ +#clock { + background-color: @mauve; + color: @base; + font-weight: bold; +} + +#battery { + background-color: @green; + color: @base; } -/* 针对电量低的情况变色 */ #battery.charging, #battery.plugged { - color: #26A65B; - background-color: rgba(38, 166, 91, 0.2); + background-color: @teal; + color: @base; } #battery.warning:not(.charging) { - background-color: #ff5d43; - color: black; + background-color: @peach; + color: @base; +} + +#battery.critical:not(.charging) { + background-color: @red; + color: @base; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} + +#cpu { + background-color: @sapphire; + color: @base; +} + +#memory { + background-color: @sky; + color: @base; +} + +#temperature { + background-color: @lavender; + color: @base; +} + +#temperature.critical { + background-color: @red; +} + +#backlight { + background-color: @yellow; + color: @base; +} + +#network { + background-color: @blue; + color: @base; +} + +#network.disconnected { + background-color: @overlay0; +} + +#pulseaudio { + background-color: @pink; + color: @base; +} + +#pulseaudio.muted { + background-color: @overlay0; + color: @subtext0; +} + +#tray { + background-color: @peach; + color: @surface0; +} + +#window.empty { + background-color: transparent; +} + +#mpd { + background-color: @surface1; + color: @text; +} + +#custom-power { + background-color: @red; + color: @base; + padding-right: 16px; +} + +@keyframes blink { + to { + background-color: @text; + color: @base; + } }