Yazi: Add pic_edit.

This commit is contained in:
Dmitry Voronin 2024-11-20 22:57:12 +03:00
parent 9326dea538
commit 4d23af8e34
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k
2 changed files with 32 additions and 5 deletions

View file

@ -64,16 +64,25 @@
block = true; block = true;
run = openWith "radare2 -c V -w"; run = openWith "radare2 -c V -w";
}]; }];
image = [{ picture = [{
desc = "Image"; desc = "Picture";
orphan = true; orphan = true;
run = openWith "loupe"; run = openWith "loupe";
}]; }];
image_edit = [{ picture_edit = [{
desc = "Image Edit"; desc = "Picture Edit";
orphan = true; orphan = true;
run = openWith "gimp"; run = openWith "gimp";
}]; }];
picture_edit_quick = [{
desc = "Picture Quick Edit";
orphan = true;
run = openWith "pic_edit";
}];
picture_copy = [{
desc = "Picture Copy";
run = openWith "pic_copy";
}];
mount = [{ mount = [{
desc = "Mount"; desc = "Mount";
run = openWith "fmount"; run = openWith "fmount";
@ -133,7 +142,7 @@
(mkMime "application/pdf" [ "pdf" ]) (mkMime "application/pdf" [ "pdf" ])
(mkMime "audio/*" [ "audio" ]) (mkMime "audio/*" [ "audio" ])
(mkName "*.mka" [ "audio" ]) (mkName "*.mka" [ "audio" ])
(mkMime "image/*" [ "image" "image_edit" ]) (mkMime "image/*" [ "picture" "picture_copy" "picture_edit" "picture_edit_quick" ])
(mkMime "video/*" [ "video" ]) (mkMime "video/*" [ "video" ])
(mkMime "text/html" [ "browser" ]) (mkMime "text/html" [ "browser" ])
(mkMime "application/vnd.openxmlformats-officedocument.*" [ "document" ]) (mkMime "application/vnd.openxmlformats-officedocument.*" [ "document" ])

View file

@ -0,0 +1,18 @@
{ ... }: {
text = ''
# Quick edit a picture and copy to clipboard.
# Usage: pic_copy <FILE>
function pic_copy() {
swappy -f "''${1}" -o - | copy
}
# Quick edit a pictures inplace.
# Usage: pic_edit <FILES>
function pic_edit() {
local IFS=$'\n'
for file in "''${@}"; do
swappy -f "''${file}" -o "''${file}"
done
}
'';
}