feat(waybar): drop eww and simplify components
This commit is contained in:
@@ -11,12 +11,10 @@
|
||||
],
|
||||
"modules-center": [
|
||||
"custom/ssh",
|
||||
"custom/notification",
|
||||
"systemd-failed-units"
|
||||
],
|
||||
"modules-right": [
|
||||
"mpris",
|
||||
"custom/vpn",
|
||||
"cpu",
|
||||
"memory",
|
||||
"battery",
|
||||
@@ -25,7 +23,7 @@
|
||||
"backlight",
|
||||
"sway/language",
|
||||
"bluetooth",
|
||||
"network",
|
||||
"custom/network",
|
||||
"clock"
|
||||
],
|
||||
|
||||
@@ -40,8 +38,7 @@
|
||||
|
||||
"sway/language": {
|
||||
"format": "{short}",
|
||||
"on-click": "swaymsg input type:keyboard xkb_switch_layout next",
|
||||
"on-click-right": "~/.config/eww/scripts/popup.sh keyboard-popup"
|
||||
"on-click": "swaymsg input type:keyboard xkb_switch_layout next"
|
||||
},
|
||||
|
||||
"custom/ssh": {
|
||||
@@ -52,15 +49,6 @@
|
||||
"on-click": "~/.config/waybar/scripts/ssh-session.sh disconnect"
|
||||
},
|
||||
|
||||
"custom/notification": {
|
||||
"format": "{}",
|
||||
"return-type": "json",
|
||||
"exec": "~/.config/waybar/scripts/notification-status.sh",
|
||||
"on-click": "sleep 0.1 && swaync-client -t -sw",
|
||||
"on-click-right": "sleep 0.1 && swaync-client -d -sw",
|
||||
"escape": true
|
||||
},
|
||||
|
||||
"systemd-failed-units": {
|
||||
"hide-on-ok": true,
|
||||
"format": "!{nr_failed}",
|
||||
@@ -70,7 +58,6 @@
|
||||
"on-click": "ghostty -e sh -c 'systemctl --failed; systemctl --user --failed; read'"
|
||||
},
|
||||
|
||||
// right: media
|
||||
"mpris": {
|
||||
"format": "{artist} - {title}",
|
||||
"format-paused": "{artist} - {title} [paused]",
|
||||
@@ -78,53 +65,35 @@
|
||||
"max-length": 35,
|
||||
"tooltip-format": "{player}: {artist} - {title} ({album})",
|
||||
"on-click": "playerctl play-pause",
|
||||
"on-click-right": "~/.config/eww/scripts/popup.sh media-popup",
|
||||
"on-scroll-up": "playerctl next",
|
||||
"on-scroll-down": "playerctl previous"
|
||||
},
|
||||
|
||||
// right: connectivity
|
||||
"network": {
|
||||
"custom/network": {
|
||||
"format": "{}",
|
||||
"return-type": "json",
|
||||
"interval": 5,
|
||||
"format-ethernet": " {ipaddr}",
|
||||
"format-wifi": " {ipaddr}",
|
||||
"format-linked": " (no ip)",
|
||||
"format-disconnected": "",
|
||||
"tooltip-format": "{ifname} {ipaddr}/{cidr}\n{gwaddr}\n{bandwidthUpBits}up {bandwidthDownBits}down",
|
||||
"on-click-right": "~/.config/eww/scripts/popup.sh network-popup"
|
||||
"exec": "~/.config/waybar/scripts/network-status.sh"
|
||||
},
|
||||
|
||||
"bluetooth": {
|
||||
"format": "",
|
||||
"format-connected": " {num_connections}",
|
||||
"format-connected-battery": " {num_connections}",
|
||||
"tooltip-format-connected": "{device_enumerate}",
|
||||
"on-click-right": "~/.config/eww/scripts/popup.sh bluetooth-popup"
|
||||
"tooltip-format-connected": "{device_enumerate}"
|
||||
},
|
||||
|
||||
"custom/vpn": {
|
||||
"format": "{}",
|
||||
"return-type": "json",
|
||||
"interval": 10,
|
||||
"exec": "~/.config/waybar/scripts/vpn-status.sh",
|
||||
"on-click-right": "~/.config/eww/scripts/popup.sh vpn-popup"
|
||||
},
|
||||
|
||||
|
||||
"cpu": {
|
||||
"format": " {usage}%",
|
||||
"tooltip": false,
|
||||
"on-click-right": "~/.config/eww/scripts/popup.sh system-popup"
|
||||
"tooltip": false
|
||||
},
|
||||
|
||||
"memory": {
|
||||
"interval": 10,
|
||||
"format": " {percentage}%",
|
||||
"tooltip-format": "total: {total:0.2f}GiB\nused: {used:0.2f}GiB\navailable: {avail:0.2f}GiB\nswap: {swapUsed:0.2f}/{swapTotal:0.2f}GiB",
|
||||
"on-click-right": "~/.config/eww/scripts/popup.sh system-popup"
|
||||
"tooltip-format": "total: {total:0.2f}GiB\nused: {used:0.2f}GiB\navailable: {avail:0.2f}GiB\nswap: {swapUsed:0.2f}/{swapTotal:0.2f}GiB"
|
||||
},
|
||||
|
||||
// right: battery
|
||||
"battery": {
|
||||
"states": {
|
||||
"warning": 30,
|
||||
@@ -136,16 +105,13 @@
|
||||
"format-full": " full",
|
||||
"format-alt": "{time}",
|
||||
"tooltip-format": "{timeTo}\n{power}W",
|
||||
"on-click": "p=$(powerprofilesctl get); case $p in power-saver) n=balanced;; balanced) n=performance;; *) n=power-saver;; esac; powerprofilesctl set $n",
|
||||
"on-click-right": "~/.config/eww/scripts/popup.sh battery-popup"
|
||||
"on-click": "p=$(powerprofilesctl get); case $p in power-saver) n=balanced;; balanced) n=performance;; *) n=power-saver;; esac; powerprofilesctl set $n"
|
||||
},
|
||||
|
||||
// right: audio
|
||||
"wireplumber": {
|
||||
"format": " {volume}%",
|
||||
"format-muted": " muted",
|
||||
"on-click": "pamixer -t",
|
||||
"on-click-right": "~/.config/eww/scripts/popup.sh volume-popup",
|
||||
"on-scroll-up": "pamixer -i 5",
|
||||
"on-scroll-down": "pamixer -d 5",
|
||||
"tooltip-format": "{node_name}: {volume}%"
|
||||
@@ -157,18 +123,15 @@
|
||||
"interval": 2,
|
||||
"exec": "~/.config/waybar/scripts/mic-status.sh",
|
||||
"on-click": "pamixer --default-source -t",
|
||||
"on-click-right": "~/.config/eww/scripts/popup.sh volume-popup",
|
||||
"on-scroll-up": "pamixer --default-source -i 5",
|
||||
"on-scroll-down": "pamixer --default-source -d 5"
|
||||
},
|
||||
|
||||
"backlight": {
|
||||
"format": " {percent}%",
|
||||
"tooltip": false,
|
||||
"on-click-right": "~/.config/eww/scripts/popup.sh volume-popup"
|
||||
"tooltip": false
|
||||
},
|
||||
|
||||
// right: clock
|
||||
"clock": {
|
||||
"interval": 1,
|
||||
"format": "{:%d/%m %H:%M:%S}",
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# wrap swaync subscription, hide when no notifications
|
||||
|
||||
swaync-client -swb 2>/dev/null | while read -r line; do
|
||||
count=$(echo "$line" | jq -r '.text // "0"')
|
||||
class=$(echo "$line" | jq -r '.class // "none"')
|
||||
|
||||
if [[ "$count" == "0" ]]; then
|
||||
echo '{"text": "", "class": "none"}'
|
||||
else
|
||||
jq -nc --arg text " $count" --arg class "$class" '{$text,$class}'
|
||||
fi
|
||||
done
|
||||
@@ -1,40 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# check wireguard and tailscale status
|
||||
# outputs waybar JSON; empty when inactive
|
||||
|
||||
parts=()
|
||||
tooltip_parts=()
|
||||
|
||||
if command -v wg &>/dev/null; then
|
||||
ifaces=$(wg show interfaces 2>/dev/null)
|
||||
if [[ -n "$ifaces" ]]; then
|
||||
parts+=("")
|
||||
tooltip_parts+=("wireguard: $ifaces")
|
||||
fi
|
||||
fi
|
||||
|
||||
if command -v tailscale &>/dev/null; then
|
||||
ts_json=$(tailscale status --json 2>/dev/null)
|
||||
state=$(jq -r '.BackendState // empty' <<<"$ts_json")
|
||||
if [[ "$state" == "Running" ]]; then
|
||||
ts_ip=$(jq -r '.TailscaleIPs[0] // empty' <<<"$ts_json")
|
||||
ts_name=$(jq -r '.Self.HostName // empty' <<<"$ts_json")
|
||||
ts_exit=$(jq -r '.ExitNodeStatus.ID // empty' <<<"$ts_json")
|
||||
parts+=("")
|
||||
tip="tailscale: ${ts_name} ${ts_ip}"
|
||||
if [[ -n "$ts_exit" ]]; then
|
||||
tip="$tip (exit node)"
|
||||
fi
|
||||
tooltip_parts+=("$tip")
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ${#parts[@]} -gt 0 ]]; then
|
||||
text="${parts[*]}"
|
||||
tip=$(printf '%s\\n' "${tooltip_parts[@]}")
|
||||
# strip trailing \n
|
||||
tip=${tip%\\n}
|
||||
jq -nc --arg text "$text" --arg tooltip "$tip" --arg class "active" \
|
||||
'{$text,$class,$tooltip}'
|
||||
fi
|
||||
@@ -83,13 +83,12 @@ button:hover {
|
||||
#cpu,
|
||||
#memory,
|
||||
#backlight,
|
||||
#network,
|
||||
#wireplumber,
|
||||
#mpris,
|
||||
#bluetooth,
|
||||
#language,
|
||||
#custom-mic,
|
||||
#custom-vpn,
|
||||
#custom-network,
|
||||
#custom-ssh,
|
||||
#custom-notification,
|
||||
#systemd-failed-units {
|
||||
@@ -101,17 +100,12 @@ button:hover {
|
||||
}
|
||||
|
||||
/* center: alert zone */
|
||||
#custom-ssh {
|
||||
min-height: 0;
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
margin-top: 3px;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
#custom-ssh.active {
|
||||
color: @cyan;
|
||||
font-size: 10px;
|
||||
font-size: 18px;
|
||||
padding: 0 10px;
|
||||
margin-top: -2px;
|
||||
margin-bottom: -2px;
|
||||
}
|
||||
|
||||
#custom-notification.notification {
|
||||
@@ -153,7 +147,7 @@ button:hover {
|
||||
}
|
||||
|
||||
/* right: connectivity */
|
||||
#network.disconnected {
|
||||
#custom-network.disconnected {
|
||||
color: @red;
|
||||
}
|
||||
|
||||
@@ -161,10 +155,6 @@ button:hover {
|
||||
color: @blue;
|
||||
}
|
||||
|
||||
#custom-vpn {
|
||||
color: @cyan;
|
||||
}
|
||||
|
||||
/* right: system */
|
||||
#cpu {
|
||||
margin-right: 0;
|
||||
|
||||
Reference in New Issue
Block a user