From b90a360321f15efaa993aa47eb72087319420049 Mon Sep 17 00:00:00 2001 From: the_4n0nym0u53 Date: Tue, 14 Dec 2021 17:31:14 +0100 Subject: [PATCH] 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)! --- README.md | 4 ++-- install.sh | 2 +- sway/.config/sway/autostart.sh | 13 +++++++------ sway/.config/sway/config.d/behavior | 3 +++ waybar/.config/waybar/config | 12 ++++++------ waybar/.config/waybar/ivpn.sh | 14 ++++++++++++++ waybar/.config/waybar/pvpn.sh | 11 ----------- waybar/.config/waybar/style.css | 6 +++--- 8 files changed, 36 insertions(+), 29 deletions(-) create mode 100755 waybar/.config/waybar/ivpn.sh delete mode 100755 waybar/.config/waybar/pvpn.sh diff --git a/README.md b/README.md index 6c866ce..5e5d6c5 100644 --- a/README.md +++ b/README.md @@ -20,12 +20,12 @@ This configuration depends on the following packages: - `doas`\* - `git` - `grimshot` +- `ivpn` (daemon + CLI) - `mako` - `neovim` - `pavucontrol` - `pipewire` - `playerctl` -- `protonvpn-cli-ng` - `python` - `stow` - `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. -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. diff --git a/install.sh b/install.sh index 417c13c..afe6351 100755 --- a/install.sh +++ b/install.sh @@ -13,7 +13,7 @@ sleep 1 echo -e "Making scripts executable..." 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 sleep 1 diff --git a/sway/.config/sway/autostart.sh b/sway/.config/sway/autostart.sh index a4454aa..f5b80fb 100755 --- a/sway/.config/sway/autostart.sh +++ b/sway/.config/sway/autostart.sh @@ -1,8 +1,9 @@ #!/bin/sh -# Replace doas with sudo below if you don't have doas. -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 -sway-launcher-desktop autostart & -disown -disown +sleep 1 + +ivpn connect -ipv6tunnel -p wg -fastest \ + && notify-send -u low "IVPN" "Successfully connected to IVPN server:\n$(ivpn status | sed -n 2p | xargs)" \ + || notify-send -u critical "IVPN" "Failed to connect to IVPN\!" + +sway-launcher-desktop autostart diff --git a/sway/.config/sway/config.d/behavior b/sway/.config/sway/config.d/behavior index 0178dd5..1db258a 100644 --- a/sway/.config/sway/config.d/behavior +++ b/sway/.config/sway/config.d/behavior @@ -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 exec dbus-update-activation-environment WAYLAND_DISPLAY diff --git a/waybar/.config/waybar/config b/waybar/.config/waybar/config index 18e01d5..94663a5 100644 --- a/waybar/.config/waybar/config +++ b/waybar/.config/waybar/config @@ -6,7 +6,7 @@ // Choose the order of the modules "modules-left": ["idle_inhibitor", "sway/workspaces", "custom/media", "sway/mode"], "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 "sway/workspaces": { "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 --player chromium 2> /dev/null" // Filter player based on name }, - "custom/pvpn": { // Custom status module for ProtonVPN - "format": "{} ProtonVPN", - "exec": "$HOME/.config/waybar/pvpn.sh", + "custom/ivpn": { // Custom status module for IVPN + "format": "{} IVPN", + "exec": "$HOME/.config/waybar/ivpn.sh", "return-type": "json", - "interval": 5, - "on-click": "protonvpn refresh && env SUDO_USER=$USER doas protonvpn c -f" + "interval": 1, + "on-click": "ivpn connect -last" } } diff --git a/waybar/.config/waybar/ivpn.sh b/waybar/.config/waybar/ivpn.sh new file mode 100755 index 0000000..efa4fd0 --- /dev/null +++ b/waybar/.config/waybar/ivpn.sh @@ -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}\"}" diff --git a/waybar/.config/waybar/pvpn.sh b/waybar/.config/waybar/pvpn.sh deleted file mode 100755 index 6baef47..0000000 --- a/waybar/.config/waybar/pvpn.sh +++ /dev/null @@ -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}\"}" - diff --git a/waybar/.config/waybar/style.css b/waybar/.config/waybar/style.css index 1dc675b..aef7ab7 100644 --- a/waybar/.config/waybar/style.css +++ b/waybar/.config/waybar/style.css @@ -87,7 +87,7 @@ window#waybar.hidden { #mode, #idle_inhibitor, #mpd, -#custom-pvpn{ +#custom-ivpn{ padding: 0 4px; margin: 0 4px; color: @white; @@ -215,12 +215,12 @@ label:focus { box-shadow: inset 0 3px @violet; } -#custom-pvpn { +#custom-ivpn { color: @red; box-shadow: inset 0 3px @red; } -#custom-pvpn.Connected { +#custom-ivpn.connected { color: @green; box-shadow: inset 0 3px @green; }