ovpn rofi

This commit is contained in:
David Aizenberg
2020-11-16 00:24:54 +04:00
parent 6072fcf99a
commit 107af1417c
4 changed files with 43 additions and 7 deletions

12
.bashrc
View File

@@ -9,8 +9,12 @@
#Exports #Exports
EDITOR=vim EDITOR=vim
#Thanks to http://bashrcgenerator.com/
export PS1="\[\e[00;32m\]\u\[\e[0m\]\[\e[00;37m\]@\h:\[\e[0m\]\[\e[00;36m\][\[\e[0m\]\[\e[00;32m\]\w\[\e[0m\]\[\e[00;36m\]]\[\e[0m\]\[\e[00;37m\]\\$ \[\e[0m\]" getCurrentSKMKey() {
skm ls | grep -e '->' | awk '{print $2}'
}
export PS1='`date +'%H:%M'`:[\h]|\e[00;33m\]🔑`getCurrentSKMKey`\e[00;0m\]|`pwd` \n\[\e[00;32m\]\u\[\e[0m\]\[\e[00;37m\]$ '
#Aliases #Aliases
alias ls='ls -hF --color' # add colors for filetype recognition alias ls='ls -hF --color' # add colors for filetype recognition
@@ -22,8 +26,6 @@ alias mv='mv -i' # ^
alias ..='cd ..' # convinient navigation alias ..='cd ..' # convinient navigation
alias vi='vim' # Also convinient alias vi='vim' # Also convinient
alias joplin='/home/david/.joplin/Joplin.AppImage'
alias ss='sshch' alias ss='sshch'
alias rtv='rtv --enable-media' alias rtv='rtv --enable-media'
@@ -103,7 +105,6 @@ alias yavide="gvim --servername yavide -f -N -u /opt/yavide/.vimrc"
alias t="clear; todoist list --filter '(overdue | today | tomorrow) | p1'" alias t="clear; todoist list --filter '(overdue | today | tomorrow) | p1'"
# function ta() { # function ta() {
# t "$1" # t "$1"
# t # t
@@ -126,7 +127,6 @@ PATH=$GOPATH/bin:$PATH
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change. # Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH="$PATH:$HOME/.rvm/bin" export PATH="$PATH:$HOME/.rvm/bin"
eval "$(starship init bash)"
[[ -s "/etc/profile.d/grc.bashrc" ]] && source /etc/profile.d/grc.bashrc [[ -s "/etc/profile.d/grc.bashrc" ]] && source /etc/profile.d/grc.bashrc
source /home/david/.config/broot/launcher/bash/br source /home/david/.config/broot/launcher/bash/br

View File

@@ -64,6 +64,7 @@ bindsym $mod+Shift+q kill
#bindsym $mod+d exec dmenu_run #bindsym $mod+d exec dmenu_run
bindsym $mod+d exec rofi -show run -modi run -theme Arc-Dark bindsym $mod+d exec rofi -show run -modi run -theme Arc-Dark
bindsym $mod+Shift+d exec rofi -show drun -modi run -show-icons -theme Arc-Dark bindsym $mod+Shift+d exec rofi -show drun -modi run -show-icons -theme Arc-Dark
bindsym F4 exec exec /home/david/dotfiles/scripts/rofi/rofi-openvpn.sh
bindsym F3 exec rofi -modi ssh -show ssh -theme Arc-Dark bindsym F3 exec rofi -modi ssh -show ssh -theme Arc-Dark
bindsym F2 exec rofi -modi window -show window -theme Arc-Dark bindsym F2 exec rofi -modi window -show window -theme Arc-Dark

View File

@@ -25,8 +25,14 @@ command= sh ~/dotfiles/scripts/corona.sh
color=#ffffff color=#ffffff
interval=240 interval=240
[ip]
command=curl -s ip.me | awk '{ print "IP:" $1 }'
interval=once
signal=10
color=#91E78B
# Update time every 5 seconds # Update time every 5 seconds
[time] [time]
command=echo "🇱🇹 $(date +%H:%M) 🇺🇸 $(TZ="America/Los_Angeles" date +%H:%M) " command=echo "🇱🇹 $(date +%H:%M) 🇺🇸 $(TZ="America/Los_Angeles" date +%H:%M) "
color=#ffffff color=#ffffff
interval=5 interval=10

29
scripts/rofi/rofi-openvpn.sh Executable file
View File

@@ -0,0 +1,29 @@
#!/bin/bash
# Copied from: https://git.john.me.tz/jpm/scripts
# Passwordless sudo required
res=$(echo "SecurEdge|homelab|bohdan|Disconnect|Restart" | rofi -sep "|" -dmenu -i -p 'OpenVPN: ' "" -theme Arc-Dark -columns 9 -width 45 -l 1 -hide-scrollbar -eh 1 -location 0 -auto-select -no-fullscreen)
if [ $res = "SecurEdge" ]; then
sudo /usr/bin/systemctl stop openvpn@*
sudo /usr/bin/systemctl start openvpn@SecurEdge
elif [ $res = "homelab" ]; then
sudo /usr/bin/systemctl stop openvpn@*
sudo /usr/bin/systemctl start openvpn@homelab
elif [ $res = "bohdan" ]; then
sudo /usr/bin/systemctl stop openvpn@*
sudo /usr/bin/systemctl start openvpn@bogdan
elif [ $res = "Disconnect" ]; then
sudo /usr/bin/systemctl stop openvpn@*
elif [ $res = "Restart" ]; then
sudo /usr/bin/systemctl restart openvpn@*
fi
if [ "$(pgrep -c i3blocks)" -gt 0 ]; then
sleep 2s
pkill -SIGRTMIN+10 i3blocks
sleep 2s
pkill -SIGRTMIN+10 i3blocks
fi
exit 0