power menu, redshift, polybar

This commit is contained in:
azpsen
2024-01-28 16:37:10 -06:00
parent 89516a6ce1
commit 319b44ecbd
307 changed files with 7642 additions and 5 deletions

View File

@@ -0,0 +1,26 @@
# Script: vpn-wireguard-wg
A script that shows the status of a chosen Wireguard connection.
![vpn-wireguard-wg](screenshots/1.png)
![vpn-wireguard-wg](screenshots/2.png)
## Configuration
You have to add the `wg` and `wg-quick` command to the `/etc/sudoers` NOPASSWD of your user:
```ini
user ALL=(ALL) NOPASSWD: /usr/bin/wg
user ALL=(ALL) NOPASSWD: /usr/bin/wg-quick
```
## Module
```ini
[module/vpn-wireguard-wg]
type = custom/script
exec = ~/polybar-scripts/vpn-wireguard-wg.sh
interval = 5
click-left = ~/polybar-scripts//vpn-wireguard-wg.sh --toggle &
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -0,0 +1,37 @@
#!/bin/sh
connection_status() {
if [ -f "$config" ]; then
connection=$(sudo wg show "$config_name" 2>/dev/null | head -n 1 | awk '{print $NF }')
if [ "$connection" = "$config_name" ]; then
echo "1"
else
echo "2"
fi
else
echo "3"
fi
}
config="$HOME/wg/wireguard.conf"
config_name=$(basename "${config%.*}")
case "$1" in
--toggle)
if [ "$(connection_status)" = "1" ]; then
sudo wg-quick down "$config" 2>/dev/null
else
sudo wg-quick up "$config" 2>/dev/null
fi
;;
*)
if [ "$(connection_status)" = "1" ]; then
echo "#1 $config_name"
elif [ "$(connection_status)" = "3" ]; then
echo "#3 Config not found!"
else
echo "#2 down"
fi
;;
esac