From 664390cc83ff9baba241949783be8b7b9faae02d Mon Sep 17 00:00:00 2001 From: Simon Cornet Date: Sat, 30 Mar 2024 13:34:41 +0100 Subject: [PATCH] [waybar] small improvements --- apps/hyprland/hypridle.sh | 30 ++++++++++++++++++++++++++++++ apps/waybar/style.css | 5 +++++ apps/waybar/waybar.conf | 10 +++++++++- apps/wireguard/wireguard.sh | 4 ++-- 4 files changed, 46 insertions(+), 3 deletions(-) create mode 100755 apps/hyprland/hypridle.sh diff --git a/apps/hyprland/hypridle.sh b/apps/hyprland/hypridle.sh new file mode 100755 index 0000000..d1d0b47 --- /dev/null +++ b/apps/hyprland/hypridle.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env zsh + + +# function to toggle hypridle +function toggle () { + if pgrep "hypridle" > /dev/null + then + pkill hypridle + notify-send -u normal -t 4500 "🙈 Hypridle Inactive" + else + hypridle & + notify-send -u normal -t 4500 "🙊 Hypridle Active" + fi +} + +# main function +case $1 in + toggle) + toggle + ;; + *) + if pgrep "hypridle" > /dev/null + then + icon="🙊" + else + icon="🙈" + fi + printf "%s" "$icon" + ;; +esac diff --git a/apps/waybar/style.css b/apps/waybar/style.css index b10c1bf..e0d4020 100644 --- a/apps/waybar/style.css +++ b/apps/waybar/style.css @@ -26,6 +26,7 @@ tooltip { #network, #pulseaudio, #workspaces, +#custom-hypridle, #custom-wireguard, #tray, #window { @@ -54,6 +55,10 @@ tooltip { color: #a6e3a1; } +#custom-hypridle { + color: #89b4fa; +} + #custom-wireguard { color: #89b4fa; } diff --git a/apps/waybar/waybar.conf b/apps/waybar/waybar.conf index c1149b5..65a6b5f 100644 --- a/apps/waybar/waybar.conf +++ b/apps/waybar/waybar.conf @@ -22,8 +22,9 @@ "modules-right": [ "custom/spotify", "tray", - "network", + "custom/hypridle", "custom/wireguard", + "network", "battery", "backlight", "pulseaudio", @@ -69,6 +70,13 @@ "tooltip-format": "{calendar}" }, + "custom/hypridle": { + "interval": 2, + "format": "{}", + "exec": "$HOME/.dotfiles/apps/hyprland/hypridle.sh", + "on-click": "$HOME/.dotfiles/apps/hyprland/hypridle.sh toggle" + }, + "custom/wireguard": { "interval": 2, "format": "{}", diff --git a/apps/wireguard/wireguard.sh b/apps/wireguard/wireguard.sh index b513218..c140eec 100755 --- a/apps/wireguard/wireguard.sh +++ b/apps/wireguard/wireguard.sh @@ -13,14 +13,14 @@ status_vpn () { if echo "$tailscale_status" | grep "$hostname_short" &> /dev/null; then vpn_status+='🔒 ' else - vpn_status+='🛡️ ' + vpn_status+='🔓 ' fi # check for direct connectivity if "$tailscale_bin" status | grep allegro | grep direct &> /dev/null; then vpn_status+='✅' else - vpn_status+='❌' + vpn_status+='⚠️' fi echo "$vpn_status"