diff --git a/home/file/yazi/module/Yazi.nix b/home/file/yazi/module/Yazi.nix index f772bf88..31b03f99 100644 --- a/home/file/yazi/module/Yazi.nix +++ b/home/file/yazi/module/Yazi.nix @@ -64,16 +64,25 @@ block = true; run = openWith "radare2 -c V -w"; }]; - image = [{ - desc = "Image"; + picture = [{ + desc = "Picture"; orphan = true; run = openWith "loupe"; }]; - image_edit = [{ - desc = "Image Edit"; + picture_edit = [{ + desc = "Picture Edit"; orphan = true; 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 = [{ desc = "Mount"; run = openWith "fmount"; @@ -133,7 +142,7 @@ (mkMime "application/pdf" [ "pdf" ]) (mkMime "audio/*" [ "audio" ]) (mkName "*.mka" [ "audio" ]) - (mkMime "image/*" [ "image" "image_edit" ]) + (mkMime "image/*" [ "picture" "picture_copy" "picture_edit" "picture_edit_quick" ]) (mkMime "video/*" [ "video" ]) (mkMime "text/html" [ "browser" ]) (mkMime "application/vnd.openxmlformats-officedocument.*" [ "document" ]) diff --git a/home/program/bash/module/Picture.nix b/home/program/bash/module/Picture.nix new file mode 100644 index 00000000..2f4b6bc3 --- /dev/null +++ b/home/program/bash/module/Picture.nix @@ -0,0 +1,18 @@ +{ ... }: { + text = '' + # Quick edit a picture and copy to clipboard. + # Usage: pic_copy + function pic_copy() { + swappy -f "''${1}" -o - | copy + } + + # Quick edit a pictures inplace. + # Usage: pic_edit + function pic_edit() { + local IFS=$'\n' + for file in "''${@}"; do + swappy -f "''${file}" -o "''${file}" + done + } + ''; +}