mirror of
https://github.com/neoromantique/dotfiles.git
synced 2026-03-13 21:53:20 +03:00
Add (terrible) custom handler for ssh
This commit is contained in:
3
.bashrc
3
.bashrc
@@ -132,3 +132,6 @@ export PATH="$PATH:$HOME/.rvm/bin"
|
||||
source /home/david/.config/broot/launcher/bash/br
|
||||
|
||||
alias repl="NODE_PATH=$(npm root -g) node"
|
||||
|
||||
# Scaleway CLI autocomplete initialization.
|
||||
eval "$(scw autocomplete script shell=bash)"
|
||||
|
||||
@@ -17,12 +17,12 @@ set $super Mod4
|
||||
font pango:monospace 8
|
||||
|
||||
#exec feh --bg-fill /home/david/Pictures/Wallpapers/ellie_full.jpg
|
||||
exec feh --bg-fill /home/david/Pictures/wall.jpg
|
||||
exec feh --bg-fill /home/david/Pictures/wall.png
|
||||
exec setxkbmap -layout gb,ru -variant ,winkeys -option grp:caps_toggle,grp_led:scroll,terminate:ctrl_alt_bksp,compose:ralt
|
||||
exec dunst
|
||||
exec xbindkeys
|
||||
exec pasystray
|
||||
|
||||
exec clipit
|
||||
|
||||
# This font is widely installed, provides lots of unicode glyphs, right-to-left
|
||||
# text rendering and scalability on retina/hidpi displays (thanks to pango).
|
||||
@@ -65,7 +65,7 @@ bindsym $mod+Shift+q kill
|
||||
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 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 exec /home/david/dotfiles/scripts/rofi/rofi-ssh.sh
|
||||
bindsym F2 exec rofi -modi window -show window -theme Arc-Dark
|
||||
|
||||
# There also is the (new) i3-dmenu-desktop which only displays applications
|
||||
@@ -169,7 +169,8 @@ bindsym $mod+i exec "/usr/bin/mocp -r"
|
||||
# Force mpv to left-most screen
|
||||
for_window [class="mpv"] move to workspace media
|
||||
|
||||
bindsym $super+l exec i3lock-fancy & sleep 1 && xset dpms force off
|
||||
bindsym $super+l exec i3lock -i /home/david/Pictures/wall.png & sleep 1 && xset dpms force off
|
||||
#bindsym $super+l exec i3lock & sleep 1 && xset dpms force off
|
||||
# reload the configuration file
|
||||
bindsym $mod+Shift+t reload
|
||||
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
#!/bin/bash
|
||||
# Copied from: https://git.john.me.tz/jpm/scripts
|
||||
# Passwordless sudo required
|
||||
# David Aizenberg
|
||||
# 2020
|
||||
|
||||
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
|
||||
if [ "$res" = "SecurEdge" ]; then
|
||||
sudo /usr/bin/systemctl stop openvpn@*
|
||||
sudo /usr/bin/systemctl start openvpn@SecurEdge
|
||||
elif [ $res = "homelab" ]; then
|
||||
elif [ "$res" = "homelab" ]; then
|
||||
sudo /usr/bin/systemctl stop openvpn@*
|
||||
sudo /usr/bin/systemctl start openvpn@homelab
|
||||
elif [ $res = "bohdan" ]; then
|
||||
elif [ "$res" = "bohdan" ]; then
|
||||
sudo /usr/bin/systemctl stop openvpn@*
|
||||
sudo /usr/bin/systemctl start openvpn@bogdan
|
||||
elif [ $res = "Disconnect" ]; then
|
||||
elif [ "$res" = "Disconnect" ]; then
|
||||
sudo /usr/bin/systemctl stop openvpn@*
|
||||
elif [ $res = "Restart" ]; then
|
||||
elif [ "$res" = "Restart" ]; then
|
||||
sudo /usr/bin/systemctl restart openvpn@*
|
||||
fi
|
||||
|
||||
if [ "$(pgrep -c i3blocks)" -gt 0 ]; then
|
||||
if [ ! -z "$res" ] && [ "$(pgrep -c i3blocks)" -gt 0 ]; then
|
||||
sleep 2s
|
||||
pkill -SIGRTMIN+10 i3blocks
|
||||
sleep 2s
|
||||
|
||||
26
scripts/rofi/rofi-ssh.sh
Executable file
26
scripts/rofi/rofi-ssh.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
# David Aizenberg
|
||||
# 2020
|
||||
# hosts file format, comma separated
|
||||
# hostname, port, pretty_name, path_to_key user
|
||||
|
||||
|
||||
hostsFile='/home/david/.ssh/ssh.hosts'
|
||||
lines=20
|
||||
|
||||
while read host; do
|
||||
|
||||
if [[ ! ${host:0:1} = \# ]]; then
|
||||
if [ ! -z "$host" ]; then
|
||||
hosts+=$(echo $host | awk -F, '{print $3}')'|'
|
||||
fi
|
||||
fi
|
||||
|
||||
done <$hostsFile
|
||||
|
||||
res=$(echo "${hosts::-1}" | rofi -sep "|" -dmenu -i -p 'SSH: ' "" -theme Arc-Dark -columns 1 -width 45 -l "$lines" -hide-scrollbar -eh1 -location 0 -auto-select -no-fullscreen)
|
||||
if [ ! -z "$res" ]; then
|
||||
connectString=$(cat $hostsFile | grep "$res" | awk -F, '{print "ssh " $5 "@" $1 " -p " $2 " -i " $4}')
|
||||
xfce4-terminal -e "$connectString"
|
||||
fi
|
||||
exit 0
|
||||
Reference in New Issue
Block a user