commit bdbd07823796973d11536dc05dc1cf7bb11f2341
parent 7879ffd66844128ccb20dd6b763658e1016856fe
Author: Benjamin Chausse <benjamin@chausse.xyz>
Date:   Mon, 26 Oct 2020 00:38:53 -0400

moving to pia as a vpn provider

Diffstat:
M.config/nvim/init.vim | 2--
M.local/bin/dbshare | 4+++-
M.local/bin/dwmbar/dwmb-date | 1+
M.local/bin/dwmbar/dwmb-dotfiles | 5+++--
M.local/bin/dwmbar/dwmb-vpn | 32++++++++++++++++++++++----------
M.local/bin/vpnmenu | 20++++++++------------
M.xinitrc | 1+
7 files changed, 38 insertions(+), 27 deletions(-)

diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim @@ -269,8 +269,6 @@ augroup END autocmd BufWritePre * %s/\s\+$//e " Soft Tabs filetype plugin indent on -" Delete ctags when leaving vim -au VimLeave * :!rm ./tags*<CR> " NERDTRee Hotkey map map <C-n> :NERDTreeToggle<CR> let NERDTreeDirArrowExpandable="|" diff --git a/.local/bin/dbshare b/.local/bin/dbshare @@ -2,6 +2,7 @@ output="$(dropbox-cli sharelink $1)" + case "$output" in https*) echo "$output" | xsel -b @@ -10,5 +11,6 @@ $output It has been copied to your clipboard." ;; *) notify-send -a " Dropbox" "ERROR: -Your file could not be shared." ;; +Your file could not be shared. +$output" ;; esac diff --git a/.local/bin/dwmbar/dwmb-date b/.local/bin/dwmbar/dwmb-date @@ -3,5 +3,6 @@ date +"  %a %b %d " case $BLOCK_BUTTON in + 1) notify-send -a " Calendar" "$(cal | tail -n +2)" ;; 6) "$TERMINAL" -e "$EDITOR" "$0" ;; esac diff --git a/.local/bin/dwmbar/dwmb-dotfiles b/.local/bin/dwmbar/dwmb-dotfiles @@ -14,5 +14,7 @@ fi echo " $warn " case $BLOCK_BUTTON in + 1) $TERMINAL -c dropdown -e yadm diff ;; + 3) $TERMINAL -c dropdown -e dfup ;; 6) "$TERMINAL" -e "$EDITOR" "$0" ;; -esac- \ No newline at end of file +esac diff --git a/.local/bin/dwmbar/dwmb-vpn b/.local/bin/dwmbar/dwmb-vpn @@ -1,19 +1,29 @@ #!/bin/bash # Outputs if Express VPN is connected or not -vpnstatus=$(expressvpn status | head -n 1) +vpnstatus="$(piactl get connectionstate)" case "$vpnstatus" in - *"Not"*) icon="" - ;; - *"Connected"*) icon="" - ;; - *"Connecting"*) icon=" " - ;; - *) icon="" + Disconnected) icon=" " ;; + Connecting) icon="  " ;; + Connected) icon=" " ;; + Interrupted) icon="  " ;; + Reconnecting) icon="  " ;; + DisconnectingToReconnect) icon="  ";; + Disconnecting) icon="  " ;; esac -echo " $icon " +# case "$vpnstatus" in +# *"Not"*) icon="" +# ;; +# *"Connected"*) icon="" +# ;; +# *"Connecting"*) icon=" " +# ;; +# *) icon="" +# esac + +echo " $icon" # \033]01;31\] # pink @@ -24,6 +34,8 @@ echo " $icon " # \033]01;33\] # bold yellow # s/onnected\sto\s//; case $BLOCK_BUTTON in - 1) ~/.local/bin/vpnmenu ;; + 1) piactl connect && notify-send -a "VPN" "Connected" && kill -36 $(pidof dwmblocks);; + 2) vpnmenu ;; + 3) piactl disconnect && notify-send -a "VPN" "Disonnected" && kill -36 $(pidof dwmblocks);; 6) "$TERMINAL" -e "$EDITOR" "$0" ;; esac diff --git a/.local/bin/vpnmenu b/.local/bin/vpnmenu @@ -1,14 +1,10 @@ #!/bin/sh -current=$(expressvpn status | sed "s/.......................//; 1q") - -location=$(expressvpn list recomend | sed "1,4d; s/^.*\t//" | head | dmenu -l 10) - -if [ ! -n "$location" ] -then - notify-send -i "$HOME/.fonts/svg/shield.svg" -a "VPN Module" "Operation aborted" -else - expressvpn disconnect; expressvpn connect "$location" -fi - -# expressvpn disconnect; expressvpn connect "$location" +region="$(piactl get regions | dmenu -p "Select Region: ")" +update=$(kill -36 $(pidof dwmblocks)) + +[ "$region" == "" ] && notify-send -a " VPN" "Operation aborted" +[ "$region" != "" ] && piactl set region "$region" && \ + $update && notify-send -a " VPN" "Changed region to $region" && \ + sleep 3 && $update +# Comment next line if not using the vpn dwmblock diff --git a/.xinitrc b/.xinitrc @@ -1,5 +1,6 @@ xwallpaper --zoom ~/.cache/wall.png & dropbox-cli start & +/opt/piavpn/bin/pia-daemon & sxhkd & remaps & dunst &