mirror of
https://github.com/sahinakkaya/dotfiles.git
synced 2024-12-23 07:39:36 +01:00
Fix wireguard patch
This commit is contained in:
parent
6516fd431c
commit
a4b58c96d5
@ -1,64 +1,33 @@
|
|||||||
diff --git a/polybar-wireguard b/polybar-wireguard
|
diff --git a/polybar-wireguard b/rofi-wireguard
|
||||||
deleted file mode 100755
|
similarity index 88%
|
||||||
index 6712185..0000000
|
rename from polybar-wireguard
|
||||||
|
rename to rofi-wireguard
|
||||||
|
index 6712185..03e7dcb 100755
|
||||||
--- a/polybar-wireguard
|
--- a/polybar-wireguard
|
||||||
+++ /dev/null
|
+++ b/rofi-wireguard
|
||||||
@@ -1,58 +0,0 @@
|
@@ -6,11 +6,11 @@
|
||||||
-#!/usr/bin/env sh
|
# https://github.com/polybar/polybar/wiki/Formatting#format-tags-inside-polybar-config
|
||||||
-
|
green=#55aa55
|
||||||
-# Unfortunately it's not easy to directly use Polybar colour values in this
|
|
||||||
-# script so I have to redefine some of my colours here. See the link below for
|
|
||||||
-# more details:
|
|
||||||
-# https://github.com/polybar/polybar/wiki/Formatting#format-tags-inside-polybar-config
|
|
||||||
-green=#55aa55
|
|
||||||
-
|
|
||||||
-configs_path="/PATH/TO/CONF/FILES"
|
-configs_path="/PATH/TO/CONF/FILES"
|
||||||
-connected_interface=$(sudo wg | grep interface | cut -d " " -f2)
|
+configs_path="$HOME/.config/wireguard"
|
||||||
-
|
connected_interface=$(sudo wg | grep interface | cut -d " " -f2)
|
||||||
-connect() {
|
|
||||||
|
connect() {
|
||||||
- selected_config=$(ls $configs_path/*.conf | xargs basename -a -s .conf | dmenu)
|
- selected_config=$(ls $configs_path/*.conf | xargs basename -a -s .conf | dmenu)
|
||||||
- [[ $selected_config ]] && sudo wg-quick up "$configs_path"/"$selected_config".conf
|
+ selected_config=$(ls $configs_path/*.conf | xargs basename -a -s .conf | rofi -i -dmenu -p "Select a VPN server to connect: ")
|
||||||
-}
|
[[ $selected_config ]] && sudo wg-quick up "$configs_path"/"$selected_config".conf
|
||||||
-
|
}
|
||||||
-disconnect() {
|
|
||||||
- # Normally we should have a single connected interface but technically
|
@@ -36,9 +36,9 @@ toggle() {
|
||||||
- # there's nothing stopping us from having multiple active intgerfaces so
|
print() {
|
||||||
- # let's do this in a loop:
|
if [[ $connected_interface ]]
|
||||||
- for connected_config in $(sudo wg | grep interface | cut -d " " -f2)
|
then
|
||||||
- do
|
|
||||||
- sudo wg-quick down $configs_path/"$connected_config".conf
|
|
||||||
- done
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-toggle() {
|
|
||||||
- if [[ $connected_interface ]]
|
|
||||||
- then
|
|
||||||
- disconnect
|
|
||||||
- else
|
|
||||||
- connect
|
|
||||||
- fi
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-print() {
|
|
||||||
- if [[ $connected_interface ]]
|
|
||||||
- then
|
|
||||||
- echo %{u"$green"}%{+u}%{T4}%{F"$green"}%{T-}%{F-} "$connected_interface"
|
- echo %{u"$green"}%{+u}%{T4}%{F"$green"}%{T-}%{F-} "$connected_interface"
|
||||||
- else
|
+ echo $connected_interface
|
||||||
|
else
|
||||||
- echo %{T4}%{T-}
|
- echo %{T4}%{T-}
|
||||||
- fi
|
+ echo
|
||||||
-}
|
fi
|
||||||
-
|
}
|
||||||
-case "$1" in
|
|
||||||
- --connect)
|
|
||||||
- connect
|
|
||||||
- ;;
|
|
||||||
- --disconnect)
|
|
||||||
- disconnect
|
|
||||||
- ;;
|
|
||||||
- --toggle)
|
|
||||||
- toggle
|
|
||||||
- ;;
|
|
||||||
- *)
|
|
||||||
- print
|
|
||||||
- ;;
|
|
||||||
-esac
|
|
||||||
|
Loading…
Reference in New Issue
Block a user