optimize scripts

This commit is contained in:
2025-12-07 02:52:32 +01:00
parent f23fe5506d
commit a1696ee49b
5 changed files with 181 additions and 85 deletions
+11 -2
View File
@@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env bash
# Description:
# Use a sequence of keybinds to open the scrollback(or screen) buffer in editor (default to vim)
@@ -18,6 +18,11 @@
# keybind = ctrl+shift+j=text:ghostty-capture\x20
# keybind = ctrl+shift+h=write_screen_file:paste
if [ -z "$1" ] && ! command -v wl-paste &> /dev/null; then
echo "Error: wl-paste not found." >&2
exit 1
fi
file=${1:-$(wl-paste --no-newline)}
[ -z "$file" ] && {
@@ -38,7 +43,11 @@ case "$file" in
;;
esac
${EDITOR:-vim} "$file"
if [[ "$EDITOR" == *"code"* ]]; then
$EDITOR --wait "$file"
else
${EDITOR:-vim} "$file"
fi
rm -f "$file"