Clipedit command
This commit is contained in:
parent
6328f14438
commit
d70b3cd44a
5 changed files with 17 additions and 1 deletions
12
custom/clipedit/default.nix
Normal file
12
custom/clipedit/default.nix
Normal 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
|
||||
''
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue