[feat] refactor

This commit is contained in:
jay
2023-03-04 17:45:19 +08:00
parent 69b457fa02
commit ce24cd5e38
36 changed files with 6 additions and 0 deletions
+177
View File
@@ -0,0 +1,177 @@
// vim: set ft=jsonc:
{
// "layer": "top", // Waybar at top layer
"position": "top", // Waybar position (top|bottom|left|right)
"height": 30, // Waybar height (to be removed for auto height)
// "width": 1280, // Waybar width
"spacing": 2, // Gaps between modules (4px)
// Choose the order of the modules
"modules-left": ["sway/workspaces", "sway/mode", "sway/window"],
"modules-center": [],
"modules-right": [
"idle_inhibitor",
"custom/sep",
"custom/pipewire",
"custom/sep",
"network",
"custom/sep",
"cpu",
"custom/sep",
"memory",
"custom/sep",
"disk",
"custom/sep",
"temperature",
"custom/sep",
"backlight",
"custom/sep",
"keyboard-state",
"custom/sep",
"battery",
"custom/sep",
"clock",
"custom/sep",
"tray"
],
// Modules configuration
"custom/sep": {
"format": "|",
"interval": "once",
"tooltip": false
},
"custom/pipewire": {
"exec": "/home/jay/bin/get-volume.sh",
"interval": "once",
"return-type": "json",
"signal": 8,
"format": "{icon} {percentage}%",
"format-icons": {
"mute": "",
"default": ["", "", ""]
},
"on-click": "pavucontrol"
},
"sway/window": {
"max-length": 40
},
"sway/workspaces": {
"disable-scroll": true,
// "all-outputs": true,
// "persistent_workspaces": {
// "1": [],
// "2": [],
// "3": [],
// "4": [],
// "5": [],
// "6": [],
// "7": [],
// "8": [],
// "9": [],
// "10": [],
// },
// "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}"
},
"idle_inhibitor": {
"format": "{icon}",
"format-icons": {
"activated": "",
"deactivated": ""
}
},
"tray": {
// "icon-size": 21,
"spacing": 10,
"show-passive-items": true
},
"clock": {
// "timezone": "America/New_York",
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
"format": "{:%Y-%m-%d %H:%M:%S}",
"format-alt": "{:%Y-%m-%d}",
"interval": 1
},
"cpu": {
"format": " {usage}%({load})",
"interval": 2,
"tooltip": false
},
"memory": {
"interval": 10,
"format": " {used}G/{total}G",
"tooltip-format": "{percentage}% used"
},
"temperature": {
// "thermal-zone": 2,
"hwmon-path": "/sys/class/hwmon/hwmon5/temp1_input",
"critical-threshold": 80,
// "format-critical": "{temperatureC}°C {icon}",
"format": " {temperatureC}°C",
"format-icons": ["", "", ""]
},
"backlight": {
// "device": "acpi_video1",
"format": "{icon} {percent}%",
"format-icons": ["", "", "", "", "", "", "", "", ""]
},
"battery": {
"states": {
// "good": 95,
"warning": 30,
"critical": 15
},
"format": "{capacity}% {icon}",
"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}"
},
"disk": {
"interval": 30,
"path": "/",
"format": " {used}/{total}"
},
}
@@ -0,0 +1,11 @@
#!/bin/bash
CONFIG_FILES="$HOME/.config/waybar/config $HOME/.config/waybar/style.css"
trap "killall waybar" EXIT
while true; do
waybar &
inotifywait -e create,modify $CONFIG_FILES
killall waybar
done
+99
View File
@@ -0,0 +1,99 @@
* {
font-family: "Ubuntu Mono Nerd Font";
font-size: 13px;
min-height: 0;
}
window#waybar {
/* background: transparent; */
/* background: black; */
background: rgba(40, 44, 52, 0.85);
color: white;
border: 1px solid #8fd4ff;
border-radius: 5px;
}
#window {
font-family: "Ubuntu Mono";
padding: 0 5px;
border: 1px solid #8fd4ff;
border-radius: 5px;
}
window#waybar.empty #window {
padding: 0px;
margin: 0px;
border: 0px;
/* background-color: rgba(66,66,66,0.5); */ /* transparent */
background-color: transparent;
}
#workspaces button {
color: gray;
/* border: 1px solid #8fd4ff; */
/* border-radius: 5px; */
}
#workspaces button.focused {
color: white;
border: 1px solid #8fd4ff;
border-radius: 5px;
}
#tray,
#custom-japan,
#custom-germany,
#temperature,
#clock,
#battery,
#cpu,
#memory,
#network,
#pulseaudio {
padding: 0 5px;
margin-right: 5px;
margin-top: 5px;
margin-bottom: 5px;
}
#temperature.critical {
color: #b62d66;
}
#battery icon {
color: #b62d66;
}
#battery.charging {
border-bottom: 1px dotted #8fd4ff;
}
@keyframes blink {
to {
background-color: #8fd4ff;
color: black;
}
}
#battery.warning:not(.charging) {
color: white;
animation-name: blink;
animation-duration: 2s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
border-radius: 5px;
}
#battery.warning:not(.charging) {
color: white;
animation-name: blink;
animation-duration: 1s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
border-radius: 5px;
}
#network.disconnected {
color: #b62d66;
}