Generate file with available vpn tunnels for rofi
This commit is contained in:
@ -1,2 +0,0 @@
|
||||
de-115
|
||||
lu-16
|
@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env fish
|
||||
|
||||
# User chooses VPN server, running servers are marked in green
|
||||
set SERVERS (cat ~/NixFlake/config/rofi/menus/servers.txt) # TODO: This file should probably be generated by nix?
|
||||
set SERVERS (cat /etc/rofi-vpns) # TODO: This file should probably be generated by nix?
|
||||
set PROMPT ""
|
||||
for SERVER in $SERVERS
|
||||
set SERVER_RUNNING "$(systemctl list-units wg0-$SERVER.service | grep wg0-$SERVER.service)"
|
||||
set SERVER_RUNNING "$(systemctl list-units $SERVER.service | grep $SERVER.service)"
|
||||
if test -z $SERVER_RUNNING
|
||||
set PROMPT $PROMPT$SERVER"\n"
|
||||
else
|
||||
@ -25,7 +25,7 @@ if not contains $ACTION $ACTIONS
|
||||
end
|
||||
|
||||
# Enable wireguard netdev
|
||||
set COMMAND "systemctl $ACTION wg0-$SERVER.service"
|
||||
set COMMAND "systemctl $ACTION $SERVER.service"
|
||||
set EVAL_RESULT "$(eval $COMMAND)"
|
||||
|
||||
if test $ACTION = "status" && test -n "$EVAL_RESULT"
|
||||
@ -36,5 +36,5 @@ else if test $ACTION = "start"
|
||||
# NOTE: With a shared home directory, firejail uses the same instance, so it won't work to
|
||||
# launch multiple browsers with different VPNs...
|
||||
# firejail --noprofile --allusers --private="~/.firejail-home" --netns="wg0-$SERVER" chromium --incognito --new-window ipaddress.my &>/dev/null
|
||||
firejail --noprofile --private --netns="wg0-$SERVER" chromium --incognito --new-window ipaddress.my &>/dev/null
|
||||
firejail --noprofile --private --netns="$SERVER" chromium --incognito --new-window ipaddress.my &>/dev/null
|
||||
end
|
||||
|
Reference in New Issue
Block a user