summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/external/tridactyl_edit16
1 files changed, 16 insertions, 0 deletions
diff --git a/bin/external/tridactyl_edit b/bin/external/tridactyl_edit
new file mode 100755
index 0000000..ab433b5
--- /dev/null
+++ b/bin/external/tridactyl_edit
@@ -0,0 +1,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"