Hiding VPN Icon When There is No VPN #3931
-
Hi! I have a custom module made that shows me my VPN connection status and to bring up/down the VPN. This is working great on a system that does have a VPN. Here is the module:
Here is the script that's run by exec:
This is all working as expected. The VPN specifically I am using is from my workplace and it shows up on my system as vpn0. Therefore, I have an exec-if first that checks if vpn0 is available on the system. The reason I have that if statement is to try and hide the VPN icon all together if I'm on a system that doesn't have the VPN. However, even when I am on a system where that test -d in the exec-if returns 1 (meaning it's not there), the icon still shows up. I thought if exec-if is 1, then exec will not be executed at all, therefore nothing will be returned to format and therefore, no module since I have hide-empty-text set to true. However, it seems that exec is getting executed regardless of whether exec-if returns a 0 or a 1. Am I misunderstanding something? Any idea how I can make the module not work when it doesn't detect a VPN? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I was able to do a workaround by writing the actual check for the VPN in the script, then returning an empty text object if it's not there: ~/.config/waybar/scripts/vpn.sh
~/.config/waybar/config-jsonc
Now, the module is disappeared when I'm on the system that doesn't have the VPN, while still appearing and allowing me to connect/disconnect to the VPN on the system with the VPN. I would still like to know if my understanding of the exec-if was correct or not. As, I feel like the first implementation should have worked. Thanks! |
Beta Was this translation helpful? Give feedback.
I was able to do a workaround by writing the actual check for the VPN in the script, then returning an empty text object if it's not there:
~/.config/waybar/scripts/vpn.sh
~/.config/waybar/config-jsonc