mirror of
https://github.com/starr-dusT/dotfiles.git
synced 2025-02-18 10:47: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 r reload
|
||||
bindsym g exec "~/.config/sway/scripts/gamemode.sh", $e
|
||||
bindsym v exec "~/.config/sway/scripts/toggle-vpn.sh {{ .hostname }}", $e
|
||||
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}')
|
||||
|
||||
# Vpn status
|
||||
vpn=$(nmcli c show --active | grep wireguard | cut -d ' ' -f1)
|
||||
if $vpn ; then
|
||||
if [ -f ~/.wg0 ] ; then
|
||||
vpn="wg0"
|
||||
else
|
||||
vpn="none"
|
||||
fi
|
||||
|
||||
#<span foreground='#c16b26'>lel</span>
|
||||
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.
|
||||
};
|
||||
|
||||
# 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.
|
||||
environment.systemPackages = with pkgs; [
|
||||
# One-off stable packages
|
||||
|
Loading…
x
Reference in New Issue
Block a user