Having an issue creating a custom waybar vpn module. Haven't scripted in 30 years. #3569
-
So, waybar made me curious again. Thing is, I have a custom VPN module that when left clicked, it runs a vpn command as a user (no sudo), and when right clicked it runs a sigterm command to a few different services to make sure that it has actually gone down and resets the connection. Now, I have a format icon set as one character, and a format-alt set as another. I really wish that when I click on it, it doesn't change the format character until it has connected succesfully, and if it disconnects, it should change to the disconnect character
What I'd like is
If I left click it, the format will change from unlocked to locked and vice versa. However, it does not remain in the locked state if I click on it, so I figured maybe if I grep|sed|awk ( something something /dev/tun0 instead of a dynamic ip ) the status of the command, it would return to the state that it's actually in (for example not running= unlocked character). Running = locked character Many thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
So I've at least gotten the connection status to echo it's output using ip add show | grep -q tun0 && echo Connected || echo Disconnected Now for the hard part for me, maybe a format character isn't the best option (even though it's what I want.) Perhaps a toggle switch.. Any ideas? |
Beta Was this translation helpful? Give feedback.
-
So, I sort of get it working
Format icon is always in the unlocked state though. I will try to see where I go wrong. |
Beta Was this translation helpful? Give feedback.
-
Solved!
Style accordingly. |
Beta Was this translation helpful? Give feedback.
Solved!
Style accordingly.