Trying out IVPN

The client doesn't depend on systemd nor NetworkManager. Excellent for an Artix user like me!
Shoutout to Viktor from IVPN for the free trial (not sponsored)!
This commit is contained in:
the_4n0nym0u53 2021-12-14 17:31:14 +01:00
parent 3d2385fd1b
commit b90a360321
No known key found for this signature in database
GPG key ID: 35EE09F5481049BB
8 changed files with 36 additions and 29 deletions

View file

@ -20,12 +20,12 @@ This configuration depends on the following packages:
- `doas`\* - `doas`\*
- `git` - `git`
- `grimshot` - `grimshot`
- `ivpn` (daemon + CLI)
- `mako` - `mako`
- `neovim` - `neovim`
- `pavucontrol` - `pavucontrol`
- `pipewire` - `pipewire`
- `playerctl` - `playerctl`
- `protonvpn-cli-ng`
- `python` - `python`
- `stow` - `stow`
- `sway` - `sway`
@ -36,5 +36,5 @@ This configuration depends on the following packages:
\* If you prefer `sudo`, then change all instances of `doas` to `sudo`. They're mainly in the sway config file and in my `autostart.sh` script. \* If you prefer `sudo`, then change all instances of `doas` to `sudo`. They're mainly in the sway config file and in my `autostart.sh` script.
Also, you need to make a `doas`/`sudo` rule that allows you to execute `protonvpn`, `poweroff` and `reboot` without a password, otherwise the keybindings for those won't work. Also, you need to make a `doas`/`sudo` rule that allows you to execute `ivpn-service`, `poweroff` and `reboot` without a password, otherwise the keybindings for those won't work.

View file

@ -13,7 +13,7 @@ sleep 1
echo -e "Making scripts executable..." echo -e "Making scripts executable..."
chmod +x sway/.config/sway/autostart.sh chmod +x sway/.config/sway/autostart.sh
chmod +x waybar/.config/waybar/pvpn.sh chmod +x waybar/.config/waybar/ivpn.sh
chmod +x waybar/.config/waybar/mediaplayer.py chmod +x waybar/.config/waybar/mediaplayer.py
sleep 1 sleep 1

View file

@ -1,8 +1,9 @@
#!/bin/sh #!/bin/sh
# Replace doas with sudo below if you don't have doas. sleep 1
doas openvpn --config /etc/openvpn/client/dk.protonvpn.com.udp.ovpn --auth-user-pass /root/ovpn_creds.txt &
sleep 5 # Wait for Waybar to fully load ivpn connect -ipv6tunnel -p wg -fastest \
sway-launcher-desktop autostart & && notify-send -u low "IVPN" "Successfully connected to IVPN server:\n$(ivpn status | sed -n 2p | xargs)" \
disown || notify-send -u critical "IVPN" "Failed to connect to IVPN\!"
disown
sway-launcher-desktop autostart

View file

@ -4,6 +4,9 @@
# # # #
############################### ###############################
# Start IVPN service
exec doas ivpn-service # replace with doas with sudo if you don't have doas
# Make xdg-desktop-portal-wlr work properly # Make xdg-desktop-portal-wlr work properly
exec dbus-update-activation-environment WAYLAND_DISPLAY exec dbus-update-activation-environment WAYLAND_DISPLAY

View file

@ -6,7 +6,7 @@
// Choose the order of the modules // Choose the order of the modules
"modules-left": ["idle_inhibitor", "sway/workspaces", "custom/media", "sway/mode"], "modules-left": ["idle_inhibitor", "sway/workspaces", "custom/media", "sway/mode"],
"modules-center": ["clock"], "modules-center": ["clock"],
"modules-right": ["custom/pvpn", "network", "pulseaudio", "cpu", "memory", "battery", "tray"], "modules-right": ["custom/ivpn", "network", "pulseaudio", "cpu", "memory", "battery", "tray"],
// Modules configuration // Modules configuration
"sway/workspaces": { "sway/workspaces": {
"disable-scroll": true, "disable-scroll": true,
@ -114,11 +114,11 @@
// "exec": "$HOME/.config/waybar/mediaplayer.py 2> /dev/null" // Script in resources folder // "exec": "$HOME/.config/waybar/mediaplayer.py 2> /dev/null" // Script in resources folder
"exec": "$HOME/.config/waybar/mediaplayer.py --player chromium 2> /dev/null" // Filter player based on name "exec": "$HOME/.config/waybar/mediaplayer.py --player chromium 2> /dev/null" // Filter player based on name
}, },
"custom/pvpn": { // Custom status module for ProtonVPN "custom/ivpn": { // Custom status module for IVPN
"format": "{} ProtonVPN", "format": "{} IVPN",
"exec": "$HOME/.config/waybar/pvpn.sh", "exec": "$HOME/.config/waybar/ivpn.sh",
"return-type": "json", "return-type": "json",
"interval": 5, "interval": 1,
"on-click": "protonvpn refresh && env SUDO_USER=$USER doas protonvpn c -f" "on-click": "ivpn connect -last"
} }
} }

14
waybar/.config/waybar/ivpn.sh Executable file
View file

@ -0,0 +1,14 @@
#!/bin/sh
STATUS=`ivpn status | awk '{print "\\\n"$0}' | head -n -4`
TOOLTIP=`echo -E ${STATUS} | cut -c 3-`
CLASS=`echo ${STATUS} | grep 'VPN' | awk '{print $3}' | tr [:upper:] [:lower:]`
TEXT=""
if [ "$CLASS" == "connected" ]; then
TEXT="\uf084" # key
else
TEXT="\uf071" # exclamation-triangle
fi
echo "{\"text\": \"${TEXT}\", \"tooltip\": \"${TOOLTIP}\", \"class\": \"${CLASS}\"}"

View file

@ -1,11 +0,0 @@
#!/bin/sh
if ip a show tun0 > /dev/null 2>&1; then
CLASS="Connected"
TEXT="\uf084" # key
else
TEXT="\uf071" # exclamation-triangle
fi
echo "{\"text\": \"${TEXT}\", \"tooltip\": \"${CLASS}\", \"class\": \"${CLASS}\"}"

View file

@ -87,7 +87,7 @@ window#waybar.hidden {
#mode, #mode,
#idle_inhibitor, #idle_inhibitor,
#mpd, #mpd,
#custom-pvpn{ #custom-ivpn{
padding: 0 4px; padding: 0 4px;
margin: 0 4px; margin: 0 4px;
color: @white; color: @white;
@ -215,12 +215,12 @@ label:focus {
box-shadow: inset 0 3px @violet; box-shadow: inset 0 3px @violet;
} }
#custom-pvpn { #custom-ivpn {
color: @red; color: @red;
box-shadow: inset 0 3px @red; box-shadow: inset 0 3px @red;
} }
#custom-pvpn.Connected { #custom-ivpn.connected {
color: @green; color: @green;
box-shadow: inset 0 3px @green; box-shadow: inset 0 3px @green;
} }