Makes fg-bg work on more listeners

master
Jonathan Hodgson 4 years ago
parent 8c2363f25e
commit 65ddfa3342
  1. 18
      shells/zsh/includes/keybindings.zsh

@ -65,16 +65,16 @@ bindkey -M viins jj vi-cmd-mode
function fg-bg() { function fg-bg() {
if [[ $#BUFFER -eq 0 ]]; then if [[ $#BUFFER -eq 0 ]]; then
local backgroundProgram="$(jobs | tail -n 1 | awk '{print $4}')" local backgroundProgram="$(jobs | tail -n 1 | awk '{print $4}')"
if [[ "$backgroundProgram" == "nc" ]] || [[ "$backgroundProgram" == "ncat" ]]; then case "$backgroundProgram" in
# Make sure that /dev/tty is given to the stty command "nc"|"ncat"|"netcat"|"resize-netcat-listener"|"rnc")
local columns=$(stty -a < /dev/tty | grep -oE 'columns [0-9]+' | cut -d' ' -f2) # Make sure that /dev/tty is given to the stty command by doing </dev/tty
local rows=$(stty -a < /dev/tty | grep -oE 'rows [0-9]+' | cut -d' ' -f2) terminal-size-clip < /dev/tty
notify-send "Terminal dimensions" "Rows: $rows\nColumns: $columns\nstty command on clipboard"
echo "stty rows $rows cols $columns" | clip
stty raw -echo < /dev/tty; fg stty raw -echo < /dev/tty; fg
else ;;
*)
fg fg
fi ;;
esac
else else
zle push-input zle push-input
fi fi
@ -100,7 +100,7 @@ make_current_word_directory(){
else else
folder="${folder//\\ / }" folder="${folder//\\ / }"
fi fi
#folder="${folder%/*}" folder="${folder%/*}"
if [ -e "$folder" ]; then if [ -e "$folder" ]; then
zle -M "$folder already exists" zle -M "$folder already exists"
else else

Loading…
Cancel
Save