Clipedit command

This commit is contained in:
Filippo Berto 2022-10-08 12:24:38 +02:00
parent 6328f14438
commit d70b3cd44a
Signed by: bertof
GPG key ID: 9DBF7E6A1D2CE9ED
5 changed files with 17 additions and 1 deletions

View file

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