├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── README.md ├── show.gif ├── src ├── animation.rs └── main.rs └── typos.toml /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | .DS_Store -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 4 4 | 5 | [[package]] 6 | name = "allocator-api2" 7 | version = "0.2.21" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" 10 | 11 | [[package]] 12 | name = "alternate_screen_wrapper" 13 | version = "0.1.1" 14 | source = "registry+https://github.com/rust-lang/crates.io-index" 15 | checksum = "8b180f70cd93a1a64e5889cf061f35d54b7ae85f7f49b9d3ee39988cc3b8c38a" 16 | dependencies = [ 17 | "crossterm", 18 | ] 19 | 20 | [[package]] 21 | name = "autocfg" 22 | version = "1.4.0" 23 | source = "registry+https://github.com/rust-lang/crates.io-index" 24 | checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" 25 | 26 | [[package]] 27 | name = "bitflags" 28 | version = "2.6.0" 29 | source = "registry+https://github.com/rust-lang/crates.io-index" 30 | checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" 31 | 32 | [[package]] 33 | name = "cassowary" 34 | version = "0.3.0" 35 | source = "registry+https://github.com/rust-lang/crates.io-index" 36 | checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53" 37 | 38 | [[package]] 39 | name = "castaway" 40 | version = "0.2.3" 41 | source = "registry+https://github.com/rust-lang/crates.io-index" 42 | checksum = "0abae9be0aaf9ea96a3b1b8b1b55c602ca751eba1b1500220cea4ecbafe7c0d5" 43 | dependencies = [ 44 | "rustversion", 45 | ] 46 | 47 | [[package]] 48 | name = "cfg-if" 49 | version = "1.0.0" 50 | source = "registry+https://github.com/rust-lang/crates.io-index" 51 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 52 | 53 | [[package]] 54 | name = "compact_str" 55 | version = "0.8.0" 56 | source = "registry+https://github.com/rust-lang/crates.io-index" 57 | checksum = "6050c3a16ddab2e412160b31f2c871015704239bca62f72f6e5f0be631d3f644" 58 | dependencies = [ 59 | "castaway", 60 | "cfg-if", 61 | "itoa", 62 | "rustversion", 63 | "ryu", 64 | "static_assertions", 65 | ] 66 | 67 | [[package]] 68 | name = "crossterm" 69 | version = "0.28.1" 70 | source = "registry+https://github.com/rust-lang/crates.io-index" 71 | checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6" 72 | dependencies = [ 73 | "bitflags", 74 | "crossterm_winapi", 75 | "mio", 76 | "parking_lot", 77 | "rustix", 78 | "signal-hook", 79 | "signal-hook-mio", 80 | "winapi", 81 | ] 82 | 83 | [[package]] 84 | name = "crossterm_winapi" 85 | version = "0.9.1" 86 | source = "registry+https://github.com/rust-lang/crates.io-index" 87 | checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" 88 | dependencies = [ 89 | "winapi", 90 | ] 91 | 92 | [[package]] 93 | name = "darling" 94 | version = "0.20.10" 95 | source = "registry+https://github.com/rust-lang/crates.io-index" 96 | checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" 97 | dependencies = [ 98 | "darling_core", 99 | "darling_macro", 100 | ] 101 | 102 | [[package]] 103 | name = "darling_core" 104 | version = "0.20.10" 105 | source = "registry+https://github.com/rust-lang/crates.io-index" 106 | checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" 107 | dependencies = [ 108 | "fnv", 109 | "ident_case", 110 | "proc-macro2", 111 | "quote", 112 | "strsim", 113 | "syn", 114 | ] 115 | 116 | [[package]] 117 | name = "darling_macro" 118 | version = "0.20.10" 119 | source = "registry+https://github.com/rust-lang/crates.io-index" 120 | checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" 121 | dependencies = [ 122 | "darling_core", 123 | "quote", 124 | "syn", 125 | ] 126 | 127 | [[package]] 128 | name = "diff" 129 | version = "0.1.13" 130 | source = "registry+https://github.com/rust-lang/crates.io-index" 131 | checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" 132 | 133 | [[package]] 134 | name = "either" 135 | version = "1.13.0" 136 | source = "registry+https://github.com/rust-lang/crates.io-index" 137 | checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" 138 | 139 | [[package]] 140 | name = "equivalent" 141 | version = "1.0.1" 142 | source = "registry+https://github.com/rust-lang/crates.io-index" 143 | checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" 144 | 145 | [[package]] 146 | name = "errno" 147 | version = "0.3.10" 148 | source = "registry+https://github.com/rust-lang/crates.io-index" 149 | checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" 150 | dependencies = [ 151 | "libc", 152 | "windows-sys 0.59.0", 153 | ] 154 | 155 | [[package]] 156 | name = "fnv" 157 | version = "1.0.7" 158 | source = "registry+https://github.com/rust-lang/crates.io-index" 159 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 160 | 161 | [[package]] 162 | name = "foldhash" 163 | version = "0.1.4" 164 | source = "registry+https://github.com/rust-lang/crates.io-index" 165 | checksum = "a0d2fde1f7b3d48b8395d5f2de76c18a528bd6a9cdde438df747bfcba3e05d6f" 166 | 167 | [[package]] 168 | name = "ghostty_animation" 169 | version = "0.1.0" 170 | dependencies = [ 171 | "alternate_screen_wrapper", 172 | "crossterm", 173 | "ratatui", 174 | ] 175 | 176 | [[package]] 177 | name = "hashbrown" 178 | version = "0.15.2" 179 | source = "registry+https://github.com/rust-lang/crates.io-index" 180 | checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" 181 | dependencies = [ 182 | "allocator-api2", 183 | "equivalent", 184 | "foldhash", 185 | ] 186 | 187 | [[package]] 188 | name = "heck" 189 | version = "0.5.0" 190 | source = "registry+https://github.com/rust-lang/crates.io-index" 191 | checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" 192 | 193 | [[package]] 194 | name = "ident_case" 195 | version = "1.0.1" 196 | source = "registry+https://github.com/rust-lang/crates.io-index" 197 | checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" 198 | 199 | [[package]] 200 | name = "indoc" 201 | version = "2.0.5" 202 | source = "registry+https://github.com/rust-lang/crates.io-index" 203 | checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" 204 | 205 | [[package]] 206 | name = "instability" 207 | version = "0.3.5" 208 | source = "registry+https://github.com/rust-lang/crates.io-index" 209 | checksum = "898e106451f7335950c9cc64f8ec67b5f65698679ac67ed00619aeef14e1cf75" 210 | dependencies = [ 211 | "darling", 212 | "indoc", 213 | "pretty_assertions", 214 | "proc-macro2", 215 | "quote", 216 | "syn", 217 | ] 218 | 219 | [[package]] 220 | name = "itertools" 221 | version = "0.13.0" 222 | source = "registry+https://github.com/rust-lang/crates.io-index" 223 | checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" 224 | dependencies = [ 225 | "either", 226 | ] 227 | 228 | [[package]] 229 | name = "itoa" 230 | version = "1.0.14" 231 | source = "registry+https://github.com/rust-lang/crates.io-index" 232 | checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" 233 | 234 | [[package]] 235 | name = "libc" 236 | version = "0.2.169" 237 | source = "registry+https://github.com/rust-lang/crates.io-index" 238 | checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" 239 | 240 | [[package]] 241 | name = "linux-raw-sys" 242 | version = "0.4.14" 243 | source = "registry+https://github.com/rust-lang/crates.io-index" 244 | checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" 245 | 246 | [[package]] 247 | name = "lock_api" 248 | version = "0.4.12" 249 | source = "registry+https://github.com/rust-lang/crates.io-index" 250 | checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" 251 | dependencies = [ 252 | "autocfg", 253 | "scopeguard", 254 | ] 255 | 256 | [[package]] 257 | name = "log" 258 | version = "0.4.22" 259 | source = "registry+https://github.com/rust-lang/crates.io-index" 260 | checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" 261 | 262 | [[package]] 263 | name = "lru" 264 | version = "0.12.5" 265 | source = "registry+https://github.com/rust-lang/crates.io-index" 266 | checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" 267 | dependencies = [ 268 | "hashbrown", 269 | ] 270 | 271 | [[package]] 272 | name = "mio" 273 | version = "1.0.3" 274 | source = "registry+https://github.com/rust-lang/crates.io-index" 275 | checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" 276 | dependencies = [ 277 | "libc", 278 | "log", 279 | "wasi", 280 | "windows-sys 0.52.0", 281 | ] 282 | 283 | [[package]] 284 | name = "parking_lot" 285 | version = "0.12.3" 286 | source = "registry+https://github.com/rust-lang/crates.io-index" 287 | checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" 288 | dependencies = [ 289 | "lock_api", 290 | "parking_lot_core", 291 | ] 292 | 293 | [[package]] 294 | name = "parking_lot_core" 295 | version = "0.9.10" 296 | source = "registry+https://github.com/rust-lang/crates.io-index" 297 | checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" 298 | dependencies = [ 299 | "cfg-if", 300 | "libc", 301 | "redox_syscall", 302 | "smallvec", 303 | "windows-targets", 304 | ] 305 | 306 | [[package]] 307 | name = "paste" 308 | version = "1.0.15" 309 | source = "registry+https://github.com/rust-lang/crates.io-index" 310 | checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" 311 | 312 | [[package]] 313 | name = "pretty_assertions" 314 | version = "1.4.1" 315 | source = "registry+https://github.com/rust-lang/crates.io-index" 316 | checksum = "3ae130e2f271fbc2ac3a40fb1d07180839cdbbe443c7a27e1e3c13c5cac0116d" 317 | dependencies = [ 318 | "diff", 319 | "yansi", 320 | ] 321 | 322 | [[package]] 323 | name = "proc-macro2" 324 | version = "1.0.92" 325 | source = "registry+https://github.com/rust-lang/crates.io-index" 326 | checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" 327 | dependencies = [ 328 | "unicode-ident", 329 | ] 330 | 331 | [[package]] 332 | name = "quote" 333 | version = "1.0.38" 334 | source = "registry+https://github.com/rust-lang/crates.io-index" 335 | checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" 336 | dependencies = [ 337 | "proc-macro2", 338 | ] 339 | 340 | [[package]] 341 | name = "ratatui" 342 | version = "0.29.0" 343 | source = "registry+https://github.com/rust-lang/crates.io-index" 344 | checksum = "eabd94c2f37801c20583fc49dd5cd6b0ba68c716787c2dd6ed18571e1e63117b" 345 | dependencies = [ 346 | "bitflags", 347 | "cassowary", 348 | "compact_str", 349 | "crossterm", 350 | "indoc", 351 | "instability", 352 | "itertools", 353 | "lru", 354 | "paste", 355 | "strum", 356 | "unicode-segmentation", 357 | "unicode-truncate", 358 | "unicode-width 0.2.0", 359 | ] 360 | 361 | [[package]] 362 | name = "redox_syscall" 363 | version = "0.5.8" 364 | source = "registry+https://github.com/rust-lang/crates.io-index" 365 | checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" 366 | dependencies = [ 367 | "bitflags", 368 | ] 369 | 370 | [[package]] 371 | name = "rustix" 372 | version = "0.38.42" 373 | source = "registry+https://github.com/rust-lang/crates.io-index" 374 | checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85" 375 | dependencies = [ 376 | "bitflags", 377 | "errno", 378 | "libc", 379 | "linux-raw-sys", 380 | "windows-sys 0.59.0", 381 | ] 382 | 383 | [[package]] 384 | name = "rustversion" 385 | version = "1.0.19" 386 | source = "registry+https://github.com/rust-lang/crates.io-index" 387 | checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" 388 | 389 | [[package]] 390 | name = "ryu" 391 | version = "1.0.18" 392 | source = "registry+https://github.com/rust-lang/crates.io-index" 393 | checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" 394 | 395 | [[package]] 396 | name = "scopeguard" 397 | version = "1.2.0" 398 | source = "registry+https://github.com/rust-lang/crates.io-index" 399 | checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" 400 | 401 | [[package]] 402 | name = "signal-hook" 403 | version = "0.3.17" 404 | source = "registry+https://github.com/rust-lang/crates.io-index" 405 | checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801" 406 | dependencies = [ 407 | "libc", 408 | "signal-hook-registry", 409 | ] 410 | 411 | [[package]] 412 | name = "signal-hook-mio" 413 | version = "0.2.4" 414 | source = "registry+https://github.com/rust-lang/crates.io-index" 415 | checksum = "34db1a06d485c9142248b7a054f034b349b212551f3dfd19c94d45a754a217cd" 416 | dependencies = [ 417 | "libc", 418 | "mio", 419 | "signal-hook", 420 | ] 421 | 422 | [[package]] 423 | name = "signal-hook-registry" 424 | version = "1.4.2" 425 | source = "registry+https://github.com/rust-lang/crates.io-index" 426 | checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" 427 | dependencies = [ 428 | "libc", 429 | ] 430 | 431 | [[package]] 432 | name = "smallvec" 433 | version = "1.13.2" 434 | source = "registry+https://github.com/rust-lang/crates.io-index" 435 | checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" 436 | 437 | [[package]] 438 | name = "static_assertions" 439 | version = "1.1.0" 440 | source = "registry+https://github.com/rust-lang/crates.io-index" 441 | checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" 442 | 443 | [[package]] 444 | name = "strsim" 445 | version = "0.11.1" 446 | source = "registry+https://github.com/rust-lang/crates.io-index" 447 | checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" 448 | 449 | [[package]] 450 | name = "strum" 451 | version = "0.26.3" 452 | source = "registry+https://github.com/rust-lang/crates.io-index" 453 | checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" 454 | dependencies = [ 455 | "strum_macros", 456 | ] 457 | 458 | [[package]] 459 | name = "strum_macros" 460 | version = "0.26.4" 461 | source = "registry+https://github.com/rust-lang/crates.io-index" 462 | checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" 463 | dependencies = [ 464 | "heck", 465 | "proc-macro2", 466 | "quote", 467 | "rustversion", 468 | "syn", 469 | ] 470 | 471 | [[package]] 472 | name = "syn" 473 | version = "2.0.93" 474 | source = "registry+https://github.com/rust-lang/crates.io-index" 475 | checksum = "9c786062daee0d6db1132800e623df74274a0a87322d8e183338e01b3d98d058" 476 | dependencies = [ 477 | "proc-macro2", 478 | "quote", 479 | "unicode-ident", 480 | ] 481 | 482 | [[package]] 483 | name = "unicode-ident" 484 | version = "1.0.14" 485 | source = "registry+https://github.com/rust-lang/crates.io-index" 486 | checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" 487 | 488 | [[package]] 489 | name = "unicode-segmentation" 490 | version = "1.12.0" 491 | source = "registry+https://github.com/rust-lang/crates.io-index" 492 | checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" 493 | 494 | [[package]] 495 | name = "unicode-truncate" 496 | version = "1.1.0" 497 | source = "registry+https://github.com/rust-lang/crates.io-index" 498 | checksum = "b3644627a5af5fa321c95b9b235a72fd24cd29c648c2c379431e6628655627bf" 499 | dependencies = [ 500 | "itertools", 501 | "unicode-segmentation", 502 | "unicode-width 0.1.14", 503 | ] 504 | 505 | [[package]] 506 | name = "unicode-width" 507 | version = "0.1.14" 508 | source = "registry+https://github.com/rust-lang/crates.io-index" 509 | checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" 510 | 511 | [[package]] 512 | name = "unicode-width" 513 | version = "0.2.0" 514 | source = "registry+https://github.com/rust-lang/crates.io-index" 515 | checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" 516 | 517 | [[package]] 518 | name = "wasi" 519 | version = "0.11.0+wasi-snapshot-preview1" 520 | source = "registry+https://github.com/rust-lang/crates.io-index" 521 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 522 | 523 | [[package]] 524 | name = "winapi" 525 | version = "0.3.9" 526 | source = "registry+https://github.com/rust-lang/crates.io-index" 527 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 528 | dependencies = [ 529 | "winapi-i686-pc-windows-gnu", 530 | "winapi-x86_64-pc-windows-gnu", 531 | ] 532 | 533 | [[package]] 534 | name = "winapi-i686-pc-windows-gnu" 535 | version = "0.4.0" 536 | source = "registry+https://github.com/rust-lang/crates.io-index" 537 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 538 | 539 | [[package]] 540 | name = "winapi-x86_64-pc-windows-gnu" 541 | version = "0.4.0" 542 | source = "registry+https://github.com/rust-lang/crates.io-index" 543 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 544 | 545 | [[package]] 546 | name = "windows-sys" 547 | version = "0.52.0" 548 | source = "registry+https://github.com/rust-lang/crates.io-index" 549 | checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" 550 | dependencies = [ 551 | "windows-targets", 552 | ] 553 | 554 | [[package]] 555 | name = "windows-sys" 556 | version = "0.59.0" 557 | source = "registry+https://github.com/rust-lang/crates.io-index" 558 | checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" 559 | dependencies = [ 560 | "windows-targets", 561 | ] 562 | 563 | [[package]] 564 | name = "windows-targets" 565 | version = "0.52.6" 566 | source = "registry+https://github.com/rust-lang/crates.io-index" 567 | checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" 568 | dependencies = [ 569 | "windows_aarch64_gnullvm", 570 | "windows_aarch64_msvc", 571 | "windows_i686_gnu", 572 | "windows_i686_gnullvm", 573 | "windows_i686_msvc", 574 | "windows_x86_64_gnu", 575 | "windows_x86_64_gnullvm", 576 | "windows_x86_64_msvc", 577 | ] 578 | 579 | [[package]] 580 | name = "windows_aarch64_gnullvm" 581 | version = "0.52.6" 582 | source = "registry+https://github.com/rust-lang/crates.io-index" 583 | checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" 584 | 585 | [[package]] 586 | name = "windows_aarch64_msvc" 587 | version = "0.52.6" 588 | source = "registry+https://github.com/rust-lang/crates.io-index" 589 | checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" 590 | 591 | [[package]] 592 | name = "windows_i686_gnu" 593 | version = "0.52.6" 594 | source = "registry+https://github.com/rust-lang/crates.io-index" 595 | checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" 596 | 597 | [[package]] 598 | name = "windows_i686_gnullvm" 599 | version = "0.52.6" 600 | source = "registry+https://github.com/rust-lang/crates.io-index" 601 | checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" 602 | 603 | [[package]] 604 | name = "windows_i686_msvc" 605 | version = "0.52.6" 606 | source = "registry+https://github.com/rust-lang/crates.io-index" 607 | checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" 608 | 609 | [[package]] 610 | name = "windows_x86_64_gnu" 611 | version = "0.52.6" 612 | source = "registry+https://github.com/rust-lang/crates.io-index" 613 | checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" 614 | 615 | [[package]] 616 | name = "windows_x86_64_gnullvm" 617 | version = "0.52.6" 618 | source = "registry+https://github.com/rust-lang/crates.io-index" 619 | checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" 620 | 621 | [[package]] 622 | name = "windows_x86_64_msvc" 623 | version = "0.52.6" 624 | source = "registry+https://github.com/rust-lang/crates.io-index" 625 | checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" 626 | 627 | [[package]] 628 | name = "yansi" 629 | version = "1.0.1" 630 | source = "registry+https://github.com/rust-lang/crates.io-index" 631 | checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" 632 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ghostty_animation" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | alternate_screen_wrapper = { version = "0.1.1", features = ["crossterm"] } 8 | crossterm = "0.28.1" 9 | ratatui = "0.29.0" 10 | 11 | [profile.release] 12 | lto = true 13 | codegen-units = 1 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # A Command that can show 👻 spinning 2 | - Animation is from [ghostty.org](https://ghostty.org) 3 | - Press `Q` to quit 4 | 5 | ### Looks like ⬇️ 6 | ![look](/show.gif) -------------------------------------------------------------------------------- /show.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lukeshere/ghostty-animation-command/d84b52d17cf904d0d98bf2ed9a1e10144bc2a19a/show.gif -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | use std::{ 2 | io::stdout, 3 | sync::mpsc::{self, Receiver, Sender}, 4 | thread, 5 | time::SystemTime, 6 | }; 7 | 8 | use animation::FRAMES; 9 | use crossterm::event::{Event, KeyCode}; 10 | use ratatui::{ 11 | layout::{Constraint, Direction, Flex, Layout}, 12 | prelude::CrosstermBackend, 13 | Terminal, 14 | }; 15 | 16 | mod animation; 17 | 18 | fn main() { 19 | let _wrapper = alternate_screen_wrapper::AlternateScreen::enter().unwrap(); 20 | let (tx, rx): (Sender<()>, Receiver<()>) = mpsc::channel(); 21 | 22 | thread::spawn(move || loop { 23 | key_press(&tx); 24 | }); 25 | 26 | { 27 | let vertical_center = Layout::new( 28 | Direction::Vertical, 29 | [Constraint::Length(animation::IMAGE_HEIGHT)], 30 | ) 31 | .flex(Flex::Center); 32 | let horizontal_center = Layout::new( 33 | Direction::Horizontal, 34 | [Constraint::Length(animation::IMAGE_WIDTH)], 35 | ) 36 | .flex(Flex::Center); 37 | 38 | let mut terminal = Terminal::new(CrosstermBackend::new(stdout())).unwrap(); 39 | let start = SystemTime::now(); 40 | const MICROS_PER_FRAME: u128 = 30_000; 41 | 42 | loop { 43 | if let Ok(_should_quit) = rx.try_recv() { 44 | break; 45 | } 46 | // Automatically skip frames when render is slow 47 | let i = (start.elapsed().unwrap().as_micros() / MICROS_PER_FRAME) as usize; 48 | let frame = &FRAMES[i % FRAMES.len()]; 49 | terminal 50 | .draw(|f| { 51 | let area = horizontal_center.split(vertical_center.split(f.area())[0])[0]; 52 | f.render_widget(frame, area); 53 | }) 54 | .unwrap(); 55 | 56 | std::thread::sleep(std::time::Duration::from_micros(MICROS_PER_FRAME.try_into().unwrap())); 57 | } 58 | } 59 | } 60 | 61 | fn key_press(tx: &Sender<()>) { 62 | loop { 63 | if let Event::Key(key) = crossterm::event::read().unwrap() { 64 | if key.code == KeyCode::Char('q') { 65 | tx.send(()).unwrap(); 66 | } 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /typos.toml: -------------------------------------------------------------------------------- 1 | [default.extend-words] 2 | ratatui = "ratatui" 3 | --------------------------------------------------------------------------------