Update waybar style, scripts and config

This commit is contained in:
Brieuc Dubois 2024-02-18 12:45:44 +01:00
parent ea15b554d7
commit 09ec8a2a78
5 changed files with 48 additions and 41 deletions

View File

@ -6,7 +6,7 @@
// Choose the order of the modules // Choose the order of the modules
"modules-left": ["hyprland/workspaces"], "modules-left": ["hyprland/workspaces"],
"modules-center": ["hyprland/window"], "modules-center": ["hyprland/window"],
"modules-right": ["pulseaudio", "custom/VPN", "network", "custom/bandwidth", "cpu", "memory", "battery", "tray", "clock"], "modules-right": ["pulseaudio", "custom/VPN", "network", "custom/bandwidth", "cpu", "memory", "battery", "tray", "custom/notifications", "clock"],
"hyprland/workspaces": { "hyprland/workspaces": {
"disable-scroll": true, "disable-scroll": true,
"all-outputs": false, "all-outputs": false,
@ -54,7 +54,7 @@
}, },
"network": { "network": {
// "interface": "wlp2s0", // (Optional) To force the use of this interface // "interface": "wlp2s0", // (Optional) To force the use of this interface
"format-wifi": "{essid} ({signalStrength}) ", "format-wifi": "{essid} ({signalStrength}%) ",
"format-ethernet": "{ifname}: {ipaddr}/{cidr} ", "format-ethernet": "{ifname}: {ipaddr}/{cidr} ",
"format-disconnected": "Disconnected ⚠" "format-disconnected": "Disconnected ⚠"
}, },
@ -64,8 +64,9 @@
"custom/VPN": { "custom/VPN": {
"format": "{}", "format": "{}",
"interval": 5, "interval": 5,
"max-length": 20, "return-type": "json",
"exec": "$HOME/.config/waybar/scripts/vpn" "exec": "$HOME/.config/waybar/scripts/vpn",
"on-click": "$HOME/.config/waybar/scripts/vpn-toggle"
}, },
"pulseaudio": { "pulseaudio": {
//"scroll-step": 1, //"scroll-step": 1,
@ -83,11 +84,24 @@
}, },
"on-click": "pavucontrol" "on-click": "pavucontrol"
}, },
"custom/spotify": { "custom/notification": {
"format": " {}", "tooltip": false,
"max-length": 40, "format": "{icon}",
"interval": 30, // Remove this if your script is endless and write in loop "format-icons": {
"exec": "$HOME/.config/waybar/mediaplayer.sh 2> /dev/null", // Script in resources folder "notification": "<span foreground='red'><sup></sup></span>",
"exec-if": "pgrep spotify" "none": "",
} "dnd-notification": "<span foreground='red'><sup></sup></span>",
"dnd-none": "",
"inhibited-notification": "<span foreground='red'><sup></sup></span>",
"inhibited-none": "",
"dnd-inhibited-notification": "<span foreground='red'><sup></sup></span>",
"dnd-inhibited-none": ""
},
"return-type": "json",
"exec-if": "which swaync-client",
"exec": "swaync-client -swb",
"on-click": "swaync-client -t -sw",
"on-click-right": "swaync-client -d -sw",
"escape": true
},
} }

View File

@ -44,7 +44,7 @@ def main():
num_left = "<span font='NotoSansMono'>" num_left = "<span font='NotoSansMono'>"
num_right = "</span>" num_right = "</span>"
fmt_str = ( fmt_str = (
f"{rx_icon}{num_left}{{rx}}{{unit_suffix}}{num_right} " f"{num_left}{{rx}}{{unit_suffix}} {rx_icon}{num_right} "
f"{tx_icon}{num_left}{{tx}}{{unit_suffix}}{num_right}" f"{tx_icon}{num_left}{{tx}}{{unit_suffix}}{num_right}"
) )
unit_suffix = "" unit_suffix = ""

View File

@ -2,11 +2,11 @@
# Check if wireguard VPN is active # Check if wireguard VPN is active
if nmcli c show --active | grep -q wireguard; then if nmcli c show --active | grep -q wireguard; then
echo "" echo '{"text": "VPN", "class": "up"}'
# If not, check if the connection named "YapiBiche" is active # If not, check if the connection named "YapiBiche" is active
elif nmcli c show --active | grep -q "YapiBiche"; then elif nmcli c show --active | grep -q "YapiBiche"; then
echo "" echo '{"text": "LAN", "class": "up"}'
# If neither is active, return "NO" # If neither is active, return "NO"
else else
echo "" echo '{"text": "OFF", "class": "down"}'
fi fi

View File

@ -0,0 +1,11 @@
#!/usr/bin/env sh
env SUDO_ASKPASS=/usr/bin/lxqt-openssh-askpass
if nmcli c show --active | grep -q wireguard; then
sudo -A wg-quick down bxl-shp
notify-send "VPN bxl-shp DOWN"
else
sudo -A wg-quick up bxl-shp
notify-send "VPN bxl-shp UP"
fi

View File

@ -39,23 +39,22 @@ window#waybar {
border-bottom: 3px solid white; border-bottom: 3px solid white;
} }
#clock, #battery, #cpu, #memory, #network, #pulseaudio, #custom-spotify, #tray, #mode { #clock, #battery, #cpu, #memory, #network, #pulseaudio, #custom-spotify, #tray, #mode, #custom-VPN, #custom-bandwidth {
padding: 0 3px; padding: 0 3px;
margin: 0 2px; margin: 0 2px;
border-left: 1px solid #999;
} }
#clock { #clock {
font-weight: bold; font-weight: bold;
} }
#battery {
}
#battery icon { #battery icon {
color: red; color: red;
} }
#battery.charging { #battery.charging {
color: orange;
} }
@keyframes blink { @keyframes blink {
@ -74,29 +73,12 @@ window#waybar {
animation-direction: alternate; animation-direction: alternate;
} }
#cpu { #custom-VPN {
/*padding: 5px 10px;*/
} }
#memory { #custom-VPN.down, #network.disconnected {
} border-radius: 5px;
background-color: #f33;
#network {
}
#network.disconnected {
background: #f53c3c;
}
#pulseaudio {
}
#pulseaudio.muted {
}
#custom-spotify {
color: rgb(102, 220, 105);
}
#tray {
} }