2022-05-14 16:33:52 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2022-10-23 07:20:28 +00:00
|
|
|
WINDOW_NAME=$1
|
|
|
|
SERVER_NAME=$2
|
|
|
|
FILE=$3
|
|
|
|
LINE=$4
|
|
|
|
COLUMN=$5
|
2022-05-14 16:33:52 +00:00
|
|
|
|
|
|
|
if test -S $SERVER_NAME; then
|
2022-10-23 07:50:58 +00:00
|
|
|
if [ "$XDG_SESSION_TYPE" = "x11" ]; then
|
|
|
|
/usr/bin/wmctrl -a "$WINDOW_NAME"
|
|
|
|
else
|
|
|
|
if [ "$XDG_SESSION_DESKTOP" = "sway" ]; then
|
|
|
|
swaymsg "[title=\"$WINDOW_NAME\"] focus"
|
2024-08-29 08:20:20 +00:00
|
|
|
elif [ "$XDG_SESSION_DESKTOP" = "gnome" ]; then
|
|
|
|
/usr/bin/wmctrl -a "$WINDOW_NAME"
|
2022-10-23 07:50:58 +00:00
|
|
|
fi
|
|
|
|
fi
|
2022-05-14 16:33:52 +00:00
|
|
|
~/.asdf/shims/nvim --server $SERVER_NAME --remote $2
|
|
|
|
~/.asdf/shims/nvim --server $SERVER_NAME --remote-send ":call cursor($LINE, $COLUMN)<CR>"
|
|
|
|
else
|
2022-10-23 07:20:28 +00:00
|
|
|
/usr/bin/alacritty --title "$WINDOW_NAME" -e /usr/bin/fish -c "nvim --listen $SERVER_NAME $2 --cmd \"call cursor($LINE, $COLUMN)\""
|
2022-05-14 16:33:52 +00:00
|
|
|
fi
|