mirror of
https://github.com/starr-dusT/dotfiles.git
synced 2025-02-19 19:27:31 -08:00
fix script for toggling vpn
This commit is contained in:
parent
07ef08868d
commit
ac95f2128f
9
home/bin/executable_linux-toggle-vpn
Normal file
9
home/bin/executable_linux-toggle-vpn
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
if [ -f ~/.wg0 ]; then
|
||||||
|
sudo systemctl stop wg-quick-wg0.service
|
||||||
|
rm ~/.wg0
|
||||||
|
else
|
||||||
|
sudo systemctl restart wg-quick-wg0.service
|
||||||
|
touch ~/.wg0
|
||||||
|
fi
|
@ -127,7 +127,6 @@ mode utility {
|
|||||||
bindsym q exit
|
bindsym q exit
|
||||||
bindsym r reload
|
bindsym r reload
|
||||||
bindsym g exec "~/.config/sway/scripts/gamemode.sh", $e
|
bindsym g exec "~/.config/sway/scripts/gamemode.sh", $e
|
||||||
bindsym v exec "~/.config/sway/scripts/toggle-vpn.sh {{ .hostname }}", $e
|
|
||||||
bindsym Escape mode default
|
bindsym Escape mode default
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,11 +44,11 @@ txmb=$(echo "scale = 1; $tx / 1280000" | bc | awk '{printf "%05.1f\n", $0}')
|
|||||||
rxmb=$(echo "scale = 1; $rx / 1280000" | bc | awk '{printf "%05.1f\n", $0}')
|
rxmb=$(echo "scale = 1; $rx / 1280000" | bc | awk '{printf "%05.1f\n", $0}')
|
||||||
|
|
||||||
# Vpn status
|
# Vpn status
|
||||||
vpn=$(nmcli c show --active | grep wireguard | cut -d ' ' -f1)
|
if [ -f ~/.wg0 ] ; then
|
||||||
if $vpn ; then
|
vpn="wg0"
|
||||||
|
else
|
||||||
vpn="none"
|
vpn="none"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#<span foreground='#c16b26'>lel</span>
|
#<span foreground='#c16b26'>lel</span>
|
||||||
echo -e "👍 $txmb 👎 $rxmb | 📡 $vpn | ⬆️ $uptime_formatted | 🔉<span foreground='$volume_color'>$volume%</span> | $gamemode | 🐧 $linux_version | $date_formatted "
|
echo -e "👍 $txmb 👎 $rxmb | 📡 $vpn | ⬆️ $uptime_formatted | 🔉<span foreground='$volume_color'>$volume%</span> | $gamemode | 🐧 $linux_version | $date_formatted "
|
||||||
|
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
cons=$(nmcli -t -f NAME c show --active | grep $1)
|
|
||||||
if [ $cons ]; then
|
|
||||||
nmcli c down $1 1> /dev/null
|
|
||||||
else
|
|
||||||
nmcli c up $1 1> /dev/null
|
|
||||||
fi
|
|
@ -59,21 +59,6 @@
|
|||||||
extraGroups = [ "dialout" "wheel" "docker" "libvirtd" ]; # Enable ‘sudo’ for the user.
|
extraGroups = [ "dialout" "wheel" "docker" "libvirtd" ]; # Enable ‘sudo’ for the user.
|
||||||
};
|
};
|
||||||
|
|
||||||
# Allow users to start/stop wireguard vpn
|
|
||||||
security.sudo.extraRules = [{
|
|
||||||
commands = [
|
|
||||||
{
|
|
||||||
command = "${pkgs.systemc}/bin/systemctl restart wg-quick-wg0";
|
|
||||||
options = [ "NOPASSWD" ];
|
|
||||||
}
|
|
||||||
{
|
|
||||||
command = "${pkgs.systemc}/bin/systemctl stop wg-quick-wg0";
|
|
||||||
options = [ "NOPASSWD" ];
|
|
||||||
}
|
|
||||||
];
|
|
||||||
groups = [ "wheel" ];
|
|
||||||
}];
|
|
||||||
|
|
||||||
# List packages installed in system profile.
|
# List packages installed in system profile.
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
# One-off stable packages
|
# One-off stable packages
|
||||||
|
Loading…
x
Reference in New Issue
Block a user