From 13bdb164a473091b46e857d37599e7e1ae22665e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E9=9B=85=20misaki=20masa?= Date: Fri, 13 Feb 2026 13:03:44 +0800 Subject: [PATCH] feat!: new `ind-app-title` DDS event to customize the app title (#3684) --- CHANGELOG.md | 9 +- Cargo.lock | 160 +++++++++++++------------- Cargo.toml | 4 +- README.md | 2 +- yazi-actor/src/app/bootstrap.rs | 8 +- yazi-actor/src/app/mod.rs | 1 + yazi-actor/src/app/quit.rs | 6 +- yazi-actor/src/app/resize.rs | 6 +- yazi-actor/src/app/resume.rs | 5 +- yazi-actor/src/app/stop.rs | 2 +- yazi-actor/src/app/title.rs | 34 ++++++ yazi-actor/src/app/update_progress.rs | 2 +- yazi-actor/src/cmp/close.rs | 2 +- yazi-actor/src/mgr/cd.rs | 1 + yazi-actor/src/mgr/refresh.rs | 7 +- yazi-actor/src/mgr/tab_close.rs | 1 + yazi-actor/src/mgr/tab_create.rs | 1 + yazi-actor/src/mgr/tab_rename.rs | 3 +- yazi-actor/src/mgr/tab_switch.rs | 1 + yazi-boot/Cargo.toml | 2 +- yazi-cli/Cargo.toml | 2 +- yazi-codegen/Cargo.toml | 2 +- yazi-config/preset/yazi-default.toml | 1 - yazi-config/src/mgr/mgr.rs | 20 +--- yazi-dds/src/spark/kind.rs | 22 +++- yazi-dds/src/spark/spark.rs | 14 ++- yazi-parser/src/app/mod.rs | 2 +- yazi-parser/src/app/quit.rs | 3 +- yazi-parser/src/app/title.rs | 17 +++ yazi-parser/src/mgr/sort.rs | 3 +- yazi-parser/src/mgr/stash.rs | 4 +- yazi-parser/src/notify/push.rs | 3 +- yazi-plugin/src/runtime/runtime.rs | 1 - yazi-term/src/option.rs | 7 +- yazi-term/src/state.rs | 16 +-- yazi-term/src/term.rs | 6 +- 36 files changed, 214 insertions(+), 166 deletions(-) create mode 100644 yazi-actor/src/app/title.rs create mode 100644 yazi-parser/src/app/title.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index 00c3ac16..b2e10722 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,10 +14,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/): ### Added -- New `fs.access()` API to access the filesystem ([#3668]) -- Allow using `ps.sub()` in `init.lua` directly without a plugin ([#3638]) -- New `relay-notify-push` DDS event to allow custom notification handlers ([#3642]) - Custom tab name ([#3666]) +- Allow using `ps.sub()` in `init.lua` directly without a plugin ([#3638]) +- New `fs.access()` API to access the filesystem ([#3668]) +- New `relay-notify-push` DDS event to allow custom notification handlers ([#3642]) +- New `ind-app-title` DDS event to customize the app title ([#3684]) - New `fs.unique()` creates a unique file or directory ([#3677]) - New `cx.which` API to access the which component state ([#3617]) - New `ind-which-activate` DDS event to change the which component behavior ([#3608]) @@ -26,6 +27,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/): - Upgrade Lua to 5.5 ([#3633]) - Change preset t for creating tabs to tt to avoid conflict with new tr for renaming tabs ([#3666]) +- Remove `title_format` in favor of new `ind-app-title` DDS event for flexible title customization ([#3684]) - Remove `micro_workers` and `macro_workers` in favor of finer control over concurrent workers ([#3661]) ### Deprecated @@ -1655,3 +1657,4 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/): [#3668]: https://github.com/sxyazi/yazi/pull/3668 [#3677]: https://github.com/sxyazi/yazi/pull/3677 [#3678]: https://github.com/sxyazi/yazi/pull/3678 +[#3684]: https://github.com/sxyazi/yazi/pull/3684 diff --git a/Cargo.lock b/Cargo.lock index 231422a6..4687aad5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -186,7 +186,7 @@ checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -500,7 +500,7 @@ checksum = "f9abbd1bc6865053c427f7198e6af43bfdedc55ab791faed4fbd361d789575ff" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -600,9 +600,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.57" +version = "4.5.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6899ea499e3fb9305a65d5ebf6e3d2248c5fab291f300ad0a704fbe142eae31a" +checksum = "63be97961acde393029492ce0be7a1af7e323e6bae9511ebfac33751be5e6806" dependencies = [ "clap_builder", "clap_derive", @@ -610,9 +610,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.57" +version = "4.5.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b12c8b680195a62a8364d16b8447b01b6c2c8f9aaf68bee653be34d4245e238" +checksum = "7f13174bda5dfd69d7e947827e5af4b0f2f94a4a3ee92912fba07a66150f21e2" dependencies = [ "anstream", "anstyle", @@ -622,9 +622,9 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.5.65" +version = "4.5.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "430b4dc2b5e3861848de79627b2bedc9f3342c7da5173a14eaa5d0f8dc18ae5d" +checksum = "c757a3b7e39161a4e56f9365141ada2a6c915a8622c408ab6bb4b5d047371031" dependencies = [ "clap", ] @@ -658,14 +658,14 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] name = "clap_lex" -version = "0.7.7" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3e64b0cc0439b12df2fa678eae89a1c56a529fd067a9115f7827f1fffd22b32" +checksum = "3a822ea5bc7590f9d40f1ba12c0dc3c2760f3482c6984db1573ad11031420831" [[package]] name = "clipboard-win" @@ -990,7 +990,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -1034,7 +1034,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -1048,7 +1048,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -1061,7 +1061,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -1072,7 +1072,7 @@ checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" dependencies = [ "darling_core 0.20.11", "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -1083,7 +1083,7 @@ checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" dependencies = [ "darling_core 0.21.3", "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -1094,7 +1094,7 @@ checksum = "ac3984ec7bd6cfa798e62b4a642426a5be0e68f9401cfc2a01e3fa9ea2fcdb8d" dependencies = [ "darling_core 0.23.0", "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -1132,7 +1132,7 @@ checksum = "780eb241654bf097afb00fc5f054a09b687dad862e485fdcf8399bb056565370" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -1154,9 +1154,9 @@ dependencies = [ [[package]] name = "der" -version = "0.8.0-rc.10" +version = "0.8.0-rc.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02c1d73e9668ea6b6a28172aa55f3ebec38507131ce179051c8033b5c6037653" +checksum = "6c0182be35043efdd2df327a443bb600606e350cfb090cccb233e9451e76f5a3" dependencies = [ "const-oid 0.10.2", "pem-rfc7468 1.0.0", @@ -1165,9 +1165,9 @@ dependencies = [ [[package]] name = "deranged" -version = "0.5.5" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ececcb659e7ba858fb4f10388c250a7252eb0a27373f1a72b8748afdd248e587" +checksum = "cc3dc5ad92c2e2d1c193bbbbdf2ea477cb81331de4f3103f267ca18368b988c4" dependencies = [ "powerfmt", "serde_core", @@ -1191,7 +1191,7 @@ dependencies = [ "darling 0.20.11", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -1201,7 +1201,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" dependencies = [ "derive_builder_core", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -1223,7 +1223,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -1240,9 +1240,9 @@ dependencies = [ [[package]] name = "digest" -version = "0.11.0-rc.11" +version = "0.11.0-rc.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b42f1d9edf5207c137646b568a0168ca0ec25b7f9eaf7f9961da51a3d91cea" +checksum = "d4b37eb2004a3548553a44cc1e688aac70f0345b896c9d822b4a0e520bc9183b" dependencies = [ "block-buffer 0.11.0", "const-oid 0.10.2", @@ -1366,7 +1366,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -1392,7 +1392,7 @@ checksum = "44f23cf4b44bfce11a86ace86f8a73ffdec849c9fd00a386a53d278bd9e81fb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -1495,7 +1495,7 @@ checksum = "a0aca10fb742cb43f9e7bb8467c91aa9bcb8e3ffbc6a6f7389bb93ffc920577d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -1655,7 +1655,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -1836,7 +1836,7 @@ dependencies = [ "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -2053,7 +2053,7 @@ dependencies = [ "indoc", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -2064,7 +2064,7 @@ checksum = "fe44f2bbd99fcb302e246e2d6bcf51aeda346d02a365f80296a07a8c711b6da6" dependencies = [ "argon2", "bcrypt-pbkdf", - "digest 0.11.0-rc.11", + "digest 0.11.0-rc.12", "ecdsa", "ed25519-dalek", "hex", @@ -2095,7 +2095,7 @@ checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -2499,7 +2499,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -2643,7 +2643,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -2899,7 +2899,7 @@ dependencies = [ "by_address", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -3018,7 +3018,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -3071,7 +3071,7 @@ dependencies = [ "phf_shared", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -3101,7 +3101,7 @@ version = "0.8.0-rc.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "986d2e952779af96ea048f160fd9194e1751b4faea78bcf3ceb456efe008088e" dependencies = [ - "der 0.8.0-rc.10", + "der 0.8.0-rc.12", "spki 0.8.0-rc.4", ] @@ -3134,11 +3134,11 @@ dependencies = [ [[package]] name = "pkcs8" -version = "0.11.0-rc.10" +version = "0.11.0-rc.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b226d2cc389763951db8869584fd800cbbe2962bf454e2edeb5172b31ee99774" +checksum = "12922b6296c06eb741b02d7b5161e3aaa22864af38dfa025a1a3ba3f68c84577" dependencies = [ - "der 0.8.0-rc.10", + "der 0.8.0-rc.12", "spki 0.8.0-rc.4", ] @@ -3246,7 +3246,7 @@ dependencies = [ "proc-macro-error-attr2", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -3274,7 +3274,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52717f9a02b6965224f95ca2a81e2e0c5c43baacd28ca057577988930b6c3d5b" dependencies = [ "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -3621,7 +3621,7 @@ checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -3692,9 +3692,9 @@ dependencies = [ "const-oid 0.10.2", "crypto-bigint 0.7.0-rc.18", "crypto-primes", - "digest 0.11.0-rc.11", + "digest 0.11.0-rc.12", "pkcs1", - "pkcs8 0.11.0-rc.10", + "pkcs8 0.11.0-rc.11", "rand_core 0.10.0-rc-3", "sha2 0.11.0-rc.5", "signature 3.0.0-rc.6", @@ -3972,7 +3972,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -4025,7 +4025,7 @@ dependencies = [ "darling 0.21.3", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -4057,7 +4057,7 @@ checksum = "3b167252f3c126be0d8926639c4c4706950f01445900c4b3db0fd7e89fcb750a" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.11.0-rc.11", + "digest 0.11.0-rc.12", ] [[package]] @@ -4079,7 +4079,7 @@ checksum = "7c5f3b1e2dc8aad28310d8410bd4d7e180eca65fca176c52ab00d364475d0024" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.11.0-rc.11", + "digest 0.11.0-rc.12", ] [[package]] @@ -4166,7 +4166,7 @@ version = "3.0.0-rc.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "597a96996ccff7dfa16f052bd995b4cecc72af22c35138738dc029f0ead6608d" dependencies = [ - "digest 0.11.0-rc.11", + "digest 0.11.0-rc.12", "rand_core 0.10.0-rc-3", ] @@ -4242,7 +4242,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8baeff88f34ed0691978ec34440140e1572b68c7dd4a495fd14a3dc1944daa80" dependencies = [ "base64ct", - "der 0.8.0-rc.10", + "der 0.8.0-rc.12", ] [[package]] @@ -4310,7 +4310,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -4332,9 +4332,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.114" +version = "2.0.115" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a" +checksum = "6e614ed320ac28113fa64972c4262d5dbc89deacdfd00c34a3e4cea073243c12" dependencies = [ "proc-macro2", "quote", @@ -4468,7 +4468,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -4479,7 +4479,7 @@ checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -4576,7 +4576,7 @@ checksum = "2d2e76690929402faae40aebdda620a2c0e25dd6d3b9afe48867dfd95991f4bd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -4604,7 +4604,7 @@ checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -4633,9 +4633,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.9.12+spec-1.1.0" +version = "1.0.1+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf92845e79fc2e2def6a5d828f0801e29a2f8acc037becc5ab08595c7d5e9863" +checksum = "bbe30f93627849fa362d4a602212d41bb237dc2bd0f8ba0b2ce785012e124220" dependencies = [ "indexmap 2.13.0", "serde_core", @@ -4648,18 +4648,18 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.7.5+spec-1.1.0" +version = "1.0.0+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347" +checksum = "32c2555c699578a4f59f0cc68e5116c8d7cabbd45e1409b989d4be085b53f13e" dependencies = [ "serde_core", ] [[package]] name = "toml_parser" -version = "1.0.7+spec-1.1.0" +version = "1.0.8+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "247eaa3197818b831697600aadf81514e577e0cba5eab10f7e064e78ae154df1" +checksum = "0742ff5ff03ea7e67c8ae6c93cac239e0d9784833362da3f9a9c1da8dfefcbdc" dependencies = [ "winnow", ] @@ -4701,7 +4701,7 @@ checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -5016,7 +5016,7 @@ dependencies = [ "bumpalo", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.115", "wasm-bindgen-shared", ] @@ -5246,7 +5246,7 @@ checksum = "f6fc35f58ecd95a9b71c4f2329b911016e6bec66b3f2e6a4aad86bd2e99e2f9b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -5257,7 +5257,7 @@ checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -5268,7 +5268,7 @@ checksum = "08990546bf4edef8f431fa6326e032865f27138718c587dc21bc0265bbcb57cc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -5279,7 +5279,7 @@ checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -5676,7 +5676,7 @@ name = "yazi-codegen" version = "26.2.2" dependencies = [ "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -6135,7 +6135,7 @@ checksum = "4122cd3169e94605190e77839c9a40d40ed048d305bfdc146e7df40ab0f3e517" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] @@ -6155,14 +6155,14 @@ checksum = "85a5b4158499876c763cb03bc4e49185d3cccbabb15b33c627f7884f43db852e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.115", ] [[package]] name = "zmij" -version = "1.0.20" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4de98dfa5d5b7fef4ee834d0073d560c9ca7b6c46a71d058c48db7960f8cfaf7" +checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" [[package]] name = "zune-core" diff --git a/Cargo.toml b/Cargo.toml index 8b4d327e..86a96f7c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,7 @@ ansi-to-tui = "8.0.1" anyhow = "1.0.101" base64 = "0.22.1" bitflags = { version = "2.10.0", features = [ "serde" ] } -clap = { version = "4.5.57", features = [ "derive" ] } +clap = { version = "4.5.58", features = [ "derive" ] } core-foundation-sys = "0.8.7" crossterm = { version = "0.29.0", features = [ "event-stream" ] } dirs = "6.0.0" @@ -62,7 +62,7 @@ thiserror = "2.0.18" tokio = { version = "1.49.0", features = [ "full" ] } tokio-stream = "0.1.18" tokio-util = "0.7.18" -toml = { version = "0.9.12" } +toml = { version = "1.0.1" } tracing = { version = "0.1.44", features = [ "max_level_debug", "release_max_level_debug" ] } twox-hash = { version = "2.1.2", default-features = false, features = [ "std", "random", "xxhash3_128" ] } typed-path = "0.12.3" diff --git a/README.md b/README.md index 1dd2105c..f5068b72 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ Yazi is currently in heavy development, expect breaking changes. | [Black Box](https://gitlab.gnome.org/raggesilver/blackbox) | [Sixel graphics format][sixel] | ✅ Built-in | | [Bobcat](https://github.com/ismail-yilmaz/Bobcat) | [Inline images protocol][iip] | ✅ Built-in | | X11 / Wayland | Window system protocol | ☑️ [Überzug++][ueberzug] required | -| Fallback | [ASCII art (Unicode block)][ascii-art] | ☑️ [Chafa][chafa] required | +| Fallback | [ASCII art (Unicode block)][ascii-art] | ☑️ [Chafa][chafa] required (>= 1.16.0) | See https://yazi-rs.github.io/docs/image-preview for details. diff --git a/yazi-actor/src/app/bootstrap.rs b/yazi-actor/src/app/bootstrap.rs index b6c1210b..0fbaf3c9 100644 --- a/yazi-actor/src/app/bootstrap.rs +++ b/yazi-actor/src/app/bootstrap.rs @@ -15,12 +15,9 @@ impl Actor for Bootstrap { const NAME: &str = "bootstrap"; fn act(cx: &mut Ctx, _: Self::Options) -> Result { - for (i, file) in BOOT.files.iter().enumerate() { - let tabs = &mut cx.core.mgr.tabs; - if tabs.len() <= i { - tabs.push(Default::default()); - } + cx.mgr.tabs.resize_with(BOOT.files.len(), Default::default); + for (i, file) in BOOT.files.iter().enumerate().rev() { cx.tab = i; if file.is_empty() { act!(mgr:cd, cx, (BOOT.cwds[i].clone(), CdSource::Tab))?; @@ -28,6 +25,7 @@ impl Actor for Bootstrap { act!(mgr:reveal, cx, (u, CdSource::Tab))?; } } + succ!(); } } diff --git a/yazi-actor/src/app/mod.rs b/yazi-actor/src/app/mod.rs index 9a954fd1..36cab3fb 100644 --- a/yazi-actor/src/app/mod.rs +++ b/yazi-actor/src/app/mod.rs @@ -11,5 +11,6 @@ yazi_macro::mod_flat!( resize resume stop + title update_progress ); diff --git a/yazi-actor/src/app/quit.rs b/yazi-actor/src/app/quit.rs index 979b580a..98d61e19 100644 --- a/yazi-actor/src/app/quit.rs +++ b/yazi-actor/src/app/quit.rs @@ -15,8 +15,8 @@ impl Actor for Quit { const NAME: &str = "quit"; fn act(cx: &mut Ctx, opt: Self::Options) -> Result { - cx.core.tasks.shutdown(); - cx.core.mgr.shutdown(); + cx.tasks.shutdown(); + cx.mgr.shutdown(); futures::executor::block_on(async { _ = futures::join!( @@ -34,7 +34,7 @@ impl Actor for Quit { impl Quit { async fn cwd_to_file(cx: &Ctx<'_>, no: bool) { if let Some(p) = ARGS.cwd_file.as_ref().filter(|_| !no) { - let cwd = cx.core.mgr.cwd().to_strand(); + let cwd = cx.mgr.cwd().to_strand(); Local::regular(p).write(cwd.encoded_bytes()).await.ok(); } } diff --git a/yazi-actor/src/app/resize.rs b/yazi-actor/src/app/resize.rs index 793f10fb..e9de66e6 100644 --- a/yazi-actor/src/app/resize.rs +++ b/yazi-actor/src/app/resize.rs @@ -16,9 +16,9 @@ impl Actor for Resize { fn act(cx: &mut Ctx, opt: Self::Options) -> Result { act!(app:reflow, cx, opt)?; - cx.core.current_mut().arrow(0); - cx.core.parent_mut().map(|f| f.arrow(0)); - cx.core.current_mut().sync_page(true); + cx.current_mut().arrow(0); + cx.parent_mut().map(|f| f.arrow(0)); + cx.current_mut().sync_page(true); act!(mgr:peek, cx) } diff --git a/yazi-actor/src/app/resume.rs b/yazi-actor/src/app/resume.rs index de217f8b..3a018c61 100644 --- a/yazi-actor/src/app/resume.rs +++ b/yazi-actor/src/app/resume.rs @@ -14,8 +14,8 @@ impl Actor for Resume { const NAME: &str = "resume"; fn act(cx: &mut Ctx, opt: Self::Options) -> Result { - cx.core.active_mut().preview.reset(); - *cx.term = Some(Term::start().unwrap()); + cx.active_mut().preview.reset(); + *cx.term = Some(Term::start()?); // While the app resumes, it's possible that the terminal size has changed. // We need to trigger a resize, and render the UI based on the resized area. @@ -23,6 +23,7 @@ impl Actor for Resume { opt.tx.send((true, opt.token))?; + act!(app:title, cx).ok(); succ!(render!()); } } diff --git a/yazi-actor/src/app/stop.rs b/yazi-actor/src/app/stop.rs index 30003482..c8e3c025 100644 --- a/yazi-actor/src/app/stop.rs +++ b/yazi-actor/src/app/stop.rs @@ -13,7 +13,7 @@ impl Actor for Stop { const NAME: &str = "stop"; fn act(cx: &mut Ctx, opt: Self::Options) -> Result { - cx.core.active_mut().preview.reset_image(); + cx.active_mut().preview.reset_image(); // We need to destroy the `term` first before stopping the `signals` // to prevent any signal from triggering the term to render again diff --git a/yazi-actor/src/app/title.rs b/yazi-actor/src/app/title.rs new file mode 100644 index 00000000..31387205 --- /dev/null +++ b/yazi-actor/src/app/title.rs @@ -0,0 +1,34 @@ +use anyhow::Result; +use crossterm::{execute, terminal::SetTitle}; +use yazi_actor::Ctx; +use yazi_dds::spark::SparkKind; +use yazi_macro::succ; +use yazi_parser::app::TitleOpt; +use yazi_shared::{Source, data::Data}; +use yazi_term::TermState; +use yazi_tty::TTY; + +use crate::Actor; + +pub struct Title; + +impl Actor for Title { + type Options = TitleOpt; + + const NAME: &str = "title"; + + fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + let s = opt.value.unwrap_or_else(|| format!("Yazi: {}", cx.tab().name()).into()); + execute!(TTY.writer(), SetTitle(&s))?; + + yazi_term::STATE.set(TermState { title: !s.is_empty(), ..yazi_term::STATE.get() }); + succ!() + } + + fn hook(cx: &Ctx, _opt: &Self::Options) -> Option { + match cx.source() { + Source::Ind => Some(SparkKind::IndAppTitle), + _ => None, + } + } +} diff --git a/yazi-actor/src/app/update_progress.rs b/yazi-actor/src/app/update_progress.rs index 3af78984..3d1b1741 100644 --- a/yazi-actor/src/app/update_progress.rs +++ b/yazi-actor/src/app/update_progress.rs @@ -15,7 +15,7 @@ impl Actor for UpdateProgress { fn act(cx: &mut Ctx, opt: Self::Options) -> Result { // Update the progress of all tasks. - let tasks = &mut cx.core.tasks; + let tasks = &mut cx.tasks; let progressed = tasks.summary != opt.summary; tasks.summary = opt.summary; diff --git a/yazi-actor/src/cmp/close.rs b/yazi-actor/src/cmp/close.rs index 623eb55e..c8b16368 100644 --- a/yazi-actor/src/cmp/close.rs +++ b/yazi-actor/src/cmp/close.rs @@ -16,7 +16,7 @@ impl Actor for Close { const NAME: &str = "close"; fn act(cx: &mut Ctx, opt: Self::Options) -> Result { - let cmp = &mut cx.core.cmp; + let cmp = &mut cx.cmp; if let Some(item) = cmp.selected().filter(|_| opt.submit).cloned() { return act!(input:complete, cx, CompleteOpt { name: item.name, is_dir: item.is_dir, ticket: cmp.ticket }); } diff --git a/yazi-actor/src/mgr/cd.rs b/yazi-actor/src/mgr/cd.rs index 24eab4ad..a0882a20 100644 --- a/yazi-actor/src/mgr/cd.rs +++ b/yazi-actor/src/mgr/cd.rs @@ -55,6 +55,7 @@ impl Actor for Cd { act!(mgr:hover, cx)?; act!(mgr:refresh, cx)?; act!(mgr:stash, cx, opt).ok(); + act!(app:title, cx).ok(); succ!(render!()); } } diff --git a/yazi-actor/src/mgr/refresh.rs b/yazi-actor/src/mgr/refresh.rs index 14875ce7..141cb55d 100644 --- a/yazi-actor/src/mgr/refresh.rs +++ b/yazi-actor/src/mgr/refresh.rs @@ -1,13 +1,10 @@ use anyhow::Result; -use crossterm::{execute, terminal::SetTitle}; -use yazi_config::YAZI; use yazi_core::tab::Folder; use yazi_fs::{CWD, Files, FilesOp, cha::Cha}; use yazi_macro::{act, succ}; use yazi_parser::VoidOpt; use yazi_proxy::MgrProxy; use yazi_shared::{data::Data, url::{UrlBuf, UrlLike}}; -use yazi_tty::TTY; use yazi_vfs::{VfsFiles, VfsFilesOp}; use crate::{Actor, Ctx}; @@ -20,9 +17,7 @@ impl Actor for Refresh { const NAME: &str = "refresh"; fn act(cx: &mut Ctx, _: Self::Options) -> Result { - if let (_, Some(s)) = (CWD.set(cx.cwd(), Self::cwd_changed), YAZI.mgr.title()) { - execute!(TTY.writer(), SetTitle(s)).ok(); - } + CWD.set(cx.cwd(), Self::cwd_changed); if let Some(p) = cx.parent() { Self::trigger_dirs(&[cx.current(), p]); diff --git a/yazi-actor/src/mgr/tab_close.rs b/yazi-actor/src/mgr/tab_close.rs index 23dde947..fe1da4e8 100644 --- a/yazi-actor/src/mgr/tab_close.rs +++ b/yazi-actor/src/mgr/tab_close.rs @@ -30,6 +30,7 @@ impl Actor for TabClose { let cx = &mut Ctx::renew(cx); act!(mgr:refresh, cx)?; act!(mgr:peek, cx, true)?; + act!(app:title, cx).ok(); succ!(render!()); } diff --git a/yazi-actor/src/mgr/tab_create.rs b/yazi-actor/src/mgr/tab_create.rs index 1cda68a0..ed31a0b6 100644 --- a/yazi-actor/src/mgr/tab_create.rs +++ b/yazi-actor/src/mgr/tab_create.rs @@ -51,6 +51,7 @@ impl Actor for TabCreate { act!(mgr:refresh, cx)?; act!(mgr:peek, cx, true)?; + act!(app:title, cx).ok(); succ!(render!()); } } diff --git a/yazi-actor/src/mgr/tab_rename.rs b/yazi-actor/src/mgr/tab_rename.rs index b968a822..12fb75b2 100644 --- a/yazi-actor/src/mgr/tab_rename.rs +++ b/yazi-actor/src/mgr/tab_rename.rs @@ -2,7 +2,7 @@ use std::borrow::Cow; use anyhow::Result; use yazi_config::popup::InputCfg; -use yazi_macro::{render, succ}; +use yazi_macro::{act, render, succ}; use yazi_parser::mgr::TabRenameOpt; use yazi_proxy::{InputProxy, MgrProxy}; use yazi_shared::data::Data; @@ -22,6 +22,7 @@ impl Actor for TabRename { if !opt.interactive { pref.name = opt.name.unwrap_or_default().into_owned(); + act!(app:title, cx).ok(); succ!(render!()); } diff --git a/yazi-actor/src/mgr/tab_switch.rs b/yazi-actor/src/mgr/tab_switch.rs index bf86e002..aff75496 100644 --- a/yazi-actor/src/mgr/tab_switch.rs +++ b/yazi-actor/src/mgr/tab_switch.rs @@ -29,6 +29,7 @@ impl Actor for TabSwitch { act!(mgr:refresh, cx)?; act!(mgr:peek, cx, true)?; + act!(app:title, cx).ok(); succ!(render!()); } } diff --git a/yazi-boot/Cargo.toml b/yazi-boot/Cargo.toml index eec28fe1..d9974b07 100644 --- a/yazi-boot/Cargo.toml +++ b/yazi-boot/Cargo.toml @@ -31,7 +31,7 @@ yazi-shared = { path = "../yazi-shared", version = "26.2.2" } # External dependencies clap = { workspace = true } -clap_complete = "4.5.65" +clap_complete = "4.5.66" clap_complete_fig = "4.5.2" clap_complete_nushell = "4.5.10" vergen-gitcl = { version = "9.1.0", features = [ "build", "rustc" ] } diff --git a/yazi-cli/Cargo.toml b/yazi-cli/Cargo.toml index e7d14ccd..26940b91 100644 --- a/yazi-cli/Cargo.toml +++ b/yazi-cli/Cargo.toml @@ -45,7 +45,7 @@ yazi-shared = { path = "../yazi-shared", version = "26.2.2" } # External build dependencies anyhow = { workspace = true } clap = { workspace = true } -clap_complete = "4.5.65" +clap_complete = "4.5.66" clap_complete_fig = "4.5.2" clap_complete_nushell = "4.5.10" serde = { workspace = true } diff --git a/yazi-codegen/Cargo.toml b/yazi-codegen/Cargo.toml index 2f30c108..06ff760d 100644 --- a/yazi-codegen/Cargo.toml +++ b/yazi-codegen/Cargo.toml @@ -16,5 +16,5 @@ proc-macro = true [dependencies] # External dependencies -syn = { version = "2.0.114", features = [ "full" ] } +syn = { version = "2.0.115", features = [ "full" ] } quote = "1.0.44" diff --git a/yazi-config/preset/yazi-default.toml b/yazi-config/preset/yazi-default.toml index 4290c9e3..78cbb112 100644 --- a/yazi-config/preset/yazi-default.toml +++ b/yazi-config/preset/yazi-default.toml @@ -14,7 +14,6 @@ show_hidden = false show_symlink = true scrolloff = 5 mouse_events = [ "click", "scroll" ] -title_format = "Yazi: {cwd}" [preview] wrap = "no" diff --git a/yazi-config/src/mgr/mgr.rs b/yazi-config/src/mgr/mgr.rs index 735a161d..63876440 100644 --- a/yazi-config/src/mgr/mgr.rs +++ b/yazi-config/src/mgr/mgr.rs @@ -1,8 +1,8 @@ use anyhow::{Result, bail}; use serde::Deserialize; use yazi_codegen::DeserializeOver2; -use yazi_fs::{CWD, SortBy}; -use yazi_shared::{SyncCell, url::UrlLike}; +use yazi_fs::SortBy; +use yazi_shared::SyncCell; use super::{MgrRatio, MouseEvents}; @@ -23,25 +23,9 @@ pub struct Mgr { pub show_symlink: SyncCell, pub scrolloff: SyncCell, pub mouse_events: SyncCell, - pub title_format: String, } impl Mgr { - pub fn title(&self) -> Option { - if self.title_format.is_empty() { - return None; - } - - let home = dirs::home_dir().unwrap_or_default(); - let cwd = if let Ok(p) = CWD.load().try_strip_prefix(home) { - format!("~{}{}", std::path::MAIN_SEPARATOR, p.display()) - } else { - format!("{}", CWD.load().display()) - }; - - Some(self.title_format.replace("{cwd}", &cwd)) - } - pub(crate) fn reshape(self) -> Result { if self.linemode.is_empty() || self.linemode.len() > 20 { bail!("[mgr].linemode must be between 1 and 20 characters."); diff --git a/yazi-dds/src/spark/kind.rs b/yazi-dds/src/spark/kind.rs index a6f155d4..ba71afd0 100644 --- a/yazi-dds/src/spark/kind.rs +++ b/yazi-dds/src/spark/kind.rs @@ -2,16 +2,21 @@ use std::fmt::Display; #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum SparkKind { - // sort + // app:title + IndAppTitle, + + // mgr:sort KeySort, IndSort, - // stash + // mgr:stash IndStash, RelayStash, - // quit + // mgr:quit KeyQuit, + // which:activate IndWhichActivate, + // notify:push RelayNotifyPush, } @@ -19,16 +24,21 @@ pub enum SparkKind { impl AsRef for SparkKind { fn as_ref(&self) -> &str { match self { - // sort + // app:title + Self::IndAppTitle => "ind-app-title", + + // mgr:sort Self::KeySort => "key-sort", Self::IndSort => "ind-sort", - // stash + // mgr:stash Self::IndStash => "ind-stash", Self::RelayStash => "relay-stash", - // quit + // mgr:quit Self::KeyQuit => "key-quit", + // which:activate Self::IndWhichActivate => "ind-which-activate", + // notify:push Self::RelayNotifyPush => "relay-notify-push", } diff --git a/yazi-dds/src/spark/spark.rs b/yazi-dds/src/spark/spark.rs index f913966f..e2d16fdd 100644 --- a/yazi-dds/src/spark/spark.rs +++ b/yazi-dds/src/spark/spark.rs @@ -20,6 +20,7 @@ pub enum Spark<'a> { AppResize(yazi_parser::app::ReflowOpt), AppResume(yazi_parser::app::ResumeOpt), AppStop(yazi_parser::app::StopOpt), + AppTitle(yazi_parser::app::TitleOpt), AppUpdateProgress(yazi_parser::app::UpdateProgressOpt), // Mgr @@ -157,16 +158,21 @@ impl<'a> Spark<'a> { use SparkKind::*; Ok(match kind { - // sort + // app:title + IndAppTitle => Self::AppTitle(<_>::from_lua(value, lua)?), + + // mgr:sort KeySort => Self::Sort(<_>::from_lua(value, lua)?), IndSort => Self::Sort(<_>::from_lua(value, lua)?), - // stash + // mgr:stash IndStash => Self::Stash(<_>::from_lua(value, lua)?), RelayStash => Self::Stash(<_>::from_lua(value, lua)?), - // quit + // mgr:quit KeyQuit => Self::Quit(<_>::from_lua(value, lua)?), + // which:activate IndWhichActivate => Self::WhichActivate(<_>::from_lua(value, lua)?), + // notify:push RelayNotifyPush => Self::NotifyPush(<_>::from_lua(value, lua)?), }) @@ -192,6 +198,7 @@ impl<'a> IntoLua for Spark<'a> { Self::AppResize(b) => b.into_lua(lua), Self::AppResume(b) => b.into_lua(lua), Self::AppStop(b) => b.into_lua(lua), + Self::AppTitle(b) => b.into_lua(lua), Self::AppUpdateProgress(b) => b.into_lua(lua), // Mgr @@ -358,6 +365,7 @@ try_from_spark!(yazi_parser::app::QuitOpt, app:quit, mgr:quit); try_from_spark!(yazi_parser::app::ReflowOpt, app:reflow, app:resize); try_from_spark!(yazi_parser::app::ResumeOpt, app:resume); try_from_spark!(yazi_parser::app::StopOpt, app:stop); +try_from_spark!(yazi_parser::app::TitleOpt, app:title); try_from_spark!(yazi_parser::app::UpdateProgressOpt, app:update_progress); try_from_spark!(yazi_parser::cmp::CloseOpt, cmp:close); try_from_spark!(yazi_parser::cmp::ShowOpt, cmp:show); diff --git a/yazi-parser/src/app/mod.rs b/yazi-parser/src/app/mod.rs index 5fcfae06..8f7ac2c4 100644 --- a/yazi-parser/src/app/mod.rs +++ b/yazi-parser/src/app/mod.rs @@ -1 +1 @@ -yazi_macro::mod_flat!(deprecate mouse plugin quit reflow resume stop update_progress); +yazi_macro::mod_flat!(deprecate mouse plugin quit reflow resume stop title update_progress); diff --git a/yazi-parser/src/app/quit.rs b/yazi-parser/src/app/quit.rs index 7a55d6ac..7990cd01 100644 --- a/yazi-parser/src/app/quit.rs +++ b/yazi-parser/src/app/quit.rs @@ -1,5 +1,6 @@ use mlua::{FromLua, IntoLua, Lua, LuaSerdeExt, Value}; use serde::{Deserialize, Serialize}; +use yazi_binding::SER_OPT; use yazi_shared::{event::CmdCow, strand::StrandBuf}; #[derive(Clone, Debug, Default, Deserialize, Serialize)] @@ -31,5 +32,5 @@ impl FromLua for QuitOpt { } impl IntoLua for QuitOpt { - fn into_lua(self, lua: &Lua) -> mlua::Result { lua.to_value(&self) } + fn into_lua(self, lua: &Lua) -> mlua::Result { lua.to_value_with(&self, SER_OPT) } } diff --git a/yazi-parser/src/app/title.rs b/yazi-parser/src/app/title.rs new file mode 100644 index 00000000..4536a183 --- /dev/null +++ b/yazi-parser/src/app/title.rs @@ -0,0 +1,17 @@ +use mlua::{FromLua, IntoLua, Lua, LuaSerdeExt, Value}; +use serde::{Deserialize, Serialize}; +use yazi_binding::SER_OPT; +use yazi_shared::SStr; + +#[derive(Debug, Default, Deserialize, Serialize)] +pub struct TitleOpt { + pub value: Option, +} + +impl FromLua for TitleOpt { + fn from_lua(value: Value, lua: &Lua) -> mlua::Result { lua.from_value(value) } +} + +impl IntoLua for TitleOpt { + fn into_lua(self, lua: &Lua) -> mlua::Result { lua.to_value_with(&self, SER_OPT) } +} diff --git a/yazi-parser/src/mgr/sort.rs b/yazi-parser/src/mgr/sort.rs index 2bccb47f..580ac4f6 100644 --- a/yazi-parser/src/mgr/sort.rs +++ b/yazi-parser/src/mgr/sort.rs @@ -1,5 +1,6 @@ use mlua::{FromLua, IntoLua, Lua, LuaSerdeExt, Value}; use serde::{Deserialize, Serialize}; +use yazi_binding::SER_OPT; use yazi_fs::SortBy; use yazi_shared::event::CmdCow; @@ -31,5 +32,5 @@ impl FromLua for SortOpt { } impl IntoLua for SortOpt { - fn into_lua(self, lua: &Lua) -> mlua::Result { lua.to_value(&self) } + fn into_lua(self, lua: &Lua) -> mlua::Result { lua.to_value_with(&self, SER_OPT) } } diff --git a/yazi-parser/src/mgr/stash.rs b/yazi-parser/src/mgr/stash.rs index a10005e4..35f6a197 100644 --- a/yazi-parser/src/mgr/stash.rs +++ b/yazi-parser/src/mgr/stash.rs @@ -1,7 +1,7 @@ use anyhow::bail; use mlua::{ExternalError, FromLua, IntoLua, Lua, LuaSerdeExt, Value}; use serde::{Deserialize, Serialize}; -use yazi_binding::Url; +use yazi_binding::{SER_OPT, Url}; use yazi_shared::{event::CmdCow, url::UrlBuf}; use crate::mgr::{CdOpt, CdSource}; @@ -37,7 +37,7 @@ impl IntoLua for StashOpt { lua .create_table_from([ ("target", Url::new(self.target).into_lua(lua)?), - ("source", lua.to_value(&self.source)?), + ("source", lua.to_value_with(&self.source, SER_OPT)?), ])? .into_lua(lua) } diff --git a/yazi-parser/src/notify/push.rs b/yazi-parser/src/notify/push.rs index 350e1e79..cb0c7bda 100644 --- a/yazi-parser/src/notify/push.rs +++ b/yazi-parser/src/notify/push.rs @@ -4,6 +4,7 @@ use anyhow::anyhow; use mlua::{FromLua, IntoLua, Lua, LuaSerdeExt, Value}; use serde::{Deserialize, Serialize}; use serde_with::{DurationSecondsWithFrac, serde_as}; +use yazi_binding::SER_OPT; use yazi_config::{Style, THEME}; use yazi_shared::event::CmdCow; @@ -31,7 +32,7 @@ impl FromLua for PushOpt { } impl IntoLua for PushOpt { - fn into_lua(self, lua: &Lua) -> mlua::Result { lua.to_value(&self) } + fn into_lua(self, lua: &Lua) -> mlua::Result { lua.to_value_with(&self, SER_OPT) } } // --- Level diff --git a/yazi-plugin/src/runtime/runtime.rs b/yazi-plugin/src/runtime/runtime.rs index 6e1c35a4..b040e68b 100644 --- a/yazi-plugin/src/runtime/runtime.rs +++ b/yazi-plugin/src/runtime/runtime.rs @@ -54,7 +54,6 @@ fn mgr() -> Composer { b"show_symlink" => m.show_symlink.get().into_lua(lua)?, b"scrolloff" => m.scrolloff.get().into_lua(lua)?, b"mouse_events" => lua.to_value_with(&m.mouse_events, SER_OPT)?, - b"title_format" => lua.create_string(&m.title_format)?.into_lua(lua)?, _ => return Ok(Value::Nil), } .into_lua(lua) diff --git a/yazi-term/src/option.rs b/yazi-term/src/option.rs index 05d6131d..6b090d87 100644 --- a/yazi-term/src/option.rs +++ b/yazi-term/src/option.rs @@ -3,15 +3,10 @@ use yazi_config::{THEME, YAZI}; pub(super) struct TermOption { pub bg: String, pub mouse: bool, - pub title: Option, } impl Default for TermOption { fn default() -> Self { - Self { - bg: THEME.app.bg_color(), - mouse: !YAZI.mgr.mouse_events.get().is_empty(), - title: YAZI.mgr.title(), - } + Self { bg: THEME.app.bg_color(), mouse: !YAZI.mgr.mouse_events.get().is_empty() } } } diff --git a/yazi-term/src/state.rs b/yazi-term/src/state.rs index 02706255..bc486237 100644 --- a/yazi-term/src/state.rs +++ b/yazi-term/src/state.rs @@ -1,13 +1,13 @@ use crate::TermOption; #[derive(Clone, Copy)] -pub(super) struct TermState { - pub(super) bg: bool, - pub(super) csi_u: bool, - pub(super) mouse: bool, - pub(super) title: bool, - pub(super) cursor_shape: u8, - pub(super) cursor_blink: bool, +pub struct TermState { + pub bg: bool, + pub csi_u: bool, + pub mouse: bool, + pub title: bool, + pub cursor_shape: u8, + pub cursor_blink: bool, } impl TermState { @@ -37,7 +37,7 @@ impl TermState { bg: !opt.bg.is_empty(), csi_u, mouse: opt.mouse, - title: opt.title.is_some(), + title: false, cursor_shape, cursor_blink, } diff --git a/yazi-term/src/term.rs b/yazi-term/src/term.rs index 296f0952..0be8dfd9 100644 --- a/yazi-term/src/term.rs +++ b/yazi-term/src/term.rs @@ -10,7 +10,7 @@ use yazi_tty::{TTY, TtyWriter}; use crate::{TermOption, TermState}; -static STATE: SyncCell = SyncCell::new(TermState::default()); +pub static STATE: SyncCell = SyncCell::new(TermState::default()); pub struct Term { inner: Terminal>>, @@ -61,10 +61,6 @@ impl Term { ); } - if let Some(s) = opt.title { - queue!(TTY.writer(), SetTitle(s)).ok(); - } - term.inner.hide_cursor()?; term.inner.clear()?; term.inner.flush()?;