style(waybar): reorganize configs, tidy up code

Reorganize Waybar config to make it more logically laid out, add explanatory comments, and in general make it easier for users to make their own changes.
This commit is contained in:
BluishHumility
2024-09-21 13:28:13 -04:00
parent c7b6aa4933
commit 04ebe23077
3 changed files with 77 additions and 75 deletions

View File

@@ -2,6 +2,5 @@
# #
# Read `man 5 sway` for a complete reference. # Read `man 5 sway` for a complete reference.
#
# user config directory # user config directory
include $HOME/.config/sway/config.d/* include $HOME/.config/sway/config.d/*

View File

@@ -1,41 +1,24 @@
// Global
{ {
"layer": "top", "layer": "top", // Waybar at top layer
"position": "top", "position": "top", // Waybar position (top|bottom|left|right)
// "height": 30, // Auto-height is used when commented
// "width": 1280, // Full screen width when commented
"spacing": 10, // Gaps between modules (in px)
// See `man waybar` for more configuration options
// If height property would be not present, it'd be calculated dynamically // Configuration - modules-left
"height": 30,
"modules-left": [ "modules-left": [
"custom/launcher", "custom/launcher",
"sway/workspaces", "sway/workspaces",
"sway/mode", "sway/mode",
"sway/window", "sway/window"
], ],
"modules-center": [
"network",
],
"modules-right": [
"custom/keyboard-layout",
"idle_inhibitor",
"cpu",
"memory",
"backlight",
"pulseaudio",
"battery",
"clock",
"tray",
"custom/power",
],
// Modules
"custom/launcher": { "custom/launcher": {
"format":"<span size='x-large'></span>", "format":"<span size='x-large'></span>",
"on-click": "exec fuzzel", "on-click": "exec fuzzel",
"tooltip": false, "tooltip": false
}, },
"sway/workspaces": { "sway/workspaces": {
@@ -62,19 +45,50 @@
"max-length": 120 "max-length": 120
}, },
// Configuration - modules-center
"modules-center": [
"network"
],
"network": { "network": {
"format-disabled": " Disabled ", "format-disabled": " Disabled",
"format-wifi": " {bandwidthDownBits:>} 󰶡 {bandwidthUpBits:>} 󰶣 ", "format-wifi": " {bandwidthDownBits:>} 󰶡 {bandwidthUpBits:>} 󰶣",
"tooltip-format-wifi": "{essid}", "tooltip-format-wifi": "{essid}",
"format-ethernet": "󰈀 {bandwidthDownBits:>} 󰶡 {bandwidthUpBits:>} 󰶣 ", "format-ethernet": "󰈀 {bandwidthDownBits:>} 󰶡 {bandwidthUpBits:>} 󰶣",
"tooltip-format-ethernet": "{ifname}: {ipaddr}/{cidr}", "tooltip-format-ethernet": "{ifname}: {ipaddr}/{cidr}",
"format-disconnected": " Disconnected ", "format-disconnected": " Disconnected",
"on-click": "footclient -T waybar_nmtui -e nmtui", "on-click": "footclient -T waybar_nmtui -e nmtui",
"interval": 2, "interval": 2,
}, },
// Configuration - modules-right
"modules-right": [
"custom/keyboard-layout",
"idle_inhibitor",
"cpu",
"memory",
"backlight",
"pulseaudio",
"battery",
"clock",
"tray",
"custom/power"
],
"custom/keyboard-layout": {
"exec": "i=$(swaymsg -t get_inputs); echo \"\"; echo \"$i\" | grep -m1 'xkb_active_layout_name' | cut -d '\"' -f4",
"format": "",
// Interval set only as a fallback; use signal to update the module more immediately
"interval": 30,
// See example config for sending signal to Waybar in ~/.config/sway/config.d/input
"signal": 1,
"on-click": "~/.config/waybar/scripts/keyhint.sh",
},
"idle_inhibitor": { "idle_inhibitor": {
"format": "{icon} ", "format": "{icon}",
"format-icons": { "format-icons": {
"activated": "", "activated": "",
"deactivated": "" "deactivated": ""
@@ -82,10 +96,20 @@
"tooltip-format-activated": "Idle Inhibitor Activated", "tooltip-format-activated": "Idle Inhibitor Activated",
"tooltip-format-deactivated": "Idle Inhibitor Deactivated" "tooltip-format-deactivated": "Idle Inhibitor Deactivated"
}, },
"cpu": {
"interval": 5,
"format": "{usage:>3}%",
"states": {
"warning": 70,
"critical": 90,
},
"on-click": "footclient -T waybar_htop -e htop",
},
"memory": { "memory": {
"interval": 5, "interval": 5,
"format": "{:>3}% ", "format": "{:>3}%",
"on-click": "footclient -T waybar_htop -e htop", "on-click": "footclient -T waybar_htop -e htop",
"states": { "states": {
"warning": 70, "warning": 70,
@@ -93,20 +117,18 @@
} }
}, },
"cpu": { "backlight": {
"interval": 5, "format": "{icon} {percent}%",
"format": "{usage:>3}% ", "format-icons": ["󰄰", "󰪞", "󰪟", "󰪠", "󰪡", "󰪢", "󰪣", "󰪤", "󰪥"],
"states": { "tooltip-format": "Backlight (Scroll): {percent:}%",
"warning": 70, "on-scroll-down": "brightnessctl -c backlight set 5%-",
"critical": 90, "on-scroll-up": "brightnessctl -c backlight set +5%"
},
"on-click": "footclient -T waybar_htop -e htop",
}, },
"pulseaudio": { "pulseaudio": {
"scroll-step": 2, "scroll-step": 2,
"format": "{icon} {volume}% ", "format": "{icon} {volume}%",
"format-muted":"󰝟 muted ", "format-muted":"󰝟 muted",
"format-icons": { "format-icons": {
"headphones": "", "headphones": "",
"handsfree": "", "handsfree": "",
@@ -119,33 +141,15 @@
"on-click": "pavucontrol" "on-click": "pavucontrol"
}, },
"custom/keyboard-layout": {
"exec": "i=$(swaymsg -t get_inputs); echo \"\"; echo \"$i\" | grep -m1 'xkb_active_layout_name' | cut -d '\"' -f4",
"format": " ",
// Interval set only as a fallback; use signal to update the module more immediately
"interval": 30,
// See example config for sending signal to Waybar in ~/.config/sway/config.d/input
"signal": 1,
"on-click": "~/.config/waybar/scripts/keyhint.sh",
},
"battery": { "battery": {
"states": { "states": {
"warning": 30, "warning": 30,
"critical": 15 "critical": 15
}, },
"format": "{icon} {capacity}% ", "format": "{icon} {capacity}%",
"format-icons": ["", "", "", "", ""] "format-icons": ["", "", "", "", ""]
}, },
"backlight": {
"format": "{icon} {percent}% ",
"format-icons": ["󰄰", "󰪞", "󰪟", "󰪠", "󰪡", "󰪢", "󰪣", "󰪤", "󰪥"],
"tooltip-format": "Backlight (Scroll): {percent:}%",
"on-scroll-down": "brightnessctl -c backlight set 5%-",
"on-scroll-up": "brightnessctl -c backlight set +5%"
},
"clock": { "clock": {
"interval": 10, "interval": 10,
"format": "󰅐 {:%H:%M}", "format": "󰅐 {:%H:%M}",

View File

@@ -68,7 +68,6 @@
#battery, #battery,
#backlight, #backlight,
#clock, #clock,
#custom-weather,
#tray { #tray {
padding:0.5rem 0.6rem; padding:0.5rem 0.6rem;
margin: 1px 0px; margin: 1px 0px;
@@ -121,6 +120,14 @@
color: orange; color: orange;
} }
#cpu.warning {
color: orange;
}
#cpu.critical {
color: red;
}
#memory { #memory {
animation-timing-function: linear; animation-timing-function: linear;
animation-iteration-count: infinite; animation-iteration-count: infinite;
@@ -139,12 +146,9 @@
padding-right:5px; padding-right:5px;
} }
#cpu.warning { #backlight.icon {
color: orange; padding-right:1px;
} font-size: 13px;
#cpu.critical {
color: red;
} }
#pulseaudio { #pulseaudio {
@@ -179,11 +183,6 @@
animation-duration: 2s; animation-duration: 2s;
} }
#backlight.icon {
padding-right:1px;
font-size: 13px;
}
#custom-power { #custom-power {
margin-left:15px; margin-left:15px;
margin-right:15px; margin-right:15px;