summaryrefslogtreecommitdiff
path: root/bin/external/tridactyl_edit
blob: ab433b516d5a7a444d33a27dddd4db845b5fd533 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env bash

# Open file in $EDITOR using tmux for tridactyl.
# Uses wait-for to make the process blocking.
# $1 is the temporary file, $2 is the line number and $3 is the column number.
# The browser window id is saved and reactivated as the editing is finished.

browser_window="$(xdotool getactivewindow)"

wait_for="tridactyl-$(basename "$1")" # The name used in tmux's wait-for

tmux_cmd_dmenu '' "${EDITOR:-nvim} $(printf %q "$1") '+normal!$2Gzv$3|'; tmux wait-for -S $(printf %q "$wait_for")"

tmux wait-for "$wait_for"

xdotool windowactivate "$browser_window"