diff --git a/.gitignore b/.gitignore
index d25b165..bd712a6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -68,3 +68,5 @@ __pycache__/
!release/0.1.5/Squid-Setup-0.1.5-win-x64.exe
!release/0.1.6/Squid-0.1.6-macOS-universal.dmg
!release/0.1.6/Squid-Setup-0.1.6-win-x64.exe
+!release/0.1.7/Squid-0.1.7-macOS-universal.dmg
+!release/0.1.7/Squid-Setup-0.1.7-win-x64.exe
diff --git a/Cargo.lock b/Cargo.lock
index 9b49d00..aab2f40 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -11,6 +11,12 @@ dependencies = [
"gimli 0.33.0",
]
+[[package]]
+name = "adler2"
+version = "2.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
+
[[package]]
name = "aho-corasick"
version = "1.1.5"
@@ -182,6 +188,29 @@ dependencies = [
"syn 3.0.8",
]
+[[package]]
+name = "atk"
+version = "0.18.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "241b621213072e993be4f6f3a9e4b45f65b7e6faad43001be957184b7bb1824b"
+dependencies = [
+ "atk-sys",
+ "glib 0.18.5",
+ "libc",
+]
+
+[[package]]
+name = "atk-sys"
+version = "0.18.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c5e48b684b0ca77d2bbadeef17424c2ea3c897d44d566a1617e7e8f30614d086"
+dependencies = [
+ "glib-sys 0.18.1",
+ "gobject-sys 0.18.0",
+ "libc",
+ "system-deps 6.2.2",
+]
+
[[package]]
name = "atomic"
version = "0.6.1"
@@ -303,6 +332,15 @@ dependencies = [
"zeroize",
]
+[[package]]
+name = "block2"
+version = "0.6.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5"
+dependencies = [
+ "objc2",
+]
+
[[package]]
name = "bstr"
version = "1.13.1"
@@ -335,6 +373,31 @@ version = "1.25.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797"
+[[package]]
+name = "cairo-rs"
+version = "0.18.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8ca26ef0159422fb77631dc9d17b102f253b876fe1586b03b803e63a309b4ee2"
+dependencies = [
+ "bitflags 2.13.2",
+ "cairo-sys-rs",
+ "glib 0.18.5",
+ "libc",
+ "once_cell",
+ "thiserror 1.0.69",
+]
+
+[[package]]
+name = "cairo-sys-rs"
+version = "0.18.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "685c9fa8e590b8b3d678873528d83411db17242a73fccaed827770ea0fedda51"
+dependencies = [
+ "glib-sys 0.18.1",
+ "libc",
+ "system-deps 6.2.2",
+]
+
[[package]]
name = "castaway"
version = "0.2.4"
@@ -354,6 +417,26 @@ dependencies = [
"shlex",
]
+[[package]]
+name = "cfg-expr"
+version = "0.15.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d067ad48b8650848b989a59a86c6c36a995d02d2bf778d45c3c5d57bc2718f02"
+dependencies = [
+ "smallvec",
+ "target-lexicon 0.12.16",
+]
+
+[[package]]
+name = "cfg-expr"
+version = "0.20.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9ba9e9ec16c447027685b1f897b720e18e9a8afd00bd7332c483537e38086c9f"
+dependencies = [
+ "smallvec",
+ "target-lexicon 0.13.5",
+]
+
[[package]]
name = "cfg-if"
version = "1.0.5"
@@ -406,7 +489,7 @@ version = "4.6.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9c751b79415d4e559e3d1fcf128e09e720eb673a06d26cf6f392d37d75b66e0"
dependencies = [
- "heck",
+ "heck 0.5.0",
"proc-macro2",
"quote",
"syn 3.0.8",
@@ -579,7 +662,7 @@ dependencies = [
"serde_derive",
"sha2 0.10.9",
"smallvec",
- "target-lexicon",
+ "target-lexicon 0.13.5",
"wasmtime-internal-core",
]
@@ -592,7 +675,7 @@ dependencies = [
"cranelift-assembler-x64-meta",
"cranelift-codegen-shared",
"cranelift-srcgen",
- "heck",
+ "heck 0.5.0",
"pulley-interpreter",
]
@@ -633,7 +716,7 @@ dependencies = [
"hashbrown 0.17.1",
"log",
"smallvec",
- "target-lexicon",
+ "target-lexicon 0.13.5",
]
[[package]]
@@ -650,7 +733,7 @@ checksum = "649c7b9ad93d5d92287fee74608cacfb139602116293a46e2f25e6ea5402f05c"
dependencies = [
"cranelift-codegen",
"libc",
- "target-lexicon",
+ "target-lexicon 0.13.5",
]
[[package]]
@@ -968,6 +1051,16 @@ dependencies = [
"windows-sys 0.61.2",
]
+[[package]]
+name = "dispatch2"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38"
+dependencies = [
+ "bitflags 2.13.2",
+ "objc2",
+]
+
[[package]]
name = "displaydoc"
version = "0.2.7"
@@ -1101,6 +1194,15 @@ dependencies = [
"regex",
]
+[[package]]
+name = "fdeflate"
+version = "0.3.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c"
+dependencies = [
+ "simd-adler32",
+]
+
[[package]]
name = "ff"
version = "0.14.0"
@@ -1117,6 +1219,33 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64cd1e32ddd350061ae6edb1b082d7c54915b5c672c389143b9a63403a109f24"
+[[package]]
+name = "field-offset"
+version = "0.3.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f"
+dependencies = [
+ "memoffset",
+ "rustc_version",
+]
+
+[[package]]
+name = "file_icon_provider"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4ff9f725b347b91d04340444fcbce0770886e4a6513e5f8e9e73a9e344efe73b"
+dependencies = [
+ "gio 0.22.10",
+ "gtk",
+ "log",
+ "objc2",
+ "objc2-app-kit",
+ "objc2-foundation",
+ "objc2-uniform-type-identifiers",
+ "scopeguard",
+ "windows 0.62.2",
+]
+
[[package]]
name = "filedescriptor"
version = "0.8.3"
@@ -1146,6 +1275,17 @@ version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80"
+[[package]]
+name = "flate2"
+version = "1.1.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "626d4928326b646e70f65ed36fc7cf9f206bdb68a0019ee7c6b4709da4e084c4"
+dependencies = [
+ "crc32fast",
+ "miniz_oxide 0.9.1",
+ "zlib-rs",
+]
+
[[package]]
name = "fnv"
version = "1.0.7"
@@ -1194,12 +1334,34 @@ version = "0.3.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e"
+[[package]]
+name = "futures-executor"
+version = "0.3.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "031b47cf1a3c6cc8bc2fc76cd437f521619387907d469316e7c0bc278f1f5432"
+dependencies = [
+ "futures-core",
+ "futures-task",
+ "futures-util",
+]
+
[[package]]
name = "futures-io"
version = "0.3.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed"
+[[package]]
+name = "futures-macro"
+version = "0.3.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 3.0.8",
+]
+
[[package]]
name = "futures-sink"
version = "0.3.34"
@@ -1221,6 +1383,7 @@ dependencies = [
"futures-channel",
"futures-core",
"futures-io",
+ "futures-macro",
"futures-sink",
"futures-task",
"memchr",
@@ -1228,6 +1391,64 @@ dependencies = [
"slab",
]
+[[package]]
+name = "gdk"
+version = "0.18.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d9f245958c627ac99d8e529166f9823fb3b838d1d41fd2b297af3075093c2691"
+dependencies = [
+ "cairo-rs",
+ "gdk-pixbuf",
+ "gdk-sys",
+ "gio 0.18.4",
+ "glib 0.18.5",
+ "libc",
+ "pango",
+]
+
+[[package]]
+name = "gdk-pixbuf"
+version = "0.18.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "50e1f5f1b0bfb830d6ccc8066d18db35c487b1b2b1e8589b5dfe9f07e8defaec"
+dependencies = [
+ "gdk-pixbuf-sys",
+ "gio 0.18.4",
+ "glib 0.18.5",
+ "libc",
+ "once_cell",
+]
+
+[[package]]
+name = "gdk-pixbuf-sys"
+version = "0.18.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3f9839ea644ed9c97a34d129ad56d38a25e6756f99f3a88e15cd39c20629caf7"
+dependencies = [
+ "gio-sys 0.18.1",
+ "glib-sys 0.18.1",
+ "gobject-sys 0.18.0",
+ "libc",
+ "system-deps 6.2.2",
+]
+
+[[package]]
+name = "gdk-sys"
+version = "0.18.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5c2d13f38594ac1e66619e188c6d5a1adb98d11b2fcf7894fc416ad76aa2f3f7"
+dependencies = [
+ "cairo-sys-rs",
+ "gdk-pixbuf-sys",
+ "gio-sys 0.18.1",
+ "glib-sys 0.18.1",
+ "gobject-sys 0.18.0",
+ "libc",
+ "pango-sys",
+ "pkg-config",
+ "system-deps 6.2.2",
+]
+
[[package]]
name = "generic-array"
version = "0.14.7"
@@ -1287,6 +1508,157 @@ dependencies = [
"stable_deref_trait",
]
+[[package]]
+name = "gio"
+version = "0.18.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d4fc8f532f87b79cbc51a79748f16a6828fb784be93145a322fa14d06d354c73"
+dependencies = [
+ "futures-channel",
+ "futures-core",
+ "futures-io",
+ "futures-util",
+ "gio-sys 0.18.1",
+ "glib 0.18.5",
+ "libc",
+ "once_cell",
+ "pin-project-lite",
+ "smallvec",
+ "thiserror 1.0.69",
+]
+
+[[package]]
+name = "gio"
+version = "0.22.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4620fbafdf19dba814473e19f18e75290cb3338662f6ae35f0402affd3b2b699"
+dependencies = [
+ "futures-channel",
+ "futures-core",
+ "futures-io",
+ "futures-util",
+ "gio-sys 0.22.9",
+ "glib 0.22.10",
+ "libc",
+ "pin-project-lite",
+ "smallvec",
+]
+
+[[package]]
+name = "gio-sys"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "37566df850baf5e4cb0dfb78af2e4b9898d817ed9263d1090a2df958c64737d2"
+dependencies = [
+ "glib-sys 0.18.1",
+ "gobject-sys 0.18.0",
+ "libc",
+ "system-deps 6.2.2",
+ "winapi",
+]
+
+[[package]]
+name = "gio-sys"
+version = "0.22.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6c28739f914c15b87a9856000bed9cbd5b3a8afbca5e982d9a299e1601422cb5"
+dependencies = [
+ "glib-sys 0.22.9",
+ "gobject-sys 0.22.9",
+ "libc",
+ "system-deps 9.0.1",
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "glib"
+version = "0.18.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "233daaf6e83ae6a12a52055f568f9d7cf4671dabb78ff9560ab6da230ce00ee5"
+dependencies = [
+ "bitflags 2.13.2",
+ "futures-channel",
+ "futures-core",
+ "futures-executor",
+ "futures-task",
+ "futures-util",
+ "gio-sys 0.18.1",
+ "glib-macros 0.18.5",
+ "glib-sys 0.18.1",
+ "gobject-sys 0.18.0",
+ "libc",
+ "memchr",
+ "once_cell",
+ "smallvec",
+ "thiserror 1.0.69",
+]
+
+[[package]]
+name = "glib"
+version = "0.22.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e4cf9e5bd8713f1990a92c422998826e0fb34824277b46bc59757373483c6694"
+dependencies = [
+ "bitflags 2.13.2",
+ "futures-channel",
+ "futures-core",
+ "futures-executor",
+ "futures-task",
+ "futures-util",
+ "glib-macros 0.22.9",
+ "glib-sys 0.22.9",
+ "gobject-sys 0.22.9",
+ "libc",
+ "memchr",
+ "smallvec",
+]
+
+[[package]]
+name = "glib-macros"
+version = "0.18.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0bb0228f477c0900c880fd78c8759b95c7636dbd7842707f49e132378aa2acdc"
+dependencies = [
+ "heck 0.4.1",
+ "proc-macro-crate 2.0.2",
+ "proc-macro-error",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.119",
+]
+
+[[package]]
+name = "glib-macros"
+version = "0.22.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c9597c68fa7bdf4154a3079642cd21c4dccac0b0bdd2897d82861523bf91e7b9"
+dependencies = [
+ "heck 0.5.0",
+ "proc-macro2",
+ "quote",
+ "syn 3.0.8",
+]
+
+[[package]]
+name = "glib-sys"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "063ce2eb6a8d0ea93d2bf8ba1957e78dbab6be1c2220dd3daca57d5a9d869898"
+dependencies = [
+ "libc",
+ "system-deps 6.2.2",
+]
+
+[[package]]
+name = "glib-sys"
+version = "0.22.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "99b38907e67e40dec9b60f858bcada952598719cb512a13eb13d6cdcd16f8295"
+dependencies = [
+ "libc",
+ "system-deps 9.0.1",
+]
+
[[package]]
name = "globset"
version = "0.4.20"
@@ -1311,6 +1683,28 @@ dependencies = [
"walkdir",
]
+[[package]]
+name = "gobject-sys"
+version = "0.18.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0850127b514d1c4a4654ead6dedadb18198999985908e6ffe4436f53c785ce44"
+dependencies = [
+ "glib-sys 0.18.1",
+ "libc",
+ "system-deps 6.2.2",
+]
+
+[[package]]
+name = "gobject-sys"
+version = "0.22.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "07595c9ba696bd9819cb6a8df39f08078f3dd679508fe052dd558492c2053834"
+dependencies = [
+ "glib-sys 0.22.9",
+ "libc",
+ "system-deps 9.0.1",
+]
+
[[package]]
name = "group"
version = "0.14.0"
@@ -1322,6 +1716,58 @@ dependencies = [
"subtle",
]
+[[package]]
+name = "gtk"
+version = "0.18.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fd56fb197bfc42bd5d2751f4f017d44ff59fbb58140c6b49f9b3b2bdab08506a"
+dependencies = [
+ "atk",
+ "cairo-rs",
+ "field-offset",
+ "futures-channel",
+ "gdk",
+ "gdk-pixbuf",
+ "gio 0.18.4",
+ "glib 0.18.5",
+ "gtk-sys",
+ "gtk3-macros",
+ "libc",
+ "pango",
+ "pkg-config",
+]
+
+[[package]]
+name = "gtk-sys"
+version = "0.18.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f29a1c21c59553eb7dd40e918be54dccd60c52b049b75119d5d96ce6b624414"
+dependencies = [
+ "atk-sys",
+ "cairo-sys-rs",
+ "gdk-pixbuf-sys",
+ "gdk-sys",
+ "gio-sys 0.18.1",
+ "glib-sys 0.18.1",
+ "gobject-sys 0.18.0",
+ "libc",
+ "pango-sys",
+ "system-deps 6.2.2",
+]
+
+[[package]]
+name = "gtk3-macros"
+version = "0.18.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "52ff3c5b21f14f0736fed6dcfc0bfb4225ebf5725f3c0209edeec181e4d73e9d"
+dependencies = [
+ "proc-macro-crate 1.3.1",
+ "proc-macro-error",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.119",
+]
+
[[package]]
name = "hashbrown"
version = "0.14.5"
@@ -1352,6 +1798,12 @@ dependencies = [
"serde_core",
]
+[[package]]
+name = "heck"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
+
[[package]]
name = "heck"
version = "0.5.0"
@@ -1745,6 +2197,26 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
+[[package]]
+name = "miniz_oxide"
+version = "0.8.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"
+dependencies = [
+ "adler2",
+ "simd-adler32",
+]
+
+[[package]]
+name = "miniz_oxide"
+version = "0.9.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c"
+dependencies = [
+ "adler2",
+ "simd-adler32",
+]
+
[[package]]
name = "mio"
version = "1.2.4"
@@ -1875,6 +2347,58 @@ dependencies = [
"libc",
]
+[[package]]
+name = "objc2"
+version = "0.6.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "08849bbd4767dfae9457696856ae1c84fe4e0281bbe4a7abff2d0e06fb7981f8"
+dependencies = [
+ "objc2-encode",
+]
+
+[[package]]
+name = "objc2-app-kit"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c"
+dependencies = [
+ "bitflags 2.13.2",
+ "block2",
+ "libc",
+ "objc2",
+ "objc2-cloud-kit",
+ "objc2-core-data",
+ "objc2-core-foundation",
+ "objc2-core-graphics",
+ "objc2-core-image",
+ "objc2-core-text",
+ "objc2-core-video",
+ "objc2-foundation",
+ "objc2-quartz-core",
+]
+
+[[package]]
+name = "objc2-cloud-kit"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "73ad74d880bb43877038da939b7427bba67e9dd42004a18b809ba7d87cee241c"
+dependencies = [
+ "bitflags 2.13.2",
+ "objc2",
+ "objc2-foundation",
+]
+
+[[package]]
+name = "objc2-core-data"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b402a653efbb5e82ce4df10683b6b28027616a2715e90009947d50b8dd298fa"
+dependencies = [
+ "bitflags 2.13.2",
+ "objc2",
+ "objc2-foundation",
+]
+
[[package]]
name = "objc2-core-foundation"
version = "0.3.2"
@@ -1882,6 +2406,108 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536"
dependencies = [
"bitflags 2.13.2",
+ "dispatch2",
+ "objc2",
+]
+
+[[package]]
+name = "objc2-core-graphics"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807"
+dependencies = [
+ "bitflags 2.13.2",
+ "dispatch2",
+ "objc2",
+ "objc2-core-foundation",
+ "objc2-io-surface",
+]
+
+[[package]]
+name = "objc2-core-image"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e5d563b38d2b97209f8e861173de434bd0214cf020e3423a52624cd1d989f006"
+dependencies = [
+ "objc2",
+ "objc2-foundation",
+]
+
+[[package]]
+name = "objc2-core-text"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0cde0dfb48d25d2b4862161a4d5fcc0e3c24367869ad306b0c9ec0073bfed92d"
+dependencies = [
+ "bitflags 2.13.2",
+ "objc2",
+ "objc2-core-foundation",
+ "objc2-core-graphics",
+]
+
+[[package]]
+name = "objc2-core-video"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d425caf1df73233f29fd8a5c3e5edbc30d2d4307870f802d18f00d83dc5141a6"
+dependencies = [
+ "bitflags 2.13.2",
+ "objc2",
+ "objc2-core-foundation",
+ "objc2-core-graphics",
+ "objc2-io-surface",
+]
+
+[[package]]
+name = "objc2-encode"
+version = "4.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33"
+
+[[package]]
+name = "objc2-foundation"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272"
+dependencies = [
+ "bitflags 2.13.2",
+ "block2",
+ "libc",
+ "objc2",
+ "objc2-core-foundation",
+]
+
+[[package]]
+name = "objc2-io-surface"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d"
+dependencies = [
+ "bitflags 2.13.2",
+ "objc2",
+ "objc2-core-foundation",
+]
+
+[[package]]
+name = "objc2-quartz-core"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f"
+dependencies = [
+ "bitflags 2.13.2",
+ "objc2",
+ "objc2-foundation",
+]
+
+[[package]]
+name = "objc2-uniform-type-identifiers"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7902ac02859fc1f7045f8b598c63f1ae0cc7efeaa06a9bc9f3d9a3c955974fa4"
+dependencies = [
+ "block2",
+ "objc2",
+ "objc2-foundation",
]
[[package]]
@@ -1992,6 +2618,31 @@ dependencies = [
"libm",
]
+[[package]]
+name = "pango"
+version = "0.18.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7ca27ec1eb0457ab26f3036ea52229edbdb74dee1edd29063f5b9b010e7ebee4"
+dependencies = [
+ "gio 0.18.4",
+ "glib 0.18.5",
+ "libc",
+ "once_cell",
+ "pango-sys",
+]
+
+[[package]]
+name = "pango-sys"
+version = "0.18.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "436737e391a843e5933d6d9aa102cb126d501e815b83601365a948a518555dc5"
+dependencies = [
+ "glib-sys 0.18.1",
+ "gobject-sys 0.18.0",
+ "libc",
+ "system-deps 6.2.2",
+]
+
[[package]]
name = "parking_lot"
version = "0.12.5"
@@ -2155,6 +2806,12 @@ dependencies = [
"spki",
]
+[[package]]
+name = "pkg-config"
+version = "0.3.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548"
+
[[package]]
name = "plist"
version = "1.10.1"
@@ -2168,6 +2825,19 @@ dependencies = [
"time",
]
+[[package]]
+name = "png"
+version = "0.17.16"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "82151a2fc869e011c153adc57cf2789ccb8d9906ce52c0b39a6b5697749d7526"
+dependencies = [
+ "bitflags 1.3.2",
+ "crc32fast",
+ "fdeflate",
+ "flate2",
+ "miniz_oxide 0.8.9",
+]
+
[[package]]
name = "portable-atomic"
version = "1.15.0"
@@ -2219,6 +2889,50 @@ dependencies = [
"wnaf",
]
+[[package]]
+name = "proc-macro-crate"
+version = "1.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919"
+dependencies = [
+ "once_cell",
+ "toml_edit 0.19.15",
+]
+
+[[package]]
+name = "proc-macro-crate"
+version = "2.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b00f26d3400549137f92511a46ac1cd8ce37cb5598a96d382381458b992a5d24"
+dependencies = [
+ "toml_datetime 0.6.3",
+ "toml_edit 0.20.2",
+]
+
+[[package]]
+name = "proc-macro-error"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
+dependencies = [
+ "proc-macro-error-attr",
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
+ "version_check",
+]
+
+[[package]]
+name = "proc-macro-error-attr"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "version_check",
+]
+
[[package]]
name = "proc-macro2"
version = "1.0.107"
@@ -2742,6 +3456,15 @@ dependencies = [
"serde",
]
+[[package]]
+name = "serde_spanned"
+version = "1.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9c187e0a369471c550af028cba56d4f4fa2a489ad28151ae95a4d340a2a8b782"
+dependencies = [
+ "serde_core",
+]
+
[[package]]
name = "serdect"
version = "0.4.3"
@@ -2832,6 +3555,12 @@ dependencies = [
"rand_core 0.10.1",
]
+[[package]]
+name = "simd-adler32"
+version = "0.3.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea"
+
[[package]]
name = "siphasher"
version = "1.0.4"
@@ -2865,7 +3594,7 @@ dependencies = [
[[package]]
name = "squid-cli"
-version = "0.1.6"
+version = "0.1.7"
dependencies = [
"anyhow",
"chrono",
@@ -2885,7 +3614,7 @@ dependencies = [
[[package]]
name = "squid-core"
-version = "0.1.6"
+version = "0.1.7"
dependencies = [
"anyhow",
"chrono",
@@ -2897,14 +3626,14 @@ dependencies = [
"serde",
"serde_json",
"thiserror 2.0.21",
- "toml",
+ "toml 0.8.2",
"walkdir",
"windows 0.58.0",
]
[[package]]
name = "squid-engine"
-version = "0.1.6"
+version = "0.1.7"
dependencies = [
"anyhow",
"chrono",
@@ -2924,7 +3653,7 @@ dependencies = [
[[package]]
name = "squid-guard"
-version = "0.1.6"
+version = "0.1.7"
dependencies = [
"chrono",
"hex",
@@ -2940,11 +3669,13 @@ dependencies = [
[[package]]
name = "squid-platform"
-version = "0.1.6"
+version = "0.1.7"
dependencies = [
"dirs",
+ "file_icon_provider",
"libc",
"plist",
+ "png",
"rayon",
"serde",
"serde_json",
@@ -2958,19 +3689,19 @@ dependencies = [
[[package]]
name = "squid-rules"
-version = "0.1.6"
+version = "0.1.7"
dependencies = [
"globset",
"serde",
"serde_json",
"squid-core",
"squid-platform",
- "toml",
+ "toml 0.8.2",
]
[[package]]
name = "squid-stats"
-version = "0.1.6"
+version = "0.1.7"
dependencies = [
"chrono",
"libc",
@@ -2982,7 +3713,7 @@ dependencies = [
[[package]]
name = "squid-tui"
-version = "0.1.6"
+version = "0.1.7"
dependencies = [
"anyhow",
"chrono",
@@ -3045,7 +3776,7 @@ version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab85eea0270ee17587ed4156089e10b9e6880ee688791d45a905f5b1ca36f664"
dependencies = [
- "heck",
+ "heck 0.5.0",
"proc-macro2",
"quote",
"syn 2.0.119",
@@ -3114,12 +3845,44 @@ dependencies = [
"windows 0.57.0",
]
+[[package]]
+name = "system-deps"
+version = "6.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a3e535eb8dded36d55ec13eddacd30dec501792ff23a0b1682c38601b8cf2349"
+dependencies = [
+ "cfg-expr 0.15.8",
+ "heck 0.5.0",
+ "pkg-config",
+ "toml 0.8.2",
+ "version-compare",
+]
+
+[[package]]
+name = "system-deps"
+version = "9.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "db551ad38aac61d5e0343e0eeeb0163be3115c4e23b6a025959570ee0c03c67d"
+dependencies = [
+ "cfg-expr 0.20.10",
+ "heck 0.5.0",
+ "pkg-config",
+ "toml 1.2.1+spec-1.1.0",
+ "version-compare",
+]
+
[[package]]
name = "tap"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
+[[package]]
+name = "target-lexicon"
+version = "0.12.16"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
+
[[package]]
name = "target-lexicon"
version = "0.13.5"
@@ -3301,44 +4064,87 @@ dependencies = [
[[package]]
name = "toml"
-version = "0.8.23"
+version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362"
+checksum = "185d8ab0dfbb35cf1399a6344d8484209c088f75f8f68230da55d48d95d43e3d"
dependencies = [
"serde",
- "serde_spanned",
- "toml_datetime",
- "toml_edit",
+ "serde_spanned 0.6.9",
+ "toml_datetime 0.6.3",
+ "toml_edit 0.20.2",
+]
+
+[[package]]
+name = "toml"
+version = "1.2.1+spec-1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d5755c51863cdac711f1956baf8eb9588e060755f7d3c4c979e70ea1e1f32cd7"
+dependencies = [
+ "indexmap",
+ "serde_core",
+ "serde_spanned 1.1.3",
+ "toml_datetime 1.1.3+spec-1.1.0",
+ "toml_parser",
+ "toml_writer",
+ "winnow 1.0.5",
]
[[package]]
name = "toml_datetime"
-version = "0.6.11"
+version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c"
+checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b"
dependencies = [
"serde",
]
+[[package]]
+name = "toml_datetime"
+version = "1.1.3+spec-1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "173f25c883cd2176a2d8212155638c0a60d484a9d84546d270866f40f56b6e49"
+dependencies = [
+ "serde_core",
+]
+
[[package]]
name = "toml_edit"
-version = "0.22.27"
+version = "0.19.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"
+checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421"
dependencies = [
"indexmap",
- "serde",
- "serde_spanned",
- "toml_datetime",
- "toml_write",
- "winnow",
+ "toml_datetime 0.6.3",
+ "winnow 0.5.40",
]
[[package]]
-name = "toml_write"
-version = "0.1.2"
+name = "toml_edit"
+version = "0.20.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801"
+checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338"
+dependencies = [
+ "indexmap",
+ "serde",
+ "serde_spanned 0.6.9",
+ "toml_datetime 0.6.3",
+ "winnow 0.5.40",
+]
+
+[[package]]
+name = "toml_parser"
+version = "1.1.5+spec-1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "baa693a8032d7e1cada7d0041e96126df243179ff061456783ac7f12bda4744c"
+dependencies = [
+ "winnow 1.0.5",
+]
+
+[[package]]
+name = "toml_writer"
+version = "1.2.0+spec-1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "009dbb7700f11c55ef83aebbe4c0e9cf1f1ac0844bd8d6f00dc38f302026e13a"
[[package]]
name = "typenum"
@@ -3405,6 +4211,12 @@ dependencies = [
"wasm-bindgen",
]
+[[package]]
+name = "version-compare"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "03c2856837ef78f57382f06b2b8563a2f512f7185d732608fd9176cb3b8edf0e"
+
[[package]]
name = "version_check"
version = "0.9.5"
@@ -3458,7 +4270,7 @@ version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a9b0525d7ea6e5f906aca581a172e5c91b4c595290dfa8ad4a2bc9ffef33b44"
dependencies = [
- "heck",
+ "heck 0.5.0",
"proc-macro2",
"quote",
"syn 2.0.119",
@@ -3605,7 +4417,7 @@ dependencies = [
"serde",
"serde_derive",
"smallvec",
- "target-lexicon",
+ "target-lexicon 0.13.5",
"wasmparser 0.254.2",
"wasmtime-environ",
"wasmtime-internal-core",
@@ -3641,7 +4453,7 @@ dependencies = [
"serde_derive",
"sha2 0.10.9",
"smallvec",
- "target-lexicon",
+ "target-lexicon 0.13.5",
"wasm-encoder 0.254.2",
"wasmparser 0.254.2",
"wasmprinter",
@@ -3683,7 +4495,7 @@ dependencies = [
"object",
"pulley-interpreter",
"smallvec",
- "target-lexicon",
+ "target-lexicon 0.13.5",
"thiserror 2.0.21",
"wasmparser 0.254.2",
"wasmtime-environ",
@@ -3873,6 +4685,27 @@ dependencies = [
"windows-targets 0.52.6",
]
+[[package]]
+name = "windows"
+version = "0.62.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580"
+dependencies = [
+ "windows-collections",
+ "windows-core 0.62.2",
+ "windows-future",
+ "windows-numerics",
+]
+
+[[package]]
+name = "windows-collections"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610"
+dependencies = [
+ "windows-core 0.62.2",
+]
+
[[package]]
name = "windows-core"
version = "0.57.0"
@@ -3911,6 +4744,17 @@ dependencies = [
"windows-strings 0.5.1",
]
+[[package]]
+name = "windows-future"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb"
+dependencies = [
+ "windows-core 0.62.2",
+ "windows-link",
+ "windows-threading",
+]
+
[[package]]
name = "windows-implement"
version = "0.57.0"
@@ -3983,6 +4827,16 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
+[[package]]
+name = "windows-numerics"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26"
+dependencies = [
+ "windows-core 0.62.2",
+ "windows-link",
+]
+
[[package]]
name = "windows-result"
version = "0.1.2"
@@ -4087,6 +4941,15 @@ dependencies = [
"windows_x86_64_msvc 0.52.6",
]
+[[package]]
+name = "windows-threading"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37"
+dependencies = [
+ "windows-link",
+]
+
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.48.5"
@@ -4179,13 +5042,19 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]]
name = "winnow"
-version = "0.7.15"
+version = "0.5.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945"
+checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876"
dependencies = [
"memchr",
]
+[[package]]
+name = "winnow"
+version = "1.0.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8c3b93199df0ab874cdf0c6a94f0a0dc3423fe41f1cafb62b8bd7b1deb277aef"
+
[[package]]
name = "winreg"
version = "0.52.0"
@@ -4335,6 +5204,12 @@ version = "1.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e13084392c5e4bc371903e2935a5eaeed24905a7511356b883835e18a78f6879"
+[[package]]
+name = "zlib-rs"
+version = "0.6.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112"
+
[[package]]
name = "zmij"
version = "1.0.23"
diff --git a/Cargo.toml b/Cargo.toml
index 63d83ae..4490f55 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -4,7 +4,7 @@ members = ["crates/*"]
exclude = ["src-tauri"]
[workspace.package]
-version = "0.1.6"
+version = "0.1.7"
edition = "2021"
rust-version = "1.95"
license = "GPL-3.0-only"
diff --git a/README.en.md b/README.en.md
index 816d075..26e9a7a 100644
--- a/README.en.md
+++ b/README.en.md
@@ -22,7 +22,7 @@ The desktop app supports macOS 12+ and Windows 10/11 x64. The CLI and TUI share
| Feature | Description |
| --- | --- |
-| Computer overview | Disk health, common actions, and CPU, memory, and storage summaries |
+| Overview | Disk health, common actions, and CPU, memory, and storage summaries |
| Daily cleanup | 38 built-in rules on macOS and 30 on Windows, covering app and browser caches, logs, crash reports, developer caches, Trash, and more |
| Uninstall apps | Finds an app by name and builds one plan containing the app bundle plus preferences, caches, containers, or AppData leftovers |
| Deep Clean | Finds rebuildable build output such as `node_modules`, disk images, installers, and stale downloads while protecting recently used projects |
@@ -39,7 +39,7 @@ Language settings offer only Simplified Chinese and English, with the current sy
### Sidebar
-- **Maintenance**: Computer overview, Daily cleanup, Uninstall apps, Deep Clean
+- **Maintenance**: Overview, Daily cleanup, Uninstall apps, Deep Clean
- **Protection**: Security, Startup items
- **Insights**: Storage, Real-time monitor
- **Bottom**: History, Settings
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 00cbebc..b9d76d0 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -22,7 +22,7 @@ Squid 是面向 macOS 与 Windows 的本地系统维护工具:清理可重建
| 功能 | 说明 |
| --- | --- |
-| 电脑概览 | 磁盘健康、常用操作入口与 CPU、内存、存储摘要 |
+| 概览 | 磁盘健康、常用操作入口与 CPU、内存、存储摘要 |
| 日常清理 | macOS 38 条 / Windows 30 条内置规则,覆盖应用与浏览器缓存、日志、崩溃报告、开发缓存与废纸篓等 |
| 应用卸载 | 按名称定位应用,把应用本体与偏好、缓存、容器或 AppData 残留组成同一个卸载计划 |
| 深度清理 | 查找 `node_modules` 等可重建构建产物、磁盘镜像、安装包和陈旧下载,并保护近期仍在使用的项目 |
@@ -39,7 +39,7 @@ Squid 是面向 macOS 与 Windows 的本地系统维护工具:清理可重建
### 左侧菜单
-- **维护**:电脑概览、日常清理、应用卸载、深度清理
+- **维护**:概览、日常清理、应用卸载、深度清理
- **保护**:安全、启动项
- **洞察**:存储空间、实时监控
- **底部**:历史记录、设置
diff --git a/crates/squid-core/src/model.rs b/crates/squid-core/src/model.rs
index fcc2e03..9988a37 100644
--- a/crates/squid-core/src/model.rs
+++ b/crates/squid-core/src/model.rs
@@ -358,6 +358,10 @@ pub struct AppInfo {
pub name: String,
pub bundle_id: Option,
pub path: PathBuf,
+ /// The file or bundle the desktop icon is read from. `path` may be an
+ /// install directory or an uninstall helper, neither of which carries the
+ /// icon the user recognises.
+ pub icon_source: Option,
pub version: Option,
pub size: Bytes,
/// Where the app was found: /Applications, ~/Applications, Homebrew Cask…
diff --git a/crates/squid-engine/src/uninstall.rs b/crates/squid-engine/src/uninstall.rs
index 8361d98..c9ef8ea 100644
--- a/crates/squid-engine/src/uninstall.rs
+++ b/crates/squid-engine/src/uninstall.rs
@@ -464,6 +464,7 @@ mod tests {
name: "Demo".into(),
bundle_id: Some("com.example.Demo".into()),
path: PathBuf::from(path),
+ icon_source: None,
version: Some("1.0".into()),
size: Bytes(1_000),
source: source.into(),
diff --git a/crates/squid-platform/Cargo.toml b/crates/squid-platform/Cargo.toml
index aa6e05c..b42260a 100644
--- a/crates/squid-platform/Cargo.toml
+++ b/crates/squid-platform/Cargo.toml
@@ -32,3 +32,7 @@ windows-sys = { version = "0.59", features = [
"Win32_Security_WinTrust",
"Win32_System_Threading",
] }
+
+[target.'cfg(any(target_os = "macos", target_os = "windows"))'.dependencies]
+file_icon_provider = "1.0.2"
+png = "0.17"
diff --git a/crates/squid-platform/src/apps.rs b/crates/squid-platform/src/apps.rs
index 5647a28..d10b1f9 100644
--- a/crates/squid-platform/src/apps.rs
+++ b/crates/squid-platform/src/apps.rs
@@ -111,6 +111,7 @@ pub fn app_from_bundle(
name,
bundle_id: bundle.bundle_id.clone(),
path: path.clone(),
+ icon_source: Some(path.clone()),
version: bundle
.short_version
.clone()
@@ -142,6 +143,32 @@ pub fn app_from_bundle(
Some(app)
}
+/// Render an application's system icon as PNG bytes.
+///
+/// macOS and Windows let the file manager do the work, so the result is the
+/// same icon Finder or Explorer shows, including HiDPI-safe source artwork.
+/// Linux has no equivalent without a GTK dependency; the desktop falls back to
+/// the app's initial.
+#[cfg(any(target_os = "macos", target_os = "windows"))]
+pub fn icon_png(app: &AppInfo, size: u16) -> Option> {
+ let source = app.icon_source.as_ref()?;
+ let icon = file_icon_provider::get_file_icon(source, size).ok()?;
+ let mut output = Vec::new();
+ {
+ let mut encoder = png::Encoder::new(&mut output, icon.width, icon.height);
+ encoder.set_color(png::ColorType::Rgba);
+ encoder.set_depth(png::BitDepth::Eight);
+ let mut writer = encoder.write_header().ok()?;
+ writer.write_image_data(&icon.pixels).ok()?;
+ }
+ Some(output)
+}
+
+#[cfg(not(any(target_os = "macos", target_os = "windows")))]
+pub fn icon_png(_app: &AppInfo, _size: u16) -> Option> {
+ None
+}
+
/// Match "is this app running" against the process executable list.
pub fn is_running(dir_name: &str, executable: Option<&str>, running: &[String]) -> bool {
let mut candidates: Vec = Vec::with_capacity(3);
@@ -167,3 +194,20 @@ pub fn stem_lower(path: &Path) -> String {
.map(|n| n.to_string_lossy().trim_end_matches(".app").to_lowercase())
.unwrap_or_default()
}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ #[cfg(any(target_os = "macos", target_os = "windows"))]
+ fn a_system_icon_is_encoded_as_png() {
+ let app = AppInfo {
+ name: "Squid".into(),
+ icon_source: std::env::current_exe().ok(),
+ ..Default::default()
+ };
+ let png = icon_png(&app, 32).expect("the running executable has a system icon");
+ assert_eq!(&png[..8], b"\x89PNG\r\n\x1a\n");
+ }
+}
diff --git a/crates/squid-platform/src/lib.rs b/crates/squid-platform/src/lib.rs
index 7f6e138..5d12400 100644
--- a/crates/squid-platform/src/lib.rs
+++ b/crates/squid-platform/src/lib.rs
@@ -108,6 +108,10 @@ pub trait Platform: Send + Sync {
fn display_name(&self) -> String;
fn os_version(&self) -> String;
fn hardware_model(&self) -> String;
+ /// Display adapter(s), when the platform exposes a stable name.
+ fn graphics_adapter(&self) -> String {
+ String::new()
+ }
/// Directories to scan for installed applications.
fn app_sources(&self) -> Vec;
diff --git a/crates/squid-platform/src/linux.rs b/crates/squid-platform/src/linux.rs
index 93ea2a0..98716a9 100644
--- a/crates/squid-platform/src/linux.rs
+++ b/crates/squid-platform/src/linux.rs
@@ -112,6 +112,29 @@ impl Platform for Linux {
.to_string()
}
+ fn graphics_adapter(&self) -> String {
+ run("lspci", &[])
+ .map(|text| {
+ text.lines()
+ .filter(|line| {
+ line.contains("VGA compatible controller")
+ || line.contains("3D controller")
+ || line.contains("Display controller")
+ })
+ .filter_map(|line| line.split_once(": ").map(|(_, value)| value.trim()))
+ .map(|value| {
+ value
+ .split_once(": ")
+ .map(|(_, name)| name.trim())
+ .unwrap_or(value)
+ .to_string()
+ })
+ .collect::>()
+ .join(" · ")
+ })
+ .unwrap_or_default()
+ }
+
fn app_sources(&self) -> Vec {
[
("/usr/share/applications", "System", 1, true),
@@ -193,6 +216,7 @@ impl Platform for Linux {
name: desktop.name.clone(),
bundle_id: Some(id.clone()),
path: path.clone(),
+ icon_source: None,
version: None,
size: Bytes::ZERO,
source: source.label.clone(),
@@ -222,6 +246,7 @@ impl Platform for Linux {
.unwrap_or_else(|| id.to_string()),
bundle_id: Some(id.to_string()),
path: PathBuf::from(format!("flatpak:{id}")),
+ icon_source: None,
version: None,
size: cols
.get(2)
diff --git a/crates/squid-platform/src/macos.rs b/crates/squid-platform/src/macos.rs
index e33f505..7b56f59 100644
--- a/crates/squid-platform/src/macos.rs
+++ b/crates/squid-platform/src/macos.rs
@@ -74,6 +74,25 @@ impl Platform for MacOs {
parts.join(" · ")
}
+ fn graphics_adapter(&self) -> String {
+ run(
+ "/usr/sbin/system_profiler",
+ &["SPDisplaysDataType", "-detailLevel", "mini"],
+ )
+ .map(|text| {
+ text.lines()
+ .filter_map(|line| {
+ line.trim()
+ .strip_prefix("Chipset Model:")
+ .map(|value| value.trim().to_string())
+ .filter(|value| !value.is_empty())
+ })
+ .collect::>()
+ .join(" · ")
+ })
+ .unwrap_or_default()
+ }
+
fn app_sources(&self) -> Vec {
let mut sources = vec![
AppSource {
diff --git a/crates/squid-platform/src/process_table.rs b/crates/squid-platform/src/process_table.rs
index a39532b..1fdf21d 100644
--- a/crates/squid-platform/src/process_table.rs
+++ b/crates/squid-platform/src/process_table.rs
@@ -17,6 +17,7 @@ use std::time::{SystemTime, UNIX_EPOCH};
use sysinfo::{ProcessRefreshKind, ProcessesToUpdate, RefreshKind, System, Users};
#[derive(Clone, Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
pub struct ProcessRow {
pub pid: u32,
pub parent: Option,
diff --git a/crates/squid-platform/src/startup.rs b/crates/squid-platform/src/startup.rs
index d9525ef..759a6c0 100644
--- a/crates/squid-platform/src/startup.rs
+++ b/crates/squid-platform/src/startup.rs
@@ -7,6 +7,10 @@
//! default: every entry says whether squid may change it, and the ones it may
//! not say why in the same field the UI shows.
//!
+//! Entries are also attributed to the application that installed them, because
+//! nobody reads 800 plist labels: both operating systems show this list per app,
+//! and `StartupOwner` is what makes that possible without guessing.
+//!
//! Disabling an entry means renaming its plist to `*.plist.disabled` on macOS
//! and moving its registry value into a sibling backup key on Windows. Both are
//! reversible without a privileged helper, which is the whole point: squid never
@@ -63,6 +67,9 @@ pub enum StartupRisk {
InTempDir,
/// The target exists but carries no usable code signature.
Unsigned,
+ /// The target is not readable by this user, so its signature was never asked
+ /// about. Different from `Unsigned`, which is an answer and an accusation.
+ SignatureUnreadable,
/// Started through a script interpreter rather than a binary.
ScriptInterpreter,
/// Created within the last fortnight.
@@ -73,7 +80,66 @@ pub enum StartupRisk {
HiddenHomeDirectory,
}
+/// Which of the two lists the operating systems themselves show an entry
+/// belongs to. macOS splits "Login Items" (apps that open when you log in) from
+/// "Allow in the Background" (helpers that keep running); Windows splits the
+/// Startup folder and Run keys from scheduled tasks and services. A page that
+/// shows one flat list of 800 labels answers neither question.
+#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "kebab-case")]
+pub enum StartupCategory {
+ /// Opens an application or window at login: a login item, a Startup folder
+ /// shortcut, or a Run value that launches an app.
+ OpenAtLogin,
+ /// A helper that keeps running without a window: LaunchAgents and
+ /// LaunchDaemons, scheduled tasks, services.
+ Background,
+}
+
+impl StartupCategory {
+ pub fn as_str(self) -> &'static str {
+ match self {
+ StartupCategory::OpenAtLogin => "open-at-login",
+ StartupCategory::Background => "background",
+ }
+ }
+}
+
+/// Why squid will not change an entry. A typed answer rather than a sentence
+/// from the platform layer, because the platform layer does not know which
+/// language the page is wearing; each variant becomes one short localised phrase.
+#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "kebab-case")]
+pub enum StartupLock {
+ /// Apple's or Microsoft's own entry.
+ OperatingSystem,
+ /// Root-owned plist, HKLM value, system task or service: one authorisation away.
+ NeedsAuthorisation,
+ /// The declaring file or folder is not writable by this user.
+ NotWritable,
+ /// macOS owns the login-item list and changes it through System Settings.
+ ManagedBySystemSettings,
+ /// This release reports these entries and leaves them alone.
+ NotManaged,
+}
+
+/// The application an entry belongs to, worked out from the paths launchd or the
+/// registry name, never from the entry's label. This is what lets the list be
+/// "Docker · 3 background items" instead of three opaque plist names.
+#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct StartupOwner {
+ /// The name to show the user: the bundle's `CFBundleDisplayName`, or the
+ /// application folder name when the bundle cannot be read.
+ pub name: String,
+ /// The `.app` bundle, or the directory the entry lives in.
+ pub bundle_path: Option,
+ /// True when the owning application is Apple's or Microsoft's own.
+ pub vendor: bool,
+}
+
#[derive(Clone, Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
pub struct StartupItem {
/// Stable identifier: the plist path, registry value, task path or service.
pub id: String,
@@ -91,12 +157,17 @@ pub struct StartupItem {
/// An entry the operating system vendor owns.
pub system_vendor: bool,
pub disabled: bool,
- /// False means squid will refuse to touch it, with `readonly_reason`.
+ /// False means squid will refuse to touch it, and `lock` says which kind of
+ /// refusal it is.
pub modifiable: bool,
- pub readonly_reason: Option,
+ pub lock: Option,
pub hidden: bool,
pub modified_ms: Option,
pub risks: Vec,
+ /// Which list of the operating system's own this entry would appear in.
+ pub category: StartupCategory,
+ /// The application that installed the entry, when one could be named.
+ pub owner: Option,
}
impl StartupItem {
@@ -124,20 +195,66 @@ impl StartupItem {
system_vendor: false,
disabled: false,
modifiable: false,
- readonly_reason: None,
+ lock: None,
hidden: false,
modified_ms: None,
risks: Vec::new(),
+ category: StartupCategory::Background,
+ owner: None,
}
}
}
/// Everything squid could read. Unreadable folders are simply absent, and the
-/// notes say which roots could not be listed.
+/// notes say which ones and why.
#[derive(Clone, Debug, Default, Serialize, Deserialize)]
pub struct StartupInventory {
pub items: Vec,
- pub notes: Vec,
+ pub notes: Vec,
+}
+
+/// Something the page has to admit it could not read. `kind` is typed rather than
+/// a sentence, because the platform layer does not know whether the page is
+/// wearing Chinese or English; a note that arrives already translated is a note
+/// that arrives in the wrong language. `detail` carries the operating system's own
+/// words beside it, which are never translated and are therefore honest.
+#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct StartupNote {
+ pub kind: StartupNoteKind,
+ /// The folder, tool or list this note is about.
+ pub subject: String,
+ pub detail: String,
+}
+
+#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "kebab-case")]
+pub enum StartupNoteKind {
+ /// A folder holding entries that could not be listed.
+ UnreadableRoot,
+ /// The login-item list could not be read at all, which on macOS means the
+ /// automation permission has not been granted.
+ LoginItemsUnavailable,
+}
+
+/// The command line speaks English, so it prints the note whole; the GUI reads
+/// `kind` and translates it. One fact, two honest renderings.
+impl std::fmt::Display for StartupNote {
+ fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ match self.kind {
+ StartupNoteKind::UnreadableRoot => {
+ write!(formatter, "{} could not be listed", self.subject)?;
+ }
+ StartupNoteKind::LoginItemsUnavailable => {
+ write!(formatter, "login items could not be read")?;
+ }
+ }
+ if self.detail.is_empty() {
+ Ok(())
+ } else {
+ write!(formatter, ": {}", self.detail)
+ }
+ }
}
impl StartupInventory {
@@ -215,6 +332,11 @@ pub fn entry_for(program: &Path) -> Option {
}
}
+/// What a refused change says. The reason itself is shown from `StartupLock`,
+/// which the page can translate; this is only what the command returns when the
+/// inventory it was given has already gone stale.
+const LOCK_REFUSAL: &str = "Squid cannot change this entry.";
+
pub fn home_dir() -> PathBuf {
dirs::home_dir().unwrap_or_else(|| PathBuf::from("/"))
}
@@ -236,7 +358,8 @@ fn now_ms() -> u64 {
const RECENT_MS: u64 = 14 * 24 * 60 * 60 * 1000;
-/// Judges one resolved program: signature, freshness, and where it lives.
+/// Judges one resolved program: freshness and where it lives. The signature half
+/// is deliberately not here — see `apply_trust`.
fn judge_program(item: &mut StartupItem, program: Option<&Path>) {
let Some(program) = program else {
return;
@@ -286,8 +409,29 @@ fn judge_program(item: &mut StartupItem, program: Option<&Path>) {
item.risks.push(StartupRisk::ScriptInterpreter);
}
}
+}
- let trust = crate::trust::assess(program);
+/// The signature half of the judgement, kept apart from `judge_program` because
+/// on macOS it costs one `codesign` process per entry. An M1 Pro has ~870 startup
+/// entries, 845 of which Apple owns and nobody is going to inspect, so assessing
+/// all of them took 8 s to answer a question about 25. Entries whose target is
+/// gone are not assessed either: "not there" is already the finding.
+fn apply_trust(item: &mut StartupItem) {
+ if item.system_vendor || item.risks.contains(&StartupRisk::MissingTarget) {
+ return;
+ }
+ let Some(program) = item.program.clone() else {
+ return;
+ };
+ // A root-owned helper installed mode 0711 — `/Library/PrivilegedHelperTools/
+ // com.docker.socket`, for one — can be run and cannot be read, and `codesign`
+ // answers that with "Permission denied". Reporting it as *unsigned* would be a
+ // false accusation against a program that is signed and merely private.
+ if !program.is_dir() && std::fs::File::open(&program).is_err() {
+ item.risks.push(StartupRisk::SignatureUnreadable);
+ return;
+ }
+ let trust = crate::trust::assess(&program);
item.signed = trust.signed;
item.publisher = trust.signer.clone();
if !trust.signed {
@@ -295,6 +439,382 @@ fn judge_program(item: &mut StartupItem, program: Option<&Path>) {
}
}
+/// The `.app` bundle an entry belongs to, found in the path launchd will run.
+/// macOS nests helpers inside the bundle that owns them, which is why this works
+/// without asking Launch Services anything.
+#[cfg(target_os = "macos")]
+fn bundle_owning(path: &Path) -> Option {
+ let mut current = Some(path);
+ while let Some(candidate) = current {
+ if candidate.to_string_lossy().to_lowercase().ends_with(".app") {
+ return Some(candidate.to_path_buf());
+ }
+ current = candidate.parent();
+ }
+ None
+}
+
+/// The installed applications, keyed by bundle id.
+///
+/// A helper installed in `/Library/PrivilegedHelperTools` says nothing about its
+/// owner in its path, but launchd's convention is that its label begins with the
+/// bundle id of the app that installed it. Checking that against what is actually
+/// installed is a lookup rather than a guess: `com.docker.socket` is Docker's
+/// because `com.docker.*` belongs to exactly one installed application.
+#[cfg(target_os = "macos")]
+#[derive(Default)]
+struct AppIndex {
+ by_id: std::collections::BTreeMap,
+}
+
+#[cfg(target_os = "macos")]
+impl AppIndex {
+ fn scan() -> AppIndex {
+ let mut out = AppIndex::default();
+ let roots = [
+ PathBuf::from("/Applications"),
+ home_dir().join("Applications"),
+ PathBuf::from("/System/Applications"),
+ PathBuf::from("/System/Library/CoreServices"),
+ ];
+ for root in roots {
+ let Ok(entries) = std::fs::read_dir(&root) else {
+ continue;
+ };
+ for entry in entries.flatten() {
+ let path = entry.path();
+ if !path.to_string_lossy().ends_with(".app") {
+ continue;
+ }
+ let Some(info) = bundle_info(&path) else {
+ continue;
+ };
+ out.by_id.entry(info.0).or_insert(StartupOwner {
+ name: info.1,
+ bundle_path: Some(path.clone()),
+ vendor: root.starts_with("/System"),
+ });
+ }
+ }
+ out
+ }
+
+ /// The longest bundle-id prefix of `label` that one installed app owns.
+ fn owner_of(&self, label: &str) -> Option {
+ let mut parts: Vec = label
+ .to_lowercase()
+ .split('.')
+ .map(|part| part.to_string())
+ .collect();
+ // The shortest usable prefix has two components. `org` on its own is a
+ // registry suffix, not a vendor, and stopping there matched
+ // `org.wireshark.ChmodBPF` to the only `org.*` application installed.
+ while parts.len() > 2 {
+ parts.pop();
+ let prefix = parts.join(".");
+ let matches: Vec<&StartupOwner> = self
+ .by_id
+ .range(prefix.clone()..)
+ .take_while(|(id, _)| *id == &prefix || id.starts_with(&format!("{prefix}.")))
+ .map(|(_, owner)| owner)
+ .collect();
+ // Only claim it when a single application is in the family; two
+ // installers sharing a vendor prefix is a tie, and a tie is a guess.
+ if matches.len() == 1 {
+ return Some(matches[0].clone());
+ }
+ if matches.len() > 1 {
+ break;
+ }
+ }
+ None
+ }
+}
+
+/// The bundle id and display name an `.app` declares for itself.
+#[cfg(target_os = "macos")]
+fn bundle_info(bundle: &Path) -> Option<(String, String)> {
+ let dict = plist::Value::from_file(bundle.join("Contents/Info.plist"))
+ .ok()?
+ .into_dictionary()?;
+ let id = dict
+ .get("CFBundleIdentifier")
+ .and_then(|value| value.as_string())?
+ .to_lowercase();
+ let name = ["CFBundleDisplayName", "CFBundleName"]
+ .iter()
+ .find_map(|key| dict.get(key).and_then(|value| value.as_string()))
+ .map(str::to_string)
+ .or_else(|| {
+ bundle
+ .file_stem()
+ .map(|stem| stem.to_string_lossy().into_owned())
+ })?;
+ Some((id, name))
+}
+
+/// Name the application every entry belongs to.
+///
+/// macOS nests helpers inside the `.app` that installed them, so the path usually
+/// answers it; where it does not, the entry's launchd label is matched against the
+/// bundle ids of the applications that are actually installed. Windows has no such
+/// nesting, so the install folder under Program Files carries the name. An entry
+/// that still names nothing stays ungrouped rather than being filed under a guess.
+#[cfg(target_os = "macos")]
+fn attribute_owners(items: &mut [StartupItem]) {
+ let mut index: Option = None;
+ for item in items {
+ if item.system_vendor {
+ continue;
+ }
+ let bundle = item
+ .program
+ .clone()
+ .or_else(|| {
+ (item.id.contains('/') || item.id.ends_with(".app"))
+ .then(|| PathBuf::from(&item.id))
+ })
+ .as_deref()
+ .and_then(bundle_owning);
+ if let Some(bundle) = bundle {
+ let vendor = bundle.starts_with("/System");
+ let name = bundle_info(&bundle)
+ .map(|(_, name)| name)
+ .unwrap_or_else(|| {
+ bundle
+ .file_stem()
+ .map(|stem| stem.to_string_lossy().into_owned())
+ .unwrap_or_else(|| bundle.display().to_string())
+ });
+ item.owner = Some(StartupOwner {
+ name,
+ bundle_path: Some(bundle),
+ vendor,
+ });
+ continue;
+ }
+ // Nothing in the path names an application: a helper in
+ // `/Library/PrivilegedHelperTools`, or an entry whose target is gone.
+ let label = item
+ .id
+ .rsplit('/')
+ .next()
+ .unwrap_or(&item.id)
+ .trim_end_matches(".plist")
+ .trim_end_matches(".disabled");
+ let index = index.get_or_insert_with(AppIndex::scan);
+ if let Some(owner) = index.owner_of(label) {
+ item.owner = Some(owner);
+ continue;
+ }
+ // The signing organisation is the last honest answer, and it is the same
+ // one System Settings groups background items by.
+ if let Some(organisation) = item.publisher.as_deref().and_then(organisation_of) {
+ item.owner = Some(StartupOwner {
+ name: organisation,
+ bundle_path: None,
+ vendor: false,
+ });
+ }
+ }
+}
+
+/// `Developer ID Application: Docker Inc (9P49FL5KQ8)` to `Docker Inc`.
+#[cfg(target_os = "macos")]
+fn organisation_of(signer: &str) -> Option {
+ let tail = signer.rsplit(": ").next().unwrap_or(signer);
+ let name = tail.split(" (").next().unwrap_or(tail).trim();
+ (!name.is_empty() && name != "not set").then(|| name.to_string())
+}
+
+#[cfg(windows)]
+fn attribute_owners(items: &mut [StartupItem]) {
+ for item in items {
+ if item.system_vendor {
+ continue;
+ }
+ let Some(program) = item.program.as_deref() else {
+ continue;
+ };
+ // The publisher the Authenticode signature names is what Control Panel and
+ // Task Manager both show, so it leads where the folder is a vendor directory.
+ if let Some(name) = item
+ .publisher
+ .as_deref()
+ .and_then(organisation_of)
+ .or_else(|| install_folder_owning(program))
+ {
+ item.owner = Some(StartupOwner {
+ name,
+ bundle_path: None,
+ vendor: false,
+ });
+ }
+ }
+}
+
+/// `CN = "Microsoft Corporation"` and `Microsoft Corporation` to one name.
+#[cfg(windows)]
+fn organisation_of(signer: &str) -> Option {
+ let tail = signer.rsplit('=').next().unwrap_or(signer);
+ let name = tail.trim_matches(|c| c == '"' || c == '\'').trim();
+ (!name.is_empty()).then(|| name.to_string())
+}
+
+/// The folder under Program Files that holds one executable, which is the unit
+/// Windows itself groups installed programs by.
+#[cfg(windows)]
+fn install_folder_owning(program: &Path) -> Option {
+ let text = program.to_string_lossy();
+ // Located without regard to case, then cut out of the original: the folder is
+ // shown to the user, and `MOZILLA firefox` is not what it is called.
+ let start = text.to_lowercase().find("program files")? + "program files".len();
+ let mut parts = text[start..]
+ .split(['\\', '/'])
+ .filter(|part| !part.trim().is_empty());
+ // ` (x86)` is part of the root, not a product, so the one folder after it is
+ // the vendor or product a person would recognise.
+ let first = parts.next()?;
+ let name = if first.trim_start().starts_with('(') {
+ parts.next()?
+ } else {
+ first
+ };
+ (!name.trim().is_empty()).then(|| name.trim().to_string())
+}
+
+/// What the operating system shows an entry under. Both platforms keep the same
+/// two lists — the things that open a window when you log in, and the helpers
+/// that run behind it — so the entry's own source decides it.
+fn categorise(item: &mut StartupItem) {
+ item.category = match item.source {
+ StartupSource::LoginItem | StartupSource::StartupFolder | StartupSource::RegistryRun => {
+ StartupCategory::OpenAtLogin
+ }
+ _ => StartupCategory::Background,
+ };
+}
+
+#[cfg(test)]
+mod attribution_tests {
+ use super::*;
+
+ /// The helper in `/Library/PrivilegedHelperTools` is named after nobody: its
+ /// path says where helpers live, not who installed it. Its label is matched
+ /// against installed bundle ids instead, which is honest only while exactly one
+ /// application owns the family.
+ #[test]
+ #[cfg(target_os = "macos")]
+ fn a_helper_is_claimed_only_by_an_unambiguous_bundle_family() {
+ let owner = |name: &str| StartupOwner {
+ name: name.to_string(),
+ bundle_path: None,
+ vendor: false,
+ };
+ let index = AppIndex {
+ by_id: [
+ ("com.docker.docker".to_string(), owner("Docker")),
+ (
+ "com.apphousekitchen.aldente-pro".to_string(),
+ owner("AlDente"),
+ ),
+ ("org.geogebra6.mac".to_string(), owner("GeoGebra")),
+ ]
+ .into_iter()
+ .collect(),
+ };
+ assert_eq!(
+ index.owner_of("com.docker.socket").map(|o| o.name),
+ Some("Docker".into())
+ );
+ assert_eq!(
+ index
+ .owner_of("com.apphousekitchen.aldente-pro.helper")
+ .map(|o| o.name),
+ Some("AlDente".into())
+ );
+ // `org` on its own is a registry suffix, not a vendor. Without that bound
+ // `org.wireshark.ChmodBPF` was matched to the only `org.*` app installed.
+ assert_eq!(index.owner_of("org.wireshark.ChmodBPF"), None);
+ assert_eq!(index.owner_of("us.zoom.ZoomDaemon"), None);
+
+ // Two applications in one family is a tie, and a tie is not an answer.
+ let tied = AppIndex {
+ by_id: [
+ ("com.google.chrome".to_string(), owner("Chrome")),
+ ("com.google.keystone".to_string(), owner("Keystone")),
+ ]
+ .into_iter()
+ .collect(),
+ };
+ // Where a prefix names one application exactly, that is the answer even
+ // though a shallower prefix would be a tie.
+ assert_eq!(
+ tied.owner_of("com.google.keystone.agent").map(|o| o.name),
+ Some("Keystone".into())
+ );
+ assert_eq!(
+ tied.owner_of("com.google.Chrome.helper").map(|o| o.name),
+ Some("Chrome".into()),
+ "the deeper prefix that does resolve is still used"
+ );
+ assert_eq!(
+ tied.owner_of("com.google.SomeUpdater"),
+ None,
+ "the only prefix left is a tie between two applications, so nothing is claimed"
+ );
+ }
+
+ #[test]
+ #[cfg(windows)]
+ fn a_program_files_path_names_the_product_folder() {
+ assert_eq!(
+ install_folder_owning(Path::new(
+ r"C:\Program Files\Google\Chrome\Application\chrome.exe"
+ )),
+ Some("Google".into())
+ );
+ // ` (x86)` belongs to the root, so the product is the folder after it.
+ assert_eq!(
+ install_folder_owning(Path::new(
+ r"C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
+ )),
+ Some("Mozilla Firefox".into())
+ );
+ assert_eq!(
+ install_folder_owning(Path::new(
+ r"C:\program files (x86)\MOZILLA Firefox\firefox.exe"
+ )),
+ Some("MOZILLA Firefox".into()),
+ "found without regard to case, shown exactly as the folder is named"
+ );
+ assert_eq!(
+ install_folder_owning(Path::new(r"D:\tools\bin\thing.exe")),
+ None
+ );
+ }
+
+ #[test]
+ fn an_entry_goes_to_the_list_its_source_declares() {
+ let mut login = StartupItem::new(
+ "login-item://Docker",
+ "Docker",
+ StartupSource::LoginItem,
+ StartupScope::User,
+ );
+ let mut daemon = StartupItem::new(
+ "/Library/LaunchDaemons/com.docker.vmnetd.plist",
+ "com.docker.vmnetd",
+ StartupSource::LaunchDaemon,
+ StartupScope::System,
+ );
+ categorise(&mut login);
+ categorise(&mut daemon);
+ assert_eq!(login.category, StartupCategory::OpenAtLogin);
+ assert_eq!(daemon.category, StartupCategory::Background);
+ }
+}
+
/// True when the path lives in a dot-directory directly under home, which is
/// where updaters and helpers that nobody installed tend to sit.
fn in_hidden_home_dir(program: &Path) -> bool {
@@ -309,6 +829,24 @@ fn in_hidden_home_dir(program: &Path) -> bool {
.unwrap_or(false)
}
+/// What happens to every entry once both platforms have finished collecting them.
+///
+/// Trust comes first because an entry whose path names no application is filed
+/// under whoever signed it, and that is only known once the signature has been
+/// asked about. On macOS that question costs one `codesign` process per entry, so
+/// it is asked in parallel: ~870 sequential calls took 8 s on an M1 Pro, and the
+/// same calls across the available cores take under 1 s.
+fn finish(items: &mut [StartupItem]) {
+ use rayon::prelude::*;
+
+ items.par_iter_mut().for_each(apply_trust);
+ attribute_owners(items);
+ for item in items.iter_mut() {
+ categorise(item);
+ }
+ sort_items(items);
+}
+
/// Order user-owned entries first; inside a scope, alphabetically.
fn sort_items(items: &mut [StartupItem]) {
items.sort_by(|a, b| {
@@ -369,10 +907,11 @@ mod macos {
Ok(entries) => entries,
Err(error) => {
if error.kind() != std::io::ErrorKind::NotFound {
- out.notes.push(format!(
- "{} could not be listed: {error}",
- root.dir.display()
- ));
+ out.notes.push(StartupNote {
+ kind: StartupNoteKind::UnreadableRoot,
+ subject: root.dir.display().to_string(),
+ detail: error.to_string(),
+ });
}
continue;
}
@@ -395,8 +934,8 @@ mod macos {
}
}
}
- out.items.extend(login_items());
- sort_items(&mut out.items);
+ out.items.extend(login_items(&mut out.notes));
+ finish(&mut out.items);
out
}
@@ -443,16 +982,16 @@ mod macos {
/// entries Apple owns: a hundred unsigned system agents is not a signal.
fn classify(item: &mut StartupItem, path: &Path, scope: StartupScope) {
if item.system_vendor {
- item.readonly_reason = Some("part of macOS".into());
+ item.lock = Some(StartupLock::OperatingSystem);
item.risks.clear();
} else if scope == StartupScope::System {
- item.readonly_reason = Some("requires an administrator authorisation".into());
+ item.lock = Some(StartupLock::NeedsAuthorisation);
} else {
let writable = crate::is_user_writable(path)
&& crate::is_user_writable(path.parent().unwrap_or(path));
item.modifiable = writable;
if !writable {
- item.readonly_reason = Some("this file is not owned by you".into());
+ item.lock = Some(StartupLock::NotWritable);
}
}
}
@@ -491,71 +1030,125 @@ mod macos {
.unwrap_or(expanded)
}
- /// The login-item database macOS still maintains beside the modern
- /// per-app setting. Reading it costs one file scan; changing it belongs to
- /// System Settings, so these entries are reported read-only.
- fn login_items() -> Vec {
- let path = home_dir().join(
- "Library/Application Support/com.apple.backgroundtaskmanagementagent/backgrounditems.btm",
- );
+ /// What System Settings shows under "Open at Login".
+ ///
+ /// Asking System Events rather than parsing a file is the point: the list is
+ /// maintained by backgroundtaskmanagement, its on-disk archive is a keychain
+ /// of security-scoped bookmarks that only root can resolve, and the one
+ /// readable copy in the home folder held 9 of the 30 groups the panel shows.
+ /// System Events *is* the panel's own view, so the two cannot disagree.
+ ///
+ /// Changing an entry still belongs to System Settings — the scriptable
+ /// `delete` is unreliable across macOS versions — so every row is reported
+ /// with its lock rather than with a toggle that might not hold.
+ fn login_items(notes: &mut Vec) -> Vec {
+ let script = "tell application \"System Events\"\n\
+ set collected to {}\n\
+ repeat with anItem in (every login item)\n\
+ set theName to \"\"\n\
+ try\n\
+ set theName to name of anItem\n\
+ end try\n\
+ set thePath to \"\"\n\
+ try\n\
+ set thePath to (path of anItem) as text\n\
+ end try\n\
+ set hiddenFlag to false\n\
+ try\n\
+ set hiddenFlag to (hidden of anItem)\n\
+ end try\n\
+ set end of collected to theName & tab & thePath & tab & (hiddenFlag as text)\n\
+ end repeat\n\
+ set AppleScript's text item delimiters to linefeed\n\
+ return collected as text\n\
+ end tell";
+ let output = match std::process::Command::new("osascript")
+ .args(["-e", script])
+ .output()
+ {
+ Ok(output) if output.status.success() => {
+ String::from_utf8_lossy(&output.stdout).into_owned()
+ }
+ Ok(output) => {
+ let reason = String::from_utf8_lossy(&output.stderr).trim().to_string();
+ notes.push(StartupNote {
+ kind: StartupNoteKind::LoginItemsUnavailable,
+ subject: String::new(),
+ detail: if reason.is_empty() {
+ "osascript failed".into()
+ } else {
+ reason
+ },
+ });
+ return Vec::new();
+ }
+ Err(error) => {
+ notes.push(StartupNote {
+ kind: StartupNoteKind::LoginItemsUnavailable,
+ subject: String::new(),
+ detail: error.to_string(),
+ });
+ return Vec::new();
+ }
+ };
+
+ parse_login_items(&output)
+ }
+
+ /// Turn the script's report into entries. One line per item, tab-separated:
+ /// name, path, and whether it launches hidden.
+ pub(super) fn parse_login_items(output: &str) -> Vec {
let mut items = Vec::new();
- for found in printable_paths(&path, 8) {
- if !found.contains("/Applications/") && !found.starts_with("/Library/") {
+ for line in output
+ .lines()
+ .map(str::trim)
+ .filter(|line| !line.is_empty())
+ {
+ let mut fields = line.split('\t');
+ let name = fields.next().unwrap_or_default().trim();
+ if name.is_empty() {
continue;
}
- let label = Path::new(&found)
- .file_name()
- .map(|name| name.to_string_lossy().trim_end_matches(".app").to_string())
- .unwrap_or_else(|| found.clone());
+ // System Events reports `missing value` for an item whose file is
+ // gone, which is the interesting case rather than a reason to drop it.
+ let path = fields.next().unwrap_or_default().trim();
+ let path = if path.is_empty() || path == "missing value" {
+ String::new()
+ } else {
+ path.to_string()
+ };
+ let hidden = fields.next().unwrap_or_default().trim() == "true";
let mut item = StartupItem::builder(
- found.clone(),
- label,
+ format!("login-item://{name}"),
+ name.to_string(),
StartupSource::LoginItem,
StartupScope::User,
);
- item.command = found.clone();
- judge_program(&mut item, Some(Path::new(&found)));
- item.readonly_reason = Some("login items are managed in System Settings".into());
+ // Left empty rather than filled with the name: repeating the name under
+ // itself says nothing, and the page can say what is actually true.
+ item.command = path.clone();
+ item.hidden = hidden;
+ judge_program(
+ &mut item,
+ (!path.is_empty()).then(|| Path::new(path.as_str())),
+ );
+ if hidden {
+ item.risks.push(StartupRisk::HiddenEntry);
+ }
+ item.modifiable = false;
+ item.lock = Some(StartupLock::ManagedBySystemSettings);
items.push(item);
}
items
}
- /// Pull printable absolute paths out of a binary archive without a parser.
- fn printable_paths(path: &Path, minimum: usize) -> Vec {
- let Ok(bytes) = std::fs::read(path) else {
- return Vec::new();
- };
- let mut found = Vec::new();
- let mut current = String::new();
- for byte in bytes {
- if byte.is_ascii_graphic() || byte == b' ' {
- current.push(byte as char);
- } else {
- if current.len() >= minimum && current.starts_with('/') {
- found.push(current.clone());
- }
- current.clear();
- }
- }
- if current.len() >= minimum && current.starts_with('/') {
- found.push(current);
- }
- found.sort();
- found.dedup();
- found
- }
-
pub fn set_enabled(id: &str, enabled: bool) -> Result {
let current = inventory();
let item = current
.find(id)
.ok_or_else(|| "That startup item is no longer there.".to_string())?;
if !item.modifiable {
- return Err(item
- .readonly_reason
- .clone()
- .unwrap_or_else(|| "Squid cannot change this item.".into()));
+ return Err(LOCK_REFUSAL.to_string());
}
let path = PathBuf::from(id);
let to = if enabled {
@@ -680,6 +1273,54 @@ mod tests {
path
}
+ #[test]
+ fn a_login_item_report_becomes_entries_that_cannot_be_touched() {
+ // The shape System Events answers with: name, path, hidden. Nothing about a
+ // real machine is assumed, so the three rows are a bundle that is there, one
+ // that is gone, and the `missing value` an item whose file vanished is
+ // reported as. Dropping the last two would hide the entries worth seeing.
+ let f = fixture("loginitems");
+ let present = f.home.join("Keeper.app");
+ std::fs::create_dir_all(&present).expect("bundle");
+ let gone = f.home.join("Uninstalled.app");
+ let report = format!(
+ "Keeper\t{}\tfalse\nUninstalled\t{}\tfalse\nDoubao\tmissing value\ttrue\n",
+ present.display(),
+ gone.display()
+ );
+
+ let mut items = macos::parse_login_items(&report);
+ assert_eq!(items.len(), 3);
+ // Which list an entry belongs to is settled once, over the whole inventory,
+ // by the same step the real inventory runs.
+ for item in &mut items {
+ categorise(item);
+ }
+
+ for item in &items {
+ assert_eq!(item.source, StartupSource::LoginItem);
+ assert_eq!(item.scope, StartupScope::User);
+ assert_eq!(item.category, StartupCategory::OpenAtLogin);
+ assert!(!item.modifiable, "macOS owns this list");
+ assert_eq!(item.lock, Some(StartupLock::ManagedBySystemSettings));
+ assert_eq!(item.id, format!("login-item://{}", item.name));
+ }
+
+ assert_eq!(items[0].program.as_deref(), Some(present.as_path()));
+ assert!(
+ items[1].risks.contains(&StartupRisk::MissingTarget),
+ "an entry pointing at nothing says so rather than disappearing"
+ );
+
+ let vanished = &items[2];
+ assert!(
+ vanished.command.is_empty(),
+ "a name is not a path, and repeating one under the other says nothing"
+ );
+ assert!(vanished.hidden);
+ assert!(vanished.risks.contains(&StartupRisk::HiddenEntry));
+ }
+
#[test]
fn a_user_agent_is_listed_with_the_program_it_runs() {
let f = fixture("listed");
@@ -860,8 +1501,7 @@ mod windows {
program_of_command(&command).as_deref().map(Path::new),
);
if scope == StartupScope::System {
- item.readonly_reason =
- Some("requires an administrator authorisation".into());
+ item.lock = Some(StartupLock::NeedsAuthorisation);
} else {
item.modifiable = true;
}
@@ -903,11 +1543,11 @@ mod windows {
item.modified_ms = modified_ms(&path);
judge_program(&mut item, Some(&path));
if scope == StartupScope::System {
- item.readonly_reason = Some("requires an administrator authorisation".into());
+ item.lock = Some(StartupLock::NeedsAuthorisation);
} else {
item.modifiable = crate::is_user_writable(&folder);
if !item.modifiable {
- item.readonly_reason = Some("this folder is not writable".into());
+ item.lock = Some(StartupLock::NotWritable);
}
}
out.items.push(item);
@@ -917,7 +1557,7 @@ mod windows {
out.items.extend(parked_entries());
out.items.extend(scheduled_tasks());
out.items.extend(services());
- sort_items(&mut out.items);
+ finish(&mut out.items);
out
}
@@ -978,7 +1618,7 @@ mod windows {
);
item.modifiable = hive_name == "HKCU";
if !item.modifiable {
- item.readonly_reason = Some("requires an administrator authorisation".into());
+ item.lock = Some(StartupLock::NeedsAuthorisation);
}
items.push(item);
}
@@ -1058,7 +1698,7 @@ mod windows {
if item.system_vendor {
item.risks.clear();
}
- item.readonly_reason = Some("scheduled tasks are read-only in this release".into());
+ item.lock = Some(StartupLock::NotManaged);
items.push(item);
}
items
@@ -1152,7 +1792,7 @@ mod windows {
if item.system_vendor {
item.risks.clear();
}
- item.readonly_reason = Some("services are read-only in this release".into());
+ item.lock = Some(StartupLock::NotManaged);
items.push(item);
}
items
@@ -1180,10 +1820,7 @@ mod windows {
.cloned()
.ok_or_else(|| "That startup item is no longer there.".to_string())?;
if !item.modifiable {
- return Err(item
- .readonly_reason
- .clone()
- .unwrap_or_else(|| "Squid cannot change this item.".into()));
+ return Err(LOCK_REFUSAL.to_string());
}
match item.source {
StartupSource::RegistryRun => set_registry_enabled(&item, enabled),
diff --git a/crates/squid-platform/src/trust.rs b/crates/squid-platform/src/trust.rs
index 81e6530..b5ec165 100644
--- a/crates/squid-platform/src/trust.rs
+++ b/crates/squid-platform/src/trust.rs
@@ -18,6 +18,7 @@ use std::path::Path;
/// What the signature says about one file.
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
pub struct Trust {
/// A signature exists and the operating system considers it intact.
pub signed: bool,
@@ -62,13 +63,20 @@ pub fn assess(path: &Path) -> Trust {
// into an answer instead of a cached guess.
return assess_uncached(path);
};
+ if let Some(found) = cache()
+ .lock()
+ .unwrap_or_else(|poisoned| poisoned.into_inner())
+ .get(&key)
+ .cloned()
+ {
+ return found;
+ }
+ // Asked with no lock held: the question costs a subprocess, so holding the
+ // cache across it would make every bulk caller take these one at a time.
+ let trust = assess_uncached(path);
let mut cache = cache()
.lock()
.unwrap_or_else(|poisoned| poisoned.into_inner());
- if let Some(found) = cache.get(&key) {
- return found.clone();
- }
- let trust = assess_uncached(path);
// Bounded, because a utility that grows its own footprint to answer a
// display question is its own kind of junk. Half is dropped rather than all,
// so a table that is still on screen keeps the answers it is showing.
@@ -318,41 +326,47 @@ fn pe_has_certificate_at(path: &Path) -> Option {
/// Cheap gate for a table with hundreds of rows: only Mach-O and PE files can
/// carry a signature, so everything else is answered without a subprocess.
+///
+/// The header decides, not the name. A macOS privileged helper is called
+/// `us.zoom.ZoomDaemon` and a Windows one `com.microsoft.autoupdate.helper`, where
+/// the last dot is part of the name rather than an extension; judging by extension
+/// never asked about a signed helper whose name happens to contain a dot. Reading
+/// eight bytes is close to free next to the subprocess being avoided, and it is the
+/// same question the signature actually answers.
pub fn might_be_executable(path: &Path) -> bool {
- if path.is_dir() {
- return false;
- }
- if path.extension().is_some() {
- const SIGNED_KINDS: [&str; 9] = [
- "app",
- "framework",
- "bundle",
- "xpc",
- "dylib",
- "so",
- "exe",
- "dll",
- "sys",
- ];
- let ext = path
- .extension()
+ /// Bundles are signed as a unit, so the directory itself is the question.
+ const BUNDLES: [&str; 4] = ["app", "framework", "bundle", "xpc"];
+
+ let extension = || {
+ path.extension()
.map(|ext| ext.to_string_lossy().to_lowercase())
- .unwrap_or_default();
- return SIGNED_KINDS.contains(&ext.as_str()) || ext.is_empty();
+ .unwrap_or_default()
+ };
+ if path.is_dir() {
+ return BUNDLES.contains(&extension().as_str());
+ }
+ match header(path) {
+ Some(head) => header_is_executable(&head),
+ // Nothing to read: an executable the current user may run but not open is
+ // common among root-owned helpers, and `codesign` may still answer for it.
+ None => {
+ BUNDLES.contains(&extension().as_str())
+ || ["dylib", "so", "exe", "dll", "sys"].contains(&extension().as_str())
+ || extension().is_empty()
+ }
}
- // Extension-less binaries are the norm on macOS, so the header decides.
- header_is_executable(path)
}
-fn header_is_executable(path: &Path) -> bool {
+/// The first eight bytes, or `None` when the file cannot be opened.
+fn header(path: &Path) -> Option<[u8; 8]> {
use std::io::Read;
- let Ok(mut file) = std::fs::File::open(path) else {
- return false;
- };
+ let mut file = std::fs::File::open(path).ok()?;
let mut head = [0_u8; 8];
- let Ok(_) = file.read(&mut head) else {
- return false;
- };
+ file.read_exact(&mut head).ok()?;
+ Some(head)
+}
+
+fn header_is_executable(head: &[u8; 8]) -> bool {
// Mach-O 32/64, fat binary, and their byte-swapped forms.
const MACHOS: [[u8; 4]; 6] = [
[0xcf, 0xfa, 0xed, 0xfe],
diff --git a/crates/squid-platform/src/windows.rs b/crates/squid-platform/src/windows.rs
index 1fb7d69..c87899b 100644
--- a/crates/squid-platform/src/windows.rs
+++ b/crates/squid-platform/src/windows.rs
@@ -90,6 +90,26 @@ fn uninstall_program(uninstall_string: &str) -> Option {
candidate.exists().then_some(candidate)
}
+/// `DisplayIcon` is a path with an optional icon index, usually quoted:
+/// `"C:\Program Files\App\app.exe",0`. The file manager accepts the path
+/// without the index and returns the application's default icon.
+fn display_icon_path(value: Option) -> Option {
+ let raw = value?.trim().to_string();
+ let unquoted = raw
+ .strip_prefix('"')
+ .and_then(|value| value.split('"').next())
+ .unwrap_or(&raw)
+ .trim();
+ let without_index = unquoted
+ .rsplit_once(',')
+ .filter(|(_, index)| index.trim().parse::().is_ok())
+ .map(|(path, _)| path)
+ .unwrap_or(unquoted)
+ .trim();
+ let path = PathBuf::from(without_index);
+ path.exists().then_some(path)
+}
+
impl Platform for Windows {
fn id(&self) -> PlatformId {
PlatformId::Windows
@@ -138,6 +158,27 @@ impl Platform for Windows {
None => String::new(),
}
}
+ fn graphics_adapter(&self) -> String {
+ let Ok(class) = RegKey::predef(HKEY_LOCAL_MACHINE).open_subkey_with_flags(
+ r"SYSTEM\CurrentControlSet\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}",
+ KEY_READ,
+ ) else {
+ return String::new();
+ };
+ let mut adapters = Vec::new();
+ for name in class.enum_keys().flatten() {
+ let Ok(adapter) = class.open_subkey_with_flags(&name, KEY_READ) else {
+ continue;
+ };
+ let Some(description) = str_value(&adapter, "DriverDesc") else {
+ continue;
+ };
+ if !adapters.contains(&description) {
+ adapters.push(description);
+ }
+ }
+ adapters.join(" · ")
+ }
fn app_sources(&self) -> Vec {
let env = |key: &str| std::env::var_os(key).map(PathBuf::from);
let mut dirs: Vec = vec![
@@ -207,6 +248,7 @@ impl Platform for Windows {
name: display_name,
bundle_id: None,
path,
+ icon_source: display_icon_path(str_value(&key, "DisplayIcon")),
version: str_value(&key, "DisplayVersion"),
size: Bytes::ZERO,
source: source.into(),
diff --git a/crates/squid-stats/src/battery.rs b/crates/squid-stats/src/battery.rs
index cd00f43..7dc3edf 100644
--- a/crates/squid-stats/src/battery.rs
+++ b/crates/squid-stats/src/battery.rs
@@ -65,6 +65,9 @@ fn macos_battery() -> Option {
battery.cycle_count = cycles;
battery.temperature_c = temp;
}
+ if let Some(health) = maximum_capacity() {
+ battery.health_percent = Some(health);
+ }
Some(battery)
}
@@ -129,19 +132,77 @@ fn battery_details() -> Option<(Option, Option, Option)> {
.ok()
.filter(|output| output.status.success())?;
let text = String::from_utf8_lossy(&output.stdout);
- let design = find_number(&text, "DesignCapacity");
- let max = find_number(&text, "MaxCapacity");
- let health = match (design, max) {
- (Some(design), Some(max)) if design > 0 => {
- Some(((max as f64 / design as f64) * 100.0).round() as u8)
- }
- _ => None,
- };
+ let health = health_from_ioreg(&text);
let cycles = find_number(&text, "CycleCount").map(|value| value as u32);
let temp = find_number(&text, "Temperature").map(|tenths| tenths as f32 / 100.0);
Some((health, cycles, temp))
}
+/// macOS already publishes the same figure it shows in System Settings. Read it
+/// once every ten minutes rather than deriving it from `MaxCapacity`, which on
+/// Apple Silicon is a percentage rather than a mAh reading.
+#[cfg(target_os = "macos")]
+fn maximum_capacity() -> Option {
+ use std::sync::Mutex;
+ use std::time::{Duration, Instant};
+
+ static CACHE: Mutex
: null}
-
- {t(
- "Closing this changes nothing. The same checks stay in Settings, and an update may reset what macOS granted.",
- "关闭本卡片不会改变任何设置,这些检查在设置中依然保留。更新后 macOS 可能重置已授予的权限。",
- )}
-