Compare commits

...

8 Commits

Author SHA1 Message Date
uttarayan21
22de9274b1 fix(viewer): remove unnecessary debug method call in layout setup 2025-10-10 10:15:00 +05:30
uttarayan21
9384b50397 feat(viewer): add bounding-box and animated SVG loading spinner 2025-10-09 13:35:56 +05:30
uttarayan21
76304da61f feat: add README with app description and keybindings
Some checks failed
build / checks-matrix (push) Successful in 19m20s
build / codecov (push) Failing after 19m22s
docs / docs (push) Failing after 28m47s
build / checks-build (push) Has been cancelled
2025-10-08 05:11:49 +05:30
uttarayan21
9bef3c273d feat(viewer): don't use None and ScaleDown for object fit
Some checks failed
build / checks-matrix (push) Successful in 19m19s
build / checks-build (push) Has been cancelled
docs / docs (push) Has been cancelled
build / codecov (push) Has been cancelled
2025-10-08 04:48:11 +05:30
uttarayan21
dcefe0f23d feat(main): improve input handling and error reporting
Some checks failed
build / checks-matrix (push) Successful in 19m29s
build / codecov (push) Failing after 19m22s
docs / docs (push) Failing after 28m47s
build / checks-build (push) Has been cancelled
2025-10-08 03:06:29 +05:30
uttarayan21
63e05c994b feat(viewer): add object fit functionality for image display
Some checks failed
build / checks-matrix (push) Successful in 19m20s
build / checks-build (push) Has been cancelled
docs / docs (push) Has been cancelled
build / codecov (push) Has been cancelled
2025-10-08 02:35:58 +05:30
uttarayan21
935ac583f7 chore: update dependencies in Cargo.lock
Some checks failed
build / checks-matrix (push) Successful in 19m20s
build / codecov (push) Failing after 19m18s
docs / docs (push) Failing after 16s
build / checks-build (push) Has been cancelled
2025-10-08 01:16:33 +05:30
uttarayan21
7be28fd81d chore: static link vulkan
Some checks failed
build / checks-build (push) Has been cancelled
build / codecov (push) Has been cancelled
build / checks-matrix (push) Has been cancelled
docs / docs (push) Has been cancelled
2025-10-08 01:08:58 +05:30
8 changed files with 357 additions and 138 deletions

306
Cargo.lock generated
View File

@@ -4,18 +4,18 @@ version = 4
[[package]]
name = "addr2line"
version = "0.24.2"
version = "0.25.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1"
checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b"
dependencies = [
"gimli",
]
[[package]]
name = "adler2"
version = "2.0.0"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627"
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
[[package]]
name = "aes"
@@ -49,9 +49,9 @@ dependencies = [
[[package]]
name = "anstream"
version = "0.6.18"
version = "0.6.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b"
checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a"
dependencies = [
"anstyle",
"anstyle-parse",
@@ -64,44 +64,44 @@ dependencies = [
[[package]]
name = "anstyle"
version = "1.0.10"
version = "1.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9"
checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78"
[[package]]
name = "anstyle-parse"
version = "0.2.6"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9"
checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2"
dependencies = [
"utf8parse",
]
[[package]]
name = "anstyle-query"
version = "1.1.2"
version = "1.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c"
checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2"
dependencies = [
"windows-sys 0.59.0",
"windows-sys 0.60.2",
]
[[package]]
name = "anstyle-wincon"
version = "3.0.7"
version = "3.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e"
checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a"
dependencies = [
"anstyle",
"once_cell",
"windows-sys 0.59.0",
"once_cell_polyfill",
"windows-sys 0.60.2",
]
[[package]]
name = "anyhow"
version = "1.0.97"
version = "1.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f"
checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61"
[[package]]
name = "approx"
@@ -182,6 +182,9 @@ dependencies = [
"serde",
"serde_repr",
"url",
"wayland-backend",
"wayland-client",
"wayland-protocols 0.32.9",
"zbus",
]
@@ -492,9 +495,9 @@ dependencies = [
[[package]]
name = "backtrace"
version = "0.3.74"
version = "0.3.76"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a"
checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6"
dependencies = [
"addr2line",
"cfg-if",
@@ -502,7 +505,7 @@ dependencies = [
"miniz_oxide",
"object",
"rustc-demangle",
"windows-targets 0.52.6",
"windows-link 0.2.1",
]
[[package]]
@@ -674,6 +677,22 @@ dependencies = [
"piper",
]
[[package]]
name = "bounding-box"
version = "0.1.0"
source = "git+https://github.com/aftershootco/ndcv-bridge#16c3b2e9105d3528a6ffbc2e1fe9046cb6930a6e"
dependencies = [
"color",
"itertools 0.14.0",
"nalgebra",
"ndarray",
"num",
"ordered-float",
"simba",
"thiserror 2.0.17",
"tracing",
]
[[package]]
name = "bstr"
version = "1.12.0"
@@ -820,9 +839,9 @@ dependencies = [
[[package]]
name = "cfg-if"
version = "1.0.0"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9"
[[package]]
name = "cfg_aliases"
@@ -863,9 +882,9 @@ dependencies = [
[[package]]
name = "clap"
version = "4.5.35"
version = "4.5.48"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8aa86934b44c19c50f87cc2790e19f54f7a67aedb64101c2e1a2e5ecfb73944"
checksum = "e2134bb3ea021b78629caa971416385309e0131b351b25e01dc16fb54e1b5fae"
dependencies = [
"clap_builder",
"clap_derive",
@@ -873,9 +892,9 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.5.35"
version = "4.5.48"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2414dbb2dd0695280da6ea9261e327479e9d37b0630f6b53ba2a11c60c679fd9"
checksum = "c2ba64afa3c0a6df7fa517765e31314e983f51dda798ffba27b988194fb65dc9"
dependencies = [
"anstream",
"anstyle",
@@ -885,18 +904,18 @@ dependencies = [
[[package]]
name = "clap_complete"
version = "4.5.47"
version = "4.5.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c06f5378ea264ad4f82bbc826628b5aad714a75abf6ece087e923010eb937fb6"
checksum = "75bf0b32ad2e152de789bb635ea4d3078f6b838ad7974143e99b99f45a04af4a"
dependencies = [
"clap",
]
[[package]]
name = "clap_derive"
version = "4.5.32"
version = "4.5.47"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09176aae279615badda0765c0c0b3f6ed53f4709118af73cf4655d85d1530cd7"
checksum = "bbfd7eae0b0f1a6e63d4b13c9c478de77c2eb546fba158ad50b4203dc24b9f9c"
dependencies = [
"heck 0.5.0",
"proc-macro2",
@@ -906,9 +925,9 @@ dependencies = [
[[package]]
name = "clap_lex"
version = "0.7.4"
version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6"
checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675"
[[package]]
name = "cocoa"
@@ -980,6 +999,12 @@ dependencies = [
"unicode-width",
]
[[package]]
name = "color"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a18ef4657441fb193b65f34dc39b3781f0dfec23d3bd94d0eeb4e88cde421edb"
[[package]]
name = "color_quant"
version = "1.1.0"
@@ -988,9 +1013,9 @@ checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
[[package]]
name = "colorchoice"
version = "1.0.3"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990"
checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"
[[package]]
name = "command-fds"
@@ -999,7 +1024,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f849b92c694fe237ecd8fafd1ba0df7ae0d45c1df6daeb7f68ed4220d51640bd"
dependencies = [
"nix 0.30.1",
"thiserror 2.0.12",
"thiserror 2.0.17",
]
[[package]]
@@ -1985,9 +2010,9 @@ dependencies = [
[[package]]
name = "gimli"
version = "0.31.1"
version = "0.32.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f"
checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7"
[[package]]
name = "glam"
@@ -2161,7 +2186,7 @@ dependencies = [
[[package]]
name = "gpui"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#94f1faffa73c17d22a949de77309c664918e3547"
source = "git+https://github.com/uttarayan21/zed#0206e34dde1fe54af1b86d46793be3fa72b37388"
dependencies = [
"anyhow",
"ashpd 0.11.0",
@@ -2221,14 +2246,14 @@ dependencies = [
"stacksafe",
"strum 0.27.2",
"taffy",
"thiserror 2.0.12",
"thiserror 2.0.17",
"usvg",
"uuid",
"waker-fn",
"wayland-backend",
"wayland-client",
"wayland-cursor",
"wayland-protocols",
"wayland-protocols 0.31.2",
"wayland-protocols-plasma",
"windows",
"windows-core",
@@ -2250,7 +2275,7 @@ dependencies = [
[[package]]
name = "gpui-macros"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#94f1faffa73c17d22a949de77309c664918e3547"
source = "git+https://github.com/uttarayan21/zed#0206e34dde1fe54af1b86d46793be3fa72b37388"
dependencies = [
"heck 0.5.0",
"proc-macro2",
@@ -2710,6 +2735,17 @@ dependencies = [
"leaky-cow",
]
[[package]]
name = "io-uring"
version = "0.7.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "046fa2d4d00aea763528b4950358d0ead425372445dc8ff86312b3c69ff7727b"
dependencies = [
"bitflags 2.9.4",
"cfg-if",
"libc",
]
[[package]]
name = "ipnet"
version = "2.11.0"
@@ -2856,9 +2892,9 @@ checksum = "7a79a3332a6609480d7d0c9eab957bca6b455b91bb84e66d19f5ff66294b85b8"
[[package]]
name = "libc"
version = "0.2.171"
version = "0.2.176"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6"
checksum = "58f929b4d672ea937a23a1ab494143d968337a5f47e56d0815df1e0890ddf174"
[[package]]
name = "libfuzzer-sys"
@@ -2926,9 +2962,9 @@ dependencies = [
[[package]]
name = "log"
version = "0.4.27"
version = "0.4.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432"
dependencies = [
"serde",
"value-bag",
@@ -3048,9 +3084,9 @@ dependencies = [
[[package]]
name = "memchr"
version = "2.7.4"
version = "2.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273"
[[package]]
name = "memmap2"
@@ -3109,9 +3145,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]]
name = "miniz_oxide"
version = "0.8.7"
version = "0.8.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff70ce3e48ae43fa075863cef62e8b43b71a4f2382229920e0df362592919430"
checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"
dependencies = [
"adler2",
"simd-adler32",
@@ -3138,13 +3174,15 @@ dependencies = [
name = "mm"
version = "0.1.0"
dependencies = [
"ash",
"bounding-box",
"clap",
"clap_complete",
"error-stack",
"gpui",
"ignore",
"nalgebra",
"thiserror 2.0.12",
"thiserror 2.0.17",
"tokio",
"tracing",
"tracing-subscriber",
@@ -3184,7 +3222,7 @@ dependencies = [
"rustc-hash 1.1.0",
"spirv",
"strum 0.26.3",
"thiserror 2.0.12",
"thiserror 2.0.17",
"unicode-ident",
]
@@ -3240,6 +3278,21 @@ dependencies = [
"getrandom 0.2.16",
]
[[package]]
name = "ndarray"
version = "0.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "882ed72dce9365842bf196bdeedf5055305f11fc8c03dee7bb0194a6cad34841"
dependencies = [
"matrixmultiply",
"num-complex",
"num-integer",
"num-traits",
"portable-atomic",
"portable-atomic-util",
"rawpointer",
]
[[package]]
name = "new_debug_unreachable"
version = "1.0.6"
@@ -3289,12 +3342,11 @@ checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8"
[[package]]
name = "nu-ansi-term"
version = "0.46.0"
version = "0.50.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84"
checksum = "d4a28e057d01f97e61255210fcff094d74ed0466038633e95017f5beb68e4399"
dependencies = [
"overload",
"winapi",
"windows-sys 0.52.0",
]
[[package]]
@@ -3509,9 +3561,9 @@ dependencies = [
[[package]]
name = "object"
version = "0.36.7"
version = "0.37.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87"
checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe"
dependencies = [
"memchr",
]
@@ -3522,6 +3574,12 @@ version = "1.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
[[package]]
name = "once_cell_polyfill"
version = "1.70.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad"
[[package]]
name = "oo7"
version = "0.5.0"
@@ -3580,6 +3638,15 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
[[package]]
name = "ordered-float"
version = "5.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f4779c6901a562440c3786d08192c6fbda7c1c2060edd10006b05ee35d10f2d"
dependencies = [
"num-traits",
]
[[package]]
name = "ordered-stream"
version = "0.2.0"
@@ -3590,12 +3657,6 @@ dependencies = [
"pin-project-lite",
]
[[package]]
name = "overload"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
[[package]]
name = "parking"
version = "2.2.1"
@@ -3773,6 +3834,21 @@ version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5da3b0203fd7ee5720aa0b5e790b591aa5d3f41c3ed2c34a3a393382198af2f7"
[[package]]
name = "portable-atomic"
version = "1.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483"
[[package]]
name = "portable-atomic-util"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507"
dependencies = [
"portable-atomic",
]
[[package]]
name = "postage"
version = "0.5.0"
@@ -3851,9 +3927,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.94"
version = "1.0.101"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84"
checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de"
dependencies = [
"unicode-ident",
]
@@ -3933,7 +4009,7 @@ dependencies = [
"rustc-hash 2.1.1",
"rustls",
"socket2",
"thiserror 2.0.12",
"thiserror 2.0.17",
"tokio",
"tracing",
"web-time",
@@ -3954,7 +4030,7 @@ dependencies = [
"rustls",
"rustls-pki-types",
"slab",
"thiserror 2.0.12",
"thiserror 2.0.17",
"tinyvec",
"tracing",
"web-time",
@@ -3976,9 +4052,9 @@ dependencies = [
[[package]]
name = "quote"
version = "1.0.40"
version = "1.0.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1"
dependencies = [
"proc-macro2",
]
@@ -4316,9 +4392,9 @@ dependencies = [
[[package]]
name = "rustc-demangle"
version = "0.1.24"
version = "0.1.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace"
[[package]]
name = "rustc-hash"
@@ -4572,9 +4648,9 @@ checksum = "0f7d95a54511e0c7be3f51e8867aa8cf35148d7b9445d44de2f943e2b206e749"
[[package]]
name = "semver"
version = "1.0.26"
version = "1.0.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0"
checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2"
[[package]]
name = "serde"
@@ -4834,12 +4910,12 @@ checksum = "dd538fb6910ac1099850255cf94a94df6551fbdd602454387d0adb2d1ca6dead"
[[package]]
name = "socket2"
version = "0.5.10"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678"
checksum = "233504af464074f9d066d7b5416c5f9b894a5862a6506e306f7b816cdd6f1807"
dependencies = [
"libc",
"windows-sys 0.52.0",
"windows-sys 0.59.0",
]
[[package]]
@@ -5228,11 +5304,11 @@ dependencies = [
[[package]]
name = "thiserror"
version = "2.0.12"
version = "2.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708"
checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8"
dependencies = [
"thiserror-impl 2.0.12",
"thiserror-impl 2.0.17",
]
[[package]]
@@ -5248,9 +5324,9 @@ dependencies = [
[[package]]
name = "thiserror-impl"
version = "2.0.12"
version = "2.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d"
checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913"
dependencies = [
"proc-macro2",
"quote",
@@ -5259,12 +5335,11 @@ dependencies = [
[[package]]
name = "thread_local"
version = "1.1.8"
version = "1.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c"
checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185"
dependencies = [
"cfg-if",
"once_cell",
]
[[package]]
@@ -5334,17 +5409,19 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "tokio"
version = "1.44.2"
version = "1.47.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6b88822cbe49de4185e3a4cbf8321dd487cf5fe0c5c65695fef6346371e9c48"
checksum = "89e49afdadebb872d3145a5638b59eb0691ea23e46ca484037cfab3b76b95038"
dependencies = [
"backtrace",
"bytes",
"io-uring",
"libc",
"mio",
"pin-project-lite",
"slab",
"socket2",
"windows-sys 0.52.0",
"windows-sys 0.59.0",
]
[[package]]
@@ -5514,9 +5591,9 @@ dependencies = [
[[package]]
name = "tracing-attributes"
version = "0.1.28"
version = "0.1.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d"
checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903"
dependencies = [
"proc-macro2",
"quote",
@@ -5525,9 +5602,9 @@ dependencies = [
[[package]]
name = "tracing-core"
version = "0.1.33"
version = "0.1.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c"
checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678"
dependencies = [
"once_cell",
"valuable",
@@ -5546,9 +5623,9 @@ dependencies = [
[[package]]
name = "tracing-subscriber"
version = "0.3.19"
version = "0.3.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008"
checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5"
dependencies = [
"nu-ansi-term",
"sharded-slab",
@@ -5646,9 +5723,9 @@ checksum = "ce61d488bcdc9bc8b5d1772c404828b17fc481c0a582b5581e95fb233aef503e"
[[package]]
name = "unicode-ident"
version = "1.0.18"
version = "1.0.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d"
[[package]]
name = "unicode-linebreak"
@@ -6030,6 +6107,18 @@ dependencies = [
"wayland-scanner",
]
[[package]]
name = "wayland-protocols"
version = "0.32.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "efa790ed75fbfd71283bd2521a1cfdc022aabcc28bdcff00851f9e4ae88d9901"
dependencies = [
"bitflags 2.9.4",
"wayland-backend",
"wayland-client",
"wayland-scanner",
]
[[package]]
name = "wayland-protocols-plasma"
version = "0.2.0"
@@ -6039,7 +6128,7 @@ dependencies = [
"bitflags 2.9.4",
"wayland-backend",
"wayland-client",
"wayland-protocols",
"wayland-protocols 0.31.2",
"wayland-scanner",
]
@@ -6062,7 +6151,6 @@ checksum = "34949b42822155826b41db8e5d0c1be3a2bd296c747577a43a3e6daefc296142"
dependencies = [
"dlib",
"log",
"once_cell",
"pkg-config",
]
@@ -6719,7 +6807,7 @@ dependencies = [
[[package]]
name = "zed-collections"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#94f1faffa73c17d22a949de77309c664918e3547"
source = "git+https://github.com/uttarayan21/zed#0206e34dde1fe54af1b86d46793be3fa72b37388"
dependencies = [
"indexmap",
"rustc-hash 2.1.1",
@@ -6729,7 +6817,7 @@ dependencies = [
[[package]]
name = "zed-derive-refineable"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#94f1faffa73c17d22a949de77309c664918e3547"
source = "git+https://github.com/uttarayan21/zed#0206e34dde1fe54af1b86d46793be3fa72b37388"
dependencies = [
"proc-macro2",
"quote",
@@ -6764,7 +6852,7 @@ dependencies = [
[[package]]
name = "zed-http-client"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#94f1faffa73c17d22a949de77309c664918e3547"
source = "git+https://github.com/uttarayan21/zed#0206e34dde1fe54af1b86d46793be3fa72b37388"
dependencies = [
"anyhow",
"async-compression",
@@ -6790,7 +6878,7 @@ dependencies = [
[[package]]
name = "zed-media"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#94f1faffa73c17d22a949de77309c664918e3547"
source = "git+https://github.com/uttarayan21/zed#0206e34dde1fe54af1b86d46793be3fa72b37388"
dependencies = [
"anyhow",
"bindgen",
@@ -6806,7 +6894,7 @@ dependencies = [
[[package]]
name = "zed-perf"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#94f1faffa73c17d22a949de77309c664918e3547"
source = "git+https://github.com/uttarayan21/zed#0206e34dde1fe54af1b86d46793be3fa72b37388"
dependencies = [
"serde",
"serde_json",
@@ -6817,7 +6905,7 @@ dependencies = [
[[package]]
name = "zed-refineable"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#94f1faffa73c17d22a949de77309c664918e3547"
source = "git+https://github.com/uttarayan21/zed#0206e34dde1fe54af1b86d46793be3fa72b37388"
dependencies = [
"workspace-hack",
"zed-derive-refineable",
@@ -6875,7 +6963,7 @@ dependencies = [
[[package]]
name = "zed-semantic-version"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#94f1faffa73c17d22a949de77309c664918e3547"
source = "git+https://github.com/uttarayan21/zed#0206e34dde1fe54af1b86d46793be3fa72b37388"
dependencies = [
"anyhow",
"serde",
@@ -6885,7 +6973,7 @@ dependencies = [
[[package]]
name = "zed-sum-tree"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#94f1faffa73c17d22a949de77309c664918e3547"
source = "git+https://github.com/uttarayan21/zed#0206e34dde1fe54af1b86d46793be3fa72b37388"
dependencies = [
"arrayvec",
"log",
@@ -6896,7 +6984,7 @@ dependencies = [
[[package]]
name = "zed-util"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#94f1faffa73c17d22a949de77309c664918e3547"
source = "git+https://github.com/uttarayan21/zed#0206e34dde1fe54af1b86d46793be3fa72b37388"
dependencies = [
"anyhow",
"async-fs",
@@ -6932,7 +7020,7 @@ dependencies = [
[[package]]
name = "zed-util-macros"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#94f1faffa73c17d22a949de77309c664918e3547"
source = "git+https://github.com/uttarayan21/zed#0206e34dde1fe54af1b86d46793be3fa72b37388"
dependencies = [
"quote",
"syn 2.0.106",

View File

@@ -14,9 +14,14 @@ thiserror = "2.0"
tokio = "1.43.1"
tracing = "0.1"
tracing-subscriber = "0.3"
gpui = { git = "https://github.com/zed-industries/zed", default-features = false, features = ["wayland"] }
gpui = { git = "https://github.com/uttarayan21/zed", default-features = false, features = [
"wayland",
] }
nalgebra = "0.34.1"
wayland-sys = { version = "0.31.7", default-features = false }
wayland-backend = { version = "0.3.11", default-features = false }
ignore = { version = "0.4.23", features = ["simd-accel"] }
unicode-segmentation = "1.12.0"
ash = { version = "0.38.0", features = ["linked"] }
bounding-box = { git = "https://github.com/aftershootco/ndcv-bridge" }

15
README.md Normal file
View File

@@ -0,0 +1,15 @@
# MM - Minimal Image Viewer
A cross platform minimal image viewer with vim-like keybindings, built using rust and gpui
### Keyboard Shortcuts
| Key | Action |
|-----|--------|
| `q` or `Escape` | Quit the application |
| `j` or `→` | Next image |
| `k` or `←` | Previous image |
| `g` | Go to first image |
| `Shift+G` | Go to last image |
| `c` | Cycle through object fit modes (Contain → Cover → Fill) |

6
assets/arrow_circle.svg Normal file
View File

@@ -0,0 +1,6 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M3 8C3 6.67392 3.52678 5.40215 4.46446 4.46447C5.40214 3.52679 6.67391 3.00001 7.99999 3.00001C9.39779 3.00527 10.7394 3.55069 11.7444 4.52223L13 5.77778" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M13 3.00001V5.77778H10.2222" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M13 8C13 9.32608 12.4732 10.5978 11.5355 11.5355C10.5978 12.4732 9.32607 13 7.99999 13C6.60219 12.9947 5.26054 12.4493 4.25555 11.4778L3 10.2222" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M5.77777 10.2222H3V13" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 748 B

View File

@@ -153,10 +153,10 @@
++ (lib.optionals pkgs.stdenv.isDarwin [
apple-sdk_13
]);
shellHook = ''
# Temp solution until I can disable wayland-backend's dlopen feature in gpui itself
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${builtins.toString (pkgs.lib.makeLibraryPath commonArgs.buildInputs)}";
'';
# shellHook = ''
# # Temp solution until I can disable wayland-backend's dlopen feature in gpui itself
# export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${builtins.toString (pkgs.lib.makeLibraryPath commonArgs.buildInputs)}";
# '';
});
};
}

View File

@@ -3,4 +3,4 @@ pub use error_stack::{Report, ResultExt};
#[error("An error occurred")]
pub struct Error;
pub type Result<T, E = error_stack::Report<Error>> = core::result::Result<T, E>;
pub type Result<T, E = Report<Error>> = core::result::Result<T, E>;

View File

@@ -5,15 +5,24 @@ use std::path::{Path, PathBuf};
use errors::*;
mod viewer;
pub fn main() -> Result<()> {
error_stack::Report::set_color_mode(error_stack::fmt::ColorMode::Color);
error_stack::Report::set_charset(error_stack::fmt::Charset::Utf8);
let args = <cli::Cli as clap::Parser>::parse();
if let Some(shell) = args.completions {
cli::Cli::completions(shell);
return Ok(());
}
let files = walker(args.input);
if files.is_empty() {
return Err(Error).attach("No files found");
}
let input = args
.input
.canonicalize()
.change_context(Error)
.attach("Failed to canonicalize path")?;
let files = walker(&input);
// if files.is_empty() {
// return Err(Error)
// .attach("No files found in the folder")
// .attach(input.display().to_string());
// }
viewer::run(files);
Ok(())
@@ -22,8 +31,10 @@ pub fn main() -> Result<()> {
// Returns all the children (if a dir) and sister (if an image) files of the input path
fn walker(input: impl AsRef<Path>) -> Vec<PathBuf> {
let mut tb = ignore::types::TypesBuilder::new();
tb.add("image", "*.jpg").expect("Failed to add image type");
tb.add("image", "*.png").expect("Failed to add image type");
gpui::Img::extensions().iter().for_each(|ext| {
tb.add("image", &format!("*.{ext}"))
.expect("Failed to add image type");
});
ignore::WalkBuilder::new(input)
.types(
tb.select("image")
@@ -31,6 +42,7 @@ fn walker(input: impl AsRef<Path>) -> Vec<PathBuf> {
.build()
.expect("Failed to build type finder"),
)
.git_ignore(false)
.sort_by_file_name(|a, b| a.cmp(b))
.build()
.filter_map(|e| e.ok())

View File

@@ -1,20 +1,53 @@
use gpui::{
App, Application, Bounds, Context, FocusHandle, KeyBinding, SharedString, Window, WindowBounds,
WindowOptions, actions, div, img, prelude::*, px, rgb, rgba, size,
Animation, AnimationExt, App, Application, Bounds, Canvas, Context, FocusHandle, KeyBinding,
ObjectFit, Transformation, Window, WindowBounds, WindowOptions, actions, black, bounce, canvas,
div, ease_in_out, img, percentage, prelude::*, pulsating_between, px, rgb, rgba, size, svg,
};
use nalgebra::Vector2;
use std::path::PathBuf;
use std::{path::PathBuf, time::Duration};
#[derive(Debug, Clone)]
struct MMViewer {
files: Vec<PathBuf>,
current: usize,
zoom: f32,
pan: Vector2<f32>,
last: Option<usize>,
// zoom: f32,
// pan: Vector2<f32>,
focus: FocusHandle,
fit: ObjectFit,
}
actions!(mm, [Quit, NextImage, PrevImage, FirstImage, LastImage]);
actions!(mm, [Quit, NextImage, PrevImage, FirstImage, LastImage, Fit]);
#[derive(Debug, Clone)]
pub struct BoundingBox {
inner: bounding_box::Aabb2<f32>,
pub width: gpui::Pixels,
pub color: gpui::Rgba,
}
impl From<bounding_box::Aabb2<f32>> for BoundingBox {
fn from(aabb: bounding_box::Aabb2<f32>) -> Self {
Self {
inner: aabb,
width: px(2.0),
color: gpui::green().to_rgb(),
}
}
}
// impl Render for BoundingBox {
// fn render(&mut self, window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
// let mut builder = gpui::PathBuilder::stroke(self.width);
// let aabb = self.inner;
// builder.move_to(gpui::Point::new(px(aabb.x1()), px(aabb.y1())));
// builder.line_to(gpui::Point::new(px(aabb.x2()), px(aabb.y1())));
// builder.line_to(gpui::Point::new(px(aabb.x2()), px(aabb.y2())));
// builder.line_to(gpui::Point::new(px(aabb.x1()), px(aabb.y2())));
// builder.line_to(gpui::Point::new(px(aabb.x1()), px(aabb.y1())));
// let path = builder.build().expect("Failed to build path");
// window.paint_path(path, gpui::green())
// }
// }
impl Render for MMViewer {
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
@@ -25,34 +58,79 @@ impl Render for MMViewer {
.on_action(cx.listener(Self::prev_image))
.on_action(cx.listener(Self::first_image))
.on_action(cx.listener(Self::last_image))
.on_action(cx.listener(Self::object_fit))
.on_action(cx.listener(Self::quit))
.flex()
.size_full()
.flex_col()
.justify_center()
.bg(rgb(0x505050))
.bg(rgba(0xffffffff))
.child(if let Some(file) = self.files.get(self.current) {
div()
.flex()
.flex_row()
.size_full()
.justify_center()
.child(img(file.clone()).size_full())
.child(
img(file.clone())
.id("loupe")
.object_fit(self.fit())
.size_full()
.with_loading(|| Self::loading().into_any_element()),
)
.relative()
.into_any()
} else {
div().child(format!(
"No image found (index: {}, total: {})",
self.current,
self.files.len()
))
Self::loading().into_any_element()
// div().child(format!(
// "No image found (index: {}, total: {})",
// self.current,
// self.files.len()
// ))
})
}
}
const ARROW_CIRCLE_SVG: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/assets/arrow_circle.svg");
fn wheel() -> impl IntoElement {
svg()
.path(ARROW_CIRCLE_SVG)
.flex_none()
.size_full()
.text_color(black())
.with_animation(
"wheel",
Animation::new(Duration::from_secs(2))
.repeat()
.with_easing(bounce(ease_in_out)),
move |svg, delta| svg.with_transformation(Transformation::rotate(percentage(delta))),
)
}
impl MMViewer {
fn loading() -> impl IntoElement {
div()
.size_full()
.flex_none()
.bg(rgb(0xff00ff))
.child(wheel())
}
fn focus_handle(&self, _: &App) -> FocusHandle {
self.focus.clone()
}
fn fit(&self) -> ObjectFit {
match self.fit {
ObjectFit::Fill => ObjectFit::Fill,
ObjectFit::Contain => ObjectFit::Contain,
ObjectFit::Cover => ObjectFit::Cover,
ObjectFit::ScaleDown => ObjectFit::ScaleDown,
ObjectFit::None => ObjectFit::None,
}
}
fn next_image(&mut self, _: &NextImage, _: &mut Window, cx: &mut Context<Self>) {
if self.current + 1 < self.files.len() {
self.current += 1;
@@ -81,6 +159,18 @@ impl MMViewer {
}
}
fn object_fit(&mut self, _: &Fit, _: &mut Window, cx: &mut Context<Self>) {
match self.fit {
ObjectFit::Fill => self.fit = ObjectFit::Contain,
ObjectFit::Contain => self.fit = ObjectFit::Cover,
ObjectFit::Cover => self.fit = ObjectFit::Fill,
// ObjectFit::ScaleDown => self.fit = ObjectFit::None,
// ObjectFit::None => self.fit = ObjectFit::Fill,
_ => self.fit = ObjectFit::Contain,
}
cx.notify();
}
fn quit(&mut self, _: &Quit, _: &mut Window, cx: &mut Context<Self>) {
cx.quit();
}
@@ -88,7 +178,7 @@ impl MMViewer {
pub fn run(files: Vec<PathBuf>) {
Application::new().run(|cx: &mut App| {
let bounds = Bounds::centered(None, size(px(800f32), px(600f32)), cx);
let bounds = Bounds::maximized(None, cx);
cx.bind_keys([
KeyBinding::new("q", Quit, None),
KeyBinding::new("Escape", Quit, None),
@@ -98,6 +188,7 @@ pub fn run(files: Vec<PathBuf>) {
KeyBinding::new("left", PrevImage, None),
KeyBinding::new("shift-g", LastImage, None),
KeyBinding::new("g", FirstImage, None),
KeyBinding::new("c", Fit, None),
]);
let window = cx
.open_window(
@@ -110,9 +201,11 @@ pub fn run(files: Vec<PathBuf>) {
cx.new(|cx| MMViewer {
files,
current: 0,
zoom: 1.0,
pan: Vector2::new(0.0, 0.0),
last: None,
// zoom: 1.0,
// pan: Vector2::new(0.0, 0.0),
focus: cx.focus_handle(),
fit: ObjectFit::Contain,
})
},
)