clipedit: change terminal

This commit is contained in:
Filippo Berto 2023-06-09 16:03:56 +02:00
parent 74bd62f90e
commit b4001fbfef
No known key found for this signature in database
GPG key ID: FE98AE5EC52B1056

View file

@ -2,8 +2,7 @@
, lib , lib
, xclip , xclip
, coreutils , coreutils
, terminal-command ? "kitty sh -c" , terminal-command ? "alacritty -e"
, editor-command ? "hx"
}: }:
# 64 │ function clipcopy() { xclip -in -selection clipboard < "${1:-/dev/stdin}"; } # 64 │ function clipcopy() { xclip -in -selection clipboard < "${1:-/dev/stdin}"; }
# 65 │ function clippaste() { xclip -out -selection clipboard; } clip # 65 │ function clippaste() { xclip -out -selection clipboard; } clip
@ -11,7 +10,7 @@ writeShellScriptBin "clipedit" ''
PATH=$PATH:"${lib.makeBinPath [ coreutils xclip ]}" PATH=$PATH:"${lib.makeBinPath [ coreutils xclip ]}"
tmp_file=$(mktemp) tmp_file=$(mktemp)
xclip -out -selection -clipboard > $tmp_file xclip -out -selection -clipboard > $tmp_file
${terminal-command} "${editor-command} $tmp_file" ${terminal-command} $VISUAL $tmp_file || ${terminal-command} $EDITOR $tmp_file
xclip -in -selection clipboard < $tmp_file xclip -in -selection clipboard < $tmp_file
rm $tmp_file rm $tmp_file
'' ''