first commit

This commit is contained in:
CGH0S7
2025-12-11 14:43:01 +08:00
commit 38c7f59409
4 changed files with 539 additions and 0 deletions

209
waybar/config.jsonc Normal file
View File

@@ -0,0 +1,209 @@
// -*- 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)
// "width": 1280, // Waybar width
"spacing": 4, // Gaps between modules (4px)
// Choose the order of the modules
"modules-left": [
"sway/workspaces",
"sway/mode",
"sway/scratchpad"
// "custom/media"
],
"modules-center": [
"sway/window"
],
"modules-right": [
"mpd",
"idle_inhibitor",
"pulseaudio",
"network",
// "power-profiles-daemon",
"cpu",
"memory",
"temperature",
"backlight",
// "keyboard-state",
// "sway/language",
// "battery#bat2",
"tray",
"battery",
"clock"
// "custom/power"
],
// Modules configuration
// "sway/workspaces": {
// "disable-scroll": true,
// "all-outputs": true,
// "warp-on-scroll": false,
// "format": "{name}: {icon}",
// "format-icons": {
// "1": "",
// "2": "",
// "3": "",
// "4": "",
// "5": "",
// "urgent": "",
// "focused": "",
// "default": ""
// }
// },
"keyboard-state": {
"numlock": true,
"capslock": true,
"format": "{name} {icon}",
"format-icons": {
"locked": "",
"unlocked": ""
}
},
"sway/mode": {
"format": "<span style=\"italic\">{}</span>"
},
"sway/scratchpad": {
"format": "{icon} {count}",
"show-empty": false,
"format-icons": ["", ""],
"tooltip": true,
"tooltip-format": "{app}: {title}"
},
"mpd": {
"format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) ⸨{songPosition}|{queueLength}⸩ {volume}% ",
"format-disconnected": "Disconnected ",
"format-stopped": "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped ",
"unknown-tag": "N/A",
"interval": 5,
"consume-icons": {
"on": " "
},
"random-icons": {
"off": "<span color=\"#f53c3c\"></span> ",
"on": " "
},
"repeat-icons": {
"on": " "
},
"single-icons": {
"on": "1 "
},
"state-icons": {
"paused": "",
"playing": ""
},
"tooltip-format": "MPD (connected)",
"tooltip-format-disconnected": "MPD (disconnected)"
},
"idle_inhibitor": {
"format": "{icon}",
"format-icons": {
"activated": "",
"deactivated": ""
}
},
"tray": {
// "icon-size": 21,
"spacing": 10,
"icons": {
"blueman": "bluetooth"
// "TelegramDesktop": "$HOME/.local/share/icons/hicolor/16x16/apps/telegram.png"
}
},
"clock": {
// "timezone": "America/New_York",
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
"format-alt": "{:%Y-%m-%d}"
},
"cpu": {
"format": "{usage}% ",
"tooltip": false
},
"memory": {
"format": "{}% "
},
"temperature": {
// "thermal-zone": 2,
// "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input",
"critical-threshold": 80,
// "format-critical": "{temperatureC}°C {icon}",
"format": "{temperatureC}°C {icon}",
"format-icons": ["", "", ""]
},
"backlight": {
// "device": "acpi_video1",
"format": "{percent}% {icon}",
"format-icons": ["", "", "", "", "", "", "", "", ""]
},
"battery": {
"states": {
// "good": 95,
"warning": 30,
"critical": 15
},
"format": "{capacity}% {icon}",
"format-full": "{capacity}% {icon}",
// "format-charging": "{capacity}% ",
"format-charging": "{capacity}% ",
"format-plugged": "{capacity}% ",
"format-alt": "{time} {icon}",
// "format-good": "", // An empty format will hide the module
// "format-full": "",
"format-icons": ["", "", "", "", ""]
},
// "battery#bat2": {
// "bat": "BAT2"
// },
"network": {
// "interface": "wlp2*", // (Optional) To force the use of this interface
"format-wifi": "{essid} ({signalStrength}%) ",
"format-ethernet": "{ipaddr}/{cidr} ",
"tooltip-format": "{ifname} via {gwaddr} ",
"format-linked": "{ifname} (No IP) ",
"format-disconnected": "Disconnected ⚠",
"format-alt": "{ifname}: {ipaddr}/{cidr}"
},
"pulseaudio": {
// "scroll-step": 1, // %, can be a float
"format": "{volume}% {icon} {format_source}",
"format-bluetooth": "{volume}% {icon} {format_source}",
"format-bluetooth-muted": " {icon} {format_source}",
"format-muted": " {format_source}",
"format-source": "{volume}% ",
"format-source-muted": "",
"format-icons": {
"headphone": "",
"hands-free": "",
"headset": "",
"phone": "",
"portable": "",
"car": "",
"default": ["", "", ""]
},
"on-click": "pavucontrol"
},
"custom/media": {
"format": "{icon} {text}",
"return-type": "json",
"max-length": 40,
"format-icons": {
"spotify": "",
"default": "🎜"
},
"escape": true,
// "exec": "$HOME/.config/waybar/mediaplayer.py 2> /dev/null" // Script in resources folder
// "exec": "$HOME/.config/waybar/mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name
},
"custom/power": {
"format" : "⏻ ",
"tooltip": false,
"menu": "on-click",
"menu-file": "$HOME/.config/waybar/power_menu.xml", // Menu file in resources folder
"menu-actions": {
"shutdown": "sudo poweroff",
"reboot": "sudo reboot",
"suspend": "sudo zzz",
// "hibernate": "systemctl hibernate"
}
}
}

66
waybar/style.css Normal file
View File

@@ -0,0 +1,66 @@
* {
border: none;
border-radius: 0;
/* 设置全局字体,确保图标显示正常 */
font-family: "Maple Mono NF CN", "Font Awesome 7 Free", "Font Awesome 7 Brands", "FontAwesome", 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;
transition-property: background-color;
transition-duration: .5s;
}
/* 当 Bar 变得隐形时的样式(如果配置了自动隐藏模式) */
window#waybar.hidden {
opacity: 0.2;
}
/* --- 模块样式 --- */
#workspaces button {
padding: 0 5px;
background-color: transparent;
color: #ffffff;
}
#workspaces button.focused {
background-color: #64727D;
box-shadow: inset 0 -3px #ffffff;
}
/* 给各个模块加一点边距和背景色,让它们看起来像“胶囊” */
#clock,
#battery,
#cpu,
#memory,
#disk,
#temperature,
#backlight,
#network,
#pulseaudio,
#tray,
#mode,
#idle_inhibitor {
padding: 0 10px;
margin: 4px 2px;
color: #ffffff;
background-color: rgba(255, 255, 255, 0.1); /* 模块自己的半透明背景 */
border-radius: 10px; /* 圆角 */
}
/* 针对电量低的情况变色 */
#battery.charging, #battery.plugged {
color: #26A65B;
background-color: rgba(38, 166, 91, 0.2);
}
#battery.warning:not(.charging) {
background-color: #ff5d43;
color: black;
}