commit 79b03cac95e1dfe18dbd173ef78492eccd71d854 Author: Tamas Csikel Date: Sat Oct 24 09:06:06 2026 +0200 SmartFox: launcher, Siri Remote driver, Debian image and installer Co-Authored-By: Claude Opus 5.5 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..2b6265d --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +* text=auto eol=lf +*.ttf binary +*.png binary diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6409846 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +/target +*.log +/image/mkosi.output +/image/mkosi.cache +/image/stage +/image/ovmf-vars.fd +/image/out diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..016b242 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,6122 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "ab_glyph" +version = "0.2.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01c0457472c38ea5bd1c3b5ada5e368271cb550be7a4ca4a0b4634e9913f6cc2" +dependencies = [ + "ab_glyph_rasterizer", + "owned_ttf_parser", +] + +[[package]] +name = "ab_glyph_rasterizer" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "366ffbaa4442f4684d91e2cd7c5ea7c4ed8add41959a31447066e279e432b618" + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "getrandom 0.3.4", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba" +dependencies = [ + "memchr", +] + +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + +[[package]] +name = "android-activity" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f2a1bb052857d5dd49572219344a7332b31b76405648eabac5bc68978251bcd" +dependencies = [ + "android-properties", + "bitflags 2.13.2", + "cc", + "jni", + "libc", + "log", + "ndk", + "ndk-context", + "ndk-sys", + "num_enum", + "thiserror 2.0.21", +] + +[[package]] +name = "android-properties" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04" + +[[package]] +name = "android_system_properties" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc" +dependencies = [ + "libc", +] + +[[package]] +name = "annotate-snippets" +version = "0.12.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a5b0a5ab8561c603f16c3b78c24a386b1f70e7fc1b1b1e8c15738828e4a176" +dependencies = [ + "anstyle", + "memchr", + "unicode-width", +] + +[[package]] +name = "anstream" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" + +[[package]] +name = "anstyle-parse" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + +[[package]] +name = "anyhow" +version = "1.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" + +[[package]] +name = "arboard" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aeb9553e62312c8756a5979254fc6d7da8bbeb5986a1e17037fab932f7037917" +dependencies = [ + "clipboard-win", + "log", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-foundation 0.3.2", + "parking_lot", + "percent-encoding", + "windows-sys 0.61.2", + "wl-clipboard-rs", + "x11rb", +] + +[[package]] +name = "arrayref" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" + +[[package]] +name = "arrayvec" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56" + +[[package]] +name = "as-raw-xcb-connection" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b" + +[[package]] +name = "ash" +version = "0.38.0+1.3.281" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f" +dependencies = [ + "libloading", +] + +[[package]] +name = "async-broadcast" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532" +dependencies = [ + "event-listener", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-channel" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2" +dependencies = [ + "concurrent-queue", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-executor" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c96bf972d85afc50bf5ab8fe2d54d1586b4e0b46c97c50a0c9e71e2f7bcd812a" +dependencies = [ + "async-task", + "concurrent-queue", + "fastrand", + "futures-lite", + "pin-project-lite", + "slab", +] + +[[package]] +name = "async-io" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc" +dependencies = [ + "autocfg", + "cfg-if", + "concurrent-queue", + "futures-io", + "futures-lite", + "parking", + "polling", + "rustix 1.1.5", + "slab", + "windows-sys 0.61.2", +] + +[[package]] +name = "async-lock" +version = "3.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290f7f2596bd5b78a9fec8088ccd89180d7f9f55b94b0576823bbbdc72ee8311" +dependencies = [ + "event-listener", + "event-listener-strategy", + "pin-project-lite", +] + +[[package]] +name = "async-process" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc50921ec0055cdd8a16de48773bfeec5c972598674347252c0399676be7da75" +dependencies = [ + "async-channel", + "async-io", + "async-lock", + "async-signal", + "async-task", + "blocking", + "cfg-if", + "event-listener", + "futures-lite", + "rustix 1.1.5", +] + +[[package]] +name = "async-recursion" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f8abc12baad266b1c8cec146854c195b5864b4221d4b2ca7296a7ae82d9e451" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "async-signal" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52b5aaafa020cf5053a01f2a60e8ff5dccf550f0f77ec54a4e47285ac2bab485" +dependencies = [ + "async-io", + "async-lock", + "atomic-waker", + "cfg-if", + "futures-core", + "futures-io", + "rustix 1.1.5", + "signal-hook-registry", + "slab", + "windows-sys 0.61.2", +] + +[[package]] +name = "async-task" +version = "4.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" + +[[package]] +name = "async-trait" +version = "0.1.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" + +[[package]] +name = "base64" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" + +[[package]] +name = "bincode" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36eaf5d7b090263e8150820482d5d93cd964a81e4019913c972f4edcc6edb740" +dependencies = [ + "serde", + "unty", +] + +[[package]] +name = "bindgen" +version = "0.72.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895" +dependencies = [ + "bitflags 2.13.2", + "cexpr", + "clang-sys", + "itertools 0.13.0", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash 2.1.3", + "shlex 1.3.0", + "syn 2.0.119", +] + +[[package]] +name = "bit-set" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2f926cc3060f09db9ebc5b52823d85268d24bb917e472c0c4bea35780a7d" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b71798fca2c1fe1086445a7258a4bc81e6e49dcd24c8d0dd9a1e57395b603f51" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" +dependencies = [ + "serde_core", +] + +[[package]] +name = "bitvec" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddcec3d12c579d40898fe0a9a358a803c23e9c52ca3c425707f81c9436211837" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + +[[package]] +name = "block2" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f" +dependencies = [ + "objc2 0.5.3", +] + +[[package]] +name = "block2" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" +dependencies = [ + "objc2 0.6.5", +] + +[[package]] +name = "blocking" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a70e4329df6cb94385eed412ec92375c3cdd8a6e502493d1229b6414e4036dfa" +dependencies = [ + "async-channel", + "async-task", + "futures-io", + "futures-lite", + "piper", +] + +[[package]] +name = "bluer" +version = "0.17.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af68112f5c60196495c8b0eea68349817855f565df5b04b2477916d09fb1a901" +dependencies = [ + "custom_debug", + "dbus", + "dbus-crossroads", + "dbus-tokio", + "displaydoc", + "futures", + "hex", + "lazy_static", + "libc", + "log", + "macaddr", + "nix 0.29.0", + "num-derive", + "num-traits", + "pin-project", + "serde", + "serde_json", + "strum 0.26.3", + "tokio", + "tokio-stream", + "uuid", +] + +[[package]] +name = "borsh" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "553c5d846a6ba5150c65e3b1b8ec073bcf1abc20f9b7220de384a4443ea4e20a" +dependencies = [ + "bytes", + "cfg_aliases", +] + +[[package]] +name = "bumpalo" +version = "3.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" + +[[package]] +name = "by_address" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64fa3c856b712db6612c019f14756e64e4bcea13337a6b33b696333a9eaa2d06" + +[[package]] +name = "bytemuck" +version = "1.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a1f896587b6f2c069c73d2f0913e2d590c3990285cd2f0b6aa02b786b4c679c" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "byteorder-lite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" + +[[package]] +name = "bytes" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" + +[[package]] +name = "calloop" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b99da2f8558ca23c71f4fd15dc57c906239752dd27ff3c00a1d56b685b7cbfec" +dependencies = [ + "bitflags 2.13.2", + "log", + "polling", + "rustix 0.38.44", + "slab", + "thiserror 1.0.69", +] + +[[package]] +name = "calloop" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43b32313e937c8721c9d17ee9bf60699a6402b4b7c2cb6ac1bee0ffcaa4b4e5e" +dependencies = [ + "bitflags 2.13.2", + "polling", + "rustix 1.1.5", + "tracing", +] + +[[package]] +name = "calloop-wayland-source" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20" +dependencies = [ + "calloop 0.13.0", + "rustix 0.38.44", + "wayland-backend", + "wayland-client", +] + +[[package]] +name = "cc" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86e055fa6e3e40ad6187ba25b6855eeb635d5271f8e0f0e1e9a5826b8d75bea0" +dependencies = [ + "find-msvc-tools", + "jobserver", + "libc", + "shlex 2.0.1", +] + +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom 7.1.3", +] + +[[package]] +name = "cfg-if" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" + +[[package]] +name = "cfg_aliases" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" + +[[package]] +name = "cgl" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ced0551234e87afee12411d535648dd89d2e7f34c78b753395567aff3d447ff" +dependencies = [ + "libc", +] + +[[package]] +name = "chrono" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" +dependencies = [ + "iana-time-zone", + "js-sys", + "num-traits", + "wasm-bindgen", + "windows-link", +] + +[[package]] +name = "clang-sys" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "157a8ba7b480713b56f4c09fd13fc3e0a22a5dfab8097ba61cbc5feef950788a" +dependencies = [ + "glob", + "libc", + "libloading", +] + +[[package]] +name = "clipboard-win" +version = "5.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "052af7878466feccda12ba7a6a67d019d712f296809559b47c12c8cc196d3a9a" +dependencies = [ + "error-code", +] + +[[package]] +name = "clru" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "197fd99cb113a8d5d9b6376f3aa817f32c1078f2343b714fff7d2ca44fdf67d5" +dependencies = [ + "hashbrown 0.16.1", +] + +[[package]] +name = "codespan-reporting" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af491d569909a7e4dee0ad7db7f5341fef5c614d5b8ec8cf765732aba3cff681" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "color_quant" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" + +[[package]] +name = "colorchoice" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" + +[[package]] +name = "combine" +version = "4.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4356eba6976435498d05a311ee9fc486da3bc81c200d3f0d7dd9703b41913f92" +dependencies = [ + "bytes", + "memchr", +] + +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "const-field-offset" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d535c69e75b4e3c69e17205b5b37a91936c54086cecd339b70071500786acb9c" +dependencies = [ + "const-field-offset-macro", + "field-offset", +] + +[[package]] +name = "const-field-offset-macro" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d5848843a221ac268cfdd6bfd14e68d5d3dfa79d52c880aafab93f9517fb74" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "convert_case" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "633458d4ef8c78b72454de2d54fd6ab2e60f9e02be22f3c6104cdc8a4e0fceb9" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "core-graphics" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "core-graphics-types", + "foreign-types", + "libc", +] + +[[package]] +name = "core-graphics-types" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "libc", +] + +[[package]] +name = "countme" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7704b5fdd17b18ae31c4c1da5a2e0305a2bf17b5249300a9ee9ed7b72114c636" + +[[package]] +name = "crc32fast" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ba106e844045ddc02c20768ac4b0b7cb45f2cc2ecbd833ac9f5dacb183c2055" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "critical-section" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" + +[[package]] +name = "crossbeam-channel" +version = "0.5.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98b0cc327b5bc766e7fda9c9260cc0fa81b43a8e240440422dff70788e3f9ef1" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622f3fc73690be383c7214310406f28a90e6edeadc3cea882f9d71e495b9711a" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc74980687109a3b14c72fd458107bf0baa1da1a1a805e178d15501ba9b86d9d" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" + +[[package]] +name = "crunchy" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" + +[[package]] +name = "ctor" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83cf0d42651b16c6dfe68685716d18480d18a9c39c62d76e8cf3eb6ed5d8bcbf" +dependencies = [ + "dtor", +] + +[[package]] +name = "cursor-icon" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f27ae1dd37df86211c42e150270f82743308803d90a6f6e6651cd730d5e1732f" + +[[package]] +name = "custom_debug" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2da7d1ad9567b3e11e877f1d7a0fa0360f04162f94965fc4448fbed41a65298e" +dependencies = [ + "custom_debug_derive", +] + +[[package]] +name = "custom_debug_derive" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a707ceda8652f6c7624f2be725652e9524c815bf3b9d55a0b2320be2303f9c11" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.119", + "synstructure 0.13.2", +] + +[[package]] +name = "darling" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.119", +] + +[[package]] +name = "darling_macro" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "data-url" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be1e0bca6c3637f992fc1cc7cbc52a78c1ef6db076dbf1059c4323d6a2048376" + +[[package]] +name = "dbus" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ab69f03cc8c4340c9c8e315114e1658e6775a9b16a04357973aa21cec22b32e" +dependencies = [ + "futures-channel", + "futures-util", + "libc", + "libdbus-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "dbus-crossroads" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64bff0bd181fba667660276c6b7ebdc50cff37ce593e7adf9e734f89c8f444e8" +dependencies = [ + "dbus", +] + +[[package]] +name = "dbus-tokio" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "007688d459bc677131c063a3a77fb899526e17b7980f390b69644bdbc41fad13" +dependencies = [ + "dbus", + "libc", + "tokio", +] + +[[package]] +name = "defmt" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4a0795ac740cb54d7b3775c9c17345f6aaecf884c01733b39d6017738e0e3e1" +dependencies = [ + "bitflags 1.3.2", + "defmt-macros", +] + +[[package]] +name = "defmt-macros" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "840bb056bd99c495c9188198a258ab787c79f306d864db3e6e8451442d6d8366" +dependencies = [ + "defmt-parser", + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "defmt-parser" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71958f69fb2de856c5dd51ac9377e986ca1aa5919f931bf5395a807277f889a0" +dependencies = [ + "thiserror 2.0.21", +] + +[[package]] +name = "derive_more" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "rustc_version", + "syn 2.0.119", + "unicode-xid", +] + +[[package]] +name = "dispatch" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" + +[[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 0.6.5", +] + +[[package]] +name = "displaydoc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "dlib" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a" +dependencies = [ + "libloading", +] + +[[package]] +name = "document-features" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61" +dependencies = [ + "litrs", +] + +[[package]] +name = "downcast-rs" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" + +[[package]] +name = "dpi" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76" + +[[package]] +name = "drm" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80bc8c5c6c2941f70a55c15f8d9f00f9710ebda3ffda98075f996a0e6c92756f" +dependencies = [ + "bitflags 2.13.2", + "bytemuck", + "drm-ffi", + "drm-fourcc", + "libc", + "rustix 0.38.44", +] + +[[package]] +name = "drm-ffi" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51a91c9b32ac4e8105dec255e849e0d66e27d7c34d184364fb93e469db08f690" +dependencies = [ + "drm-sys", + "rustix 1.1.5", +] + +[[package]] +name = "drm-fourcc" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0aafbcdb8afc29c1a7ee5fbe53b5d62f4565b35a042a662ca9fecd0b54dae6f4" + +[[package]] +name = "drm-sys" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc8e1361066d91f5ffccff060a3c3be9c3ecde15be2959c1937595f7a82a9f8" +dependencies = [ + "libc", + "linux-raw-sys 0.9.4", +] + +[[package]] +name = "dtor" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edf234dd1594d6dd434a8fb8cada51ddbbc593e40e4a01556a0b31c62da2775b" + +[[package]] +name = "either" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" + +[[package]] +name = "endi" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66b7e2430c6dff6a955451e2cfc438f09cea1965a9d6f87f7e3b90decc014099" + +[[package]] +name = "enumflags2" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1027f7680c853e056ebcec683615fb6fbbc07dbaa13b4d5d9442b146ded4ecef" +dependencies = [ + "enumflags2_derive", + "serde", +] + +[[package]] +name = "enumflags2_derive" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67c78a4d8fdf9953a5c9d458f9efe940fd97a0cab0941c075a813ac594733827" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "env_filter" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "900d271a03799a1ee8d1ca9b19893b48ca674a9284fefcfb85f05e74ed314217" +dependencies = [ + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de671bd27a75a797dc9ae289ba1e77276e75e2026408aab65185384e2d5cd3f6" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "jiff", + "log", +] + +[[package]] +name = "equivalent" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "error-code" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5343afd4a8365a643ac588dab4cf234a190c7f6c88c9f6dd6ffe00837661b7" + +[[package]] +name = "euclid" +version = "0.22.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1a05365e3b1c6d1650318537c7460c6923f1abdd272ad6842baa2b509957a06" +dependencies = [ + "num-traits", +] + +[[package]] +name = "evdev" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25b686663ba7f08d92880ff6ba22170f1df4e83629341cba34cf82cd65ebea99" +dependencies = [ + "bitvec", + "cfg-if", + "libc", + "nix 0.29.0", + "tokio", +] + +[[package]] +name = "event-listener" +version = "5.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a23add41df1562121a9393cb065eab5146a1242410f23a644851e90cfd669d2" +dependencies = [ + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" +dependencies = [ + "event-listener", + "pin-project-lite", +] + +[[package]] +name = "fastrand" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" + +[[package]] +name = "fdeflate" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" +dependencies = [ + "simd-adler32", +] + +[[package]] +name = "femtovg" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31eebf3ab1b76359ccd5f850c07a7c6b2722c64d9127c40e02358e83f3ff9b1a" +dependencies = [ + "bitflags 2.13.2", + "bytemuck", + "fnv", + "glow 0.18.0", + "imgref", + "itertools 0.15.0", + "log", + "rgb", + "slotmap", + "swash", + "wasm-bindgen", + "web-sys", +] + +[[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 = "filetime" +version = "0.2.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c287a33c7f0a620c38e641e7f60827713987b3c0f26e8ddc9462cc69cf75759" +dependencies = [ + "cfg-if", + "libc", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48" + +[[package]] +name = "fixed_decimal" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2214fb00f669ee96bee5bb29dfb1ddabe058b2bc426817efc79afa03c9bc55ae" +dependencies = [ + "displaydoc", + "smallvec", + "writeable", +] + +[[package]] +name = "fixedbitset" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" + +[[package]] +name = "flate2" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e634e2e0ebac1ee034020da1ca582e17ffe4e0f5e985823721e168928136dcb" +dependencies = [ + "crc32fast", + "miniz_oxide 0.9.1", + "zlib-rs", +] + +[[package]] +name = "float-cmp" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + +[[package]] +name = "font-types" +version = "0.12.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835ae9d781464a79026cde387f9cbc650c9a4909d7cf7e658b127e3c35d2f35d" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "fontdb" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2660c5e9157bf76d2db1294e4a9feba604ef610819a3b591088d0d8392a3290f" +dependencies = [ + "log", + "slotmap", + "tinyvec", +] + +[[package]] +name = "fontique" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6688bc1294fe7117d788937b6c53480169b29c566954af490830d4c09da9516a" +dependencies = [ + "hashbrown 0.17.1", + "linebender_resource_handle", + "memmap2", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-core-text", + "objc2-foundation 0.3.2", + "parlance", + "read-fonts", + "roxmltree", + "smallvec", + "windows", + "windows-core", + "yeslogic-fontconfig-sys", +] + +[[package]] +name = "foreign-types" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" +dependencies = [ + "foreign-types-macros", + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-macros" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea5190182e6915eb873ddbc16e23b711b6eb1f9c00a0d0a3a91b5f6228475225" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "foreign-types-shared" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "futures" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a31d2a3fbaaeb2af2368bbdd904aa8e812d3c04a1ee10d3171f52d556e5d0a3" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +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-lite" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "parking", + "pin-project-lite", +] + +[[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.9", +] + +[[package]] +name = "futures-sink" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d" + +[[package]] +name = "futures-task" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" + +[[package]] +name = "futures-util" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "slab", +] + +[[package]] +name = "gbm" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce852e998d3ca5e4a97014fb31c940dc5ef344ec7d364984525fd11e8a547e6a" +dependencies = [ + "bitflags 2.13.2", + "drm", + "drm-fourcc", + "gbm-sys", + "libc", +] + +[[package]] +name = "gbm-sys" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c13a5f2acc785d8fb6bf6b7ab6bfb0ef5dad4f4d97e8e70bb8e470722312f76f" +dependencies = [ + "libc", +] + +[[package]] +name = "gethostname" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8" +dependencies = [ + "rustix 1.1.5", + "windows-link", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi 5.3.0", + "wasip2", +] + +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", +] + +[[package]] +name = "gif" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee8cfcc411d9adbbaba82fb72661cc1bcca13e8bba98b364e62b2dba8f960159" +dependencies = [ + "color_quant", + "weezl", +] + +[[package]] +name = "gl_generator" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d" +dependencies = [ + "khronos_api", + "log", + "xml-rs", +] + +[[package]] +name = "glob" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b" + +[[package]] +name = "glow" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5e5ea60d70410161c8bf5da3fdfeaa1c72ed2c15f8bbb9d19fe3a4fad085f08" +dependencies = [ + "js-sys", + "slotmap", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "glow" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "263218b0ba2b0715c3370fb04674f5f8aa331594b521c94ff0a8e4a8472d1386" +dependencies = [ + "js-sys", + "slotmap", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "glutin" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12124de845cacfebedff80e877bb37b5b75c34c5a4c89e47e1cdd67fb6041325" +dependencies = [ + "bitflags 2.13.2", + "cfg_aliases", + "cgl", + "dispatch2", + "glutin_egl_sys", + "glutin_glx_sys", + "glutin_wgl_sys", + "libloading", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "once_cell", + "raw-window-handle", + "wayland-sys", + "windows-sys 0.52.0", + "x11-dl", +] + +[[package]] +name = "glutin-winit" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85edca7075f8fc728f28cb8fbb111a96c3b89e930574369e3e9c27eb75d3788f" +dependencies = [ + "cfg_aliases", + "glutin", + "raw-window-handle", + "winit", +] + +[[package]] +name = "glutin_egl_sys" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c4680ba6195f424febdc3ba46e7a42a0e58743f2edb115297b86d7f8ecc02d2" +dependencies = [ + "gl_generator", + "windows-sys 0.52.0", +] + +[[package]] +name = "glutin_glx_sys" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7bb2938045a88b612499fbcba375a77198e01306f52272e692f8c1f3751185" +dependencies = [ + "gl_generator", + "x11-dl", +] + +[[package]] +name = "glutin_wgl_sys" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c4ee00b289aba7a9e5306d57c2d05499b2e5dc427f84ac708bd2c090212cf3e" +dependencies = [ + "gl_generator", +] + +[[package]] +name = "gpu-allocator" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51255ea7cfaadb6c5f1528d43e92a82acb2b96c43365989a28b2d44ee38f8795" +dependencies = [ + "ash", + "hashbrown 0.16.1", + "log", + "presser", + "thiserror 2.0.21", + "windows", +] + +[[package]] +name = "grid" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b40ca9252762c466af32d0b1002e91e4e1bc5398f77455e55474deb466355ff5" + +[[package]] +name = "half" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" +dependencies = [ + "cfg-if", + "crunchy", + "num-traits", + "zerocopy", +] + +[[package]] +name = "harfrust" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c03d949a14aa089bbb282f7dd76a498a7f684428e4257202efc119ec010376f9" +dependencies = [ + "bitflags 2.13.2", + "bytemuck", + "read-fonts", + "smallvec", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash 0.1.5", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash 0.2.0", +] + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" +dependencies = [ + "foldhash 0.2.0", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + +[[package]] +name = "hermit-abi" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e17592d60ebacc7d5e169f4663c5f84f9161cc90328abcfe8456f41e4dfcb284" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "htmlparser" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48ce8546b993eaf241d69ded33b1be6d205dd9857ec879d9d18bd05d3676e144" + +[[package]] +name = "i-slint-backend-linuxkms" +version = "1.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f519a8611a4982921e46e391015e5e40ceac5cc63813333ef91ada77df180d8" +dependencies = [ + "calloop 0.14.5", + "cfg_aliases", + "drm", + "gbm", + "glutin", + "i-slint-common", + "i-slint-core", + "i-slint-renderer-femtovg", + "input", + "libseat", + "nix 0.31.3", + "raw-window-handle", + "xkbcommon", +] + +[[package]] +name = "i-slint-backend-selector" +version = "1.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb974705d61ba56034f6129ff61f3e6282a2c0c07752f25e6cb417d81c0f0958" +dependencies = [ + "cfg-if", + "cfg_aliases", + "i-slint-backend-linuxkms", + "i-slint-backend-winit", + "i-slint-common", + "i-slint-core", + "i-slint-core-macros", + "i-slint-renderer-femtovg", +] + +[[package]] +name = "i-slint-backend-winit" +version = "1.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dae4fcf1b19e9cb109984d2af87d2b9485388c619265bff71dd523133888bee2" +dependencies = [ + "arboard", + "block2 0.6.2", + "cfg-if", + "cfg_aliases", + "futures", + "glutin", + "glutin-winit", + "i-slint-common", + "i-slint-core", + "i-slint-core-macros", + "i-slint-renderer-femtovg", + "i-slint-renderer-skia", + "lyon_path", + "muda", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-foundation 0.3.2", + "objc2-quartz-core 0.3.2", + "objc2-ui-kit 0.3.2", + "pin-weak", + "raw-window-handle", + "scoped-tls-hkt", + "scopeguard", + "softbuffer", + "strum 0.28.0", + "vtable", + "wasm-bindgen", + "web-sys", + "webbrowser", + "windows", + "winit", + "zbus", +] + +[[package]] +name = "i-slint-common" +version = "1.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68a578f3e4b681b2b9cbd326d3be19716e2fac51d00a8a5b00c0ef4ae923b5e6" +dependencies = [ + "derive_more", + "fontique", + "htmlparser", + "icu_decimal", + "icu_locale_core", + "icu_provider", + "pulldown-cmark", + "resvg", + "skrifa", +] + +[[package]] +name = "i-slint-compiler" +version = "1.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55d48ebef05e2bf09ba5a1fc67bcb11033b9e12a2a50ed3105c7d25e2b539d0" +dependencies = [ + "annotate-snippets", + "by_address", + "data-url", + "derive_more", + "i-slint-common", + "icu_normalizer", + "icu_properties", + "image", + "indexmap", + "itertools 0.15.0", + "lyon_extra", + "lyon_path", + "num_enum", + "proc-macro2", + "quote", + "rayon", + "resvg", + "rowan", + "rspolib", + "skrifa", + "smol_str 0.3.7", + "strum 0.28.0", + "swash", + "typed-index-collections", + "unicode-segmentation", + "url", +] + +[[package]] +name = "i-slint-core" +version = "1.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2ea15059d70bc31b1a8b1eb4c34f2c5df04cb7e53f36179b43c0261231d646" +dependencies = [ + "bitflags 2.13.2", + "cfg-if", + "chrono", + "clru", + "const-field-offset", + "derive_more", + "euclid", + "i-slint-common", + "i-slint-core-macros", + "icu_normalizer", + "image", + "js-sys", + "lyon_algorithms", + "lyon_extra", + "lyon_geom", + "lyon_path", + "num-traits", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-foundation 0.3.2", + "once_cell", + "parley", + "pin-project", + "pin-weak", + "portable-atomic", + "raw-window-handle", + "resvg", + "rgb", + "scopeguard", + "skrifa", + "slab", + "strum 0.28.0", + "swash", + "sys-locale", + "taffy", + "unicode-linebreak", + "unicode-script", + "unicode-segmentation", + "vtable", + "wasm-bindgen", + "web-sys", + "web-time", + "wgpu", + "windows", +] + +[[package]] +name = "i-slint-core-macros" +version = "1.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73f5a8a076de52f53be80caa826599ed2107b54c9d4a421e66dc06cf893a984c" +dependencies = [ + "quote", + "serde_json", + "syn 3.0.9", +] + +[[package]] +name = "i-slint-renderer-femtovg" +version = "1.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb0de504d57cdadf80c2abf7bcb8b7135a3716aee1f41b6ebb90ea93e3649d7c" +dependencies = [ + "cfg-if", + "const-field-offset", + "femtovg", + "glow 0.18.0", + "i-slint-common", + "i-slint-core", + "i-slint-core-macros", + "imgref", + "lyon_path", + "pin-weak", + "rgb", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "i-slint-renderer-skia" +version = "1.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc9c1cf02385f1d26fc1f423544e52390a8e5c2d89420a8042aa94b4fe109d1f" +dependencies = [ + "bytemuck", + "cfg-if", + "cfg_aliases", + "clru", + "const-field-offset", + "glow 0.18.0", + "glutin", + "i-slint-common", + "i-slint-core", + "i-slint-core-macros", + "lyon_path", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "objc2-metal 0.3.2", + "objc2-quartz-core 0.3.2", + "pin-weak", + "raw-window-handle", + "read-fonts", + "scoped-tls-hkt", + "skia-safe", + "softbuffer", + "spin_on", + "unicode-segmentation", + "vtable", + "wgpu", + "wgpu-hal", + "windows", + "windows-core", + "write-fonts", +] + +[[package]] +name = "i-slint-renderer-software" +version = "1.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f8c641e138a2cc96537cac4481f5c7c8bb8dcc66d09acaed269329c8738628a" +dependencies = [ + "bytemuck", + "clru", + "derive_more", + "euclid", + "i-slint-common", + "i-slint-core", + "lyon_path", + "num-traits", + "skrifa", + "swash", + "zeno", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe090a42a0d3140fed8c63263ed1fecc02422cb2f4bfe55cd8de2de1b8e105dd" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_decimal" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1150ad5e272740670464934ee76facda43ef2e11f85c27b7ba76ccb33edf2d05" +dependencies = [ + "displaydoc", + "fixed_decimal", + "icu_decimal_data", + "icu_locale_core", + "icu_locale_fallback", + "icu_plurals", + "icu_provider", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_decimal_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5595ab78370d48abd24a062f3db115d5108dd0b65634352036cae532aebb0df8" + +[[package]] +name = "icu_locale_core" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25d29b57c17c6528d0dc4c2141cfa2d08200465acb537a3909c8b9b8a4a984c0" +dependencies = [ + "displaydoc", + "litemap", + "serde", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locale_fallback" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "406e9ae5b95d8aa37db6293405931b766a6172d1848daee22d70eb44aa78a43c" +dependencies = [ + "icu_locale_core", + "icu_locale_fallback_data", + "icu_provider", + "potential_utf", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locale_fallback_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3632ebbd0c5c3637ba1a40bdf8288f2cb9d2268e73441a69d5fc73d7cfbaa87c" + +[[package]] +name = "icu_normalizer" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "404a3b8c486f205c87fe7f23ab6894d84a4ad76d6e4671ae1981ba7def87c599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20f0088bfb7441f7a37fa0c9e20cb1e9cba1cac6b9ce8cd2a6dc44294f8e8cbc" + +[[package]] +name = "icu_plurals" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ef046647b445acf95ce0f8083fa292467d3df649959fa9a20f3f8abfd957c5d" +dependencies = [ + "fixed_decimal", + "icu_locale_fallback", + "icu_plurals_data", + "icu_provider", + "zerovec", +] + +[[package]] +name = "icu_plurals_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d43ff7df2c1a1d41588a6ddcba354d513d4a3e10eec22c06fe56d13c12a848ea" + +[[package]] +name = "icu_properties" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ea83d991c56158f7cf898bf86436c1dfe7c07ee82fe88951f2695c9f37a379f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98f29af82d02b163fe50161388350e743bb3107cc8e8c2f7314cb505faddfcf" + +[[package]] +name = "icu_provider" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413099315636c588ee8f011190b329b971a09a8fae9d157e01dcae8379468514" +dependencies = [ + "displaydoc", + "icu_locale_core", + "serde", + "stable_deref_trait", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_segmenter" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61b195dc605f81aa181bec9b3bd14e26cc71b903e4644f6af578ca9772c7a710" +dependencies = [ + "icu_collections", + "icu_locale_fallback", + "icu_provider", + "icu_segmenter_data", + "potential_utf", + "smallvec", + "utf8_iter", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_segmenter_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "913a7d294ad056474749152107309fdee3ec17d2482d1ab70fdc61a81c64b9a3" + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "image" +version = "0.25.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85ab80394333c02fe689eaf900ab500fbd0c2213da414687ebf995a65d5a6104" +dependencies = [ + "bytemuck", + "byteorder-lite", + "moxcms", + "num-traits", + "png", + "zune-core", + "zune-jpeg", +] + +[[package]] +name = "image-webp" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "525e9ff3e1a4be2fbea1fdf0e98686a6d98b4d8f937e1bf7402245af1909e8c3" +dependencies = [ + "byteorder-lite", + "quick-error", +] + +[[package]] +name = "imagesize" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65b27460c2c92b037f3f94c538ed9a3342f3fdf923606781629ccb35f82d042a" + +[[package]] +name = "imgref" +version = "1.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e44b0a4eaa4c82f441d50a963f2d5f05a787240aeee097597033e72accfd22f" + +[[package]] +name = "indexmap" +version = "2.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" +dependencies = [ + "equivalent", + "hashbrown 0.17.1", +] + +[[package]] +name = "input" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9793345a65d71317763a33066b5d8351f8760dde8d4930fe9e39b5f14a7959d" +dependencies = [ + "bitflags 2.13.2", + "input-sys", + "libc", + "log", + "udev", +] + +[[package]] +name = "input-sys" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36eee07d8e02bd95bf52b2e642cf13d33701b94c6e4b04fbf1d1fb07e9cb19e7" + +[[package]] +name = "io-lifetimes" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" +dependencies = [ + "hermit-abi 0.3.9", + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b4baf93f58d4425749ca49a51c50ebab072c5df6994d08fed93541c331481dc" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "jiff" +version = "0.2.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2b005715dcbeb0089a3c0dab99f2ff1cc3b2525323552703d648585d342a383" +dependencies = [ + "defmt", + "jiff-core", + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", +] + +[[package]] +name = "jiff-core" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e52fe76043ccecc9005d2305ebaadf7d7fc0cc89ca6baa10a94d6bc68c7128c" +dependencies = [ + "defmt", + "log", +] + +[[package]] +name = "jiff-static" +version = "0.2.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2cc9817253cf7c7ee4684451bd327e88d6f3658014e54a29198625590650695c" +dependencies = [ + "jiff-core", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "jni" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498" +dependencies = [ + "cfg-if", + "combine", + "jni-macros", + "jni-sys 0.4.1", + "log", + "simd_cesu8", + "thiserror 2.0.21", + "walkdir", + "windows-link", +] + +[[package]] +name = "jni-macros" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "simd_cesu8", + "syn 2.0.119", +] + +[[package]] +name = "jni-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258" +dependencies = [ + "jni-sys 0.4.1", +] + +[[package]] +name = "jni-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2" +dependencies = [ + "jni-sys-macros", +] + +[[package]] +name = "jni-sys-macros" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" +dependencies = [ + "quote", + "syn 2.0.119", +] + +[[package]] +name = "jobserver" +version = "0.1.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3" +dependencies = [ + "getrandom 0.4.3", + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7883d941dae510fb2d978fc3fe018c71c9e2892fd38854de3e8b92c2e5ad9cc5" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + +[[package]] +name = "keyboard-types" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b750dcadc39a09dbadd74e118f6dd6598df77fa01df0cfcdc52c28dece74528a" +dependencies = [ + "bitflags 2.13.2", + "serde", + "unicode-segmentation", +] + +[[package]] +name = "khronos_api" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" + +[[package]] +name = "kurbo" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b60dfc32f652b926df6192e55525b16d186c69d47876c3ead4da5cc9f8450e2" +dependencies = [ + "arrayvec", + "euclid", + "polycool", + "smallvec", +] + +[[package]] +name = "lazy_static" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb" + +[[package]] +name = "libc" +version = "0.2.191" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" + +[[package]] +name = "libdbus-sys" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "328c4789d42200f1eeec05bd86c9c13c7f091d2ba9a6ea35acdf51f31bc0f043" +dependencies = [ + "pkg-config", +] + +[[package]] +name = "libloading" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" +dependencies = [ + "cfg-if", + "windows-link", +] + +[[package]] +name = "libm" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" + +[[package]] +name = "libredox" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61ff90caf6077a803a240f62fdbe88645a890bbca49ef8174c3cb0404362171d" +dependencies = [ + "bitflags 2.13.2", + "libc", + "plain", + "redox_syscall 0.9.5", +] + +[[package]] +name = "libseat" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6656c69b6e0366ffb83faa232f3e4fda5fc91161722d140f2c95ce2e90b1ef31" +dependencies = [ + "errno", + "libseat-sys", + "log", +] + +[[package]] +name = "libseat-sys" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8a484fa48be5f62a8d3ffed767779d0ab808cfead91de98ef4362d469097dfb" +dependencies = [ + "pkg-config", +] + +[[package]] +name = "libudev-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c8469b4a23b962c1396b9b451dda50ef5b283e8dd309d69033475fa9b334324" +dependencies = [ + "libc", + "pkg-config", +] + +[[package]] +name = "linebender_resource_handle" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" + +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + +[[package]] +name = "linux-raw-sys" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" + +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + +[[package]] +name = "litemap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" + +[[package]] +name = "litrs" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4744e383959f0db86ede514b809b1c53251889093803c05267acc7d4e7030d70" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" + +[[package]] +name = "lyon_algorithms" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3a6b9d4e8b48acd531fbf1241ad9b270df6e60b6b92bdea1469f4f40899d805" +dependencies = [ + "lyon_path", + "num-traits", +] + +[[package]] +name = "lyon_extra" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7755f08423275157ad1680aaecc9ccb7e0cc633da3240fea2d1522935cc15c72" +dependencies = [ + "lyon_path", + "thiserror 2.0.21", +] + +[[package]] +name = "lyon_geom" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d82dd26aa4dc0b5b70b9115de59824842bcb43cf4a28e1b1e6d0ad148c93f93e" +dependencies = [ + "arrayvec", + "euclid", + "num-traits", +] + +[[package]] +name = "lyon_path" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c463f9c428b7fc5ec885dcd39ce4aa61e29111d0e33483f6f98c74e89d8621e" +dependencies = [ + "lyon_geom", + "num-traits", +] + +[[package]] +name = "macaddr" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baee0bbc17ce759db233beb01648088061bf678383130602a298e6998eedb2d8" + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "memmap2" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b0ca1155a9ecc25aa12e8313a119f32edf0255fea2f44839c4ac0a12b2ac157" +dependencies = [ + "libc", +] + +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "minimal-lexical" +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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1788edb87fdc09c7e26304471e2f5be8cdefb1b6930d6e3985fc02ff53bf86ee" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "moxcms" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb85c154ba489f01b25c0d36ae69a87e4a1c73a72631fc6c0eb6dde34a73e44b" +dependencies = [ + "num-traits", + "pxfm", +] + +[[package]] +name = "muda" +version = "0.19.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dd04e60bc0b07438a6771710ee1698f98f6ebbc7f89b61264af1563b8aeb878" +dependencies = [ + "crossbeam-channel", + "dpi", + "keyboard-types", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "once_cell", + "png", + "thiserror 2.0.21", + "windows-sys 0.61.2", +] + +[[package]] +name = "naga" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a616d2fb8c89516ac2723a581f69d6c18576046bed761bd6b305e5618e6ae130" +dependencies = [ + "arrayvec", + "bit-set", + "bitflags 2.13.2", + "cfg-if", + "cfg_aliases", + "codespan-reporting", + "half", + "hashbrown 0.17.1", + "indexmap", + "libm", + "log", + "naga-types", + "num-traits", + "once_cell", + "rustc-hash 1.1.0", + "spirv", + "thiserror 2.0.21", + "unicode-ident", +] + +[[package]] +name = "naga-types" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "590afbf58a6f4f62873cd5cff4468061844bafa1cdf399cc954537c22d768d49" +dependencies = [ + "hashbrown 0.17.1", + "indexmap", + "rustc-hash 1.1.0", + "thiserror 2.0.21", +] + +[[package]] +name = "natord" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "308d96db8debc727c3fd9744aac51751243420e46edf401010908da7f8d5e57c" + +[[package]] +name = "ndk" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" +dependencies = [ + "bitflags 2.13.2", + "jni-sys 0.3.1", + "log", + "ndk-sys", + "num_enum", + "raw-window-handle", + "thiserror 1.0.69", +] + +[[package]] +name = "ndk-context" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" + +[[package]] +name = "ndk-sys" +version = "0.6.0+11769913" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873" +dependencies = [ + "jni-sys 0.3.1", +] + +[[package]] +name = "nix" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" +dependencies = [ + "bitflags 2.13.2", + "cfg-if", + "cfg_aliases", + "libc", +] + +[[package]] +name = "nix" +version = "0.31.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d" +dependencies = [ + "bitflags 2.13.2", + "cfg-if", + "cfg_aliases", + "libc", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "nom" +version = "8.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405" +dependencies = [ + "memchr", +] + +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "num_enum" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26" +dependencies = [ + "num_enum_derive", + "rustversion", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "objc-sys" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310" + +[[package]] +name = "objc2" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d5490aaf8f1d7cf7688dfa9b0ce07900e168852c45cd2c03f534dfd27cfd0b" +dependencies = [ + "objc-sys", + "objc2-encode", +] + +[[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.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "libc", + "objc2 0.5.3", + "objc2-core-data", + "objc2-core-image", + "objc2-foundation 0.2.2", + "objc2-quartz-core 0.2.2", +] + +[[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", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", + "objc2-quartz-core 0.3.2", +] + +[[package]] +name = "objc2-cloud-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.3", + "objc2-core-location", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-contacts" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-core-data" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-core-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +dependencies = [ + "bitflags 2.13.2", + "dispatch2", + "objc2 0.6.5", +] + +[[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 0.6.5", + "objc2-core-foundation", + "objc2-io-surface", +] + +[[package]] +name = "objc2-core-image" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", + "objc2-metal 0.2.2", +] + +[[package]] +name = "objc2-core-location" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.3", + "objc2-contacts", + "objc2-foundation 0.2.2", +] + +[[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-core-foundation", +] + +[[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.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "dispatch", + "libc", + "objc2 0.5.3", +] + +[[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 0.6.2", + "objc2 0.6.5", + "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 0.6.5", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-link-presentation" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.3", + "objc2-app-kit 0.2.2", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-metal" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-metal" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0125f776a10d00af4152d74616409f0d4a2053a6f57fa5b7d6aa2854ac04794" +dependencies = [ + "bitflags 2.13.2", + "block2 0.6.2", + "objc2 0.6.5", + "objc2-foundation 0.3.2", +] + +[[package]] +name = "objc2-quartz-core" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", + "objc2-metal 0.2.2", +] + +[[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 0.6.5", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", + "objc2-metal 0.3.2", +] + +[[package]] +name = "objc2-symbols" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a684efe3dec1b305badae1a28f6555f6ddd3bb2c2267896782858d5a78404dc" +dependencies = [ + "objc2 0.5.3", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-ui-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.3", + "objc2-cloud-kit", + "objc2-core-data", + "objc2-core-image", + "objc2-core-location", + "objc2-foundation 0.2.2", + "objc2-link-presentation", + "objc2-quartz-core 0.2.2", + "objc2-symbols", + "objc2-uniform-type-identifiers", + "objc2-user-notifications", +] + +[[package]] +name = "objc2-ui-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d87d638e33c06f577498cbcc50491496a3ed4246998a7fbba7ccb98b1e7eab22" +dependencies = [ + "bitflags 2.13.2", + "block2 0.6.2", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "objc2-quartz-core 0.3.2", +] + +[[package]] +name = "objc2-uniform-type-identifiers" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-user-notifications" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.3", + "objc2-core-location", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" +dependencies = [ + "critical-section", + "portable-atomic", +] + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "orbclient" +version = "0.3.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5df339f526ea9a60e371768d50efc2f2508c7203290731565d1f7a6f71d21747" +dependencies = [ + "libc", + "libredox", +] + +[[package]] +name = "ordered-float" +version = "5.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c7c9e0d9b23589f26070720bac724174bfec1083e82f7854cdd0267518343c0" +dependencies = [ + "num-traits", +] + +[[package]] +name = "ordered-stream" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50" +dependencies = [ + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "os_pipe" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "owned_ttf_parser" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36820e9051aca1014ddc75770aab4d68bc1e9e632f0f5627c4086bc216fb583b" +dependencies = [ + "ttf-parser", +] + +[[package]] +name = "parking" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.5.18", + "smallvec", + "windows-link", +] + +[[package]] +name = "parlance" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73072a9470554c8e794778acece2312661218aaabb635600957d952cf01c716e" + +[[package]] +name = "parley" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22d2ff88bd3f7d68d1d9b09c7e6209f9a8e8c05088295140a2bcf2e9b17038c5" +dependencies = [ + "fontique", + "harfrust", + "hashbrown 0.17.1", + "icu_normalizer", + "icu_properties", + "icu_segmenter", + "linebender_resource_handle", + "parlance", + "parley_data", + "skrifa", +] + +[[package]] +name = "parley_data" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1567535334d6ba2d3cde19221ba9a7bd0fabb3cbd99046ddfb10ae061cfcc889" +dependencies = [ + "icu_properties", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "petgraph" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455" +dependencies = [ + "fixedbitset", + "hashbrown 0.15.5", + "indexmap", +] + +[[package]] +name = "pico-args" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315" + +[[package]] +name = "pin-project" +version = "1.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2466b2336ed02bcdca6b294417127b90ec92038d1d5c4fbeac971a922e0e0924" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c96395f0a926bc13b1c17622aaddda1ecb55d49c8f1bf9777e4d877800a43f8b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "pin-utils" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13bee6c73da26345c729282832b60b0363cf3dd9f4bfd81d8551b7a1c889a113" + +[[package]] +name = "pin-weak" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b330c9d1b92dfe68442ca20b009c717d5f0b1e3cf4965e62f704c3c6e95a1305" + +[[package]] +name = "piper" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c835479a4443ded371d6c535cbfd8d31ad92c5d23ae9770a61bc155e4992a3c1" +dependencies = [ + "atomic-waker", + "fastrand", + "futures-io", +] + +[[package]] +name = "pkg-config" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548" + +[[package]] +name = "plain" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" + +[[package]] +name = "png" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61" +dependencies = [ + "bitflags 2.13.2", + "crc32fast", + "fdeflate", + "flate2", + "miniz_oxide 0.8.9", +] + +[[package]] +name = "polling" +version = "3.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218" +dependencies = [ + "cfg-if", + "concurrent-queue", + "hermit-abi 0.5.3", + "pin-project-lite", + "rustix 1.1.5", + "windows-sys 0.61.2", +] + +[[package]] +name = "polycool" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50596ddc09eb5ad5f75cacd40209568e66df71baf86e1499a0e99c4cff12a5a6" +dependencies = [ + "arrayvec", +] + +[[package]] +name = "portable-atomic" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85" +dependencies = [ + "critical-section", +] + +[[package]] +name = "portable-atomic-util" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "potential_utf" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" +dependencies = [ + "serde_core", + "writeable", + "zerovec", +] + +[[package]] +name = "presser" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa" + +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn 2.0.119", +] + +[[package]] +name = "proc-macro-crate" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" +dependencies = [ + "toml_edit", +] + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "profiling" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d595e54a326bc53c1c197b32d295e14b169e3cfeaa8dc82b529f947fba6bcf5" + +[[package]] +name = "pulldown-cmark" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "278e9268c93b9e498a2da46c34d90ba93a3255eb99009646398f34bc73ab36eb" +dependencies = [ + "bitflags 2.13.2", + "memchr", + "unicase", +] + +[[package]] +name = "pxfm" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d55d956fa96f5ec02be2e13af0e20391a5aa83d6a074e3ad368959d0fab299ea" + +[[package]] +name = "quick-error" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" + +[[package]] +name = "quick-xml" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e660451e55124f798a69a5af3f49ccfbefbd41910eefd25caf2393e1f3473ec1" +dependencies = [ + "memchr", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "range-alloc" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca45419789ae5a7899559e9512e58ca889e41f04f1f2445e9f4b290ceccd1d08" + +[[package]] +name = "raw-window-handle" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" + +[[package]] +name = "raw-window-metal" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40d213455a5f1dc59214213c7330e074ddf8114c9a42411eb890c767357ce135" +dependencies = [ + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "objc2-quartz-core 0.3.2", +] + +[[package]] +name = "rayon" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "read-fonts" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046a7d674daf459825b32f5062056d6882db0d2f5a479fbd76ccfc870ac18709" +dependencies = [ + "bytemuck", + "font-types", + "once_cell", +] + +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "redox_syscall" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "580c875845b41ecb1564ad1ae4703044cef774145e3d7a94dc2b3fa7c97868fd" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "regex" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" + +[[package]] +name = "renderdoc-sys" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832" + +[[package]] +name = "resvg" +version = "0.48.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67e3803f97b999e80cbf7c6ecdd07a8102204d92e1633cf48783720c521196bd" +dependencies = [ + "bytemuck", + "gif", + "image-webp", + "log", + "pico-args", + "rgb", + "svgtypes", + "tiny-skia 0.12.0", + "usvg", + "zune-jpeg", +] + +[[package]] +name = "rgb" +version = "0.8.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b34b781b31e5d73e9fbc8689c70551fd1ade9a19e3e28cfec8580a79290cc4" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "rowan" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14b574c58582fa59fa43a2feb6608b8744184659f08a2e0117e4b8224d95ed61" +dependencies = [ + "countme", + "hashbrown 0.14.5", + "memoffset", + "rustc-hash 1.1.0", + "text-size", +] + +[[package]] +name = "roxmltree" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1964b10c76125c36f8afe190065a4bf9a87bf324842c05701330bba9f1cacbb" +dependencies = [ + "memchr", +] + +[[package]] +name = "rspolib" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fda9a7796aff63a7b1b39ccc93fffaaf65e20042984b4843041a49ca4677535" +dependencies = [ + "lazy_static", + "natord", + "snafu", + "unicode-linebreak", + "unicode-width", +] + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc-hash" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags 2.13.2", + "errno", + "libc", + "linux-raw-sys 0.4.15", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustix" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891efababe418670775f199f0d233d84843c227a0949a883ce15b37c78d6629d" +dependencies = [ + "bitflags 2.13.2", + "errno", + "libc", + "linux-raw-sys 0.12.1", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustversion" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + +[[package]] +name = "scoped-tls-hkt" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9603871ffe5df3ac39cb624790c296dbd47a400d202f56bf3e414045099524d" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "sctk-adwaita" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6277f0217056f77f1d8f49f2950ac6c278c0d607c45f5ee99328d792ede24ec" +dependencies = [ + "ab_glyph", + "log", + "memmap2", + "smithay-client-toolkit", + "tiny-skia 0.11.4", +] + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "serde_json" +version = "1.0.154" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_repr" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d3b1629de253c70a0508c3899572da79ca359fdab27c7920ff00406df418906" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "serde_spanned" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7523beb55eece201a2356bee0bbca0d1ab466c14c07703b2e0ee6d42cb0c2c" +dependencies = [ + "serde_core", +] + +[[package]] +name = "sf-ipc" +version = "0.1.0" +dependencies = [ + "anyhow", + "log", + "serde", + "serde_json", + "toml 0.9.12+spec-1.1.0", +] + +[[package]] +name = "sf-launcher" +version = "0.1.0" +dependencies = [ + "anyhow", + "chrono", + "env_logger", + "glow 0.16.0", + "log", + "png", + "serde_json", + "sf-ipc", + "slint", + "slint-build", + "windows-sys 0.61.2", +] + +[[package]] +name = "sf-remote" +version = "0.1.0" +dependencies = [ + "anyhow", + "bluer", + "env_logger", + "evdev", + "futures", + "libc", + "log", + "tokio", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "simd-adler32" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea" + +[[package]] +name = "simd_cesu8" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11031e251abf8611c80f460e19dbdeb54a66db918e49c65a7065b46ac7aec520" +dependencies = [ + "rustc_version", + "simdutf8", +] + +[[package]] +name = "simdutf8" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" + +[[package]] +name = "simplecss" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a9c6883ca9c3c7c90e888de77b7a5c849c779d25d74a1269b0218b14e8b136c" +dependencies = [ + "log", +] + +[[package]] +name = "siphasher" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33f4fe9184a62d842c9ef383018f3306d8ba224fd9d836f56d7288308847c256" + +[[package]] +name = "skia-bindings" +version = "0.153.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb325787c91b3f6c34a7c6f2b8a2297b20292d733ca53a08c233e5028aec49af" +dependencies = [ + "bindgen", + "cc", + "flate2", + "heck", + "pkg-config", + "regex", + "serde_json", + "tar", + "toml 1.1.8+spec-1.1.0", +] + +[[package]] +name = "skia-safe" +version = "0.153.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61cb643dac43067f3eb76c866635a74377ac0abca0ff2590674e1e295514c3d" +dependencies = [ + "bitflags 2.13.2", + "skia-bindings", + "windows", +] + +[[package]] +name = "skrifa" +version = "0.44.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819ab7d62b1d3e72d9d9dea5650bac30424f9111364bb94928dbf5ecad1baa68" +dependencies = [ + "bytemuck", + "read-fonts", +] + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "slint" +version = "1.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15e477d5ff6fec20909100ff8f7062432ebfbda7a62a0f37d0252aa126f38c83" +dependencies = [ + "const-field-offset", + "i-slint-backend-linuxkms", + "i-slint-backend-selector", + "i-slint-common", + "i-slint-core", + "i-slint-core-macros", + "i-slint-renderer-femtovg", + "i-slint-renderer-software", + "num-traits", + "once_cell", + "pin-weak", + "slint-macros", + "unicode-segmentation", + "vtable", +] + +[[package]] +name = "slint-build" +version = "1.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ea28d4e1ad47d829b91e227f17037fac07a8001668a93fee47ac04f88718ebc" +dependencies = [ + "derive_more", + "fontique", + "i-slint-compiler", + "spin_on", + "toml_edit", +] + +[[package]] +name = "slint-macros" +version = "1.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35e74b13d20884dc480ce37d0fabbf02cb4bc0df2a595434feac96ca7c2a0f15" +dependencies = [ + "i-slint-compiler", + "proc-macro2", + "quote", + "spin_on", +] + +[[package]] +name = "slotmap" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdd58c3c93c3d278ca835519292445cb4b0d4dc59ccfdf7ceadaab3f8aeb4038" +dependencies = [ + "version_check", +] + +[[package]] +name = "smallvec" +version = "1.16.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b3dc8af474f516a851ff4bd12db780f948b9250ad37211e4eec0bccea54e01b" + +[[package]] +name = "smithay-client-toolkit" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016" +dependencies = [ + "bitflags 2.13.2", + "calloop 0.13.0", + "calloop-wayland-source", + "cursor-icon", + "libc", + "log", + "memmap2", + "rustix 0.38.44", + "thiserror 1.0.69", + "wayland-backend", + "wayland-client", + "wayland-csd-frame", + "wayland-cursor", + "wayland-protocols", + "wayland-protocols-wlr", + "wayland-scanner", + "xkeysym", +] + +[[package]] +name = "smol_str" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd538fb6910ac1099850255cf94a94df6551fbdd602454387d0adb2d1ca6dead" +dependencies = [ + "serde", +] + +[[package]] +name = "smol_str" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eeb7109d23f319619d4cc0de5464613c8b7b1a09db2774a58101459cf6be2f10" +dependencies = [ + "borsh", + "serde_core", +] + +[[package]] +name = "snafu" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e84b3f4eacbf3a1ce05eac6763b4d629d60cbc94d632e4092c54ade71f1e1a2" +dependencies = [ + "snafu-derive", +] + +[[package]] +name = "snafu-derive" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1c97747dbf44bb1ca44a561ece23508e99cb592e862f22222dcf42f51d1e451" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "socket2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "softbuffer" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aac18da81ebbf05109ab275b157c22a653bb3c12cf884450179942f81bcbf6c3" +dependencies = [ + "as-raw-xcb-connection", + "bytemuck", + "fastrand", + "js-sys", + "memmap2", + "ndk", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", + "objc2-quartz-core 0.3.2", + "raw-window-handle", + "redox_syscall 0.5.18", + "rustix 1.1.5", + "tiny-xlib", + "tracing", + "wasm-bindgen", + "wayland-backend", + "wayland-client", + "wayland-sys", + "web-sys", + "windows-sys 0.61.2", + "x11rb", +] + +[[package]] +name = "spin_on" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "076e103ed41b9864aa838287efe5f4e3a7a0362dd00671ae62a212e5e4612da2" +dependencies = [ + "pin-utils", +] + +[[package]] +name = "spirv" +version = "0.4.0+sdk-1.4.341.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9571ea910ebd84c86af4b3ed27f9dbdc6ad06f17c5f96146b2b671e2976744f" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "strict-num" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731" +dependencies = [ + "float-cmp", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "strum" +version = "0.26.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" +dependencies = [ + "strum_macros 0.26.4", +] + +[[package]] +name = "strum" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9628de9b8791db39ceda2b119bbe13134770b56c138ec1d3af810d045c04f9bd" +dependencies = [ + "strum_macros 0.28.0", +] + +[[package]] +name = "strum_macros" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.119", +] + +[[package]] +name = "strum_macros" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab85eea0270ee17587ed4156089e10b9e6880ee688791d45a905f5b1ca36f664" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "svgtypes" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "695b5790b3131dafa99b3bbfd25a216edb3d216dad9ca208d4657bfb8f2abc3d" +dependencies = [ + "kurbo", + "siphasher", +] + +[[package]] +name = "swash" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c2499c2d826531388872b2268718aed907a39bd785ab0dcfe57fab26283f92e" +dependencies = [ + "skrifa", + "yazi", + "zeno", +] + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "synstructure" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "sys-locale" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eab9a99a024a169fe8a903cf9d4a3b3601109bcc13bd9e3c6fff259138626c4" +dependencies = [ + "js-sys", + "libc", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "taffy" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aea22054047c16c3f34d3ac473a2170be1424b1115b2a3adcf28cfb067c88859" +dependencies = [ + "arrayvec", + "grid", + "serde", + "slotmap", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "tar" +version = "0.4.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f6221d9a6003c78398e3b239969f352578258df48c8eb051caadae0015bc840" +dependencies = [ + "filetime", + "libc", + "xattr", +] + +[[package]] +name = "tempfile" +version = "3.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" +dependencies = [ + "fastrand", + "getrandom 0.4.3", + "once_cell", + "rustix 1.1.5", + "windows-sys 0.61.2", +] + +[[package]] +name = "text-size" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f18aa187839b2bdb1ad2fa35ead8c4c2976b64e4363c386d45ac0f7ee85c9233" + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" +dependencies = [ + "thiserror-impl 2.0.21", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "tiny-skia" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83d13394d44dae3207b52a326c0c85a8bf87f1541f23b0d143811088497b09ab" +dependencies = [ + "arrayref", + "arrayvec", + "bytemuck", + "cfg-if", + "log", + "tiny-skia-path 0.11.4", +] + +[[package]] +name = "tiny-skia" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47ffee5eaaf5527f630fb0e356b90ebdec84d5d18d937c5e440350f88c5a91ea" +dependencies = [ + "arrayref", + "arrayvec", + "bytemuck", + "cfg-if", + "log", + "png", + "tiny-skia-path 0.12.0", +] + +[[package]] +name = "tiny-skia-path" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c9e7fc0c2e86a30b117d0462aa261b72b7a99b7ebd7deb3a14ceda95c5bdc93" +dependencies = [ + "arrayref", + "bytemuck", + "strict-num", +] + +[[package]] +name = "tiny-skia-path" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edca365c3faccca67d06593c5980fa6c57687de727a03131735bb85f01fdeeb9" +dependencies = [ + "arrayref", + "bytemuck", + "strict-num", +] + +[[package]] +name = "tiny-xlib" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a90a0ca3ee6a69f2ad28fd11621a4c3f03b371f366be500b64df260c4ffbafb4" +dependencies = [ + "as-raw-xcb-connection", + "ctor", + "libloading", + "pkg-config", + "tracing", +] + +[[package]] +name = "tinystr" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abc840c238154d58f9e86b2792261edfde565a17696e1cda1a449de27979801a" +dependencies = [ + "displaydoc", + "serde_core", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee" + +[[package]] +name = "tokio" +version = "1.54.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3" +dependencies = [ + "bytes", + "libc", + "mio", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-macros" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "tokio-stream" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3d06f0b082ba57c26b79407372e57cf2a1e28124f78e9479fe80322cf53420b" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml" +version = "0.9.12+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf92845e79fc2e2def6a5d828f0801e29a2f8acc037becc5ab08595c7d5e9863" +dependencies = [ + "indexmap", + "serde_core", + "serde_spanned", + "toml_datetime 0.7.5+spec-1.1.0", + "toml_parser", + "toml_writer", + "winnow 0.7.15", +] + +[[package]] +name = "toml" +version = "1.1.8+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20489e00e4d8741d6be680764cc12e270655e375a20d1011e844a9c3379e678d" +dependencies = [ + "indexmap", + "serde_core", + "serde_spanned", + "toml_datetime 1.1.2+spec-1.1.0", + "toml_parser", + "toml_writer", + "winnow 1.0.4", +] + +[[package]] +name = "toml_datetime" +version = "0.7.5+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_datetime" +version = "1.1.2+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b86d767906c6c42421dcba507eb9d203e779497710a47782a224bb871653053" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_edit" +version = "0.25.17+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3641d5bbb5349a79e1020a242d251efbc546ad8048d133958323ce9c40a9c9c" +dependencies = [ + "indexmap", + "toml_datetime 1.1.2+spec-1.1.0", + "toml_parser", + "toml_writer", + "winnow 1.0.4", +] + +[[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.4", +] + +[[package]] +name = "toml_writer" +version = "1.1.3+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06bdbd8cfc056b8d2e2e85f29b56a3bdbecb527cef81eb39e3e7b98af4652770" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "tree_magic_mini" +version = "3.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8765b90061cba6c22b5831f675da109ae5561588290f9fa2317adab2714d5a6" +dependencies = [ + "memchr", + "nom 8.0.0", + "petgraph", +] + +[[package]] +name = "ttf-parser" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31" + +[[package]] +name = "typed-index-collections" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "898160f1dfd383b4e92e17f0512a7d62f3c51c44937b23b6ffc3a1614a8eaccd" +dependencies = [ + "bincode", + "serde", +] + +[[package]] +name = "udev" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af4e37e9ea4401fc841ff54b9ddfc9be1079b1e89434c1a6a865dd68980f7e9f" +dependencies = [ + "io-lifetimes", + "libc", + "libudev-sys", + "pkg-config", +] + +[[package]] +name = "uds_windows" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e" +dependencies = [ + "memoffset", + "tempfile", + "windows-sys 0.61.2", +] + +[[package]] +name = "unicase" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357cc3acc6a036009fd6c973ed009037c732d60d0b4f6c673e9041497482a28f" + +[[package]] +name = "unicode-bidi" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" + +[[package]] +name = "unicode-ident" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" + +[[package]] +name = "unicode-linebreak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" + +[[package]] +name = "unicode-script" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "383ad40bb927465ec0ce7720e033cb4ca06912855fc35db31b5755d0de75b1ee" + +[[package]] +name = "unicode-segmentation" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" + +[[package]] +name = "unicode-vo" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1d386ff53b415b7fe27b50bb44679e2cc4660272694b7b6f3326d8480823a94" + +[[package]] +name = "unicode-width" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "unty" +version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d49784317cd0d1ee7ec5c716dd598ec5b4483ea832a2dced265471cc0f690ae" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "usvg" +version = "0.48.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "977d0a4abdef933f424a99fe09f95576e089b90aebc6f016a3bc813762493e91" +dependencies = [ + "base64", + "data-url", + "flate2", + "fontdb", + "harfrust", + "imagesize", + "kurbo", + "log", + "pico-args", + "roxmltree", + "simplecss", + "siphasher", + "skrifa", + "strict-num", + "svgtypes", + "tiny-skia-path 0.12.0", + "unicode-bidi", + "unicode-script", + "unicode-vo", + "xmlwriter", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "uuid" +version = "1.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a0e2d11620c50695fe12bbbfde96b3477fe606e7284c22d505c12ce51214514" +dependencies = [ + "getrandom 0.4.3", + "js-sys", + "serde_core", + "wasm-bindgen", +] + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "vtable" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "515a4b5b1399cc46fb0dc4081436cb40a3852a2d3e94fd1fa50bb68a334896eb" +dependencies = [ + "const-field-offset", + "portable-atomic", + "stable_deref_trait", + "vtable-macro", +] + +[[package]] +name = "vtable-macro" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8191d73ececf73fc94e65809bf0e667525a0bcff9aeeb8d042a4173a508332a1" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.4+wasi-0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb54f33acc68fd454578d9820b0bde1a1a3d17aa17bb7b6595806d02886d409" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cbab34de2d982e9b48e18d216d04c4a6f641066ff19ffb699980f591ee3610e" +dependencies = [ + "js-sys", + "tokio", + "wasm-bindgen", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e29d0c35b16e224a7eeb5cd2d25e3e1968fbd65604117b44d3b789d00ee8535" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f501a8bc3719dba86ef8ae4728879c08001bea749eb1333ac5b91e040e2a6b7" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 3.0.9", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23f0c9c52aa7cd7d77769a4cfe2a9adb1b331f489a41d912ce14513d5ab995c6" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wayland-backend" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38a91b4eaddff87b1cd1074985e3713da4af2c49742d1b356b2c01670a67a078" +dependencies = [ + "cc", + "downcast-rs", + "rustix 1.1.5", + "scoped-tls", + "smallvec", + "wayland-sys", +] + +[[package]] +name = "wayland-client" +version = "0.31.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3c36a0f861ad76d0901f2800b46321410d9f73f2ea88aac0650d86c32688073" +dependencies = [ + "bitflags 2.13.2", + "rustix 1.1.5", + "wayland-backend", + "wayland-scanner", +] + +[[package]] +name = "wayland-csd-frame" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e" +dependencies = [ + "bitflags 2.13.2", + "cursor-icon", + "wayland-backend", +] + +[[package]] +name = "wayland-cursor" +version = "0.31.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a52d18780be9b1314328a3de5f930b73d2200112e3849ca6cb11822793fb34d" +dependencies = [ + "rustix 1.1.5", + "wayland-client", + "xcursor", +] + +[[package]] +name = "wayland-protocols" +version = "0.32.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23d0c813de3daa2ed6520af85a3bd49b0e722a3078506899aa9686fea58dc4b6" +dependencies = [ + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-plasma" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b6d8cf1eb2c1c31ed1f5643c88a6e53538129d4af80030c8cabd1f9fa884d91" +dependencies = [ + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-wlr" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb04e52f7836d7c7976c78ca0250d61e33873c34156a2a1fc9474828ec268234" +dependencies = [ + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-scanner" +version = "0.31.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "338e30461b3a2b67d70eb30a6d89f8e0c93a833e07d2ae89085cd070c4a00ac0" +dependencies = [ + "proc-macro2", + "quick-xml", + "quote", +] + +[[package]] +name = "wayland-sys" +version = "0.31.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8eab23fefc9e41f8e841df4a9c707e8a8c4ed26e944ef69297184de2785e3be" +dependencies = [ + "dlib", + "log", + "once_cell", + "pkg-config", +] + +[[package]] +name = "web-sys" +version = "0.3.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88261b9deccee56594c11a3460c462c41f58d148598fe70ad77070126a68aba4" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webbrowser" +version = "1.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2c8ddfbbf66e501434657400268cefe51b95140a0266236415cda7627732df7" +dependencies = [ + "jni", + "log", + "ndk-context", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-foundation 0.3.2", + "url", + "web-sys", +] + +[[package]] +name = "weezl" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88" + +[[package]] +name = "wgpu" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527ccdf43dd5b2e8676eed9984ce00e2bbb0a1b85b70c1969dcb6cd2eb55ab9e" +dependencies = [ + "arrayvec", + "bitflags 2.13.2", + "bytemuck", + "cfg-if", + "cfg_aliases", + "document-features", + "hashbrown 0.17.1", + "log", + "portable-atomic", + "profiling", + "raw-window-handle", + "smallvec", + "static_assertions", + "wgpu-core", + "wgpu-hal", + "wgpu-types", +] + +[[package]] +name = "wgpu-core" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c018fce9b6270aa203c2fdd56f3cce996713534bd757e4ea58c8560b121f14" +dependencies = [ + "arrayvec", + "bit-set", + "bit-vec", + "bitflags 2.13.2", + "bytemuck", + "cfg_aliases", + "document-features", + "hashbrown 0.17.1", + "indexmap", + "log", + "naga", + "naga-types", + "once_cell", + "parking_lot", + "portable-atomic", + "profiling", + "raw-window-handle", + "rustc-hash 1.1.0", + "smallvec", + "thiserror 2.0.21", + "wgpu-core-deps-apple", + "wgpu-core-deps-windows-linux-android", + "wgpu-hal", + "wgpu-naga-bridge", + "wgpu-types", +] + +[[package]] +name = "wgpu-core-deps-apple" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "061f3d319a40d39d00b1ecc2c33b89fe21d4e6fe01859df3500a3a8ecccd6b68" +dependencies = [ + "wgpu-hal", +] + +[[package]] +name = "wgpu-core-deps-windows-linux-android" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7586165fd5f6d881cb9ce4bb71f40d6caab2c0f1837e3fc1d9788a197fb6004f" +dependencies = [ + "wgpu-hal", +] + +[[package]] +name = "wgpu-hal" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6b7fb58561a792bc237628ba0792e332de418fefe145f13b5ed8201e6d52f58" +dependencies = [ + "android_system_properties", + "arrayvec", + "ash", + "bit-set", + "bitflags 2.13.2", + "block2 0.6.2", + "bytemuck", + "cfg-if", + "cfg_aliases", + "gpu-allocator", + "hashbrown 0.17.1", + "libc", + "libloading", + "log", + "naga", + "naga-types", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", + "objc2-metal 0.3.2", + "objc2-quartz-core 0.3.2", + "once_cell", + "ordered-float", + "parking_lot", + "portable-atomic", + "portable-atomic-util", + "profiling", + "range-alloc", + "raw-window-handle", + "raw-window-metal", + "renderdoc-sys", + "smallvec", + "static_assertions", + "thiserror 2.0.21", + "wgpu-naga-bridge", + "wgpu-types", + "windows", + "windows-core", +] + +[[package]] +name = "wgpu-naga-bridge" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2f62e73117bb7a62bfd9c5a5841438a823f6566c6442a808ee269d2d055c081" +dependencies = [ + "naga", + "wgpu-types", +] + +[[package]] +name = "wgpu-types" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99dad6f1fbdbbdb4c278a6508b059d44688f5cebddf78d005a46a31340269286" +dependencies = [ + "bitflags 2.13.2", + "bytemuck", + "log", + "naga-types", + "raw-window-handle", + "static_assertions", +] + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "windows" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" +dependencies = [ + "windows-collections", + "windows-core", + "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", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-future" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" +dependencies = [ + "windows-core", + "windows-link", + "windows-threading", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-link" +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", + "windows-link", +] + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winit" +version = "0.30.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6755fa58a9f8350bd1e472d4c3fcc25f824ec358933bba33306d0b63df5978d" +dependencies = [ + "ahash", + "android-activity", + "atomic-waker", + "bitflags 2.13.2", + "block2 0.5.1", + "bytemuck", + "calloop 0.13.0", + "cfg_aliases", + "concurrent-queue", + "core-foundation", + "core-graphics", + "cursor-icon", + "dpi", + "js-sys", + "libc", + "memmap2", + "ndk", + "objc2 0.5.3", + "objc2-app-kit 0.2.2", + "objc2-foundation 0.2.2", + "objc2-ui-kit 0.2.2", + "orbclient", + "percent-encoding", + "pin-project", + "raw-window-handle", + "redox_syscall 0.4.1", + "rustix 0.38.44", + "sctk-adwaita", + "smithay-client-toolkit", + "smol_str 0.2.2", + "tracing", + "unicode-segmentation", + "wasm-bindgen", + "wasm-bindgen-futures", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-protocols-plasma", + "web-sys", + "web-time", + "windows-sys 0.52.0", + "x11-dl", + "x11rb", + "xkbcommon-dl", +] + +[[package]] +name = "winnow" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" + +[[package]] +name = "winnow" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81" +dependencies = [ + "memchr", +] + +[[package]] +name = "wit-bindgen" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "wl-clipboard-rs" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d7888ccd4896447b2d14d3a9350a85df2aeb6f181e2e7a31349d104ac46cac1" +dependencies = [ + "libc", + "log", + "os_pipe", + "rustix 1.1.5", + "thiserror 2.0.21", + "tree_magic_mini", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-protocols-wlr", +] + +[[package]] +name = "write-fonts" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cae90d1d9f6d1d36ef116b0b1e651a6d7c12ba925439d4d06ff9adc94662a3d8" +dependencies = [ + "font-types", + "indexmap", + "kurbo", + "log", + "read-fonts", +] + +[[package]] +name = "writeable" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "x11-dl" +version = "2.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f" +dependencies = [ + "libc", + "once_cell", + "pkg-config", +] + +[[package]] +name = "x11rb" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9993aa5be5a26815fe2c3eacfc1fde061fc1a1f094bf1ad2a18bf9c495dd7414" +dependencies = [ + "as-raw-xcb-connection", + "gethostname", + "libc", + "libloading", + "once_cell", + "rustix 1.1.5", + "x11rb-protocol", +] + +[[package]] +name = "x11rb-protocol" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd" + +[[package]] +name = "xattr" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32e45ad4206f6d2479085147f02bc2ef834ac85886624a23575ae137c8aa8156" +dependencies = [ + "libc", + "rustix 1.1.5", +] + +[[package]] +name = "xcursor" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "163b33ed8786455e2fa5d72f554057ce3f3182425434f756cd39c99839d88e23" + +[[package]] +name = "xkbcommon" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a974f48060a14e95705c01f24ad9c3345022f4d97441b8a36beb7ed5c4a02d" +dependencies = [ + "libc", + "memmap2", + "xkeysym", +] + +[[package]] +name = "xkbcommon-dl" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d039de8032a9a8856a6be89cea3e5d12fdd82306ab7c94d74e6deab2460651c5" +dependencies = [ + "bitflags 2.13.2", + "dlib", + "log", + "once_cell", + "xkeysym", +] + +[[package]] +name = "xkeysym" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56" + +[[package]] +name = "xml-rs" +version = "0.8.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e450f9b2ed1dff33c94c12589a87338689467b9c4f5d8a5710bd09a847d2c8a7" + +[[package]] +name = "xmlwriter" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9" + +[[package]] +name = "yazi" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e01738255b5a16e78bbb83e7fbba0a1e7dd506905cfc53f4622d89015a03fbb5" + +[[package]] +name = "yeslogic-fontconfig-sys" +version = "6.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d8b8abf912b9a29ff112e1671c97c33636903d13a69712037190e6805af4f76" +dependencies = [ + "dlib", + "once_cell", + "pkg-config", +] + +[[package]] +name = "yoke" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "417ef3fcf6c300b7dbd25c85531a746931c02ad536f3cf4786ed1e88223340b3" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", + "synstructure 0.14.0", +] + +[[package]] +name = "zbus" +version = "5.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5db4be7c075cb421e4b7ee645541604239bd243ba7c357511f4ff3a74b555907" +dependencies = [ + "async-broadcast", + "async-executor", + "async-io", + "async-lock", + "async-process", + "async-recursion", + "async-task", + "async-trait", + "blocking", + "enumflags2", + "event-listener", + "futures-core", + "futures-lite", + "hex", + "libc", + "ordered-stream", + "rustix 1.1.5", + "serde", + "serde_repr", + "tracing", + "uds_windows", + "uuid", + "windows-sys 0.61.2", + "winnow 1.0.4", + "zbus_macros", + "zbus_names", + "zvariant", +] + +[[package]] +name = "zbus_macros" +version = "5.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2990635d09ade6df1868f72f8cac69a876a90981e8bd3c40b1be413f8dc88f40" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 3.0.9", + "zbus_names", + "zvariant", + "zvariant_utils", +] + +[[package]] +name = "zbus_names" +version = "4.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812a12be4ead7a59e18ea8f047d08add0066b73bc62fc1467066a2472ae088dd" +dependencies = [ + "serde", + "winnow 1.0.4", + "zvariant", +] + +[[package]] +name = "zcheapstr" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1afec51604565183aeb5c54c20aeab286120d4e4460f7f76e3e8bb8c0d99473" +dependencies = [ + "serde", +] + +[[package]] +name = "zeno" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6df3dc4292935e51816d896edcd52aa30bc297907c26167fec31e2b0c6a32524" + +[[package]] +name = "zerocopy" +version = "0.8.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5fe1f8f1b06191a00962174c61aa5005e0bb391a6d80d07e24d115c01a92ed8" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "863ad3ac83293fb4d740aedbfdc9240dd8d1a50c1099acd76ce80ce7c7230c7f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", + "synstructure 0.14.0", +] + +[[package]] +name = "zerotrie" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "zerovec" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f58a2799cfe9a1670c7ea8edbd52ef8edb93cb37a7f83bf31ba9e35d9dae6a40" +dependencies = [ + "serde", + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3743ddbf47738d929cd1ae2e199d40d0162979dfe31aef8ae646d2bf00bf97a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" + +[[package]] +name = "zune-core" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d56377fd46368984a170bc5aac5567e52ca5da874caa60bea39fcbca78fb658b" + +[[package]] +name = "zune-jpeg" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27bc9d5b815bc103f142aa054f561d9187d191692ec7c2d1e2b4737f8dbd7296" +dependencies = [ + "zune-core", +] + +[[package]] +name = "zvariant" +version = "5.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80bf6d6cd6a4b601acb64cfb8284cdc643fcfa75ef26ae3c46ec8aa4e8a1fbb7" +dependencies = [ + "endi", + "enumflags2", + "serde", + "winnow 1.0.4", + "zcheapstr", + "zvariant_derive", + "zvariant_utils", +] + +[[package]] +name = "zvariant_derive" +version = "5.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef2672456ba1cb54b5eaec136e63135b3c7495fb938e53b28a62e633496d486d" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 3.0.9", + "zvariant_utils", +] + +[[package]] +name = "zvariant_utils" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bad0294361a320b694a328460dc73add56c306150f5cb6bfafc44446120008a3" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "syn 3.0.9", + "winnow 1.0.4", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..38dbbff --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,27 @@ +[workspace] +resolver = "3" +members = ["crates/sf-ipc", "crates/sf-launcher", "crates/sf-remote"] + +[workspace.package] +version = "0.1.0" +edition = "2024" +license = "MIT" + +[workspace.dependencies] +sf-ipc = { path = "crates/sf-ipc" } +serde = { version = "1", features = ["derive"] } +serde_json = "1" +toml = "0.9" +anyhow = "1" +log = "0.4" +env_logger = "0.11" + +[profile.release] +lto = "thin" +codegen-units = 1 +strip = true +opt-level = 3 + +# Keep debug builds snappy for UI iteration. +[profile.dev.package."*"] +opt-level = 2 diff --git a/README.md b/README.md new file mode 100644 index 0000000..9fcd7eb --- /dev/null +++ b/README.md @@ -0,0 +1,169 @@ +# SmartFox + +Egy saját okos-TV rendszer minimál Debianra (Intel N100). Rust launcher, Liquid Glass dizájn, Netflex, YouTube TV, DIAL/AirPlay/Miracast castolás és Siri Remote. +A teljes terv: `C:\Users\csike\.claude\plans\szeretnek-egy-linux-alapra-resilient-nova.md`. + +## Állapot +- [x] **1. fázis:** launcher prototípus (Slint + OpenGL Liquid Glass réteg) és manifest-alapú appok +- [x] **1b. fázis:** Siri Remote: protokoll visszafejtve (`docs/siri-remote.md`), `sf-remote` driver (gombok, ismétlés, swipe → uinput) +- [ ] 2: mkosi Debian image +- [ ] 3: `sf-core` (app indítás, Chromium web runtime) +- [ ] 4: DIAL (YouTube cast), AirPlay, Miracast +- [ ] 5: saját Smithay kompozitor + +## Futtatás (fejlesztés) +```sh +cargo run -p sf-launcher # ablakban +cargo run -p sf-launcher -- --fullscreen +cargo run --release -p sf-launcher +``` +**Billentyűk:** +- ← → ↑ ↓ : lépkedés az app-rácsban (soronként 5 ikon, tvOS-elrendezés); +- Enter röviden: megnyitás (felengedéskor); +- Enter hosszan (≈0,5 mp): helyi menü (Megnyitás, Részletek), ↑ ↓ és Enter; +- Esc / Backspace: vissza (lejjebbi sorból a legfelső sorra). + +**Opciók:** +- `--apps `: az app manifestek mappája (alapból a repó `apps/` mappáját keresi); +- `--settings `: a beállítások fájlja (alapból `%APPDATA%\smartfox\settings.toml` vagy `~/.config/smartfox/settings.toml`). + +**Beállítások** (a „Beállítások” app): bal oldalt kategóriák, jobb oldalt a sorok (↑ ↓, Enter, ← / Esc vissza). +- Kijelző: felbontás és frissítés választása (`wlr-randr`). Az új mód 15 mp-ig ideiglenes, megerősítés nélkül visszaáll; a megtartott mód a `settings.toml` `display_mode` kulcsába kerül, és induláskor újra beállítódik. +- Távirányító és Bluetooth: a párosított eszközök (`bluetoothctl`) állapottal, akkuval; eltávolítás, új Siri Remote párosítása. +- Hálózat: kapcsolat, IP és Wi-Fi (`iwd`). + - A Wi-Fi ki- és bekapcsolható. A hálózatlista jelerősséget és lakatot mutat. + - Új védett hálózatnál a képernyő-billentyűzeten kell megadni a jelszót. Ha a csatlakozás nem sikerül, a billentyűzet hibaüzenettel újra megnyílik. + - A mentett vagy csatlakoztatott hálózat leválasztható és elfelejthető. + - A launcher a `busctl` és az `iwctl --passphrase` paranccsal vezérli az iwd-t. Ehhez a `tv` felhasználónak a `netdev` csoport tagjának kell lennie (ezt az image beállítja). +- Képernyő-billentyűzet (`ui/keyboard.slint`, `src/keyboard.rs`): tvOS-stílusú, egysoros betűsor. + - ← → lépked (a sor két vége körbeér), Enter beír, Vissza (Esc) mégse. + - ↓ a módváltókhoz visz: `abc`, `ABC`, `.?123`, `#+=`, Megjelenítés, Csatlakozás. + - Valódi billentyűzetről közvetlenül is lehet gépelni, a Backspace töröl. +- Energia: mit csináljon a távirányító bekapcsológombja (képernyő ki / alvó mód / képernyő ki, majd alvás), lásd lent: [Készenlét és alvás](#készenlét-és-alvás). +- Rendszer: gépnév, verzió; a felület újraindítása. +- Rendszer → Távoli hibakeresés: SSH be/ki, lásd lent: [Távoli hibakeresés (SSH)](#távoli-hibakeresés-ssh). + +Windowson (vagy `SMARTFOX_DEMO_SYSTEM=1`-gyel) demó adatokkal fut, a rendszert nem módosítja. + +A Netflex szerver a Netflex app beállítása (a Részletek lapon látszik), a címét így adod meg: +```toml +# settings.toml +netflex_server = "https://netflex.furbidden.cloud" +``` + +## Felépítés +``` +crates/sf-ipc/ manifestek, beállítások, IPC üzenetek (közös a daemonokkal) +crates/sf-remote/ Siri Remote driver (BlueZ GATT -> uinput), csak Linux +tools/siri-remote/ párosítás (fastpair.py), nyers HID/btmon elemzők, host setup scriptek +crates/sf-launcher/ Slint UI (ui/*.slint) + src/glass/ (OpenGL háttér és üveg shaderek) +apps//app.toml appok: kind = "web" | "exec" | "builtin" +``` + +**Hogyan készül a Liquid Glass hatás:** a Slint FemtoVG (OpenGL) rendererének `BeforeRendering` hookjában fut egy saját két passos GL réteg (`src/glass/`). +1. A háttér egy sötét, lassan áramló, homályos színátmenet a fókuszált app palettájából (néhány lágy színfolt, kettő árnyalat-eltolással). Mivel eleve homályos, kis felbontású (max. 640 px széles, RGBA16F, ha a driver tudja) mipmappelt textúrába renderelődik, majd ditherrel felskálázva kerül a képernyőre. Fókuszváltáskor a színek a CPU-n úsznak át, a GPU egyszer számol. +2. Az üvegpanelek egyenként, csak a saját téglalapjukon (plusz árnyék-margó) rajzolódnak, keveréssel (`dst * a + rgb`), így a teljes képernyőn nem fut végig minden panelre a shader. Az Apple Liquid Glass mintájára a fényt nem szórja (blur), hanem töri: + - minden panel egy üveglap (IOR ≈ 1,5), domború squircle peremmel; a hátteret egy valódi törési sugár (Snell) tolja el, csatornánként eltérő IOR-ral (diszperzió); + - a nagyobb panel vastagabb üveg: szélesebb perem, erősebb lencsehatás, mélyebb árnyék; + - Fresnel-tükröződés, a fény felé eső peremen éles csúcsfény, a túloldalon halvány visszaverődés; + - fókuszban belső felizzás és egy lassan átsuhanó fénycsík (tvOS-szerű); + - az `alpha` a fénytörést „materializálja”, nem csak áttűnik; + - az azonos `group`-ú egymást követő panelek folyadékként összeolvadnak (smooth union), így válik le például az értesítés a státusz-kapszuláról. + - a kis vezérlők teljes kupolák (cseppszerű lencse), a nagy panelek vastag lapok széles, lekerekített peremmel; + - negatív `blur` = beágyazott üveg egy másik panelen (beállítás-sorok, chipek, lépésszámok): nem töri újra a hátteret, csak formát, peremfényt és árnyékot ad. + +Minden vezérlő üveg: státusz-kapszula, értesítés, app-ikonok, helyi menü, beállítás-panel és sorai, párosítási panel, státusz-pill, gyorsbillentyű-chipek, töltősáv. A Slint csak a szöveget és az ikonokat rajzolja rájuk. Korlát: az üveg a GL hátteret töri, a Slint által rajzolt tartalmat nem. + +A panelek geometriáját a Slint adja: a `glass-under`, `glass-menu` és `glass-over` tömbökből, valamint a rács property-jeiből. A kártyák képlete a `ui/app.slint` és a `src/main.rs` (`card_rects`) fájlban szinkronban kell legyen. A helyi menü a fókuszált ikonnal egy csoportban van, ezért cseppként válik ki belőle. + +**Dev snapshot:** UI-változtatások ellenőrzéséhez a launcher billentyűket tud küldeni magának, és PNG-t ment, majd kilép (`src/devshot.rs`): +```powershell +$env:SMARTFOX_SIZE = "1920x1080" +$env:SMARTFOX_KEYS = "right right enter" # left/right/up/down/enter/esc, hold (hosszú Enter), 0,7 mp-enként +$env:SMARTFOX_SNAPSHOT = "shot.png" # mentés az utolsó billentyű után 1,5 mp-cel +$env:SMARTFOX_SNAPSHOT_MS = "4000" # vagy pontos időpont +cargo run --release -p sf-launcher +``` +`SMARTFOX_DEMO_PAIRING=1` a párosítási útmutatót játssza le távirányító nélkül. + +## Telepítő ISO (pendrive, Rufus) +```sh +sudo bash /mnt/g/source/smartfox/image/build-iso.sh # WSL Debianban; image + telepítő + ISO +``` +Az eredmény: `image/out/smartfox-installer.iso`. +- **Rufus:** válaszd ki az ISO-t, Partíciós séma: GPT, Cél: UEFI (CSM nélkül), majd „ISO kép mód”. +- **balenaEtcher / dd:** is működik: az ISO-ban GPT és EFI rendszerpartíció van, így nyersen kiírva is bootol. +- **A gépen:** kapcsold ki a Secure Bootot (a bootloader nincs aláírva), és bootolj a pendrive-ról. +- **A telepítő:** RAM-ból fut. Kiválasztod a belső lemezt, beírod, hogy `igen`, és a SmartFox image kiíródik rá. A lemezen minden adat törlődik. + +**Lemezkiosztás a telepített gépen:** +- `esp`: systemd-boot és a UKI. +- `root-x86-64`: a rendszer, **csak olvasható**. +- `sf-data` (ext4, `/var`): az első bootkor a `systemd-repart` hozza létre a lemez maradék helyén. Itt van minden, aminek újraindítás után is meg kell maradnia: + - `/home` → `/var/home`: launcher beállítások, felbontás, Chromium profilok; + - Bluetooth párosítások, naplók. + + Az üres partíciót az `sf-data-init.service` tölti fel a `/usr/share/factory/var` gyári tartalmával. + +## Alapértelmezett belépés +| Felhasználó | Jelszó | Megjegyzés | +|---|---|---| +| `root` | `smartfox` | konzolon és SSH-n (`mkosi.conf`: `RootPassword`) | +| `tv` | nincs | a TV felülete ezzel fut, automatikus belépéssel a tty1-en | + +A jelszó minden telepítésen ugyanaz. Ha a gép idegen hálózatra kerül, változtasd meg az image építése előtt (`image/mkosi.conf`). + +## Távoli hibakeresés (SSH) +A telepített gépen az SSH alapból **ki van kapcsolva**. + +**Bekapcsolás:** a távirányítóval nyisd meg a Beállítások → Rendszer → **Távoli hibakeresés** sort, majd erősítsd meg a Bekapcsolás gombbal. A sor alatt megjelenik a belépési parancs és a kikapcsolás időpontja: +```sh +ssh root@ # jelszó: smartfox +``` + +**Kikapcsolás:** +- kézzel: ugyanazon a soron; +- magától: **1 óra** múlva (a `LIMIT=1h` sor az `image/mkosi.extra/usr/bin/sf-remote-debug` scriptben); +- magától: **minden újraindításkor**. + +A már megnyitott SSH-kapcsolatok a kikapcsolás után is élnek, újat nyitni viszont nem lehet. + +**VM-ben** (`tools/vm`, `run-qemu.sh`) az SSH alapból be van kapcsolva, időkorlát nélkül, hogy a fejlesztői scriptek működjenek (`ssh -p 2222 root@localhost`). + +**Működése:** +1. A launcher `tv` userként fut, ezért az SSH-t nem tudja maga elindítani. Csak beírja az `on` vagy `off` szót a `/var/lib/smartfox/remote-debug` fájlba. +2. Az `sf-remote-debug.path` figyeli ezt a fájlt, és rootként lefuttatja az `sf-remote-debug` scriptet. +3. A script indítja vagy leállítja az `ssh.service`-t. Bekapcsoláskor elindítja az `sf-remote-debug-off.timer`-t is, ez kapcsolja ki az SSH-t, amikor letelik az 1 óra. +4. Rendszerinduláskor az `sf-remote-debug-boot.service` törli a kapcsoló-fájlt, így a gép mindig kikapcsolt SSH-val indul. + +## Készenlét és alvás +A Siri Remote bekapcsológombja készenlétbe teszi a TV-t. Mit jelent ez, azt a Beállítások → **Energia** → Bekapcsológomb sorban lehet választani: + +| Mód | Mi történik | Ébresztés | +|---|---|---| +| **Képernyő kikapcsolása** (alapértelmezett) | A HDMI-jel megszűnik, a lejátszás szünetel, a gép fut tovább. | Bármelyik gomb, azonnal. Biztosan működik. | +| **Alvó mód** | Képernyő ki, majd a gép alvó állapotba megy (`systemctl suspend`). | Bármelyik gomb, Bluetooth-on keresztül. **Ki kell próbálni az adott gépen.** | +| **Képernyő ki, később alvás** | Előbb csak a képernyő alszik, az Elalvás sorban megadott idő (5 perc – 2 óra) után a gép is. | Ugyanaz, mint fent. | + +A „Készenlét most” sor ugyanazt csinálja, mint a gomb. A beállítás a `settings.toml` `power_button` (`screen` / `suspend` / `auto`) és `suspend_after_min` kulcsába kerül. + +**Működése:** +1. Az `sf-remote` a Power gombra `power`-t küld a launcher socketjére. A launcher (`src/power.rs`) dönt, és minden parancsra visszaírja az állapotot: `standby off|screen|suspend `. +2. Készenlétben az `sf-remote` minden gombnyomást `wake`-ké alakít, és a gomb nem jut el az apphoz. Belépéskor egy `KEY_PAUSECD`-t küld, hogy a lejátszás megálljon. +3. A képernyőt a launcher kapcsolja ki: `wlopm --off`, ha telepítve van, egyébként `wlr-randr --output … --off`. Ébredéskor visszakapcsolja, és újra beállítja a mentett felbontást. +4. A launcher `tv`-ként nem altathatja a gépet (nincs polkit). Ezért `standby suspend ` esetén az `sf-remote` (root) altat: + - engedélyezi a Bluetooth-vezérlő ébresztését (`power/wakeup` az USB-eszközén és fölötte); + - a kernel mgmt interfészén a távirányítót felveszi a kapcsolódási listára (Add Device, auto-connect), és megjelöli „remote wakeup”-ként (Set Device Flags). A BlueZ ezt csak a HID-pluginjain keresztül tenné meg, de ezeket kikapcsoltuk; + - végül `systemctl suspend`. +5. **Ébredés.** A távirányító gombnyomásra újracsatlakozik, ezt az `sf-remote` ébresztésnek veszi (`wake`). Ha a gép magától ébred, és 45 mp-en belül nem csatlakozik a távirányító, a launcher újra altatást kér (`suspend `). Ilyenkor a képernyő végig sötét marad. + +**Ha az ébresztés nem működik** (`sf-diag` → „Standby / wake” rész): +- a BIOS-ban engedélyezni kell az USB-ről ébresztést, és ki kell kapcsolni az ErP/Deep Sleep módot; +- a `/sys/power/mem_sleep` mutatja, hogy `s2idle` vagy `deep` (S3) alvás van-e. Az USB-s Bluetooth ébresztése S3-ból gépfüggő; +- a távirányító változó (privát) címmel hirdet. Ha a kernel a vezérlőben nem tud címet feloldani („LL privacy”), alvás közben minden közeli Bluetooth-hirdetés felébresztheti a gépet. Ezt az 5. pont visszaaltatása kezeli, de fogyasztásban számít. Kipróbálható a `/etc/bluetooth/main.conf` `[General]` részében a `KernelExperimental = 15c0a148-c273-11ea-b3de-0242ac130004` sorral (az image alapból nem kapcsolja be). + +Ha az ébresztés megbízhatatlan, a **Képernyő kikapcsolása** mód mindig működik. + +## Licenc +- A Slint a GPL-3.0 alatt van használva (beágyazott eszközre a royalty-free licenc nem vonatkozik). +- Az Inter betűtípus OFL licencű (`crates/sf-launcher/ui/fonts/OFL-LICENSE.txt`). diff --git a/apps/airplay/app.toml b/apps/airplay/app.toml new file mode 100644 index 0000000..4269a2f --- /dev/null +++ b/apps/airplay/app.toml @@ -0,0 +1,10 @@ +id = "airplay" +name = "AirPlay" +kind = "exec" +category = "Képernyőtükrözés" +description = "iPhone, iPad vagy Mac képernyőjének tükrözése. A Vezérlőközpontban válaszd a SmartFoxot." +exec = ["uxplay", "-n", "SmartFox", "-nh", "-vs", "waylandsink"] +icon = "airplay" +accent = "#4DA3FF" +palette = ["#7cc4ff", "#1d4fa8", "#050c1c"] +order = 30 diff --git a/apps/miracast/app.toml b/apps/miracast/app.toml new file mode 100644 index 0000000..5582150 --- /dev/null +++ b/apps/miracast/app.toml @@ -0,0 +1,10 @@ +id = "miracast" +name = "Miracast" +kind = "exec" +category = "Képernyőtükrözés · Kísérleti" +description = "Android telefon képernyőjének tükrözése Wi-Fi Directen keresztül." +exec = ["sf-miracast-sink"] +icon = "miracast" +accent = "#2FE0C0" +palette = ["#6ff5dc", "#0f7a6c", "#03130f"] +order = 40 diff --git a/apps/netflex/app.toml b/apps/netflex/app.toml new file mode 100644 index 0000000..43d9a06 --- /dev/null +++ b/apps/netflex/app.toml @@ -0,0 +1,14 @@ +id = "netflex" +name = "Netflex" +kind = "web" +category = "Saját streaming" +description = "Filmek, sorozatok és anime a saját szerveredről. Válaszd ki, és már nézheted is, miközben töltődik." +url = "${settings.netflex_server}/" +icon = "netflex" +accent = "#E50914" +palette = ["#ff4a3d", "#8c0b14", "#120305"] +order = 10 + +[web] +# "SMART-TV" turns on the Netflex 10-foot UI (see packages/client/src/remote.ts → isTv). +user_agent_suffix = "SMART-TV SmartFox/0.1" diff --git a/apps/settings/app.toml b/apps/settings/app.toml new file mode 100644 index 0000000..79dcb47 --- /dev/null +++ b/apps/settings/app.toml @@ -0,0 +1,9 @@ +id = "settings" +name = "Beállítások" +kind = "builtin" +category = "Rendszer" +description = "Kijelző felbontás, Siri Remote és Bluetooth eszközök, hálózat és rendszer." +icon = "settings" +accent = "#C9D3E0" +palette = ["#c3cfe0", "#3b4658", "#07090d"] +order = 90 diff --git a/apps/youtube/app.toml b/apps/youtube/app.toml new file mode 100644 index 0000000..1c6a3aa --- /dev/null +++ b/apps/youtube/app.toml @@ -0,0 +1,17 @@ +id = "youtube" +name = "YouTube" +kind = "web" +category = "Videó · Castolható" +description = "A YouTube TV-s felülete. Telefonról a YouTube appban a cast ikonnal küldhetsz ide videót." +url = "https://www.youtube.com/tv" +icon = "youtube" +accent = "#FF2D2D" +palette = ["#ff6a5c", "#a3121c", "#16070a"] +order = 20 + +[web] +# A Cobalt (TV) user agent makes YouTube serve its leanback UI. +user_agent = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0 Safari/537.36 Cobalt/25.lts.30.1034943-gold (unlike Gecko), Unknown_TV_Unknown_0/Unknown (SmartFox, SF1, Wired)" + +[dial] +name = "YouTube" diff --git a/crates/sf-ipc/Cargo.toml b/crates/sf-ipc/Cargo.toml new file mode 100644 index 0000000..781fe0e --- /dev/null +++ b/crates/sf-ipc/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "sf-ipc" +description = "Shared types for SmartFox: app manifests, settings and IPC messages" +version.workspace = true +edition.workspace = true +license.workspace = true + +[dependencies] +serde.workspace = true +serde_json.workspace = true +toml.workspace = true +anyhow.workspace = true +log.workspace = true diff --git a/crates/sf-ipc/src/lib.rs b/crates/sf-ipc/src/lib.rs new file mode 100644 index 0000000..34a4278 --- /dev/null +++ b/crates/sf-ipc/src/lib.rs @@ -0,0 +1,9 @@ +//! Shared types for SmartFox components (launcher, core daemon, remote daemon). + +pub mod manifest; +pub mod message; +pub mod settings; + +pub use manifest::{AppKind, AppManifest, load_apps}; +pub use message::{CoreEvent, LauncherRequest}; +pub use settings::Settings; diff --git a/crates/sf-ipc/src/manifest.rs b/crates/sf-ipc/src/manifest.rs new file mode 100644 index 0000000..6733d10 --- /dev/null +++ b/crates/sf-ipc/src/manifest.rs @@ -0,0 +1,137 @@ +//! App manifests: one `app.toml` per folder under the apps directory. + +use std::path::{Path, PathBuf}; + +use anyhow::{Context, Result}; +use serde::{Deserialize, Serialize}; + +use crate::settings::Settings; + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "lowercase")] +pub enum AppKind { + /// Runs in the shared Chromium web runtime. + Web, + /// Any executable: AppImage, Rust binary, script. + Exec, + /// Built into the launcher (e.g. settings screen). + Builtin, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct AppManifest { + pub id: String, + pub name: String, + pub kind: AppKind, + /// Short label above the title in the hero ("Saját app", "Castolás"...). + #[serde(default)] + pub category: String, + #[serde(default)] + pub description: String, + /// Web apps: start URL. May contain `${settings.}` placeholders. + #[serde(default)] + pub url: Option, + /// Exec apps: command line. + #[serde(default)] + pub exec: Option>, + /// Built-in icon name used by the launcher. + #[serde(default)] + pub icon: String, + /// Accent color (hex), used for focus glow and buttons. + #[serde(default = "default_accent")] + pub accent: String, + /// Three colors for the animated hero backdrop: highlight, mid, deep. + #[serde(default)] + pub palette: Vec, + /// Sort order on the home row. + #[serde(default)] + pub order: i32, + #[serde(default)] + pub web: WebOptions, + #[serde(default)] + pub dial: Option, + /// Folder the manifest was loaded from (not serialized). + #[serde(skip)] + pub dir: PathBuf, +} + +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +pub struct WebOptions { + /// Full user agent override. + #[serde(default)] + pub user_agent: Option, + /// Appended to the default user agent. + #[serde(default)] + pub user_agent_suffix: Option, + /// Unpacked extensions to load (paths relative to the app folder). + #[serde(default)] + pub extensions: Vec, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct DialOptions { + /// DIAL application name, e.g. "YouTube". + pub name: String, +} + +fn default_accent() -> String { + "#ffffff".into() +} + +impl AppManifest { + /// Start URL with `${settings.key}` placeholders filled in. + pub fn resolved_url(&self, settings: &Settings) -> Option { + self.url.as_ref().map(|u| settings.expand(u)) + } +} + +/// Loads every `*/app.toml` under `dir`, sorted by `order` then name. +pub fn load_apps(dir: &Path) -> Result> { + let mut apps = Vec::new(); + let entries = std::fs::read_dir(dir).with_context(|| format!("reading {}", dir.display()))?; + for entry in entries.flatten() { + let path = entry.path().join("app.toml"); + if !path.is_file() { + continue; + } + match load_one(&path) { + Ok(app) => apps.push(app), + Err(e) => log::warn!("skipping {}: {e:#}", path.display()), + } + } + apps.sort_by(|a, b| a.order.cmp(&b.order).then_with(|| a.name.cmp(&b.name))); + Ok(apps) +} + +fn load_one(path: &Path) -> Result { + let text = std::fs::read_to_string(path)?; + let mut app: AppManifest = toml::from_str(&text)?; + app.dir = path.parent().unwrap_or(Path::new(".")).to_path_buf(); + Ok(app) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn parses_web_manifest() { + let app: AppManifest = toml::from_str( + r##" + id = "netflex" + name = "Netflex" + kind = "web" + url = "${settings.netflex_server}/" + accent = "#E50914" + palette = ["#ff3b3b", "#7a0a10", "#0c0203"] + [web] + user_agent_suffix = "SMART-TV SmartFox/0.1" + "##, + ) + .unwrap(); + assert_eq!(app.kind, AppKind::Web); + let mut s = Settings::default(); + s.values.insert("netflex_server".into(), "http://10.0.0.5:7880".into()); + assert_eq!(app.resolved_url(&s).unwrap(), "http://10.0.0.5:7880/"); + } +} diff --git a/crates/sf-ipc/src/message.rs b/crates/sf-ipc/src/message.rs new file mode 100644 index 0000000..504fe87 --- /dev/null +++ b/crates/sf-ipc/src/message.rs @@ -0,0 +1,23 @@ +//! Messages between the launcher and the core daemon (newline-delimited JSON +//! over a unix socket). The core daemon itself comes in phase 3. + +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(tag = "type", rename_all = "snake_case")] +pub enum LauncherRequest { + Launch { app_id: String }, + /// Bring the launcher back to the front (freezes the foreground app). + GoHome, + SetSetting { key: String, value: String }, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(tag = "type", rename_all = "snake_case")] +pub enum CoreEvent { + AppStarted { app_id: String }, + AppStopped { app_id: String }, + /// Something connected over DIAL/AirPlay/Miracast. + CastConnected { app_id: String, device: String }, + Toast { text: String }, +} diff --git a/crates/sf-ipc/src/settings.rs b/crates/sf-ipc/src/settings.rs new file mode 100644 index 0000000..486cdf4 --- /dev/null +++ b/crates/sf-ipc/src/settings.rs @@ -0,0 +1,57 @@ +//! Flat key/value settings stored in `settings.toml`. + +use std::collections::BTreeMap; +use std::path::Path; + +use anyhow::Result; +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +pub struct Settings { + #[serde(flatten)] + pub values: BTreeMap, +} + +impl Settings { + /// Missing file means default settings. + pub fn load(path: &Path) -> Result { + if !path.exists() { + return Ok(Self::default()); + } + Ok(toml::from_str(&std::fs::read_to_string(path)?)?) + } + + pub fn save(&self, path: &Path) -> Result<()> { + if let Some(dir) = path.parent() { + std::fs::create_dir_all(dir)?; + } + std::fs::write(path, toml::to_string_pretty(self)?)?; + Ok(()) + } + + pub fn get(&self, key: &str) -> Option<&str> { + self.values.get(key).map(String::as_str) + } + + /// Replaces `${settings.key}` with the value (or an empty string). + pub fn expand(&self, input: &str) -> String { + let mut out = String::with_capacity(input.len()); + let mut rest = input; + while let Some(start) = rest.find("${settings.") { + out.push_str(&rest[..start]); + let after = &rest[start + "${settings.".len()..]; + match after.find('}') { + Some(end) => { + out.push_str(self.get(&after[..end]).unwrap_or("")); + rest = &after[end + 1..]; + } + None => { + out.push_str(&rest[start..]); + rest = ""; + } + } + } + out.push_str(rest); + out + } +} diff --git a/crates/sf-launcher/Cargo.toml b/crates/sf-launcher/Cargo.toml new file mode 100644 index 0000000..baaa05e --- /dev/null +++ b/crates/sf-launcher/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "sf-launcher" +description = "SmartFox TV launcher: Slint UI on top of a Liquid Glass OpenGL layer" +version.workspace = true +edition.workspace = true +# Slint is used under GPL-3.0 (or its royalty-free license on desktop). +license = "GPL-3.0-only" + +[dependencies] +sf-ipc.workspace = true +anyhow.workspace = true +log.workspace = true +env_logger.workspace = true +serde_json.workspace = true +slint = { version = "1.18", default-features = false, features = ["std", "backend-default", "renderer-femtovg", "compat-1-2"] } +glow = "0.16" +png = "0.18" +chrono = { version = "0.4", default-features = false, features = ["clock", "std"] } + +[build-dependencies] +slint-build = "1.18" + +[target.'cfg(windows)'.dependencies] +windows-sys = { version = "0.61", features = ["Win32_Foundation", "Win32_UI_WindowsAndMessaging"] } diff --git a/crates/sf-launcher/build.rs b/crates/sf-launcher/build.rs new file mode 100644 index 0000000..29ee3db --- /dev/null +++ b/crates/sf-launcher/build.rs @@ -0,0 +1,3 @@ +fn main() { + slint_build::compile("ui/app.slint").expect("compiling ui/app.slint"); +} diff --git a/crates/sf-launcher/src/devshot.rs b/crates/sf-launcher/src/devshot.rs new file mode 100644 index 0000000..3a2ad2a --- /dev/null +++ b/crates/sf-launcher/src/devshot.rs @@ -0,0 +1,116 @@ +//! Dev helper: scripted key presses and a PNG snapshot of the window, so UI +//! changes can be checked without a person at the screen. +//! +//! - `SMARTFOX_KEYS="up right enter"`: keys sent one by one (left, right, up, +//! down, enter, esc, `hold` = enter held for 0.8 s, or `wait`), starting +//! after 1.2 s, every 0.7 s (a hold takes two slots). +//! - `SMARTFOX_SNAPSHOT=out.png`: saves the frame and quits, 1.5 s after the +//! last key (or at `SMARTFOX_SNAPSHOT_MS`). +//! - `SMARTFOX_SIZE=1920x1080`: physical window size. + +use std::cell::Cell; +use std::path::PathBuf; +use std::rc::Rc; +use std::time::Duration; + +use slint::ComponentHandle; +use slint::platform::{Key, WindowEvent}; + +use crate::App; +use crate::glass::GlassRenderer; + +pub struct Snapshot { + path: Option, + due: Rc>, +} + +pub fn setup(ui: &App) -> Snapshot { + if let Some((w, h)) = std::env::var("SMARTFOX_SIZE").ok().and_then(|s| { + let (w, h) = s.split_once('x')?; + Some((w.parse().ok()?, h.parse().ok()?)) + }) { + ui.window().set_size(slint::PhysicalSize::new(w, h)); + } + + let keys: Vec = std::env::var("SMARTFOX_KEYS") + .map(|s| s.split_whitespace().map(str::to_lowercase).collect()) + .unwrap_or_default(); + let mut at = 1200u64; + for k in &keys { + let hold = k == "hold"; + let key: Option = match k.as_str() { + "hold" => Some(Key::Return), + "left" => Some(Key::LeftArrow), + "right" => Some(Key::RightArrow), + "up" => Some(Key::UpArrow), + "down" => Some(Key::DownArrow), + "enter" => Some(Key::Return), + "esc" => Some(Key::Escape), + _ => None, + }; + let start = at; + at += if hold { 1400 } else { 700 }; + let Some(key) = key else { continue }; + let text: slint::SharedString = key.into(); + let weak = ui.as_weak(); + let t = text.clone(); + slint::Timer::single_shot(Duration::from_millis(start), move || { + if let Some(ui) = weak.upgrade() { + ui.window().dispatch_event(WindowEvent::KeyPressed { text: t.clone() }); + if !hold { + ui.window().dispatch_event(WindowEvent::KeyReleased { text: t }); + } + } + }); + if hold { + let weak = ui.as_weak(); + slint::Timer::single_shot(Duration::from_millis(start + 800), move || { + if let Some(ui) = weak.upgrade() { + ui.window().dispatch_event(WindowEvent::KeyReleased { text }); + } + }); + } + } + + let path = std::env::var_os("SMARTFOX_SNAPSHOT").map(PathBuf::from); + let due = Rc::new(Cell::new(false)); + if path.is_some() { + let at = std::env::var("SMARTFOX_SNAPSHOT_MS") + .ok() + .and_then(|s| s.parse().ok()) + .unwrap_or(at + 1500); + let due = due.clone(); + slint::Timer::single_shot(Duration::from_millis(at), move || due.set(true)); + } + Snapshot { path, due } +} + +impl Snapshot { + pub fn capture_if_due(&self, ui: &App, r: &GlassRenderer) { + if !self.due.get() { + return; + } + self.due.set(false); + let Some(path) = &self.path else { return }; + let size = ui.window().size(); + // SAFETY: called from AfterRendering with the GL context current. + let mut pixels = unsafe { r.read_pixels(size.width, size.height) }; + // Opaque output: the framebuffer alpha is meaningless here. + pixels.iter_mut().skip(3).step_by(4).for_each(|a| *a = 255); + match write_png(path, size.width, size.height, &pixels) { + Ok(()) => log::info!("snapshot saved to {}", path.display()), + Err(e) => log::error!("snapshot: {e:#}"), + } + let _ = slint::quit_event_loop(); + } +} + +fn write_png(path: &PathBuf, w: u32, h: u32, rgba: &[u8]) -> anyhow::Result<()> { + let file = std::io::BufWriter::new(std::fs::File::create(path)?); + let mut enc = png::Encoder::new(file, w, h); + enc.set_color(png::ColorType::Rgba); + enc.set_depth(png::BitDepth::Eight); + let mut writer = enc.write_header()?; + writer.write_image_data(rgba)?; + Ok(()) +} diff --git a/crates/sf-launcher/src/glass/mod.rs b/crates/sf-launcher/src/glass/mod.rs new file mode 100644 index 0000000..0f9e6ac --- /dev/null +++ b/crates/sf-launcher/src/glass/mod.rs @@ -0,0 +1,49 @@ +//! "Liquid Glass" layer: an OpenGL pass under the Slint UI that draws the +//! animated backdrop and the frosted, refracting glass panels. + +mod renderer; +mod shaders; + +pub use renderer::GlassRenderer; + +/// Panels drawn per frame at most (each one is its own small draw call). +pub const MAX_RECTS: usize = 48; +/// Members of one merged (liquid) group at most. +pub const MAX_GROUP: usize = 4; + +/// One glass panel in physical pixels (top-left origin). +#[derive(Debug, Clone, Copy)] +pub struct Panel { + pub x: f32, + pub y: f32, + pub w: f32, + pub h: f32, + pub radius: f32, + /// 0..1, brightens the rim and adds the accent glow. + pub focus: f32, + pub alpha: f32, + /// Mip level used for the frost (higher = blurrier). Negative = nested glass. + pub blur: f32, + pub glow: [f32; 3], + /// Consecutive panels with the same group (> 0) melt into one shape. + pub group: f32, + /// rgb + amount. + pub tint: [f32; 4], +} + +/// Everything the renderer needs for one frame. +#[derive(Debug, Clone)] +pub struct Frame { + pub width: u32, + pub height: u32, + pub scale: f32, + pub time: f32, + /// Backdrop palette (highlight, mid, deep), already crossfaded. + pub palette: [f32; 9], + /// 1 = top shelf visible (bright backdrop), 0 = scrolled down into the grid. + pub shelf: f32, + pub light: [f32; 2], + /// Backdrop zoom (1 = none), used for the launch fly-in. + pub zoom: f32, + pub rects: Vec, +} diff --git a/crates/sf-launcher/src/glass/renderer.rs b/crates/sf-launcher/src/glass/renderer.rs new file mode 100644 index 0000000..370487e --- /dev/null +++ b/crates/sf-launcher/src/glass/renderer.rs @@ -0,0 +1,425 @@ +//! OpenGL underlay drawn before Slint renders its items. +//! +//! Pass 1 renders the backdrop (a smooth gradient) into a small, mipmapped +//! texture. Pass 2 upscales it to the window. Pass 3 draws every glass panel +//! as its own quad, covering only the panel and its shadow, blended onto the +//! window. Uniform locations are looked up once. + +use glow::HasContext; + +use super::shaders; +use super::{Frame, MAX_GROUP, MAX_RECTS, Panel}; + +/// The backdrop is blurry by design, so it never needs more than this width. +const SCENE_MAX_W: i32 = 640; + +type Loc = Option; + +struct SceneLocs { + res: Loc, + time: Loc, + pal: Loc, + zoom: Loc, + shelf: Loc, +} + +struct BlitLocs { + scene: Loc, + time: Loc, +} + +struct GlassLocs { + box_: Loc, + res: Loc, + scene: Loc, + scale: Loc, + time: Loc, + light: Loc, + count: Loc, + rect: Loc, + param: Loc, + glow: Loc, + tint: Loc, +} + +pub struct GlassRenderer { + gl: glow::Context, + vao: glow::VertexArray, + scene_prog: glow::Program, + blit_prog: glow::Program, + glass_prog: glow::Program, + scene_locs: SceneLocs, + blit_locs: BlitLocs, + glass_locs: GlassLocs, + fbo: glow::Framebuffer, + tex: glow::Texture, + tex_size: (i32, i32), + /// RGBA16F if the driver can render to it (no banding in dark gradients). + half_float: bool, +} + +/// GL state we touch and must hand back to the Slint renderer untouched. +struct SavedState { + program: i32, + vao: i32, + array_buffer: i32, + framebuffer: i32, + active_texture: i32, + texture0: i32, + viewport: [i32; 4], + blend: bool, + blend_func: [i32; 4], + blend_eq: [i32; 2], + scissor: bool, + depth: bool, + stencil: bool, + cull: bool, +} + +impl GlassRenderer { + /// # Safety + /// Must be called with the Slint OpenGL context current. + pub unsafe fn new(gl: glow::Context) -> anyhow::Result { + unsafe { + let version = gl.get_parameter_string(glow::VERSION); + let is_es = version.contains("OpenGL ES"); + log::info!("OpenGL: {version} ({})", gl.get_parameter_string(glow::RENDERER)); + let header = if is_es { + "#version 300 es\nprecision highp float;\nprecision highp int;\n" + } else { + "#version 330 core\n" + }; + + let scene_prog = link(&gl, header, shaders::VERTEX, shaders::SCENE)?; + let blit_prog = link(&gl, header, shaders::VERTEX, shaders::BLIT)?; + let glass_prog = link(&gl, header, shaders::QUAD_VERTEX, shaders::GLASS)?; + let loc = |p: glow::Program, name: &str| gl.get_uniform_location(p, name); + let scene_locs = SceneLocs { + res: loc(scene_prog, "uRes"), + time: loc(scene_prog, "uTime"), + pal: loc(scene_prog, "uPal"), + zoom: loc(scene_prog, "uZoom"), + shelf: loc(scene_prog, "uShelf"), + }; + let blit_locs = BlitLocs { scene: loc(blit_prog, "uScene"), time: loc(blit_prog, "uTime") }; + let glass_locs = GlassLocs { + box_: loc(glass_prog, "uBox"), + res: loc(glass_prog, "uRes"), + scene: loc(glass_prog, "uScene"), + scale: loc(glass_prog, "uScale"), + time: loc(glass_prog, "uTime"), + light: loc(glass_prog, "uLight"), + count: loc(glass_prog, "uCount"), + rect: loc(glass_prog, "uRect"), + param: loc(glass_prog, "uParam"), + glow: loc(glass_prog, "uGlow"), + tint: loc(glass_prog, "uTint"), + }; + let vao = gl.create_vertex_array().map_err(anyhow::Error::msg)?; + let fbo = gl.create_framebuffer().map_err(anyhow::Error::msg)?; + let tex = gl.create_texture().map_err(anyhow::Error::msg)?; + + Ok(Self { + gl, + vao, + scene_prog, + blit_prog, + glass_prog, + scene_locs, + blit_locs, + glass_locs, + fbo, + tex, + tex_size: (0, 0), + half_float: true, + }) + } + } + + unsafe fn save(&self) -> SavedState { + let gl = &self.gl; + unsafe { + let mut viewport = [0; 4]; + gl.get_parameter_i32_slice(glow::VIEWPORT, &mut viewport); + let active_texture = gl.get_parameter_i32(glow::ACTIVE_TEXTURE); + gl.active_texture(glow::TEXTURE0); + SavedState { + program: gl.get_parameter_i32(glow::CURRENT_PROGRAM), + vao: gl.get_parameter_i32(glow::VERTEX_ARRAY_BINDING), + array_buffer: gl.get_parameter_i32(glow::ARRAY_BUFFER_BINDING), + framebuffer: gl.get_parameter_i32(glow::FRAMEBUFFER_BINDING), + active_texture, + texture0: gl.get_parameter_i32(glow::TEXTURE_BINDING_2D), + viewport, + blend: gl.is_enabled(glow::BLEND), + blend_func: [ + gl.get_parameter_i32(glow::BLEND_SRC_RGB), + gl.get_parameter_i32(glow::BLEND_DST_RGB), + gl.get_parameter_i32(glow::BLEND_SRC_ALPHA), + gl.get_parameter_i32(glow::BLEND_DST_ALPHA), + ], + blend_eq: [ + gl.get_parameter_i32(glow::BLEND_EQUATION_RGB), + gl.get_parameter_i32(glow::BLEND_EQUATION_ALPHA), + ], + scissor: gl.is_enabled(glow::SCISSOR_TEST), + depth: gl.is_enabled(glow::DEPTH_TEST), + stencil: gl.is_enabled(glow::STENCIL_TEST), + cull: gl.is_enabled(glow::CULL_FACE), + } + } + } + + unsafe fn restore(&self, s: SavedState) { + let gl = &self.gl; + let nz = |v: i32| std::num::NonZeroU32::new(v as u32); + unsafe { + gl.use_program(nz(s.program).map(glow::NativeProgram)); + gl.bind_vertex_array(nz(s.vao).map(glow::NativeVertexArray)); + gl.bind_buffer(glow::ARRAY_BUFFER, nz(s.array_buffer).map(glow::NativeBuffer)); + gl.bind_framebuffer(glow::FRAMEBUFFER, nz(s.framebuffer).map(glow::NativeFramebuffer)); + gl.active_texture(glow::TEXTURE0); + gl.bind_texture(glow::TEXTURE_2D, nz(s.texture0).map(glow::NativeTexture)); + gl.active_texture(s.active_texture as u32); + gl.viewport(s.viewport[0], s.viewport[1], s.viewport[2], s.viewport[3]); + let [sr, dr, sa, da] = s.blend_func.map(|v| v as u32); + gl.blend_func_separate(sr, dr, sa, da); + gl.blend_equation_separate(s.blend_eq[0] as u32, s.blend_eq[1] as u32); + let set = |cap, on: bool| if on { gl.enable(cap) } else { gl.disable(cap) }; + set(glow::BLEND, s.blend); + set(glow::SCISSOR_TEST, s.scissor); + set(glow::DEPTH_TEST, s.depth); + set(glow::STENCIL_TEST, s.stencil); + set(glow::CULL_FACE, s.cull); + } + } + + unsafe fn alloc_target(&self, w: i32, h: i32, half_float: bool) -> bool { + let gl = &self.gl; + unsafe { + gl.bind_texture(glow::TEXTURE_2D, Some(self.tex)); + let (internal, ty) = + if half_float { (glow::RGBA16F, glow::HALF_FLOAT) } else { (glow::RGBA8, glow::UNSIGNED_BYTE) }; + gl.tex_image_2d( + glow::TEXTURE_2D, + 0, + internal as i32, + w, + h, + 0, + glow::RGBA, + ty, + glow::PixelUnpackData::Slice(None), + ); + gl.tex_parameter_i32(glow::TEXTURE_2D, glow::TEXTURE_MIN_FILTER, glow::LINEAR_MIPMAP_LINEAR as i32); + gl.tex_parameter_i32(glow::TEXTURE_2D, glow::TEXTURE_MAG_FILTER, glow::LINEAR as i32); + gl.tex_parameter_i32(glow::TEXTURE_2D, glow::TEXTURE_WRAP_S, glow::CLAMP_TO_EDGE as i32); + gl.tex_parameter_i32(glow::TEXTURE_2D, glow::TEXTURE_WRAP_T, glow::CLAMP_TO_EDGE as i32); + gl.generate_mipmap(glow::TEXTURE_2D); + gl.bind_framebuffer(glow::FRAMEBUFFER, Some(self.fbo)); + gl.framebuffer_texture_2d(glow::FRAMEBUFFER, glow::COLOR_ATTACHMENT0, glow::TEXTURE_2D, Some(self.tex), 0); + gl.check_framebuffer_status(glow::FRAMEBUFFER) == glow::FRAMEBUFFER_COMPLETE + } + } + + unsafe fn ensure_target(&mut self, w: i32, h: i32) { + if self.tex_size == (w, h) { + return; + } + unsafe { + if self.half_float && !self.alloc_target(w, h, true) { + log::info!("glass: RGBA16F not renderable, using RGBA8 for the backdrop"); + self.half_float = false; + } + if !self.half_float { + self.alloc_target(w, h, false); + } + } + self.tex_size = (w, h); + } + + /// # Safety + /// Must be called from the Slint rendering notifier with the context current. + pub unsafe fn render(&mut self, f: &Frame) { + let (w, h) = (f.width as i32, f.height as i32); + if w <= 0 || h <= 0 { + return; + } + unsafe { + let saved = self.save(); + let gl = &self.gl; + gl.disable(glow::BLEND); + gl.disable(glow::SCISSOR_TEST); + gl.disable(glow::DEPTH_TEST); + gl.disable(glow::STENCIL_TEST); + gl.disable(glow::CULL_FACE); + gl.bind_vertex_array(Some(self.vao)); + + // Pass 1: backdrop at low resolution (it is a smooth gradient). + let sw = (w / 4).clamp(1, SCENE_MAX_W); + let sh = ((sw as i64 * h as i64 / w as i64) as i32).max(1); + self.ensure_target(sw, sh); + let gl = &self.gl; + gl.bind_framebuffer(glow::FRAMEBUFFER, Some(self.fbo)); + gl.viewport(0, 0, sw, sh); + let l = &self.scene_locs; + gl.use_program(Some(self.scene_prog)); + gl.uniform_2_f32(l.res.as_ref(), sw as f32, sh as f32); + gl.uniform_1_f32(l.time.as_ref(), f.time); + gl.uniform_3_f32_slice(l.pal.as_ref(), &f.palette); + gl.uniform_1_f32(l.zoom.as_ref(), f.zoom); + gl.uniform_1_f32(l.shelf.as_ref(), f.shelf); + gl.draw_arrays(glow::TRIANGLES, 0, 3); + + gl.bind_texture(glow::TEXTURE_2D, Some(self.tex)); + gl.generate_mipmap(glow::TEXTURE_2D); + + // Pass 2: upscale to the window framebuffer. + gl.bind_framebuffer( + glow::FRAMEBUFFER, + std::num::NonZeroU32::new(saved.framebuffer as u32).map(glow::NativeFramebuffer), + ); + gl.viewport(0, 0, w, h); + let l = &self.blit_locs; + gl.use_program(Some(self.blit_prog)); + gl.uniform_1_i32(l.scene.as_ref(), 0); + gl.uniform_1_f32(l.time.as_ref(), f.time); + gl.draw_arrays(glow::TRIANGLES, 0, 3); + + // Pass 3: glass, one quad per panel or merged group: dst * a + rgb. + gl.enable(glow::BLEND); + gl.blend_equation_separate(glow::FUNC_ADD, glow::FUNC_ADD); + gl.blend_func_separate(glow::ONE, glow::SRC_ALPHA, glow::ZERO, glow::ONE); + let l = &self.glass_locs; + gl.use_program(Some(self.glass_prog)); + gl.uniform_1_i32(l.scene.as_ref(), 0); + gl.uniform_2_f32(l.res.as_ref(), w as f32, h as f32); + gl.uniform_1_f32(l.scale.as_ref(), f.scale); + gl.uniform_1_f32(l.time.as_ref(), f.time); + gl.uniform_2_f32(l.light.as_ref(), f.light[0], f.light[1]); + + let rects = &f.rects[..f.rects.len().min(MAX_RECTS)]; + let mut rect = [0f32; MAX_GROUP * 4]; + let mut param = [0f32; MAX_GROUP * 4]; + let mut glow_c = [0f32; MAX_GROUP * 4]; + let mut tint = [0f32; MAX_GROUP * 4]; + for run in runs(rects) { + let n = run.len(); + // Bounds plus room for the shadow (spread + downward offset). + let margin = 132.0 * f.scale; + let (mut x0, mut y0, mut x1, mut y1) = (f32::MAX, f32::MAX, f32::MIN, f32::MIN); + for (i, r) in run.iter().enumerate() { + rect[i * 4..i * 4 + 4].copy_from_slice(&[r.x, r.y, r.w, r.h]); + param[i * 4..i * 4 + 4].copy_from_slice(&[r.radius, r.focus, r.alpha, r.blur]); + glow_c[i * 4..i * 4 + 4].copy_from_slice(&[r.glow[0], r.glow[1], r.glow[2], 0.0]); + tint[i * 4..i * 4 + 4].copy_from_slice(&r.tint); + x0 = x0.min(r.x); + y0 = y0.min(r.y); + x1 = x1.max(r.x + r.w); + y1 = y1.max(r.y + r.h); + } + let bx = [ + (x0 - margin).max(0.0), + (y0 - margin).max(0.0), + (x1 + margin).min(w as f32), + (y1 + margin + 46.0 * f.scale).min(h as f32), + ]; + if bx[0] >= bx[2] || bx[1] >= bx[3] { + continue; + } + gl.uniform_4_f32(l.box_.as_ref(), bx[0], bx[1], bx[2], bx[3]); + gl.uniform_1_i32(l.count.as_ref(), n as i32); + gl.uniform_4_f32_slice(l.rect.as_ref(), &rect[..n * 4]); + gl.uniform_4_f32_slice(l.param.as_ref(), ¶m[..n * 4]); + gl.uniform_4_f32_slice(l.glow.as_ref(), &glow_c[..n * 4]); + gl.uniform_4_f32_slice(l.tint.as_ref(), &tint[..n * 4]); + gl.draw_arrays(glow::TRIANGLE_STRIP, 0, 4); + } + + self.restore(saved); + } + } + + /// Reads the current window framebuffer as top-down RGBA8 (dev snapshots). + /// + /// # Safety + /// Must be called with the context current, after Slint has rendered. + pub unsafe fn read_pixels(&self, w: u32, h: u32) -> Vec { + let mut buf = vec![0u8; (w * h * 4) as usize]; + unsafe { + self.gl.pixel_store_i32(glow::PACK_ALIGNMENT, 1); + self.gl.read_pixels( + 0, + 0, + w as i32, + h as i32, + glow::RGBA, + glow::UNSIGNED_BYTE, + glow::PixelPackData::Slice(Some(&mut buf)), + ); + } + let row = (w * 4) as usize; + let mut flipped = Vec::with_capacity(buf.len()); + for y in (0..h as usize).rev() { + flipped.extend_from_slice(&buf[y * row..(y + 1) * row]); + } + flipped + } + + /// # Safety + /// Must be called with the context current. + pub unsafe fn destroy(&mut self) { + unsafe { + self.gl.delete_program(self.scene_prog); + self.gl.delete_program(self.blit_prog); + self.gl.delete_program(self.glass_prog); + self.gl.delete_vertex_array(self.vao); + self.gl.delete_framebuffer(self.fbo); + self.gl.delete_texture(self.tex); + } + } +} + +/// Splits the panels into draw runs: consecutive panels sharing a group +/// (> 0) melt together and are drawn as one; the rest are drawn alone. +fn runs(rects: &[Panel]) -> impl Iterator { + let mut rest = rects; + std::iter::from_fn(move || { + let first = rest.first()?; + let mut n = 1; + if first.group > 0.5 { + while n < rest.len() && n < MAX_GROUP && (rest[n].group - first.group).abs() < 0.5 { + n += 1; + } + } + let (run, tail) = rest.split_at(n); + rest = tail; + Some(run) + }) +} + +unsafe fn link(gl: &glow::Context, header: &str, vs: &str, fs: &str) -> anyhow::Result { + unsafe { + let program = gl.create_program().map_err(anyhow::Error::msg)?; + let mut shaders = Vec::new(); + for (kind, src) in [(glow::VERTEX_SHADER, vs), (glow::FRAGMENT_SHADER, fs)] { + let sh = gl.create_shader(kind).map_err(anyhow::Error::msg)?; + gl.shader_source(sh, &format!("{header}{src}")); + gl.compile_shader(sh); + if !gl.get_shader_compile_status(sh) { + anyhow::bail!("shader compile failed: {}", gl.get_shader_info_log(sh)); + } + gl.attach_shader(program, sh); + shaders.push(sh); + } + gl.link_program(program); + if !gl.get_program_link_status(program) { + anyhow::bail!("program link failed: {}", gl.get_program_info_log(program)); + } + for sh in shaders { + gl.detach_shader(program, sh); + gl.delete_shader(sh); + } + Ok(program) + } +} diff --git a/crates/sf-launcher/src/glass/shaders.rs b/crates/sf-launcher/src/glass/shaders.rs new file mode 100644 index 0000000..fa67d00 --- /dev/null +++ b/crates/sf-launcher/src/glass/shaders.rs @@ -0,0 +1,384 @@ +//! GLSL sources. The `#version` line is added at runtime (desktop GL 3.3 core or GLES 3.0). + +/// Fullscreen triangle without vertex buffers. +pub const VERTEX: &str = r#" +out vec2 vUv; +void main() { + vec2 p = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2)); + vUv = p; + gl_Position = vec4(p * 2.0 - 1.0, 0.0, 1.0); +} +"#; + +/// A quad over `uBox` (x0, y0, x1, y1 in px, top-left origin), drawn as a +/// 4-vertex triangle strip. Glass panels only shade the pixels they can reach. +pub const QUAD_VERTEX: &str = r#" +uniform vec4 uBox; +uniform vec2 uRes; +void main() { + vec2 c = vec2(float(gl_VertexID & 1), float((gl_VertexID >> 1) & 1)); + vec2 p = mix(uBox.xy, uBox.zw, c); + gl_Position = vec4(p.x / uRes.x * 2.0 - 1.0, 1.0 - p.y / uRes.y * 2.0, 0.0, 1.0); +} +"#; + +/// Backdrop: a dark, slowly flowing mesh gradient (soft colour fields in the +/// focused app's palette), like Apple's dark dynamic wallpapers. +/// +/// It is smooth by design, so it is rendered at low resolution and upscaled. +/// Cost per pixel: a handful of exp() calls, no noise, no loops over shapes. +pub const SCENE: &str = r#" +in vec2 vUv; +out vec4 fragColor; + +uniform vec2 uRes; +uniform float uTime; +uniform vec3 uPal[3]; // highlight, mid, deep +uniform float uZoom; // launch fly-in +uniform float uShelf; // 1 = top shelf showing, 0 = scrolled into the grid + +float field(vec2 d, float r) { + return exp(-dot(d, d) / (r * r)); +} + +// Rotates the hue around the grey axis (keeps brightness roughly the same). +vec3 hueRot(vec3 c, float ang) { + const vec3 k = vec3(0.57735); + float ca = cos(ang); + return max(c * ca + cross(k, c) * sin(ang) + k * dot(k, c) * (1.0 - ca), 0.0); +} + +void main() { + vec2 uv = vec2(vUv.x, 1.0 - vUv.y); // top-left origin + uv = (uv - 0.5) / uZoom + 0.5; + float aspect = uRes.x / uRes.y; + float t = uTime; + + // Gentle flow: two layers of low-frequency sine warp make the fields drift + // and bend like liquid without any visible shapes. + vec2 w = uv; + w += 0.050 * vec2(sin(uv.y * 3.1 + t * 0.110), sin(uv.x * 2.3 - t * 0.090)); + w += 0.022 * vec2(sin(uv.y * 5.7 - t * 0.070 + 1.3), sin(uv.x * 4.9 + t * 0.130 + 0.7)); + vec2 a = vec2(aspect, 1.0); + + vec3 hi = uPal[0]; + vec3 mid = uPal[1]; + vec3 deep = uPal[2]; + + // Near-black base; colour lives in a few soft fields with dark gaps between. + vec3 col = deep * 0.35 + vec3(0.003, 0.003, 0.005); + // Fields on slow Lissajous paths. Two are hue-shifted for depth, like + // Apple's dark gradients (never a single flat hue). + vec2 c0 = vec2(0.76 + 0.10 * sin(t * 0.050), 0.18 + 0.08 * cos(t * 0.043)); + vec2 c1 = vec2(0.20 + 0.12 * cos(t * 0.037 + 1.0), 0.26 + 0.10 * sin(t * 0.041)); + vec2 c2 = vec2(0.52 + 0.20 * sin(t * 0.029 + 2.0), 0.62 + 0.08 * cos(t * 0.033 + 0.5)); + vec2 c3 = vec2(0.96 + 0.05 * cos(t * 0.045), 0.88 + 0.06 * sin(t * 0.052)); + vec2 c4 = vec2(0.04 + 0.06 * sin(t * 0.031 + 4.0), 0.94 + 0.05 * cos(t * 0.027)); + col += hi * 0.34 * field((w - c0) * a, 0.40); + col += mid * 0.62 * field((w - c1) * a, 0.48); + col += hueRot(mix(mid, hi, 0.4), 0.55) * 0.34 * field((w - c2) * a, 0.38); + col += hueRot(mid, -0.70) * 0.40 * field((w - c3) * a, 0.36); + col += mid * 0.30 * field((w - c4) * a, 0.34); + + // Soft shoulder so bright palettes stay "dark mode". + col = col / (1.0 + col * 1.2); + + // Calmer at the bottom where the icons sit; dimmer when the shelf is gone. + col *= mix(1.0, 0.62, smoothstep(0.45, 1.0, uv.y)); + col *= mix(0.42, 1.0, uShelf); + vec2 v = uv - 0.5; + col *= 1.0 - 0.30 * dot(v, v); + + fragColor = vec4(col, 1.0); +} +"#; + +/// Upscales the backdrop to the window with dithering (no banding). +pub const BLIT: &str = r#" +in vec2 vUv; +out vec4 fragColor; +uniform sampler2D uScene; +uniform float uTime; + +float hash12(vec2 p) { + vec3 p3 = fract(vec3(p.xyx) * 0.1031); + p3 += dot(p3, p3.yzx + 33.33); + return fract((p3.x + p3.y) * p3.z); +} + +void main() { + vec3 col = textureLod(uScene, vUv, 0.0).rgb; + col += (hash12(gl_FragCoord.xy + fract(uTime) * 61.0) - 0.5) / 255.0; + fragColor = vec4(col, 1.0); +} +"#; + +/// One Liquid Glass panel (or one merged group of panels), drawn as a quad +/// over its bounds plus the shadow margin. +/// +/// The model follows Apple's Liquid Glass: light is *bent*, not scattered. +/// Each panel is a slab of glass (IOR ~1.5) whose edge is a convex squircle +/// bevel. The backdrop seen through it is displaced by a real refraction ray +/// (Snell), with per-channel IOR for dispersion. Bigger panels are thicker: +/// wider bevel, stronger lensing, deeper shadow. On top: Fresnel reflection, +/// a geometry-aware specular rim, light from within when focused, and +/// "materialize" (alpha ramps the lensing, not just the opacity). +/// +/// The result is written as `dst * a + rgb` (blend ONE, SRC_ALPHA), so the +/// shader never needs to read the framebuffer: shadows multiply, glass +/// replaces, and nested glass (on another pane) lights what is already there. +pub const GLASS: &str = r#" +out vec4 fragColor; + +#define MAX_GROUP 4 + +uniform sampler2D uScene; +uniform vec2 uRes; // physical px +uniform float uScale; // physical px per design px +uniform float uTime; +uniform vec2 uLight; // direction towards the key light (screen space, y down) +uniform int uCount; // members of this run (> 1 = merged group) +uniform vec4 uRect[MAX_GROUP]; // x, y, w, h (px, top-left origin) +uniform vec4 uParam[MAX_GROUP]; // radius, focus, alpha, frost (mip lod; < 0 = nested on other glass) +uniform vec4 uGlow[MAX_GROUP]; // accent rgb, unused +uniform vec4 uTint[MAX_GROUP]; // tint rgb, tint amount + +float sdRoundRect(vec2 p, vec2 b, float r) { + vec2 q = abs(p) - b + r; + return min(max(q.x, q.y), 0.0) + length(max(q, 0.0)) - r; +} + +// Analytic outward gradient of sdRoundRect. +vec2 gradRoundRect(vec2 p, vec2 b, float r) { + vec2 w = abs(p) - b + r; + vec2 q = max(w, 0.0); + vec2 g = (max(w.x, w.y) > 0.0) ? q / max(length(q), 1e-5) : ((w.x > w.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0)); + return sign(p) * g; +} + +float sdPanel(int i, vec2 p) { + vec4 R = uRect[i]; + vec2 hs = R.zw * 0.5; + float r = min(uParam[i].x, min(hs.x, hs.y)); + return sdRoundRect(p - (R.xy + hs), hs, r); +} + +// Polynomial smooth minimum: the "liquid bridge" between merged panels. +float smin(float a, float b, float k) { + float h = max(k - abs(a - b), 0.0) / k; + return min(a, b) - h * h * k * 0.25; +} + +float sdGroup(vec2 p, float k) { + float d = 1e5; + for (int i = 0; i < MAX_GROUP; i++) { + if (i >= uCount) break; + if (uParam[i].z <= 0.001) continue; + d = smin(d, sdPanel(i, p), k); + } + return d; +} + +// uv has a top-left origin; the scene texture is stored GL-style (bottom row first). +vec3 sceneAt(vec2 uv, float lod) { + uv = clamp(uv, vec2(0.001), vec2(0.999)); + return textureLod(uScene, vec2(uv.x, 1.0 - uv.y), lod).rgb; +} + +float luma(vec3 c) { return dot(c, vec3(0.2126, 0.7152, 0.0722)); } + +// Convex squircle bevel: height (0 at the rim, 1 on the flat top) and slope. +// u = distance from the rim / bevel width. +vec2 squircle(float u) { + u = clamp(u, 0.0, 1.0); + float a = 1.0 - u; + float a4 = a * a * a * a; + float h = pow(max(1.0 - a4, 1e-4), 0.25); + float dh = a * a * a * pow(max(1.0 - a4, 1e-3), -0.75); + return vec2(h, dh); +} + +// Where a vertical ray through the glass lands on the backdrop (px offset). +vec2 refractOffset(vec3 N, float height, float ior) { + vec3 t = refract(vec3(0.0, 0.0, -1.0), N, 1.0 / ior); + return t.xy / max(-t.z, 0.2) * height; +} + +void main() { + vec2 p = vec2(gl_FragCoord.x, uRes.y - gl_FragCoord.y); // px, top-left + float s = uScale; + float mergeK = 30.0 * s; + bool merged = uCount > 1; + + // Combined distance, and parameters blended towards the nearest member. + float d = 1e5; + float wsum = 0.0; + vec4 P = vec4(0.0); + vec3 accent = vec3(0.0); + vec4 tint = vec4(0.0); + vec2 center = vec2(0.0); + vec2 halfSize = vec2(0.0); + for (int k = 0; k < MAX_GROUP; k++) { + if (k >= uCount) break; + float a = uParam[k].z; + if (a <= 0.001) continue; + float dk = sdPanel(k, p); + d = merged ? smin(d, dk, mergeK) : dk; + float w = exp(-max(dk, 0.0) / (12.0 * s)) + 1e-4; + wsum += w; + P += uParam[k] * w; + accent += uGlow[k].rgb * w; + tint += uTint[k] * w; + vec4 R = uRect[k]; + center += (R.xy + R.zw * 0.5) * w; + halfSize += R.zw * 0.5 * w; + } + if (wsum <= 0.0) discard; + P /= wsum; accent /= wsum; tint /= wsum; center /= wsum; halfSize /= wsum; + + float focus = P.y; + float alpha = P.z; + float minHalf = min(halfSize.x, halfSize.y); + bool nested = P.w < 0.0; + // Size-dependent thickness: small controls are full domes (a drop of + // liquid), big panes are thick slabs with a wide rounded edge. + float bezel = min(minHalf * 0.80, 9.0 * s + minHalf * 0.10); + bezel = clamp(bezel, 5.0 * s, 40.0 * s); + float sizeK = clamp(minHalf / (240.0 * s), 0.0, 1.0); + float small = 1.0 - clamp(minHalf / (90.0 * s), 0.0, 1.0); + + // Output is dst * mul + add. + float mul = 1.0; + vec3 add = vec3(0.0); + + // ---- outside: grounding shadow and a little accent light spill ---- + if (d > 0.0) { + vec2 off = vec2(0.0, (10.0 + 18.0 * focus + 14.0 * sizeK) * s); + float ds = merged ? sdGroup(p - off, mergeK) : sdPanel(0, p - off); + float spread = (34.0 + 34.0 * focus + 50.0 * sizeK) * s * (nested ? 0.5 : 1.0); + float shadow = (1.0 - smoothstep(-spread * 0.5, spread, ds)) * (0.26 + 0.22 * focus + 0.18 * sizeK); + shadow += (1.0 - smoothstep(0.0, 6.0 * s, d)) * 0.10; + mul = 1.0 - shadow * alpha; + add = accent * exp(-d / (22.0 * s)) * focus * 0.16 * alpha; + if (d > 1.0) { + if (mul > 0.998 && dot(add, vec3(1.0)) < 0.002) discard; + fragColor = vec4(add, mul); + return; + } + } + + // ---- surface geometry ---- + vec2 n2; + if (merged) { + vec2 e = vec2(0.75, 0.0); + vec2 g2 = vec2(sdGroup(p + e.xy, mergeK) - sdGroup(p - e.xy, mergeK), + sdGroup(p + e.yx, mergeK) - sdGroup(p - e.yx, mergeK)); + n2 = g2 / max(length(g2), 1e-5); + } else { + vec4 R = uRect[0]; + vec2 hs = R.zw * 0.5; + n2 = gradRoundRect(p - (R.xy + hs), hs, min(uParam[0].x, min(hs.x, hs.y))); + } + + float inside = max(-d, 0.0); + float u = inside / bezel; + vec2 hp = squircle(u); + float thick = bezel * (1.1 + 0.3 * focus); // glass height in px + float height = thick * hp.x; + float slope = (u < 1.0) ? hp.y * thick / bezel : 0.0; + slope = min(slope, 6.0); + vec3 N = normalize(vec3(n2 * slope, 1.0)); + + // Materialize: lensing and frost ramp up with alpha instead of a plain fade. + float mat = smoothstep(0.0, 1.0, alpha); + float lens = (1.25 + 0.35 * focus) * mat; + vec2 mag = -(p - center) * (0.025 + 0.035 * focus) * mat; + float lod = abs(P.w) * mix(0.35, 1.0, mat); + + // The glass colour is affine in what is underneath: g = dst * A + B. + float A = 0.0; + vec3 B; + if (nested) { + A = 1.0; + B = vec3(0.0); + } else if (slope > 0.02) { + // Bevel: refract each channel with its own IOR (dispersion). + B.r = sceneAt((p + refractOffset(N, height, 1.46) * lens + mag) / uRes, lod).r; + B.g = sceneAt((p + refractOffset(N, height, 1.50) * lens + mag) / uRes, lod).g; + B.b = sceneAt((p + refractOffset(N, height, 1.56) * lens + mag) / uRes, lod).b; + } else { + B = sceneAt((p + mag) / uRes, lod); + } + + // ---- body ---- + // Adaptive tone: lift glass over dark content, hold it back over bright content. + float bgL = luma(sceneAt(center / uRes, 6.0)); + float kb = 1.02 + 0.10 * focus; + A *= kb; + B = B * kb + mix(0.045, -0.01, clamp(bgL * 2.0, 0.0, 1.0)) + (nested ? 0.025 : 0.0); + A *= 1.0 - tint.a; + B = mix(B, tint.rgb, tint.a); + + // Light from within when focused: starts at the center, spreads to the rim. + vec2 qn = (p - center) / max(halfSize, vec2(1.0)); + float core = exp(-dot(qn, qn) * 1.3); + vec3 inner = mix(vec3(1.0), accent, 0.45); + B += inner * focus * (0.06 + 0.12 * core); + + // Focus sheen: a soft diagonal band of light glides across the glass now and then. + float sweep = fract(uTime * 0.16 + center.x * 0.0007); + float band = (qn.x * 0.8 + qn.y * 0.45) * 0.5 + 0.5; + float sheen = exp(-pow((band - (sweep * 1.8 - 0.4)) * 7.0, 2.0)); + B += vec3(1.0) * sheen * focus * 0.10 * mat; + + // Soft vertical sheen, as if lit from above. + float vy = clamp((p.y - (center.y - halfSize.y)) / (2.0 * halfSize.y), 0.0, 1.0); + B += vec3(0.06 + 0.05 * focus) * pow(1.0 - vy, 2.5); + + // ---- light ---- + float wob = focus * 0.35 * sin(uTime * 0.9); + vec2 L2 = mat2(cos(wob), sin(wob), -sin(wob), cos(wob)) * uLight; + vec3 L = normalize(vec3(L2, 0.55)); + vec3 V = vec3(0.0, 0.0, 1.0); + + // Fresnel: steep bevel reflects the (blurred, brightened) surroundings. + float cosT = clamp(N.z, 0.0, 1.0); + float F = 0.04 + 0.96 * pow(1.0 - cosT, 5.0); + float Fm = clamp(F, 0.0, 1.0) * 0.35 * mat; + vec3 env = mix(sceneAt((p + n2 * 60.0 * s) / uRes, 5.0) * 1.6, vec3(0.92), 0.35); + A *= 1.0 - Fm; + B = mix(B, env, Fm); + + // Specular on the bevel: key light, plus a weaker bounce on the far side. + vec3 H = normalize(L + V); + vec3 H2 = normalize(vec3(-L2, 0.55) + V); + float spec = pow(max(dot(N, H), 0.0), 26.0); + float spec2 = pow(max(dot(N, H2), 0.0), 26.0); + float bevelMask = 1.0 - smoothstep(0.0, 1.0, u); + B += vec3(1.0) * (spec * 0.60 + spec2 * 0.38) * bevelMask * (0.8 + 0.6 * focus) * mat; + + // Glossy highlight on small domes, like a water drop. + vec2 hl = qn - uLight * 0.42; + float gloss = exp(-dot(hl * vec2(1.4, 2.2), hl * vec2(1.4, 2.2)) * 3.0); + B += vec3(1.0) * gloss * small * 0.14 * mat; + + // Crisp rim: a bright hairline all around, strongest towards the light + // and again on the far side where light exits the glass. + float facing = max(dot(n2, uLight), 0.0); + float away = max(dot(n2, -uLight), 0.0); + float rimLine = exp(-inside / (1.0 * s)); + float rimGlow = exp(-inside / (6.0 * s)); + B += rimLine * (0.22 + 0.80 * pow(facing, 2.0) + 0.55 * pow(away, 2.0) + 0.22 * focus) * mat; + B += rimGlow * (0.06 + 0.10 * facing + 0.06 * away + 0.08 * focus) * mat; + B += accent * rimGlow * focus * 0.10 * mat; + + // Subtle inner shade on the side away from the light gives the slab depth. + float shade = 1.0 - 0.08 * bevelMask * away * mat; + A *= shade; + B *= shade; + + float cov = clamp(0.5 - d, 0.0, 1.0) * clamp(alpha * 2.0, 0.0, 1.0); + float keep = 1.0 - cov + cov * A; + fragColor = vec4(add * keep + cov * B, mul * keep); +} +"#; diff --git a/crates/sf-launcher/src/ipc.rs b/crates/sf-launcher/src/ipc.rs new file mode 100644 index 0000000..f16240f --- /dev/null +++ b/crates/sf-launcher/src/ipc.rs @@ -0,0 +1,106 @@ +#![cfg_attr(not(unix), allow(dead_code))] +//! Tiny command socket so other SmartFox components (the remote daemon) can +//! reach the launcher even while an app has focus. +//! Protocol: one command per line: +//! `home` bring the launcher to the front +//! `remote ` Siri Remote status (no-adapter|searching|pairing|paired|connected) +//! `power` the remote's power button: into or out of standby +//! `wake` leave standby (any button, or the remote reconnected) +//! Every command is answered with the standby state (see `power::reply`). + +use crate::power; + +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum Command { + Home, + Remote(String), + Power, + Wake, + /// A standby change already made on the socket thread; effects pending. + Standby(power::Change), +} + +pub fn parse(line: &str) -> Option { + let line = line.trim(); + match line.split_once(' ') { + _ if line == "home" => Some(Command::Home), + _ if line == "power" => Some(Command::Power), + _ if line == "wake" => Some(Command::Wake), + Some(("remote", state)) => Some(Command::Remote(state.trim().to_string())), + _ => None, + } +} + +/// Standby changes happen right here, so the reply already carries the new +/// state. In standby, `home` (F12 on a keyboard) wakes instead. +fn resolve(cmd: Command) -> Command { + match cmd { + Command::Power => Command::Standby(power::press()), + Command::Wake => Command::Standby(power::wake()), + Command::Home if power::state() != power::State::Awake => Command::Standby(power::wake()), + other => other, + } +} + +#[cfg(unix)] +pub fn socket_path() -> std::path::PathBuf { + if let Ok(p) = std::env::var("SMARTFOX_SOCKET") { + return p.into(); + } + let dir = std::env::var("XDG_RUNTIME_DIR").unwrap_or_else(|_| "/tmp".into()); + std::path::Path::new(&dir).join("smartfox.sock") +} + +/// Calls `on_command` on the Slint event loop for every command received. +#[cfg(unix)] +pub fn listen(on_command: impl Fn(Command) + Send + Sync + Clone + 'static) { + use std::io::{BufRead, BufReader, Write}; + use std::os::unix::net::UnixListener; + + let path = socket_path(); + let _ = std::fs::remove_file(&path); + let listener = match UnixListener::bind(&path) { + Ok(l) => l, + Err(e) => { + log::warn!("command socket {}: {e}", path.display()); + return; + } + }; + log::info!("command socket {}", path.display()); + std::thread::spawn(move || { + for stream in listener.incoming().flatten() { + let mut reply_to = stream.try_clone().ok(); + for line in BufReader::new(stream).lines().map_while(Result::ok) { + match parse(&line) { + Some(cmd) => { + let cmd = resolve(cmd); + let f = on_command.clone(); + let _ = slint::invoke_from_event_loop(move || f(cmd)); + } + None => log::warn!("unknown command {line:?}"), + } + // Older senders don't read the reply; that's fine. + if let Some(w) = reply_to.as_mut() { + let _ = writeln!(w, "{}", power::reply()); + } + } + } + }); +} + +#[cfg(not(unix))] +pub fn listen(_on_command: impl Fn(Command) + Send + Sync + Clone + 'static) {} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn parses_commands() { + assert_eq!(parse("home\n"), Some(Command::Home)); + assert_eq!(parse("remote searching"), Some(Command::Remote("searching".into()))); + assert_eq!(parse("power"), Some(Command::Power)); + assert_eq!(parse("wake\n"), Some(Command::Wake)); + assert_eq!(parse("bogus"), None); + } +} diff --git a/crates/sf-launcher/src/keyboard.rs b/crates/sf-launcher/src/keyboard.rs new file mode 100644 index 0000000..6a4d58f --- /dev/null +++ b/crates/sf-launcher/src/keyboard.rs @@ -0,0 +1,217 @@ +//! On-screen keyboard (tvOS style, one horizontal row of keys). +//! +//! ui/keyboard.slint draws it and moves the focus; this module owns the text, +//! checks its length and hands it to whoever opened the keyboard. + +use std::cell::RefCell; + +use slint::ComponentHandle; + +use crate::App; +use crate::glass::Panel; + +pub struct Request { + pub title: String, + pub subtitle: String, + pub placeholder: String, + /// Shows dots instead of the text (with a "Megjelenítés" chip). + pub secret: bool, + pub submit_label: String, + /// Characters needed before submitting (0 = anything, even empty). + pub min_len: usize, + pub max_len: usize, + /// Shown in red under the field until the text is edited (e.g. "wrong password"). + pub error: Option, + pub on_submit: Box, +} + +struct Open { + req: Request, + text: String, + error: Option, +} + +thread_local! { + static KB: RefCell> = const { RefCell::new(None) }; +} + +/// A character that can be typed: no controls, no Slint special keys +/// (arrows etc. arrive as private-use code points). +fn typable(c: char) -> bool { + !c.is_control() && !('\u{E000}'..='\u{F8FF}').contains(&c) +} + +pub fn install(ui: &App) { + let w = ui.as_weak(); + ui.on_kb_type(move |s| { + edit(&w, |t, max| { + for c in s.chars().filter(|c| typable(*c)) { + if t.chars().count() < max { + t.push(c); + } + } + }) + }); + let w = ui.as_weak(); + ui.on_kb_delete(move || { + edit(&w, |t, _| { + t.pop(); + }) + }); + let w = ui.as_weak(); + ui.on_kb_clear(move || edit(&w, |t, _| t.clear())); + let w = ui.as_weak(); + ui.on_kb_submit(move || submit(&w)); + // Every way out (Back, submit, settings closed) lands here: forget the text. + let w = ui.as_weak(); + ui.on_kb_closed(move || { + KB.with(|k| k.borrow_mut().take()); + if let Some(ui) = w.upgrade() { + ui.set_kb_text("".into()); + ui.set_kb_masked("".into()); + } + }); +} + +pub fn open(ui: &App, req: Request) { + ui.set_kb_title(req.title.clone().into()); + ui.set_kb_subtitle(req.subtitle.clone().into()); + ui.set_kb_placeholder(req.placeholder.clone().into()); + ui.set_kb_secret(req.secret); + ui.set_kb_submit_label(req.submit_label.clone().into()); + ui.set_kb_reveal(false); + ui.set_kb_mode(0); + ui.set_kb_index(1); + ui.set_kb_area(0); + ui.set_kb_chip(0); + let error = req.error.clone(); + KB.with(|k| *k.borrow_mut() = Some(Open { req, text: String::new(), error })); + update(ui); + ui.set_kb_open(true); +} + +fn edit(w: &slint::Weak, f: impl FnOnce(&mut String, usize)) { + let Some(ui) = w.upgrade() else { return }; + let changed = KB.with(|k| { + let mut k = k.borrow_mut(); + let Some(open) = k.as_mut() else { return false }; + let before = open.text.clone(); + f(&mut open.text, open.req.max_len.max(1)); + if open.text != before { + open.error = None; + true + } else { + false + } + }); + if changed { + update(&ui); + } +} + +fn update(ui: &App) { + KB.with(|k| { + let k = k.borrow(); + let Some(open) = k.as_ref() else { return }; + let len = open.text.chars().count(); + let ok = len >= open.req.min_len; + let (hint, error) = match &open.error { + Some(e) => (e.clone(), true), + None if !ok && len == 0 => (format!("Legalább {} karakter", open.req.min_len), false), + None if !ok => (format!("Még {} karakter kell", open.req.min_len - len), false), + None if len >= open.req.max_len => (format!("Legfeljebb {} karakter", open.req.max_len), false), + None if open.req.secret => (format!("{len} karakter"), false), + None => (String::new(), false), + }; + ui.set_kb_text(open.text.clone().into()); + ui.set_kb_masked("•".repeat(len).into()); + ui.set_kb_hint(hint.into()); + ui.set_kb_hint_error(error); + ui.set_kb_can_submit(ok); + }); +} + +fn submit(w: &slint::Weak) { + let Some(ui) = w.upgrade() else { return }; + let taken = KB.with(|k| { + let mut k = k.borrow_mut(); + let ok = k.as_ref().is_some_and(|o| o.text.chars().count() >= o.req.min_len); + if ok { k.take() } else { None } + }); + let Some(open) = taken else { return }; + ui.set_kb_open(false); + (open.req.on_submit)(open.text); +} + +/// Glass for the keyboard, drawn on the settings pane. Mirrors the kb-* +/// geometry in ui/app.slint and the layout in ui/keyboard.slint. +pub fn glass(ui: &App, scale: f32) -> Vec { + let t = ui.get_kb_t() * ui.get_set_t(); + if t <= 0.001 { + return Vec::new(); + } + let u = ui.get_u(); + let px = |v: f32| v * scale; + let panel = |x: f32, y: f32, w: f32, h: f32, r: f32, focus: f32, alpha: f32, glow: [f32; 3], tint: [f32; 4]| Panel { + x: px(x), + y: px(y), + w: px(w), + h: px(h), + radius: px(r), + focus, + alpha, + blur: -1.0, + glow, + group: 0.0, + tint, + }; + let white = [1.0, 1.0, 1.0]; + let orange = [1.0, 0.48, 0.21]; + let mut out = Vec::with_capacity(9); + + // Text field. + let (fx, fy, fw, fh) = (ui.get_kb_field_x(), ui.get_kb_field_y(), ui.get_kb_field_w(), ui.get_kb_field_h()); + out.push(panel(fx, fy, fw, fh, 30.0 * u, 0.25, t, orange, [1.0, 1.0, 1.0, 0.07])); + + // Key track and the focus lens that glides along it. + let (rx, ry, rh, kw) = (ui.get_kb_row_x(), ui.get_kb_row_y(), ui.get_kb_row_h(), ui.get_kb_key_w()); + let n = ui.get_kb_n() as f32; + let track_h = rh - 28.0 * u; + out.push(panel(rx - 26.0 * u, ry + 14.0 * u, n * kw + 52.0 * u, track_h, track_h / 2.0, 0.0, t, white, [1.0, 1.0, 1.0, 0.035])); + let active = ui.get_kb_keys_active(); + let (lw, lh) = (86.0 * u, 112.0 * u); + let cx = rx + (ui.get_kb_pos() + 0.5) * kw; + out.push(panel(cx - lw / 2.0, ry + (rh - lh) / 2.0, lw, lh, 30.0 * u, active, t * active, white, [1.0, 1.0, 1.0, 0.88 * active])); + + // Chips: modes, show/clear, submit. + let (chx, chy, chw, chh, step) = + (ui.get_kb_chip_x(), ui.get_kb_chip_y(), ui.get_kb_chip_w(), ui.get_kb_chip_h(), ui.get_kb_chip_step()); + let (cpos, cactive, mode, can) = (ui.get_kb_cpos(), ui.get_kb_chips_active(), ui.get_kb_mode(), ui.get_kb_can_submit()); + for i in 0..6 { + let f = (1.0 - (cpos - i as f32).abs()).max(0.0) * cactive; + let s = 1.0 + 0.05 * f; + let (w, h) = (chw * s, chh * s); + let x = chx + i as f32 * step - (w - chw) / 2.0; + let y = chy - (h - chh) / 2.0; + let (glow, tint) = if i == 5 { + (orange, [1.0, 0.48, 0.21, if can { 0.34 + 0.56 * f } else { 0.08 + 0.2 * f }]) + } else { + let sel = if i < 4 && i == mode { 0.16 } else { 0.0 }; + (white, [1.0, 1.0, 1.0, 0.04 + sel + 0.80 * f]) + }; + out.push(panel(x, y, w, h, h / 2.0, f, t, glow, tint)); + } + out +} + +#[cfg(test)] +mod tests { + use super::typable; + + #[test] + fn filters_special_keys() { + assert!(typable('a') && typable('Ő') && typable(' ') && typable('"')); + // Slint's arrow keys, Return, Escape, Backspace. + assert!(!typable('\u{F700}') && !typable('\n') && !typable('\u{1b}') && !typable('\u{8}')); + } +} diff --git a/crates/sf-launcher/src/main.rs b/crates/sf-launcher/src/main.rs new file mode 100644 index 0000000..14f9590 --- /dev/null +++ b/crates/sf-launcher/src/main.rs @@ -0,0 +1,560 @@ +//! SmartFox launcher. +//! +//! Slint draws text and icons; the `glass` module draws the animated backdrop +//! and frosted glass panels underneath via a rendering notifier. + +mod glass; +mod ipc; +mod devshot; +mod keyboard; +mod power; +mod runtime; +mod settings_screen; +mod system; +#[cfg(windows)] +mod winfade; + +use std::cell::RefCell; +use std::path::{Path, PathBuf}; +use std::rc::Rc; +use std::time::{Duration, Instant}; + +use anyhow::{Context, Result}; +use chrono::{Datelike, Local, Timelike}; +use glass::{Frame, GlassRenderer, Panel}; +use sf_ipc::{AppKind, AppManifest, Settings}; +use slint::{ComponentHandle, Model, ModelRc, SharedString, VecModel}; + +slint::include_modules!(); + +/// Time constant of the backdrop colour change when focus moves (seconds). +const CROSSFADE: f32 = 0.35; + +struct Options { + apps_dir: PathBuf, + settings_path: PathBuf, + fullscreen: bool, +} + +fn parse_args() -> Options { + let mut apps_dir = None; + let mut settings_path = None; + let mut fullscreen = false; + let mut args = std::env::args().skip(1); + while let Some(a) = args.next() { + match a.as_str() { + "--apps" => apps_dir = args.next().map(PathBuf::from), + "--settings" => settings_path = args.next().map(PathBuf::from), + "--fullscreen" | "-f" => fullscreen = true, + other => log::warn!("unknown argument {other}"), + } + } + Options { + apps_dir: apps_dir.or_else(find_apps_dir).unwrap_or_else(|| PathBuf::from("/usr/share/smartfox/apps")), + settings_path: settings_path.unwrap_or_else(default_settings_path), + fullscreen, + } +} + +/// Looks for an `apps` folder next to the binary or in a parent of the cwd (dev checkout). +fn find_apps_dir() -> Option { + let mut starts = vec![]; + if let Ok(cwd) = std::env::current_dir() { + starts.push(cwd); + } + if let Ok(exe) = std::env::current_exe() { + starts.extend(exe.parent().map(Path::to_path_buf)); + } + for start in starts { + for dir in start.ancestors() { + let candidate = dir.join("apps"); + if candidate.join("netflex").is_dir() { + return Some(candidate); + } + } + } + None +} + +fn default_settings_path() -> PathBuf { + if let Ok(p) = std::env::var("SMARTFOX_SETTINGS") { + return p.into(); + } + let base = std::env::var_os("XDG_CONFIG_HOME") + .map(PathBuf::from) + .or_else(|| std::env::var_os("APPDATA").map(PathBuf::from)) + .or_else(|| std::env::var_os("HOME").map(|h| PathBuf::from(h).join(".config"))) + .unwrap_or_else(|| PathBuf::from(".")); + base.join("smartfox").join("settings.toml") +} + +fn parse_hex(hex: &str) -> [f32; 3] { + let h = hex.trim_start_matches('#'); + let v = u32::from_str_radix(h.get(..6).unwrap_or("ffffff"), 16).unwrap_or(0xffffff); + [((v >> 16) & 0xff) as f32 / 255.0, ((v >> 8) & 0xff) as f32 / 255.0, (v & 0xff) as f32 / 255.0] +} + +fn to_color(rgb: [f32; 3]) -> slint::Color { + slint::Color::from_rgb_u8((rgb[0] * 255.0) as u8, (rgb[1] * 255.0) as u8, (rgb[2] * 255.0) as u8) +} + +/// Backdrop palette (highlight, mid, deep) as linear floats. +fn palette_of(app: &AppManifest) -> [f32; 9] { + let fallback = ["#9aa4b5", "#2a3140", "#06070a"]; + let mut out = [0.0; 9]; + for i in 0..3 { + let hex = app.palette.get(i).map(String::as_str).unwrap_or(fallback[i]); + out[i * 3..i * 3 + 3].copy_from_slice(&parse_hex(hex)); + } + out +} + +fn entry_of(app: &AppManifest, settings: &Settings) -> AppEntry { + let (kind, kind_label, target) = match app.kind { + AppKind::Web => ("web", "Webes alkalmazás (Chromium)", app.resolved_url(settings).unwrap_or_default()), + AppKind::Exec => ("exec", "Natív alkalmazás", app.exec.clone().unwrap_or_default().join(" ")), + AppKind::Builtin => ("builtin", "Beépített", String::new()), + }; + AppEntry { + id: app.id.clone().into(), + name: app.name.clone().into(), + category: app.category.clone().into(), + description: app.description.clone().into(), + icon: app.icon.clone().into(), + accent: to_color(parse_hex(&app.accent)), + kind: kind.into(), + kind_label: kind_label.into(), + target: target.into(), + } +} + +/// Backdrop colours, eased towards the focused app's palette every frame. +struct Backdrop { + palette: [f32; 9], + last: f32, +} + +fn color_rgb(c: slint::Color) -> [f32; 3] { + [c.red() as f32 / 255.0, c.green() as f32 / 255.0, c.blue() as f32 / 255.0] +} + +fn rect_from_slint(g: &GlassRect, scale: f32) -> Panel { + Panel { + x: g.x * scale, + y: g.y * scale, + w: g.w * scale, + h: g.h * scale, + radius: g.r * scale, + focus: g.focus, + alpha: g.alpha, + blur: g.blur, + glow: color_rgb(g.glow), + group: g.group as f32, + tint: { + let [r, gr, b] = color_rgb(g.tint); + [r, gr, b, g.tint.alpha() as f32 / 255.0] + }, + } +} + +/// Mirrors the card formulas in ui/app.slint (`for app[i] in root.apps`). +/// +/// Draw order: the other cards, then the focused one, then the context menu. +/// While the menu is out, the focused card and the menu share a merge group, +/// so the menu buds out of the icon like a droplet. +fn card_rects(ui: &App, scale: f32, accents: &[[f32; 3]]) -> Vec { + let u = ui.get_u(); + let cols = ui.get_cols().max(1) as usize; + let (row_x, row_y, step) = (ui.get_row_x(), ui.get_row_y(), ui.get_row_step()); + let (cw, ch, gap, radius) = (ui.get_card_w(), ui.get_card_h(), ui.get_card_gap(), ui.get_card_r()); + let (fx, fy, active, intro) = (ui.get_focus_x(), ui.get_focus_y(), ui.get_row_active(), ui.get_intro()); + let (lift, press_in, press) = (ui.get_lift(), ui.get_press_in(), ui.get_press()); + let scroll = ui.get_grid_scroll(); + let menu_t = ui.get_menu_t().clamp(0.0, 1.0); + let focus_index = ui.get_focus_index().max(0) as usize; + let hidden = (1.0 - ui.get_launch_t()) * (1.0 - ui.get_sheet_t()) * ui.get_dim(); + let card = |i: usize, accent: &[f32; 3]| { + let (col, row) = ((i % cols) as f32, (i / cols) as f32); + let f = (1.0 - (fx - col).abs()).max(0.0) * (1.0 - (fy - row).abs()).max(0.0) * active; + let s = 1.0 + (lift - press_in * press) * f; + let appear = (intro * 2.2 - col * 0.12 - row * 0.2 - 0.4).clamp(0.0, 1.0); + let others = if i == focus_index { 1.0 } else { 1.0 - 0.55 * menu_t }; + let (w, h) = (cw * s, ch * s); + let x = row_x + col * (cw + gap) + (cw - w) / 2.0; + let y = row_y + row * step - scroll + (ch - h) / 2.0 + (1.0 - appear) * 60.0 * u; + // Coloured glass in the app's accent; focus makes it brighter and lighter. + let tint = accent.map(|c| { + let c = c * 0.72; + c + (1.0 - c) * 0.22 * f + }); + Panel { + x: x * scale, + y: y * scale, + w: w * scale, + h: h * scale, + radius: radius * s * scale, + focus: f, + alpha: appear * others * hidden, + blur: 1.2 - 0.3 * f, + glow: *accent, + group: 0.0, + tint: [tint[0], tint[1], tint[2], 0.38 + 0.12 * f], + } + }; + let mut out: Vec = + accents.iter().enumerate().filter(|(i, _)| *i != focus_index).map(|(i, a)| card(i, a)).collect(); + if let Some(accent) = accents.get(focus_index) { + let mut focused = card(focus_index, accent); + if menu_t > 0.001 { + focused.group = 2.0; + } + out.push(focused); + } + if menu_t > 0.001 { + out.extend(ui.get_glass_menu().iter().map(|g| rect_from_slint(&g, scale))); + } + out +} + +const DAYS: [&str; 7] = ["hétfő", "kedd", "szerda", "csütörtök", "péntek", "szombat", "vasárnap"]; +const MONTHS: [&str; 12] = ["jan.", "febr.", "márc.", "ápr.", "máj.", "jún.", "júl.", "aug.", "szept.", "okt.", "nov.", "dec."]; + +fn update_clock(ui: &App) { + let now = Local::now(); + ui.set_clock(format!("{:02}:{:02}", now.hour(), now.minute()).into()); + ui.set_date( + format!( + "{}, {} {}.", + DAYS[now.weekday().num_days_from_monday() as usize], + MONTHS[now.month0() as usize], + now.day() + ) + .into(), + ); +} + +/// Remote status from sf-remote: drives the pairing guide and the settings row. +fn on_remote_state(ui: &App, state: &str) { + if ui.get_remote_state() != state { + log::info!("remote: {state}"); + } + ui.set_remote_state(state.into()); + ui.set_remote_status( + match state { + "no-adapter" => "Nincs Bluetooth adapter", + "searching" => "Nincs párosítva · keresés", + "pairing" => "Párosítás…", + "paired" => "Párosítva · alszik", + "connected" => "Csatlakozva", + other => other, + } + .into(), + ); + match state { + // No remote yet: show the guide (unless skipped this session). + "searching" | "pairing" | "no-adapter" => { + if !ui.get_pairing_skipped() { + ui.set_settings_open(false); + ui.set_pairing_open(true); + } + log::debug!( + "pairing guide: open={} skipped={} t={}", + ui.get_pairing_open(), + ui.get_pairing_skipped(), + ui.get_pair_t() + ); + } + // Paired: let the success state show for a moment, then close. + "paired" | "connected" if ui.get_pairing_open() => { + let weak = ui.as_weak(); + slint::Timer::single_shot(Duration::from_millis(2200), move || { + if let Some(ui) = weak.upgrade() { + ui.set_pairing_open(false); + } + }); + } + _ => {} + } + if let Some(screen) = settings_screen::current() { + screen.set_remote_status(&ui.get_remote_status()); + } +} + +fn show_toast(ui: &App, text: impl Into, timer: &slint::Timer) { + ui.set_toast_text(text.into()); + ui.set_toast_shown(true); + let weak = ui.as_weak(); + timer.start(slint::TimerMode::SingleShot, Duration::from_millis(2800), move || { + if let Some(ui) = weak.upgrade() { + ui.set_toast_shown(false); + } + }); +} + +fn main() -> Result<()> { + env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("info")).init(); + let opts = parse_args(); + + // The glass layer needs an OpenGL context, which the FemtoVG renderer provides + // on both winit (desktop) and linuxkms (TV). + slint::BackendSelector::new() + .renderer_name("femtovg".into()) + .select() + .context("selecting the femtovg (OpenGL) renderer")?; + + let mut settings = Settings::load(&opts.settings_path).unwrap_or_else(|e| { + log::warn!("settings: {e:#}"); + Settings::default() + }); + if settings.get("netflex_server").is_none() { + settings.values.insert("netflex_server".into(), "http://localhost:7880".into()); + } + let data_dir = opts.settings_path.parent().map(Path::to_path_buf).unwrap_or_else(|| PathBuf::from(".")); + + let apps = sf_ipc::load_apps(&opts.apps_dir).with_context(|| format!("loading apps from {}", opts.apps_dir.display()))?; + log::info!("{} apps from {}", apps.len(), opts.apps_dir.display()); + + let ui = App::new()?; + let entries: Vec = apps.iter().map(|a| entry_of(a, &settings)).collect(); + ui.set_apps(ModelRc::new(VecModel::from(entries))); + let _screen = settings_screen::Screen::install(&ui, opts.settings_path.clone()); + keyboard::install(&ui); + power::configure_from(&settings); + power::install(&ui, opts.settings_path.clone()); + // The TV mode chosen in settings (wlr-randr; only inside the compositor). + if let Some(mode) = settings.get("display_mode").map(str::to_string) { + if !system::demo() && std::env::var_os("WAYLAND_DISPLAY").is_some() { + std::thread::spawn(move || { + if let Err(e) = system::apply_saved_mode(&mode) { + log::warn!("display: {e:#}"); + } + }); + } + } + update_clock(&ui); + + let clock_timer = slint::Timer::default(); + { + let weak = ui.as_weak(); + clock_timer.start(slint::TimerMode::Repeated, Duration::from_secs(1), move || { + if let Some(ui) = weak.upgrade() { + update_clock(&ui); + } + }); + } + + // Launching. Locally the launcher starts apps itself; on the TV this moves to sf-core. + let toast_timer = Rc::new(slint::Timer::default()); + let running: Rc>> = Rc::default(); + { + let weak = ui.as_weak(); + let apps = apps.clone(); + let settings = settings.clone(); + let toast_timer = toast_timer.clone(); + let running = running.clone(); + let data_dir = data_dir.clone(); + let fullscreen = opts.fullscreen; + ui.on_launch(move |index| { + let Some(ui) = weak.upgrade() else { return }; + let Some(app) = apps.get(index as usize) else { return }; + if let Some((_, mut old)) = running.borrow_mut().take() { + runtime::stop(&mut old); + } + ui.set_launch_detail("indítása…".into()); + ui.set_app_ready(false); + let pos = ui.window().position(); + let size = ui.window().size(); + let opts = runtime::LaunchOptions { + data_dir: &data_dir, + fullscreen, + bounds: Some((pos.x, pos.y, size.width, size.height)), + }; + match runtime::launch(app, &settings, &opts) { + Ok(child) => { + log::info!("started {} (pid {})", app.id, child.id()); + #[cfg(windows)] + { + // Keep the window hidden until the morph finishes and the page loads. + let weak = ui.as_weak(); + let not_before = std::time::Instant::now() + Duration::from_millis(950); + winfade::reveal_when_ready(child.id(), not_before, move || { + let _ = weak.upgrade_in_event_loop(|ui| ui.set_app_ready(true)); + }); + } + *running.borrow_mut() = Some((app.name.clone(), child)); + } + Err(e) => { + log::error!("launch {}: {e:#}", app.id); + ui.set_launching(false); + show_toast(&ui, format!("{}: {e:#}", app.name), &toast_timer); + } + } + }); + } + { + let running = running.clone(); + ui.on_cancel_launch(move || { + if let Some((name, mut child)) = running.borrow_mut().take() { + log::info!("closing {name}"); + runtime::stop(&mut child); + } + }); + } + // Global "home" (remote's TV button): close the foreground app and play the reverse morph. + { + let weak = ui.as_weak(); + ipc::listen(move |cmd| { + let Some(ui) = weak.upgrade() else { return }; + match cmd { + ipc::Command::Home => { + log::info!("home"); + ui.invoke_cancel_launch(); + ui.set_launching(false); + ui.set_app_ready(false); + ui.set_sheet_open(false); + ui.set_settings_open(false); + } + ipc::Command::Remote(state) => on_remote_state(&ui, &state), + ipc::Command::Standby(change) => power::apply(change), + // Resolved into Standby on the socket thread. + ipc::Command::Power | ipc::Command::Wake => {} + } + }); + } + // Windows/dev: walk through the pairing guide without a remote. + if std::env::var_os("SMARTFOX_DEMO_PAIRING").is_some() { + for (ms, state) in [(1500, "searching"), (7000, "pairing"), (10000, "connected")] { + let weak = ui.as_weak(); + slint::Timer::single_shot(Duration::from_millis(ms), move || { + if let Some(ui) = weak.upgrade() { + on_remote_state(&ui, state); + } + }); + } + } + // Back to the home screen when the app exits on its own. + let app_watch = slint::Timer::default(); + { + let weak = ui.as_weak(); + let running = running.clone(); + let toast_timer = toast_timer.clone(); + app_watch.start(slint::TimerMode::Repeated, Duration::from_millis(400), move || { + let mut slot = running.borrow_mut(); + let Some((name, child)) = slot.as_mut() else { return }; + if let Ok(Some(status)) = child.try_wait() { + log::info!("{name} exited ({status})"); + let name = name.clone(); + *slot = None; + if let Some(ui) = weak.upgrade() { + #[cfg(windows)] + winfade::focus_self(); + // Reverse morph: the full-screen glass shrinks back into the card. + ui.set_launching(false); + ui.set_app_ready(false); + show_toast(&ui, format!("{name} bezárva"), &toast_timer); + } + } + }); + } + + if opts.fullscreen { + ui.window().set_fullscreen(true); + } + let snapshot = devshot::setup(&ui); + + // Glass layer. + let palettes: Vec<[f32; 9]> = apps.iter().map(palette_of).collect(); + let accents: Vec<[f32; 3]> = apps.iter().map(|a| parse_hex(&a.accent)).collect(); + let start = Instant::now(); + let backdrop = Rc::new(RefCell::new(Backdrop { palette: palettes.first().copied().unwrap_or([0.0; 9]), last: 0.0 })); + let renderer: Rc>> = Rc::default(); + let frames = Rc::new(RefCell::new((Instant::now(), 0u32))); + + let weak = ui.as_weak(); + ui.window() + .set_rendering_notifier(move |state, api| match state { + slint::RenderingState::RenderingSetup => { + let slint::GraphicsAPI::NativeOpenGL { get_proc_address } = api else { + log::error!("glass layer needs OpenGL; running without it"); + return; + }; + let gl = unsafe { glow::Context::from_loader_function_cstr(|s| get_proc_address(s)) }; + match unsafe { GlassRenderer::new(gl) } { + Ok(r) => *renderer.borrow_mut() = Some(r), + Err(e) => log::error!("glass layer disabled: {e:#}"), + } + } + slint::RenderingState::BeforeRendering => { + let mut guard = renderer.borrow_mut(); + let (Some(ui), Some(r)) = (weak.upgrade(), guard.as_mut()) else { + return; + }; + let time = start.elapsed().as_secs_f32(); + let size = ui.window().size(); + let scale = ui.window().scale_factor(); + + let mut bd = backdrop.borrow_mut(); + let focus = ui.get_focus_index().max(0) as usize; + if let Some(target) = palettes.get(focus) { + let k = 1.0 - (-(time - bd.last).max(0.0) / CROSSFADE).exp(); + for (c, t) in bd.palette.iter_mut().zip(target) { + *c += (t - *c) * k; + } + } + bd.last = time; + + let mut rects: Vec = + ui.get_glass_under().iter().map(|g| rect_from_slint(&g, scale)).collect(); + rects.extend(card_rects(&ui, scale, &accents)); + rects.extend(ui.get_glass_over().iter().map(|g| rect_from_slint(&g, scale))); + rects.extend(settings_screen::glass(&ui, scale)); + rects.extend(keyboard::glass(&ui, scale)); + // Each visible panel is one small draw; hidden ones are skipped. + rects.retain(|p| p.alpha > 0.002); + + // Light sweeps gently and follows the focused card. + let angle = -2.25 + 0.10 * (time * 0.35).sin() + (ui.get_focus_x() - 2.0) * 0.06; + + let frame = Frame { + width: size.width, + height: size.height, + scale, + time, + palette: bd.palette, + shelf: ui.get_shelf_t(), + light: [angle.cos(), angle.sin()], + zoom: 1.0 + 0.35 * ui.get_launch_t() * ui.get_launch_t(), + rects, + }; + drop(bd); + // SAFETY: called on the UI thread with the Slint GL context current. + unsafe { r.render(&frame) }; + + let mut fps = frames.borrow_mut(); + fps.1 += 1; + if fps.0.elapsed() >= Duration::from_secs(5) { + log::debug!("{:.1} fps", fps.1 as f32 / fps.0.elapsed().as_secs_f32()); + *fps = (Instant::now(), 0); + } + } + slint::RenderingState::AfterRendering => { + // The backdrop is animated, so keep frames coming (vsync-limited). + if let Some(ui) = weak.upgrade() { + if let Some(r) = renderer.borrow().as_ref() { + snapshot.capture_if_due(&ui, r); + } + ui.window().request_redraw(); + } + } + slint::RenderingState::RenderingTeardown => { + if let Some(mut r) = renderer.borrow_mut().take() { + unsafe { r.destroy() }; + } + } + _ => {} + }) + .map_err(|e| anyhow::anyhow!("rendering notifier: {e:?}"))?; + + ui.run()?; + Ok(()) +} diff --git a/crates/sf-launcher/src/power.rs b/crates/sf-launcher/src/power.rs new file mode 100644 index 0000000..9b95a22 --- /dev/null +++ b/crates/sf-launcher/src/power.rs @@ -0,0 +1,298 @@ +//! Standby: what the remote's power button does (Settings > Energia). +//! +//! The launcher owns the standby state; sf-remote asks for changes over the +//! command socket (`power`, `wake`) and gets the state back after every +//! command (`standby off|screen|suspend `). The launcher runs as `tv` and +//! can't suspend the machine, so sf-remote (root) does that when it sees a new +//! `suspend `; it also wakes us when the remote reconnects after a resume. +//! +//! - Képernyő (Screen): the TV output is switched off, everything keeps running. +//! - Alvó mód (Suspend): screen off, then the machine suspends. +//! - Auto: screen off, and after `suspend_after` minutes the machine suspends. + +use std::cell::{Cell, RefCell}; +use std::path::PathBuf; +use std::rc::Rc; +use std::sync::Mutex; +use std::time::{Duration, Instant, SystemTime}; + +use slint::ComponentHandle; + +use crate::App; +use crate::system; + +/// Settings keys. +pub const MODE_KEY: &str = "power_button"; +pub const AFTER_KEY: &str = "suspend_after_min"; +pub const AFTER_CHOICES: [u32; 5] = [5, 15, 30, 60, 120]; +const DEFAULT_AFTER: u32 = 15; + +/// After a resume nobody asked for (no remote reconnected), sleep again. +const RESUSPEND_AFTER: Duration = Duration::from_secs(45); + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Mode { + Screen, + Suspend, + Auto, +} + +impl Mode { + pub const ALL: [Mode; 3] = [Mode::Screen, Mode::Suspend, Mode::Auto]; + + pub fn key(self) -> &'static str { + match self { + Mode::Screen => "screen", + Mode::Suspend => "suspend", + Mode::Auto => "auto", + } + } + + pub fn from_key(key: &str) -> Option { + Mode::ALL.into_iter().find(|m| m.key() == key) + } + + pub fn label(self) -> &'static str { + match self { + Mode::Screen => "Képernyő kikapcsolása", + Mode::Suspend => "Alvó mód", + Mode::Auto => "Képernyő ki, később alvás", + } + } + + pub fn detail(self) -> &'static str { + match self { + Mode::Screen => "A gép bekapcsolva marad, azonnal ébred", + Mode::Suspend => "A legkevesebb áram, Bluetooth-ébresztéssel", + Mode::Auto => "Előbb csak a képernyő alszik, aztán a gép is", + } + } +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum State { + Awake, + /// Screen off, machine running. + Screen, + /// Machine asked to suspend (sf-remote does it). + Suspend, +} + +struct Shared { + mode: Mode, + after_min: u32, + state: State, + /// Bumped on every suspend request, so sf-remote sees each one. + generation: u64, +} + +static SHARED: Mutex = + Mutex::new(Shared { mode: Mode::Screen, after_min: DEFAULT_AFTER, state: State::Awake, generation: 0 }); + +pub type Change = (State, State); + +fn set(s: &mut Shared, next: State) -> Change { + let prev = s.state; + if next == State::Suspend && prev != State::Suspend { + s.generation += 1; + } + s.state = next; + (prev, next) +} + +pub fn configure(mode: Mode, after_min: u32) { + let mut s = SHARED.lock().unwrap(); + s.mode = mode; + s.after_min = after_min.max(1); +} + +/// Reads the mode and delay from settings.toml values. +pub fn configure_from(settings: &sf_ipc::Settings) { + let mode = settings.get(MODE_KEY).and_then(Mode::from_key).unwrap_or(Mode::Screen); + let after = settings.get(AFTER_KEY).and_then(|v| v.parse().ok()).unwrap_or(DEFAULT_AFTER); + configure(mode, after); +} + +pub fn mode() -> Mode { + SHARED.lock().unwrap().mode +} + +pub fn after_min() -> u32 { + SHARED.lock().unwrap().after_min +} + +pub fn state() -> State { + SHARED.lock().unwrap().state +} + +/// Line sent back to sf-remote after every command. +#[cfg_attr(not(unix), allow(dead_code))] +pub fn reply() -> String { + let s = SHARED.lock().unwrap(); + match s.state { + State::Awake => "standby off".into(), + State::Screen => "standby screen".into(), + State::Suspend => format!("standby suspend {}", s.generation), + } +} + +/// Power button: into standby (per the mode) or back out of it. +pub fn press() -> Change { + let mut s = SHARED.lock().unwrap(); + let next = match (s.state, s.mode) { + (State::Awake, Mode::Suspend) => State::Suspend, + (State::Awake, _) => State::Screen, + _ => State::Awake, + }; + set(&mut s, next) +} + +/// Any button (or the remote reconnecting) while in standby. +pub fn wake() -> Change { + set(&mut SHARED.lock().unwrap(), State::Awake) +} + +/// Auto mode: the screen has been off long enough. +fn auto_suspend() -> Change { + let mut s = SHARED.lock().unwrap(); + let next = if s.state == State::Screen { State::Suspend } else { s.state }; + set(&mut s, next) +} + +/// Woke up without anyone asking: ask sf-remote to suspend again. +fn resuspend() -> bool { + let mut s = SHARED.lock().unwrap(); + if s.state != State::Suspend { + return false; + } + s.generation += 1; + true +} + +// ---- effects on the UI thread ------------------------------------------------ + +struct Effects { + ui: slint::Weak, + settings_path: PathBuf, + auto_timer: slint::Timer, + resuspend_timer: slint::Timer, + resume_watch: slint::Timer, +} + +thread_local! { + static EFFECTS: RefCell>> = const { RefCell::new(None) }; +} + +pub fn install(ui: &App, settings_path: PathBuf) { + let fx = Rc::new(Effects { + ui: ui.as_weak(), + settings_path, + auto_timer: slint::Timer::default(), + resuspend_timer: slint::Timer::default(), + resume_watch: slint::Timer::default(), + }); + EFFECTS.with(|e| *e.borrow_mut() = Some(fx.clone())); + + ui.on_wake_requested(|| apply(wake())); + + // Instant stands still while suspended, the wall clock doesn't: a jump + // between them means the machine just resumed. + let last = Cell::new((Instant::now(), SystemTime::now())); + fx.resume_watch.start(slint::TimerMode::Repeated, Duration::from_secs(2), move || { + let (mono, wall) = (Instant::now(), SystemTime::now()); + let (last_mono, last_wall) = last.replace((mono, wall)); + let slept = wall.duration_since(last_wall).unwrap_or_default().saturating_sub(mono - last_mono); + if slept > Duration::from_secs(5) { + on_resume(slept); + } + }); +} + +fn on_resume(slept: Duration) { + log::info!("power: resumed after ~{} s, state {:?}", slept.as_secs(), state()); + if state() != State::Suspend { + return; + } + // A real wake comes with the remote reconnecting (sf-remote sends `wake`). + // Otherwise something else woke us (a stray Bluetooth advert, the RTC): + // stay dark and go back to sleep. + EFFECTS.with(|e| { + let Some(fx) = e.borrow().clone() else { return }; + fx.resuspend_timer.start(slint::TimerMode::SingleShot, RESUSPEND_AFTER, || { + if resuspend() { + log::info!("power: nobody woke us, suspending again"); + } + }); + }); +} + +/// Runs the side effects of a state change. Call on the UI thread. +pub fn apply((prev, next): Change) { + if prev == next { + return; + } + log::info!("power: {prev:?} -> {next:?} (mode {:?})", mode()); + let Some(fx) = EFFECTS.with(|e| e.borrow().clone()) else { return }; + let Some(ui) = fx.ui.upgrade() else { return }; + + if prev == State::Awake { + ui.set_standby(true); + std::thread::spawn(|| { + if let Err(e) = system::display_power(false, None) { + log::warn!("power: screen off: {e:#}"); + } + }); + } + match next { + State::Screen if mode() == Mode::Auto => { + let after = Duration::from_secs(60 * after_min() as u64); + fx.auto_timer.start(slint::TimerMode::SingleShot, after, || apply(auto_suspend())); + } + State::Suspend => log::info!("power: suspend requested, sf-remote puts the machine to sleep"), + State::Awake => { + fx.auto_timer.stop(); + fx.resuspend_timer.stop(); + ui.set_standby(false); + let saved = sf_ipc::Settings::load(&fx.settings_path) + .ok() + .and_then(|s| s.get("display_mode").map(str::to_string)); + std::thread::spawn(move || { + if let Err(e) = system::display_power(true, saved.as_deref()) { + log::warn!("power: screen on: {e:#}"); + } + }); + } + State::Screen => {} + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn power_button_cycle() { + // One test touches the shared state, so the steps don't race. + configure(Mode::Screen, 15); + assert_eq!(press(), (State::Awake, State::Screen)); + assert_eq!(reply(), "standby screen"); + assert_eq!(press(), (State::Screen, State::Awake)); + assert_eq!(reply(), "standby off"); + + configure(Mode::Suspend, 15); + let g = SHARED.lock().unwrap().generation; + assert_eq!(press(), (State::Awake, State::Suspend)); + assert_eq!(reply(), format!("standby suspend {}", g + 1)); + assert!(resuspend()); + assert_eq!(reply(), format!("standby suspend {}", g + 2)); + assert_eq!(wake(), (State::Suspend, State::Awake)); + assert!(!resuspend()); + + configure(Mode::Auto, 5); + assert_eq!(press(), (State::Awake, State::Screen)); + assert_eq!(auto_suspend(), (State::Screen, State::Suspend)); + assert_eq!(wake().1, State::Awake); + assert_eq!(Mode::from_key("auto"), Some(Mode::Auto)); + configure(Mode::Screen, 15); + } +} diff --git a/crates/sf-launcher/src/runtime.rs b/crates/sf-launcher/src/runtime.rs new file mode 100644 index 0000000..1b0f320 --- /dev/null +++ b/crates/sf-launcher/src/runtime.rs @@ -0,0 +1,187 @@ +//! Starts apps. Web apps run in a Chromium-family browser in app/kiosk mode +//! with a per-app profile; exec apps are spawned directly. +//! +//! This lives in the launcher for local testing; on the TV it moves into the +//! sf-core daemon (systemd scopes, freeze/thaw). + +use std::path::{Path, PathBuf}; +use std::process::{Child, Command}; + +use anyhow::{Context, Result, bail}; +use sf_ipc::{AppKind, AppManifest, Settings}; + +pub struct Browser { + pub exe: PathBuf, + /// Full version, used to build a realistic user agent. + pub version: String, +} + +pub fn find_browser() -> Option { + let mut candidates: Vec = Vec::new(); + if let Ok(p) = std::env::var("SMARTFOX_BROWSER") { + candidates.push(p.into()); + } + #[cfg(windows)] + { + for base in ["ProgramFiles", "ProgramFiles(x86)", "LOCALAPPDATA"] { + if let Some(b) = std::env::var_os(base) { + let b = PathBuf::from(b); + candidates.push(b.join(r"Google\Chrome\Application\chrome.exe")); + candidates.push(b.join(r"Chromium\Application\chrome.exe")); + candidates.push(b.join(r"Microsoft\Edge\Application\msedge.exe")); + } + } + } + #[cfg(not(windows))] + { + for name in ["chromium", "chromium-browser", "google-chrome-stable", "google-chrome"] { + for dir in ["/usr/bin", "/usr/local/bin", "/snap/bin"] { + candidates.push(Path::new(dir).join(name)); + } + } + } + let exe = candidates.into_iter().find(|p| p.is_file())?; + let version = browser_version(&exe).unwrap_or_else(|| "141.0.0.0".into()); + Some(Browser { exe, version }) +} + +fn browser_version(exe: &Path) -> Option { + // Windows installs keep a folder named after the version next to the exe. + if cfg!(windows) { + let dir = exe.parent()?; + let mut versions: Vec = std::fs::read_dir(dir) + .ok()? + .flatten() + .filter_map(|e| e.file_name().into_string().ok()) + .filter(|n| n.split('.').count() == 4 && n.split('.').all(|p| p.parse::().is_ok())) + .collect(); + versions.sort_by_key(|v| v.split('.').map(|p| p.parse::().unwrap_or(0)).collect::>()); + return versions.pop(); + } + let out = Command::new(exe).arg("--version").output().ok()?; + String::from_utf8_lossy(&out.stdout) + .split_whitespace() + .find(|w| w.chars().next().is_some_and(|c| c.is_ascii_digit()) && w.contains('.')) + .map(str::to_string) +} + +fn default_user_agent(version: &str) -> String { + let platform = if cfg!(windows) { "Windows NT 10.0; Win64; x64" } else { "X11; Linux x86_64" }; + let major = version.split('.').next().unwrap_or("141"); + format!("Mozilla/5.0 ({platform}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{major}.0.0.0 Safari/537.36") +} + +pub struct LaunchOptions<'a> { + pub data_dir: &'a Path, + pub fullscreen: bool, + /// Windowed mode: open the app exactly over the launcher (x, y, w, h). + pub bounds: Option<(i32, i32, u32, u32)>, +} + +pub fn launch(app: &AppManifest, settings: &Settings, opts: &LaunchOptions) -> Result { + match app.kind { + AppKind::Web => launch_web(app, settings, opts), + AppKind::Exec => { + let cmd = app.exec.as_deref().unwrap_or_default(); + let (prog, args) = cmd.split_first().context("empty exec command")?; + Command::new(prog).args(args).spawn().with_context(|| format!("starting {prog}")) + } + AppKind::Builtin => bail!("built-in app has no process"), + } +} + +/// First-run preferences for an app profile: no translate prompt, Hungarian +/// content language. Existing profiles are left alone. +fn seed_profile(profile: &Path) -> Result<()> { + let prefs = profile.join("Default").join("Preferences"); + if prefs.exists() { + return Ok(()); + } + std::fs::create_dir_all(prefs.parent().unwrap())?; + std::fs::write( + &prefs, + r#"{"translate":{"enabled":false},"intl":{"accept_languages":"hu-HU,hu,en"},"browser":{"has_seen_welcome_page":true}}"#, + )?; + Ok(()) +} + +fn launch_web(app: &AppManifest, settings: &Settings, opts: &LaunchOptions) -> Result { + let browser = find_browser().context("no Chromium/Chrome/Edge found (set SMARTFOX_BROWSER)")?; + let url = app.resolved_url(settings).filter(|u| !u.is_empty()).context("app has no URL")?; + if url.starts_with('/') { + bail!("URL is not set (check settings: {url})"); + } + let profile = opts.data_dir.join("profiles").join(&app.id); + seed_profile(&profile)?; + + let ua = match (&app.web.user_agent, &app.web.user_agent_suffix) { + (Some(ua), _) => ua.clone(), + (None, Some(suffix)) => format!("{} {suffix}", default_user_agent(&browser.version)), + (None, None) => default_user_agent(&browser.version), + }; + + let mut cmd = Command::new(&browser.exe); + cmd.arg(format!("--user-data-dir={}", profile.display())) + .arg(format!("--user-agent={ua}")) + .arg("--no-first-run") + .arg("--no-default-browser-check") + .arg("--disable-session-crashed-bubble") + .arg("--hide-crash-restore-bubble") + .arg("--disable-features=Translate,TranslateUI,MediaRouter") + .arg("--lang=hu") + .arg("--accept-lang=hu-HU,hu,en") + // Dark first paint instead of a white flash before the page draws. + .arg("--force-dark-mode") + .arg("--autoplay-policy=no-user-gesture-required") + .arg("--overscroll-history-navigation=0"); + if opts.fullscreen { + cmd.arg("--kiosk").arg(&url); + } else { + cmd.arg(format!("--app={url}")); + match opts.bounds { + Some((x, y, w, h)) => { + cmd.arg(format!("--window-position={x},{y}")).arg(format!("--window-size={w},{h}")); + } + None => { + cmd.arg("--window-size=1600,900"); + } + } + } + if cfg!(target_os = "linux") { + // Chromium on Linux picks its UI language from the environment, not --lang. + cmd.env("LANGUAGE", "hu"); + cmd.arg("--enable-features=VaapiVideoDecoder,VaapiIgnoreDriverChecks,PlatformHEVCDecoderSupport"); + if std::env::var_os("WAYLAND_DISPLAY").is_some() { + cmd.arg("--ozone-platform=wayland"); + } + } + for ext in &app.web.extensions { + cmd.arg(format!("--load-extension={}", app.dir.join(ext).display())); + } + // Own process group, so closing the app also ends Chromium's helper processes. + #[cfg(unix)] + { + use std::os::unix::process::CommandExt; + cmd.process_group(0); + } + log::info!("{} {:?}", browser.exe.display(), cmd.get_args().collect::>()); + cmd.spawn().with_context(|| format!("starting {}", browser.exe.display())) +} + +/// Stops an app and everything it started. +pub fn stop(child: &mut Child) { + #[cfg(unix)] + { + // The app runs in its own process group (see launch_web). + let _ = Command::new("kill").arg("-TERM").arg("--").arg(format!("-{}", child.id())).status(); + for _ in 0..20 { + if matches!(child.try_wait(), Ok(Some(_))) { + return; + } + std::thread::sleep(std::time::Duration::from_millis(50)); + } + let _ = Command::new("kill").arg("-KILL").arg("--").arg(format!("-{}", child.id())).status(); + } + let _ = child.kill(); + let _ = child.wait(); +} diff --git a/crates/sf-launcher/src/settings_screen.rs b/crates/sf-launcher/src/settings_screen.rs new file mode 100644 index 0000000..c40021f --- /dev/null +++ b/crates/sf-launcher/src/settings_screen.rs @@ -0,0 +1,1091 @@ +//! The settings screen: categories on the left, rows on the right. +//! +//! Slint owns focus and navigation (ui/settings.slint); this module fills the +//! rows, runs the actions and talks to the system backends on worker threads. + +use std::cell::RefCell; +use std::path::PathBuf; +use std::rc::Rc; +use std::time::{Duration, Instant}; + +use slint::{ComponentHandle, ModelRc, SharedString, VecModel}; + +use crate::system::{self, BtDevice, DeviceInfo, Display, Mode, NetInfo, RemoteDebug, Security, Wifi, WifiNetwork}; +use crate::power; +use crate::{App, SettingRow, keyboard}; + +/// How long a new resolution stays without confirmation. +const KEEP_SECS: u64 = 15; + +const DISPLAY: i32 = 0; +const DEVICES: i32 = 1; +const NETWORK: i32 = 2; +const ENERGY: i32 = 3; + +#[derive(Clone, PartialEq)] +enum Action { + None, + WifiPower, + /// A network row (by D-Bus path): connect, or its page when saved/connected. + WifiNetwork(String), + WifiConnect(String), + WifiDisconnect, + WifiForget(String), + WifiScan, + Resolution, + PickMode(usize), + Keep, + Revert, + Device(String), + Remove(String), + Back, + PairRemote, + ReplaceRemote, + Restart, + ConfirmRestart, + RemoteDebug, + SetRemoteDebug(bool), + PowerMode, + PickPowerMode(power::Mode), + SuspendAfter, + PickSuspendAfter(u32), + StandbyNow, +} + +#[derive(Clone, PartialEq)] +enum Sub { + None, + Wifi(String), + Resolution, + KeepMode, + Device(String), + ReplaceRemote, + Restart, + RemoteDebug, + PowerMode, + SuspendAfter, +} + +struct Pending { + output: String, + previous: Mode, + chosen: Mode, + deadline: Instant, +} + +/// Results coming back from worker threads. +enum Loaded { + Display(Result), + Devices(Result, String>), + Net(NetInfo), + Wifi(Result, String>), + /// A Wi-Fi action finished: notice text, or the error. `retry` reopens the + /// password keyboard for that network after a failed attempt. + WifiDone { result: Result, retry: Option }, + Info(DeviceInfo), + ModeSet { output: String, previous: Mode, chosen: Mode, result: Result<(), String> }, + Reverted(Result<(), String>), + Removed { name: String, result: Result<(), String>, then_pair: bool }, + RemoteDebug(RemoteDebug), + RemoteDebugSet { on: bool, result: Result<(), String> }, +} + +struct State { + category: i32, + sub: Sub, + /// Row to return to when leaving a sub page. + parent_row: i32, + display: Option>, + devices: Option, String>>, + net: Option, + /// Ok(None) = no Wi-Fi adapter. + wifi: Option, String>>, + /// Network being connected to (its row says "Csatlakozás…"). + wifi_pending: Option, + info: Option, + /// Whether sshd runs (remote debugging); None until queried. + remote_debug: Option, + remote_status: String, + /// One-line feedback shown under the page title (e.g. "AirPods eltávolítva"). + notice: String, + actions: Vec, + pending: Option, + busy: bool, +} + +pub struct Screen { + ui: slint::Weak, + state: RefCell, + settings_path: PathBuf, + timer: slint::Timer, +} + +thread_local! { + static SCREEN: RefCell>> = const { RefCell::new(None) }; +} + +fn row(title: impl Into, value: impl Into, detail: impl Into, kind: &str) -> SettingRow { + SettingRow { title: title.into(), value: value.into(), detail: detail.into(), kind: kind.into(), level: 0, lock: false } +} + +fn fmt_minutes(min: u32) -> String { + if min >= 60 && min % 60 == 0 { format!("{} óra", min / 60) } else { format!("{min} perc") } +} + +/// A Wi-Fi network row: signal bars and a lock on the right. +fn network_row(net: &WifiNetwork, value: &str) -> SettingRow { + SettingRow { + level: net.bars(), + lock: net.security != Security::Open, + ..row(net.name.clone(), value, net.security_label(), "network") + } +} + +fn wifi_result(r: anyhow::Result) -> Result { + r.map_err(|e| format!("{e:#}")) +} + +fn short_err(e: &str) -> String { + let line = e.lines().next().unwrap_or(e); + if line.chars().count() > 60 { format!("{}…", line.chars().take(60).collect::()) } else { line.to_string() } +} + +/// The screen installed on this (UI) thread. +pub fn current() -> Option> { + SCREEN.with(|s| s.borrow().clone()) +} + +/// Runs `job` on a worker thread and hands its result to the screen. +fn post(job: impl FnOnce() -> Loaded + Send + 'static) { + std::thread::spawn(move || { + let loaded = job(); + let _ = slint::invoke_from_event_loop(move || { + if let Some(s) = SCREEN.with(|s| s.borrow().clone()) { + s.on_loaded(loaded); + } + }); + }); +} + +impl Screen { + pub fn install(ui: &App, settings_path: PathBuf) -> Rc { + let screen = Rc::new(Screen { + ui: ui.as_weak(), + state: RefCell::new(State { + category: 0, + sub: Sub::None, + parent_row: 0, + display: None, + devices: None, + net: None, + wifi: None, + wifi_pending: None, + info: None, + remote_debug: None, + remote_status: String::new(), + notice: String::new(), + actions: Vec::new(), + pending: None, + busy: false, + }), + settings_path, + timer: slint::Timer::default(), + }); + SCREEN.with(|s| *s.borrow_mut() = Some(screen.clone())); + + let s = screen.clone(); + ui.on_settings_opened(move || { + s.state.borrow_mut().notice.clear(); + s.refresh_all(); + s.rebuild(None); + }); + let s = screen.clone(); + ui.on_settings_nav_changed(move |i| { + { + let mut st = s.state.borrow_mut(); + st.category = i; + st.notice.clear(); + if st.sub != Sub::KeepMode { + st.sub = Sub::None; + } + } + if i == NETWORK { + s.scan_wifi(); + } + s.rebuild(Some(0)); + }); + let s = screen.clone(); + ui.on_settings_activate(move |i| s.activate(i)); + let s = screen.clone(); + ui.on_settings_back(move || s.run(Action::Back)); + + // Ticks the confirm countdown and keeps device/network rows fresh. + let s = Rc::downgrade(&screen); + let mut ticks = 0u32; + screen.timer.start(slint::TimerMode::Repeated, Duration::from_secs(1), move || { + let Some(s) = s.upgrade() else { return }; + ticks += 1; + s.tick(ticks); + }); + screen + } + + pub fn set_remote_status(&self, status: &str) { + let changed = { + let mut st = self.state.borrow_mut(); + let changed = st.remote_status != status; + st.remote_status = status.to_string(); + changed + }; + if changed && self.is_open() { + post(|| Loaded::Devices(system::bt_devices().map_err(|e| format!("{e:#}")))); + self.rebuild(None); + } + } + + fn is_open(&self) -> bool { + self.ui.upgrade().is_some_and(|ui| ui.get_settings_open()) + } + + fn refresh_all(&self) { + post(|| Loaded::Display(system::display().map_err(|e| format!("{e:#}")))); + post(|| Loaded::Devices(system::bt_devices().map_err(|e| format!("{e:#}")))); + post(|| Loaded::Net(system::network())); + post(|| Loaded::Wifi(wifi_result(system::wifi()))); + post(|| Loaded::RemoteDebug(system::remote_debug())); + if self.state.borrow().info.is_none() { + post(|| Loaded::Info(system::device_info())); + } + } + + fn tick(&self, ticks: u32) { + let (expired, sub, category) = { + let st = self.state.borrow(); + let expired = st.pending.as_ref().is_some_and(|p| Instant::now() >= p.deadline); + (expired, st.sub.clone(), st.category) + }; + if expired { + self.run(Action::Revert); + return; + } + if sub == Sub::KeepMode { + self.rebuild(None); + } + if !self.is_open() || sub != Sub::None || ticks % 4 != 0 { + return; + } + match category { + DEVICES => post(|| Loaded::Devices(system::bt_devices().map_err(|e| format!("{e:#}")))), + NETWORK => { + post(|| Loaded::Net(system::network())); + post(|| Loaded::Wifi(wifi_result(system::wifi()))); + } + _ => {} + } + } + + /// Starts a scan and shows its results once they are in. + fn scan_wifi(&self) { + let Some(device) = self.wifi().map(|w| w.device) else { + post(|| Loaded::Wifi(wifi_result(system::wifi()))); + return; + }; + post(move || { + let _ = system::wifi_scan(&device); + Loaded::Wifi(wifi_result(system::wifi())) + }); + post(|| { + std::thread::sleep(Duration::from_secs(4)); + Loaded::Wifi(wifi_result(system::wifi())) + }); + } + + fn wifi(&self) -> Option { + match &self.state.borrow().wifi { + Some(Ok(Some(w))) => Some(w.clone()), + _ => None, + } + } + + fn wifi_net(&self, path: &str) -> Option { + self.wifi()?.networks.into_iter().find(|n| n.path == path) + } + + /// Password keyboard for a protected network; `error` after a failed try. + fn ask_passphrase(&self, net: WifiNetwork, error: Option) { + let Some(ui) = self.ui.upgrade() else { return }; + let subtitle = format!("Írd be a(z) „{}” hálózat jelszavát.", net.name); + keyboard::open( + &ui, + keyboard::Request { + title: "Wi-Fi jelszó".into(), + subtitle, + placeholder: "Jelszó".into(), + secret: true, + submit_label: "Csatlakozás".into(), + // WPA: 8-63 characters, or 64 hex digits. + min_len: 8, + max_len: 64, + error, + on_submit: Box::new(move |pass| { + if let Some(s) = current() { + s.connect(net, Some(pass)); + } + }), + }, + ); + } + + fn connect(&self, net: WifiNetwork, passphrase: Option) { + let Some(iface) = self.wifi().map(|w| w.iface) else { return }; + log::info!("wifi: connecting to {}", net.name); + { + let mut st = self.state.borrow_mut(); + st.busy = true; + st.sub = Sub::None; + st.wifi_pending = Some(net.path.clone()); + st.notice = format!("Csatlakozás: {}…", net.name); + } + let parent = self.state.borrow().parent_row; + self.rebuild(Some(parent)); + post(move || { + let result = system::wifi_connect(&iface, &net, passphrase.as_deref()); + let retry = (result.is_err() && passphrase.is_some()).then(|| net.clone()); + Loaded::WifiDone { result: wifi_result(result).map(|()| format!("Csatlakozva: {}", net.name)), retry } + }); + } + + /// Runs a quick Wi-Fi action on a worker thread with "busy" feedback. + fn wifi_job(&self, job: impl FnOnce() -> Result + Send + 'static) { + self.state.borrow_mut().busy = true; + self.rebuild(None); + post(move || Loaded::WifiDone { result: job(), retry: None }); + } + + fn on_loaded(&self, loaded: Loaded) { + match loaded { + Loaded::Display(d) => self.state.borrow_mut().display = Some(d), + Loaded::Devices(d) => self.state.borrow_mut().devices = Some(d), + Loaded::Net(n) => self.state.borrow_mut().net = Some(n), + Loaded::Wifi(w) => { + if let Err(e) = &w { + log::debug!("wifi: {e}"); + } + self.state.borrow_mut().wifi = Some(w); + } + Loaded::WifiDone { result, retry } => { + { + let mut st = self.state.borrow_mut(); + st.busy = false; + st.wifi_pending = None; + st.sub = Sub::None; + st.notice = match &result { + Ok(text) => text.clone(), + Err(e) => { + log::warn!("wifi: {e}"); + format!("Nem sikerült: {}", short_err(e)) + } + }; + } + post(|| Loaded::Wifi(wifi_result(system::wifi()))); + // DHCP takes a moment after connecting. + post(|| Loaded::Net(system::network())); + post(|| { + std::thread::sleep(Duration::from_secs(3)); + Loaded::Net(system::network()) + }); + if let (Some(net), Err(_)) = (retry, &result) { + if self.is_open() { + self.ask_passphrase(net, Some("Nem sikerült csatlakozni. Ellenőrizd a jelszót.".into())); + } + } + } + Loaded::Info(i) => self.state.borrow_mut().info = Some(i), + Loaded::RemoteDebug(on) => self.state.borrow_mut().remote_debug = Some(on), + Loaded::RemoteDebugSet { on, result } => { + { + let mut st = self.state.borrow_mut(); + st.busy = false; + st.sub = Sub::None; + st.notice = match &result { + Ok(()) if on => "Távoli hibakeresés bekapcsolva.".into(), + Ok(()) => "Távoli hibakeresés kikapcsolva.".into(), + Err(e) => { + log::warn!("remote debug: {e}"); + format!("Nem sikerült: {}", short_err(e)) + } + }; + } + post(|| Loaded::RemoteDebug(system::remote_debug())); + let parent = self.state.borrow().parent_row; + self.rebuild(Some(parent)); + return; + } + Loaded::ModeSet { output, previous, chosen, result } => { + let mut st = self.state.borrow_mut(); + st.busy = false; + match result { + Ok(()) => { + st.pending = Some(Pending { + output, + previous, + chosen, + deadline: Instant::now() + Duration::from_secs(KEEP_SECS), + }); + st.sub = Sub::KeepMode; + drop(st); + post(|| Loaded::Display(system::display().map_err(|e| format!("{e:#}")))); + self.rebuild(Some(0)); + return; + } + Err(e) => { + log::warn!("display: {e}"); + st.notice = format!("Nem sikerült beállítani: {}", short_err(&e)); + st.sub = Sub::None; + } + } + } + Loaded::Reverted(result) => { + let mut st = self.state.borrow_mut(); + st.busy = false; + st.notice = match result { + Ok(()) => "Az előző felbontás visszaállítva.".into(), + Err(e) => format!("Visszaállítás sikertelen: {}", short_err(&e)), + }; + drop(st); + post(|| Loaded::Display(system::display().map_err(|e| format!("{e:#}")))); + } + Loaded::Removed { name, result, then_pair } => { + let ok = result.is_ok(); + { + let mut st = self.state.borrow_mut(); + st.busy = false; + st.sub = Sub::None; + st.notice = match &result { + Ok(()) => format!("{name} eltávolítva."), + Err(e) => format!("{name}: nem sikerült eltávolítani ({})", short_err(e)), + }; + } + post(|| Loaded::Devices(system::bt_devices().map_err(|e| format!("{e:#}")))); + if ok && then_pair { + self.open_pairing(); + } + let parent = self.state.borrow().parent_row; + self.rebuild(Some(parent)); + return; + } + } + self.rebuild(None); + } + + fn activate(&self, index: i32) { + let action = self.state.borrow().actions.get(index as usize).cloned().unwrap_or(Action::None); + let mut st = self.state.borrow_mut(); + if !matches!(action, Action::None) && st.sub == Sub::None { + st.parent_row = index; + } + drop(st); + self.run(action); + } + + fn enter(&self, sub: Sub, row: i32) { + self.state.borrow_mut().sub = sub; + self.rebuild(Some(row)); + } + + fn leave(&self) { + let parent = { + let mut st = self.state.borrow_mut(); + st.sub = Sub::None; + st.parent_row + }; + self.rebuild(Some(parent)); + } + + fn run(&self, action: Action) { + if self.state.borrow().busy && !matches!(action, Action::Back) { + return; + } + match action { + Action::None => {} + Action::WifiPower => { + let Some(w) = self.wifi() else { return }; + let on = !w.powered; + log::info!("wifi: turning {}", if on { "on" } else { "off" }); + self.wifi_job(move || { + wifi_result(system::wifi_set_powered(&w.device, on)) + .map(|()| if on { "Wi-Fi bekapcsolva." } else { "Wi-Fi kikapcsolva." }.to_string()) + }); + if on { + self.scan_wifi(); + } + } + Action::WifiScan => { + self.state.borrow_mut().notice = "Hálózatok keresése…".into(); + self.scan_wifi(); + self.rebuild(None); + } + Action::WifiNetwork(path) => { + let Some(net) = self.wifi_net(&path) else { return }; + self.state.borrow_mut().notice.clear(); + if net.connected || net.known.is_some() { + self.enter(Sub::Wifi(path), 0); + return; + } + match net.security { + Security::Open => self.connect(net, None), + Security::Psk => self.ask_passphrase(net, None), + Security::Wep => { + self.state.borrow_mut().notice = "A WEP titkosítás elavult, a rendszer nem támogatja.".into(); + self.rebuild(None); + } + Security::Enterprise => { + self.state.borrow_mut().notice = "Vállalati (802.1X) hálózat itt nem állítható be.".into(); + self.rebuild(None); + } + } + } + Action::WifiConnect(path) => { + if let Some(net) = self.wifi_net(&path) { + self.connect(net, None); + } + } + Action::WifiDisconnect => { + let Some(w) = self.wifi() else { return }; + self.state.borrow_mut().sub = Sub::None; + self.wifi_job(move || wifi_result(system::wifi_disconnect(&w.device)).map(|()| "Wi-Fi leválasztva.".to_string())); + } + Action::WifiForget(path) => { + let Some(net) = self.wifi_net(&path) else { return }; + let Some(known) = net.known.clone() else { return }; + self.state.borrow_mut().sub = Sub::None; + self.wifi_job(move || wifi_result(system::wifi_forget(&known)).map(|()| format!("{} elfelejtve.", net.name))); + } + Action::Resolution => { + let current = match &self.state.borrow().display { + Some(Ok(d)) if !d.modes.is_empty() => d.current.unwrap_or(0) as i32, + _ => return, + }; + self.state.borrow_mut().notice.clear(); + self.enter(Sub::Resolution, current); + } + Action::PickMode(i) => { + let (output, previous, chosen) = { + let st = self.state.borrow(); + let Some(Ok(d)) = &st.display else { return }; + let (Some(prev), Some(chosen)) = (d.current_mode(), d.modes.get(i)) else { return }; + (d.output.clone(), prev.clone(), chosen.clone()) + }; + if previous == chosen { + self.leave(); + return; + } + log::info!("display: switching to {}", chosen.label()); + self.state.borrow_mut().busy = true; + post(move || { + let result = system::set_mode(&output, &chosen).map_err(|e| format!("{e:#}")); + Loaded::ModeSet { output, previous, chosen, result } + }); + } + Action::Keep => { + let Some(p) = self.state.borrow_mut().pending.take() else { return }; + match sf_ipc::Settings::load(&self.settings_path).and_then(|mut s| { + s.values.insert("display_mode".into(), p.chosen.key()); + s.save(&self.settings_path) + }) { + Ok(()) => log::info!("display: saved {}", p.chosen.key()), + Err(e) => log::warn!("saving display mode: {e:#}"), + } + self.state.borrow_mut().notice = format!("Felbontás: {}", p.chosen.label()); + self.leave(); + } + Action::Revert => { + let Some(p) = self.state.borrow_mut().pending.take() else { + self.leave(); + return; + }; + log::info!("display: reverting to {}", p.previous.label()); + { + let mut st = self.state.borrow_mut(); + st.busy = true; + st.sub = Sub::None; + } + post(move || Loaded::Reverted(system::set_mode(&p.output, &p.previous).map_err(|e| format!("{e:#}")))); + let parent = self.state.borrow().parent_row; + self.rebuild(Some(parent)); + } + Action::Back => match self.state.borrow().sub.clone() { + Sub::KeepMode => self.run(Action::Revert), + Sub::None => {} + _ => self.leave(), + }, + Action::Device(addr) => { + self.state.borrow_mut().notice.clear(); + self.enter(Sub::Device(addr), 1); + } + Action::Remove(addr) => { + let name = self.device(&addr).map(|d| d.name).unwrap_or_else(|| addr.clone()); + self.state.borrow_mut().busy = true; + self.rebuild(None); + post(move || Loaded::Removed { + name, + result: system::bt_remove(&addr).map_err(|e| format!("{e:#}")), + then_pair: false, + }); + } + Action::PairRemote => { + if self.remotes().is_empty() { + self.open_pairing(); + } else { + self.enter(Sub::ReplaceRemote, 1); + } + } + Action::ReplaceRemote => { + let remotes = self.remotes(); + let name = remotes.first().map(|d| d.name.clone()).unwrap_or_else(|| "Siri Remote".into()); + self.state.borrow_mut().busy = true; + self.rebuild(None); + post(move || { + let result = remotes.iter().try_for_each(|d| system::bt_remove(&d.address)).map_err(|e| format!("{e:#}")); + Loaded::Removed { name, result, then_pair: true } + }); + } + Action::Restart => self.enter(Sub::Restart, 1), + Action::ConfirmRestart => { + log::info!("restarting the launcher (settings)"); + if let Some(ui) = self.ui.upgrade() { + ui.invoke_cancel_launch(); + } + let _ = slint::quit_event_loop(); + } + Action::PowerMode => { + let current = power::Mode::ALL.iter().position(|m| *m == power::mode()).unwrap_or(0); + self.state.borrow_mut().notice.clear(); + self.enter(Sub::PowerMode, current as i32); + } + Action::PickPowerMode(mode) => { + power::configure(mode, power::after_min()); + self.save_setting(power::MODE_KEY, mode.key()); + self.state.borrow_mut().notice = format!("Bekapcsológomb: {}", mode.label()); + self.leave(); + } + Action::SuspendAfter => { + let current = power::AFTER_CHOICES.iter().position(|m| *m == power::after_min()).unwrap_or(1); + self.state.borrow_mut().notice.clear(); + self.enter(Sub::SuspendAfter, current as i32); + } + Action::PickSuspendAfter(min) => { + power::configure(power::mode(), min); + self.save_setting(power::AFTER_KEY, &min.to_string()); + self.state.borrow_mut().notice = format!("Elalvás {min} perc képernyő nélküli készenlét után."); + self.leave(); + } + Action::StandbyNow => power::apply(power::press()), + Action::RemoteDebug => match self.state.borrow().remote_debug.as_ref().map(|d| d.on) { + // Turning it on asks first; turning it off doesn't. + Some(false) => self.enter(Sub::RemoteDebug, 1), + Some(true) => self.run(Action::SetRemoteDebug(false)), + None => {} + }, + Action::SetRemoteDebug(on) => { + log::info!("remote debug: turning {}", if on { "on" } else { "off" }); + self.state.borrow_mut().busy = true; + self.rebuild(None); + post(move || Loaded::RemoteDebugSet { on, result: system::set_remote_debug(on).map_err(|e| format!("{e:#}")) }); + } + } + } + + fn device(&self, addr: &str) -> Option { + match &self.state.borrow().devices { + Some(Ok(list)) => list.iter().find(|d| d.address == addr).cloned(), + _ => None, + } + } + + fn remotes(&self) -> Vec { + match &self.state.borrow().devices { + Some(Ok(list)) => list.iter().filter(|d| d.remote).cloned().collect(), + _ => Vec::new(), + } + } + + /// Stores one key in settings.toml (keeps the other keys). + fn save_setting(&self, key: &str, value: &str) { + match sf_ipc::Settings::load(&self.settings_path).and_then(|mut s| { + s.values.insert(key.into(), value.into()); + s.save(&self.settings_path) + }) { + Ok(()) => log::info!("settings: {key} = {value}"), + Err(e) => log::warn!("saving {key}: {e:#}"), + } + } + + /// Closes settings and shows the pairing guide; sf-remote starts searching + /// on its own once no remote is paired. + fn open_pairing(&self) { + let Some(ui) = self.ui.upgrade() else { return }; + ui.set_settings_open(false); + ui.set_pairing_skipped(false); + ui.set_pairing_open(true); + } + + /// Pushes the current page to Slint. `row` moves the focus (clamped). + fn rebuild(&self, row: Option) { + let Some(ui) = self.ui.upgrade() else { return }; + let (title, subtitle, rows, actions) = self.page(); + let len = rows.len() as i32; + let in_sub = self.state.borrow().sub != Sub::None; + // A refresh can reorder rows (Wi-Fi signal changes): keep the focus on + // the same item rather than the same index. + let focused = self.state.borrow().actions.get(ui.get_set_row().max(0) as usize).cloned(); + let same_item = match (row, focused) { + (None, Some(a)) if a != Action::None => actions.iter().position(|b| *b == a).map(|i| i as i32), + _ => None, + }; + self.state.borrow_mut().actions = actions; + ui.set_set_title(title.into()); + ui.set_set_subtitle(subtitle.into()); + ui.set_set_rows(ModelRc::new(VecModel::from(rows))); + ui.set_set_sub(in_sub); + let target = row.or(same_item).unwrap_or_else(|| ui.get_set_row()); + ui.set_set_row(target.clamp(0, (len - 1).max(0))); + } + + fn page(&self) -> (String, String, Vec, Vec) { + let st = self.state.borrow(); + let mut rows = Vec::new(); + let mut actions = Vec::new(); + let mut push = |r: SettingRow, a: Action| { + rows.push(r); + actions.push(a); + }; + let notice_or = |text: &str| if st.notice.is_empty() { text.to_string() } else { st.notice.clone() }; + + let (title, subtitle) = match (&st.sub, st.category) { + (Sub::Wifi(path), _) => { + let net = match &st.wifi { + Some(Ok(Some(w))) => w.networks.iter().find(|n| &n.path == path).cloned(), + _ => None, + }; + match net { + Some(n) => { + if n.connected { + push(row(if st.busy { "Leválasztás…" } else { "Leválasztás" }, "", "", "action"), Action::WifiDisconnect); + } else { + push(row("Csatlakozás", "", "", "action"), Action::WifiConnect(n.path.clone())); + } + if n.known.is_some() { + push(row("Hálózat elfelejtése", "", "", "danger"), Action::WifiForget(n.path.clone())); + } + push(row("Mégse", "", "", "action"), Action::Back); + let state = if n.connected { "Csatlakozva" } else { "Mentett hálózat" }; + let forget = if n.known.is_some() { " Elfelejtés után újra meg kell adni a jelszót." } else { "" }; + (n.name.clone(), format!("{state} · {} · {} jel.{forget}", n.security_label(), n.strength_label().to_lowercase())) + } + None => { + push(row("Vissza", "", "", "action"), Action::Back); + ("Wi-Fi hálózat".to_string(), "A hálózat már nem érhető el.".to_string()) + } + } + } + (Sub::Resolution, _) => { + if let Some(Ok(d)) = &st.display { + for (i, m) in d.modes.iter().enumerate() { + let detail = match (m.name(), m.preferred) { + ("", true) => "A TV ajánlása".to_string(), + (n, true) => format!("{n} · a TV ajánlása"), + (n, false) => n.to_string(), + }; + let check = if d.current == Some(i) { "✓" } else { "" }; + push(row(m.label(), check, detail, "option"), Action::PickMode(i)); + } + } + let subtitle = if st.busy { + "Felbontás váltása…".to_string() + } else { + format!("Ha a TV nem tudja megjeleníteni, {KEEP_SECS} másodperc múlva visszaáll az előző.") + }; + ("Felbontás".to_string(), subtitle) + } + (Sub::KeepMode, _) => { + let (label, left) = st + .pending + .as_ref() + .map(|p| (p.chosen.label(), p.deadline.saturating_duration_since(Instant::now()).as_secs() + 1)) + .unwrap_or_default(); + push(row("Megtartás", "", "", "action"), Action::Keep); + push(row("Visszaállítás az előzőre", "", "", "action"), Action::Revert); + ( + "Megtartod ezt a felbontást?".to_string(), + format!("{label} · {} mp múlva automatikusan visszaáll.", left.min(KEEP_SECS)), + ) + } + (Sub::Device(addr), _) => { + let dev = match &st.devices { + Some(Ok(list)) => list.iter().find(|d| &d.address == addr).cloned(), + _ => None, + }; + let remove_label = if st.busy { "Eltávolítás…" } else { "Eszköz eltávolítása" }; + push(row(remove_label, "", "", "danger"), Action::Remove(addr.clone())); + push(row("Mégse", "", "", "action"), Action::Back); + match dev { + Some(d) => { + let warn = if d.remote { + " Eltávolítás után a távirányító nem működik, amíg újra nem párosítod." + } else { + "" + }; + (d.name.clone(), format!("{} · {} · {}.{warn}", d.kind_label(), d.address, d.status())) + } + None => (addr.clone(), String::new()), + } + } + (Sub::ReplaceRemote, _) => { + let label = if st.busy { "Eltávolítás…" } else { "Mostani eltávolítása, új párosítása" }; + push(row(label, "", "", "danger"), Action::ReplaceRemote); + push(row("Mégse", "", "", "action"), Action::Back); + ( + "Új Siri Remote párosítása".to_string(), + "Egyszerre egy Siri Remote használható. A mostani eltávolítása után megjelenik a párosítási útmutató.".to_string(), + ) + } + (Sub::Restart, _) => { + push(row("Újraindítás", "", "", "danger"), Action::ConfirmRestart); + push(row("Mégse", "", "", "action"), Action::Back); + ("Felület újraindítása".to_string(), "A futó alkalmazás bezárul, a kezdőképernyő újraindul.".to_string()) + } + (Sub::RemoteDebug, _) => { + let label = if st.busy { "Bekapcsolás…" } else { "Bekapcsolás" }; + push(row(label, "", "", "danger"), Action::SetRemoteDebug(true)); + push(row("Mégse", "", "", "action"), Action::Back); + ( + "Távoli hibakeresés".to_string(), + "Bekapcsolja az SSH-t: a helyi hálózatról bárki beléphet a root jelszóval. Egy óra múlva és újraindításkor magától kikapcsol." + .to_string(), + ) + } + (Sub::None, DISPLAY) => { + match &st.display { + None => push(row("Kijelző lekérdezése…", "", "", "info"), Action::None), + Some(Err(e)) => { + push(row("A kijelző nem érhető el", "", short_err(e), "info"), Action::None); + } + Some(Ok(d)) => { + let (value, detail) = match d.current_mode() { + Some(m) => (m.label(), m.name().to_string()), + None => ("Egyéni".to_string(), String::new()), + }; + push(row("Felbontás", value, detail, "choice"), Action::Resolution); + if !d.description.is_empty() { + push(row("Kijelző", d.description.clone(), "", "info"), Action::None); + } + push(row("Csatlakozó", d.output.clone(), "", "info"), Action::None); + } + } + ("Kijelző".to_string(), notice_or("A TV képének felbontása és frissítési gyakorisága.")) + } + (Sub::None, DEVICES) => { + match &st.devices { + None => push(row("Eszközök keresése…", "", "", "info"), Action::None), + Some(Err(e)) => push(row("A Bluetooth nem érhető el", "", short_err(e), "info"), Action::None), + Some(Ok(list)) if list.is_empty() => { + push(row("Nincs párosított eszköz", "", "", "info"), Action::None) + } + Some(Ok(list)) => { + for d in list { + push( + row(d.name.clone(), d.status(), format!("{} · {}", d.kind_label(), d.address), "device"), + Action::Device(d.address.clone()), + ); + } + } + } + push(row("Új Siri Remote párosítása", "", "", "action"), Action::PairRemote); + if !st.remote_status.is_empty() { + push(row("Távirányító állapota", st.remote_status.clone(), "", "info"), Action::None); + } + ( + "Távirányító és Bluetooth".to_string(), + notice_or("Párosított eszközök. Válassz ki egyet az eltávolításhoz."), + ) + } + (Sub::None, NETWORK) => { + match &st.net { + None => push(row("Hálózat lekérdezése…", "", "", "info"), Action::None), + Some(n) => { + let conn = match (&n.iface, n.ip.is_some(), n.wireless) { + (Some(i), true, true) => format!("Wi-Fi · {i}"), + (Some(i), true, false) => format!("Vezetékes · {i}"), + _ => "Nincs kapcsolat".to_string(), + }; + push(row("Kapcsolat", conn, "", "info"), Action::None); + let gateway = n.gateway.as_ref().map(|g| format!("Átjáró: {g}")).unwrap_or_default(); + push(row("IP-cím", n.ip.clone().unwrap_or_else(|| "-".into()), gateway, "info"), Action::None); + } + } + match &st.wifi { + None => {} + Some(Err(e)) => push(row("Wi-Fi", "Nem érhető el", short_err(e), "info"), Action::None), + Some(Ok(None)) => push(row("Wi-Fi", "Nincs Wi-Fi adapter", "", "info"), Action::None), + Some(Ok(Some(w))) => { + let value = match (st.busy && st.wifi_pending.is_none(), w.powered) { + (true, _) => "…", + (false, true) => "Be", + (false, false) => "Ki", + }; + push(row("Wi-Fi", value, w.iface.clone(), "action"), Action::WifiPower); + if w.powered { + if w.networks.is_empty() { + let text = if w.scanning { "Hálózatok keresése…" } else { "Nincs elérhető hálózat" }; + push(row(text, "", "", "info"), Action::None); + } + for net in &w.networks { + let value = if st.wifi_pending.as_deref() == Some(net.path.as_str()) { + "Csatlakozás…" + } else if net.connected { + "Csatlakozva" + } else if net.known.is_some() { + "Mentve" + } else { + "" + }; + push(network_row(net, value), Action::WifiNetwork(net.path.clone())); + } + let value = if w.scanning { "Keresés…" } else { "" }; + push(row("Hálózatok keresése", value, "", "action"), Action::WifiScan); + } + } + } + ("Hálózat".to_string(), notice_or("Vezetékes kapcsolat, vagy válassz egy Wi-Fi hálózatot.")) + } + (Sub::PowerMode, _) => { + for m in power::Mode::ALL { + let check = if m == power::mode() { "✓" } else { "" }; + push(row(m.label(), check, m.detail(), "option"), Action::PickPowerMode(m)); + } + ("Bekapcsológomb".to_string(), "Mit csináljon a távirányító bekapcsológombja.".to_string()) + } + (Sub::SuspendAfter, _) => { + for min in power::AFTER_CHOICES { + let check = if min == power::after_min() { "✓" } else { "" }; + push(row(fmt_minutes(min), check, "", "option"), Action::PickSuspendAfter(min)); + } + ("Elalvás".to_string(), "Ennyi idő kikapcsolt képernyő után alszik el a gép.".to_string()) + } + (Sub::None, ENERGY) => { + let mode = power::mode(); + push(row("Bekapcsológomb", mode.label(), mode.detail(), "choice"), Action::PowerMode); + if mode == power::Mode::Auto { + let value = format!("{} után", fmt_minutes(power::after_min())); + push(row("Elalvás", value, "Kikapcsolt képernyő után", "choice"), Action::SuspendAfter); + } + if mode != power::Mode::Screen { + let (value, detail) = match system::bt_wake() { + system::BtWake::NoController => ("Nincs Bluetooth", "Alvó módból csak a gép gombja ébreszt"), + system::BtWake::Enabled => ("Engedélyezve", "A távirányító felébreszti a gépet"), + system::BtWake::Disabled => ("Alváskor bekapcsol", "Az sf-remote engedélyezi elalvás előtt"), + system::BtWake::Unknown => ("Ismeretlen", "Ezen a gépen ki kell próbálni"), + }; + push(row("Ébresztés távirányítóval", value, detail, "info"), Action::None); + } + push(row("Készenlét most", "", "Bármelyik gomb felébreszti", "action"), Action::StandbyNow); + ( + "Energia".to_string(), + notice_or("A bekapcsológomb készenlétbe teszi a TV-t; újabb gombnyomásra visszajön."), + ) + } + (Sub::None, _) => { + let info = st.info.clone().unwrap_or_default(); + push(row("Eszköz neve", info.hostname, "", "info"), Action::None); + push(row("SmartFox", format!("v{}", env!("CARGO_PKG_VERSION")), "", "info"), Action::None); + push(row("Operációs rendszer", info.os, "", "info"), Action::None); + push(row("Kernel", info.kernel, "", "info"), Action::None); + let ip = st.net.as_ref().and_then(|n| n.ip.clone()); + let (value, detail) = match (st.busy, &st.remote_debug) { + (true, _) | (_, None) => ("…".to_string(), String::new()), + (false, Some(d)) if d.on => { + let login = ip.map(|ip| format!("ssh root@{ip}")).unwrap_or_else(|| "SSH bekapcsolva".into()); + let value = d.until.as_ref().map(|t| format!("Be · {t}-kor kikapcsol")).unwrap_or_else(|| "Be".into()); + (value, login) + } + (false, Some(_)) => ("Ki".to_string(), "SSH a helyi hálózatról".to_string()), + }; + push(row("Távoli hibakeresés", value, detail, "action"), Action::RemoteDebug); + push(row("Felület újraindítása", "", "", "action"), Action::Restart); + ("Rendszer".to_string(), notice_or("Az eszköz adatai.")) + } + }; + drop(push); + (title, subtitle, rows, actions) + } +} + +/// Glass for the settings screen. Mirrors the geometry in ui/settings.slint. +pub fn glass(ui: &App, scale: f32) -> Vec { + use crate::glass::Panel; + use slint::Model; + + let t = ui.get_set_t(); + if t <= 0.001 { + return Vec::new(); + } + let u = ui.get_u(); + let px = |v: f32| v * scale; + let panel = |x: f32, y: f32, w: f32, h: f32, r: f32, focus: f32, alpha: f32, blur: f32, glow: [f32; 3], tint: [f32; 4]| Panel { + x: px(x), + y: px(y), + w: px(w), + h: px(h), + radius: px(r), + focus, + alpha, + blur, + glow, + group: 0.0, + tint, + }; + let white = [1.0, 1.0, 1.0]; + let (sx, sy, sw, sh) = (ui.get_sp_x(), ui.get_sp_y(), ui.get_sp_w(), ui.get_sp_h()); + let mut out = vec![panel(sx, sy, sw, sh, 52.0 * u, 0.15 * t, t, 3.6, [0.79, 0.83, 0.88], [0.04, 0.043, 0.063, 0.40])]; + // The on-screen keyboard takes over the pane: categories and rows fade out. + let content = t * (1.0 - ui.get_kb_t()); + + // Category column: focus glides with nav-pos, the selected one stays lit. + let (nx, ny, nw, nh, nstep) = (ui.get_nav_x(), ui.get_nav_y(), ui.get_nav_w(), ui.get_nav_h(), ui.get_nav_step()); + let (nav_pos, nav_active) = (ui.get_nav_pos(), ui.get_nav_active()); + for i in 0..ui.get_set_nav_count() { + let sel = (1.0 - (nav_pos - i as f32).abs()).max(0.0); + let f = sel * nav_active; + let s = 1.0 + 0.03 * f; + let (w, h) = (nw * s, nh * s); + let y = ny + i as f32 * nstep; + out.push(panel(nx - (w - nw) / 2.0, y - (h - nh) / 2.0, w, h, 26.0 * u * s, f, content, -1.0, white, [1.0, 1.0, 1.0, 0.035 + 0.16 * sel + 0.66 * f])); + } + // Back chip. + out.push(panel(nx, sy + sh - 92.0 * u, 300.0 * u, 56.0 * u, 28.0 * u, 0.0, t, -1.0, white, [1.0, 1.0, 1.0, 0.03])); + + // Rows, scrolled and faded at the edges of the list area. + let (rx, ry, rw) = (ui.get_rows_x(), ui.get_rows_y(), ui.get_rows_w()); + let (rh, rstep, view, scroll) = (ui.get_set_row_h(), ui.get_set_row_step(), ui.get_rows_view_h(), ui.get_rows_scroll()); + let (row_pos, active) = (ui.get_row_pos(), ui.get_content_active()); + for (j, row) in ui.get_set_rows().iter().enumerate() { + let top = ry + j as f32 * rstep - scroll; + let over = (ry - top).max(top + rh - (ry + view)) / rh; + let vis = (1.0 - over).clamp(0.0, 1.0); + if vis <= 0.01 { + continue; + } + let f = (1.0 - (row_pos - j as f32).abs()).max(0.0) * active; + let s = 1.0 + 0.02 * f; + let (w, h) = (rw * s, rh * s); + let (glow, tint) = if row.kind == "danger" { + let red = [1.0, 0.27, 0.23]; + (red, [1.0, 0.27, 0.23, 0.10 + 0.72 * f]) + } else { + (white, [1.0, 1.0, 1.0, 0.04 + 0.80 * f]) + }; + out.push(panel(rx - (w - rw) / 2.0, top - (h - rh) / 2.0, w, h, 24.0 * u * s, f, content * vis, -1.0, glow, tint)); + } + out +} diff --git a/crates/sf-launcher/src/system.rs b/crates/sf-launcher/src/system.rs new file mode 100644 index 0000000..9357237 --- /dev/null +++ b/crates/sf-launcher/src/system.rs @@ -0,0 +1,927 @@ +//! System backends for the settings screen: display modes (wlr-randr), +//! Bluetooth devices (bluetoothctl), Wi-Fi (iwd), network and device info. +//! +//! Off Linux (Windows dev builds), or with `SMARTFOX_DEMO_SYSTEM=1`, a demo +//! backend with in-memory state keeps the settings screen usable. +//! All calls can block for a moment, so run them off the UI thread. + +use std::process::{Command, Stdio}; +use std::sync::Mutex; +use std::time::{Duration, Instant}; + +use anyhow::{Context, Result, bail}; + +pub fn demo() -> bool { + !cfg!(target_os = "linux") || std::env::var_os("SMARTFOX_DEMO_SYSTEM").is_some() +} + +/// Runs a command and returns its stdout; kills it after `timeout`. +fn run(prog: &str, args: &[&str], timeout: Duration) -> Result { + let mut child = Command::new(prog) + .args(args) + .stdin(Stdio::null()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn() + .with_context(|| format!("starting {prog}"))?; + let deadline = Instant::now() + timeout; + loop { + if child.try_wait()?.is_some() { + break; + } + if Instant::now() >= deadline { + let _ = child.kill(); + let _ = child.wait(); + bail!("{prog} {} timed out", args.join(" ")); + } + std::thread::sleep(Duration::from_millis(20)); + } + let out = child.wait_with_output()?; + let stdout = strip_ansi(&String::from_utf8_lossy(&out.stdout)); + if !out.status.success() { + let err = strip_ansi(&String::from_utf8_lossy(&out.stderr)); + bail!("{prog} {}: {}", args.join(" "), err.trim()); + } + Ok(stdout) +} + +/// bluetoothctl colours its output even when it isn't a terminal. +fn strip_ansi(s: &str) -> String { + let mut out = String::with_capacity(s.len()); + let mut chars = s.chars(); + while let Some(c) = chars.next() { + if c == '\x1b' { + for c in chars.by_ref() { + if c.is_ascii_alphabetic() { + break; + } + } + } else if c != '\x01' && c != '\x02' { + out.push(c); + } + } + out +} + +// ---- display --------------------------------------------------------------- + +#[derive(Debug, Clone, PartialEq)] +pub struct Mode { + pub w: u32, + pub h: u32, + pub hz: f32, + pub preferred: bool, +} + +impl Mode { + pub fn label(&self) -> String { + format!("{} × {} · {} Hz", self.w, self.h, fmt_hz(self.hz)) + } + + /// Short name of the format, e.g. "4K UHD". + pub fn name(&self) -> &'static str { + match (self.w, self.h) { + (3840, 2160) | (4096, 2160) => "4K UHD", + (2560, 1440) => "QHD", + (1920, 1080) => "Full HD", + (1280, 720) => "HD", + _ => "", + } + } + + /// Key stored in settings.toml (`display_mode`). + pub fn key(&self) -> String { + format!("{}x{}@{:.3}", self.w, self.h, self.hz) + } + + fn same(&self, other: &Mode) -> bool { + self.w == other.w && self.h == other.h && (self.hz - other.hz).abs() < 0.05 + } + + pub fn matches_key(&self, key: &str) -> bool { + parse_mode_key(key).is_some_and(|m| self.same(&m)) + } +} + +fn fmt_hz(hz: f32) -> String { + let r = (hz * 100.0).round() / 100.0; + if (r - r.round()).abs() < 0.005 { format!("{}", r.round() as u32) } else { format!("{r:.2}") } +} + +fn parse_mode_key(key: &str) -> Option { + let (size, hz) = key.split_once('@')?; + let (w, h) = size.split_once('x')?; + Some(Mode { w: w.parse().ok()?, h: h.parse().ok()?, hz: hz.trim_end_matches("Hz").parse().ok()?, preferred: false }) +} + +#[derive(Debug, Clone)] +pub struct Display { + pub output: String, + pub description: String, + pub modes: Vec, + pub current: Option, +} + +impl Display { + pub fn current_mode(&self) -> Option<&Mode> { + self.current.and_then(|i| self.modes.get(i)) + } +} + +/// Parses `wlr-randr` text output; the first output is the TV. +fn parse_wlr_randr(text: &str) -> Option { + let mut lines = text.lines(); + let head = lines.find(|l| !l.trim().is_empty() && !l.starts_with(' '))?; + let (output, description) = match head.split_once(' ') { + Some((o, d)) => (o.to_string(), d.trim().trim_matches('"').to_string()), + None => (head.trim().to_string(), String::new()), + }; + let mut modes: Vec = Vec::new(); + let mut current = None; + let mut in_modes = false; + for line in lines { + if !line.starts_with(' ') { + break; // next output + } + let t = line.trim(); + if t == "Modes:" { + in_modes = true; + continue; + } + if !in_modes { + continue; + } + if !t.chars().next().is_some_and(|c| c.is_ascii_digit()) { + in_modes = false; + continue; + } + // "1920x1080 px, 60.000000 Hz (preferred, current)" + let Some((size, rest)) = t.split_once(" px,") else { continue }; + let Some((w, h)) = size.split_once('x') else { continue }; + let hz: f32 = rest.trim().split_whitespace().next().and_then(|v| v.parse().ok()).unwrap_or(60.0); + let flags = rest.split_once('(').map(|(_, f)| f).unwrap_or(""); + let mode = Mode { + w: w.trim().parse().unwrap_or(0), + h: h.trim().parse().unwrap_or(0), + hz, + preferred: flags.contains("preferred"), + }; + let is_current = flags.contains("current"); + match modes.iter().position(|m| m.same(&mode)) { + Some(i) => { + modes[i].preferred |= mode.preferred; + if is_current { + current = Some(i); + } + } + None => { + modes.push(mode); + if is_current { + current = Some(modes.len() - 1); + } + } + } + } + // Biggest first; tiny legacy modes are not useful on a TV. + let cur = current.map(|i| modes[i].clone()); + modes.retain(|m| (m.w >= 1024 && m.h >= 576) || cur.as_ref().is_some_and(|c| c.same(m))); + modes.sort_by(|a, b| (b.w * b.h).cmp(&(a.w * a.h)).then(b.hz.total_cmp(&a.hz))); + let current = cur.and_then(|c| modes.iter().position(|m| m.same(&c))); + Some(Display { output, description, modes, current }) +} + +static DEMO_DISPLAY: Mutex> = Mutex::new(None); + +fn demo_display() -> Display { + let mut guard = DEMO_DISPLAY.lock().unwrap(); + guard + .get_or_insert_with(|| { + let m = |w, h, hz, preferred| Mode { w, h, hz, preferred }; + Display { + output: "HDMI-A-1".into(), + description: "Fejlesztői mód (demó kijelző)".into(), + modes: vec![ + m(3840, 2160, 60.0, true), + m(3840, 2160, 30.0, false), + m(2560, 1440, 60.0, false), + m(1920, 1080, 60.0, false), + m(1920, 1080, 50.0, false), + m(1280, 720, 60.0, false), + ], + current: Some(3), + } + }) + .clone() +} + +pub fn display() -> Result { + if demo() { + return Ok(demo_display()); + } + let out = run("wlr-randr", &[], Duration::from_secs(3))?; + parse_wlr_randr(&out).context("wlr-randr: no output found") +} + +pub fn set_mode(output: &str, mode: &Mode) -> Result<()> { + if demo() { + let mut guard = DEMO_DISPLAY.lock().unwrap(); + if let Some(d) = guard.as_mut() { + d.current = d.modes.iter().position(|m| m.same(mode)); + } + return Ok(()); + } + let arg = format!("{}x{}@{}Hz", mode.w, mode.h, mode.hz); + run("wlr-randr", &["--output", output, "--mode", &arg], Duration::from_secs(5))?; + Ok(()) +} + +/// Applies the saved `display_mode` at startup, if the TV offers it. +pub fn apply_saved_mode(key: &str) -> Result<()> { + let d = display()?; + let Some(mode) = d.modes.iter().find(|m| m.matches_key(key)) else { + bail!("saved mode {key} is not offered by {}", d.output); + }; + if d.current_mode().is_some_and(|c| c.same(mode)) { + return Ok(()); + } + log::info!("display: applying saved mode {}", mode.label()); + set_mode(&d.output, mode) +} + +/// Standby: switches the TV signal off or back on. `saved` is the +/// `display_mode` to restore after the output comes back. +pub fn display_power(on: bool, saved: Option<&str>) -> Result<()> { + if demo() || std::env::var_os("WAYLAND_DISPLAY").is_none() { + return Ok(()); + } + let t = Duration::from_secs(4); + // DPMS keeps the mode; only if the compositor offers it (wlopm installed). + let state = if on { "--on" } else { "--off" }; + if run("wlopm", &[state, "*"], t).is_ok() { + return Ok(()); + } + // Otherwise disable the output (cage supports wlr-output-management). + let head = run("wlr-randr", &[], t)?; + let output = parse_wlr_randr(&head).context("wlr-randr: no output found")?.output; + run("wlr-randr", &["--output", &output, state], t)?; + if on { + if let Some(key) = saved { + apply_saved_mode(key)?; + } + } + Ok(()) +} + +/// Whether the Bluetooth controller may wake the machine (USB `power/wakeup`). +/// sf-remote (root) turns this on before suspending. +#[derive(Debug, Clone, PartialEq)] +pub enum BtWake { + NoController, + Enabled, + /// Off now; sf-remote enables it before each suspend. + Disabled, + Unknown, +} + +pub fn bt_wake() -> BtWake { + if demo() { + return BtWake::Enabled; + } + let Ok(entries) = std::fs::read_dir("/sys/class/bluetooth") else { return BtWake::NoController }; + let mut found = false; + for e in entries.flatten() { + let name = e.file_name().to_string_lossy().to_string(); + if !name.starts_with("hci") || name.contains(':') { + continue; + } + found = true; + let Ok(dev) = std::fs::canonicalize(e.path().join("device")) else { continue }; + if let Some(v) = dev.ancestors().find_map(|a| std::fs::read_to_string(a.join("power/wakeup")).ok()) { + return if v.trim() == "enabled" { BtWake::Enabled } else { BtWake::Disabled }; + } + } + if found { BtWake::Unknown } else { BtWake::NoController } +} + +// ---- bluetooth ----------------------------------------------------------- + +#[derive(Debug, Clone)] +pub struct BtDevice { + pub address: String, + pub name: String, + pub connected: bool, + pub battery: Option, + /// An Apple Siri Remote (the one sf-remote drives). + pub remote: bool, + pub icon: String, +} + +impl BtDevice { + pub fn status(&self) -> String { + match (self.connected, self.battery) { + (true, Some(b)) => format!("Csatlakozva · {b}%"), + (true, None) => "Csatlakozva".into(), + (false, _) if self.remote => "Alszik · nyomj meg egy gombot".into(), + (false, _) => "Nincs csatlakozva".into(), + } + } + + pub fn kind_label(&self) -> &'static str { + if self.remote { + return "Siri Remote"; + } + match self.icon.as_str() { + "audio-headphones" | "audio-headset" => "Fejhallgató", + "audio-card" | "audio-speakers" => "Hangszóró", + "input-gaming" => "Játékvezérlő", + "input-keyboard" => "Billentyűzet", + "input-mouse" => "Egér", + "phone" => "Telefon", + _ => "Bluetooth eszköz", + } + } +} + +fn is_mac(s: &str) -> bool { + s.len() == 17 && s.split(':').count() == 6 && s.split(':').all(|p| p.len() == 2 && p.chars().all(|c| c.is_ascii_hexdigit())) +} + +/// "Device AA:BB:CC:DD:EE:FF Name" lines. +fn parse_device_list(text: &str) -> Vec<(String, String)> { + text.lines() + .filter_map(|l| { + let rest = &l[l.find("Device ")? + "Device ".len()..]; + let (addr, name) = rest.split_once(' ').unwrap_or((rest, "")); + is_mac(addr).then(|| (addr.to_string(), name.trim().to_string())) + }) + .collect() +} + +fn parse_info(addr: &str, fallback_name: &str, text: &str) -> BtDevice { + let field = |key: &str| { + text.lines() + .map(str::trim) + .find_map(|l| l.strip_prefix(key).map(|v| v.trim().to_string())) + }; + let name = field("Alias:").or_else(|| field("Name:")).unwrap_or_else(|| fallback_name.to_string()); + let connected = field("Connected:").is_some_and(|v| v == "yes"); + // "Battery Percentage: 0x5a (90)" + let battery = field("Battery Percentage:") + .and_then(|v| v.split_once('(').and_then(|(_, p)| p.trim_end_matches(')').parse().ok())); + // "Modalias: bluetooth:v004Cp0315d0001" (vendor 004C = Apple) + let modalias = field("Modalias:").unwrap_or_default().to_ascii_lowercase(); + let remote = ["p0314", "p0315", "p0266"].iter().any(|p| modalias.contains(&format!("v004c{p}"))); + let icon = field("Icon:").unwrap_or_default(); + BtDevice { address: addr.to_string(), name, connected, battery, remote, icon } +} + +static DEMO_DEVICES: Mutex>> = Mutex::new(None); + +fn demo_devices() -> Vec { + DEMO_DEVICES + .lock() + .unwrap() + .get_or_insert_with(|| { + vec![ + BtDevice { + address: "F0:B3:EC:12:7A:41".into(), + name: "Siri Remote".into(), + connected: true, + battery: Some(82), + remote: true, + icon: "input-gaming".into(), + }, + BtDevice { + address: "4C:87:5D:0E:22:9B".into(), + name: "AirPods Pro".into(), + connected: false, + battery: None, + remote: false, + icon: "audio-headphones".into(), + }, + ] + }) + .clone() +} + +pub fn bt_devices() -> Result> { + if demo() { + return Ok(demo_devices()); + } + let t = Duration::from_secs(4); + let list = match run("bluetoothctl", &["devices", "Paired"], t) { + Ok(out) if !parse_device_list(&out).is_empty() => out, + // Older BlueZ. + _ => run("bluetoothctl", &["paired-devices"], t).unwrap_or_default(), + }; + let mut devices = Vec::new(); + for (addr, name) in parse_device_list(&list) { + let info = run("bluetoothctl", &["info", &addr], t).unwrap_or_default(); + devices.push(parse_info(&addr, &name, &info)); + } + // Remotes first, then connected devices. + devices.sort_by_key(|d| (!d.remote, !d.connected, d.name.to_lowercase())); + Ok(devices) +} + +pub fn bt_remove(addr: &str) -> Result<()> { + if demo() { + if let Some(list) = DEMO_DEVICES.lock().unwrap().as_mut() { + list.retain(|d| d.address != addr); + } + return Ok(()); + } + let out = run("bluetoothctl", &["remove", addr], Duration::from_secs(6))?; + if out.contains("not available") || out.contains("Failed") { + bail!("{}", out.trim()); + } + Ok(()) +} + +// ---- network & device info ------------------------------------------------- + +#[derive(Debug, Clone, Default)] +pub struct NetInfo { + pub iface: Option, + pub wireless: bool, + pub ip: Option, + pub gateway: Option, + pub wifi_adapter: bool, +} + +pub fn network() -> NetInfo { + if demo() { + return NetInfo { + iface: Some("enp1s0".into()), + wireless: false, + ip: Some("192.168.1.42".into()), + gateway: Some("192.168.1.1".into()), + wifi_adapter: true, + }; + } + let t = Duration::from_secs(2); + let mut info = NetInfo::default(); + // "2: enp1s0 inet 192.168.1.42/24 brd ... " + if let Ok(out) = run("ip", &["-o", "-4", "addr", "show", "scope", "global"], t) { + if let Some(line) = out.lines().next() { + let f: Vec<&str> = line.split_whitespace().collect(); + info.iface = f.get(1).map(|s| s.to_string()); + info.ip = f.get(3).map(|s| s.split('/').next().unwrap_or(s).to_string()); + } + } + // "default via 192.168.1.1 dev enp1s0 ..." + if let Ok(out) = run("ip", &["route", "show", "default"], t) { + let f: Vec<&str> = out.split_whitespace().collect(); + info.gateway = f.iter().position(|w| *w == "via").and_then(|i| f.get(i + 1)).map(|s| s.to_string()); + } + let wireless = |iface: &str| std::path::Path::new("/sys/class/net").join(iface).join("wireless").exists(); + info.wireless = info.iface.as_deref().is_some_and(wireless); + info.wifi_adapter = std::fs::read_dir("/sys/class/net") + .map(|d| d.flatten().any(|e| wireless(&e.file_name().to_string_lossy()))) + .unwrap_or(false); + info +} + +// ---- wi-fi (iwd over D-Bus) ------------------------------------------------- +// +// Reads go through `busctl --json` (the whole iwd object tree in one call). +// A new password needs an agent, which `iwctl --passphrase` provides; known +// and open networks connect with a plain D-Bus call. The tv user reaches iwd +// through the netdev group (iwd's D-Bus policy). + +const IWD: &str = "net.connman.iwd"; + +#[derive(Debug, Clone, Copy, PartialEq)] +pub enum Security { + Open, + Psk, + Wep, + Enterprise, +} + +#[derive(Debug, Clone, PartialEq)] +pub struct WifiNetwork { + /// D-Bus object path, stable while the network is in range. + pub path: String, + pub name: String, + pub security: Security, + /// dBm. + pub signal: i32, + pub connected: bool, + /// KnownNetwork object path when a password is saved. + pub known: Option, +} + +impl WifiNetwork { + pub fn bars(&self) -> i32 { + match self.signal { + s if s >= -60 => 4, + s if s >= -67 => 3, + s if s >= -75 => 2, + _ => 1, + } + } + + pub fn strength_label(&self) -> &'static str { + ["", "Gyenge", "Közepes", "Jó", "Kiváló"][self.bars() as usize] + } + + pub fn security_label(&self) -> &'static str { + match self.security { + Security::Open => "Nyílt hálózat", + Security::Psk => "Jelszóval védett", + Security::Wep => "WEP (elavult)", + Security::Enterprise => "Vállalati (802.1X)", + } + } +} + +#[derive(Debug, Clone, Default, PartialEq)] +pub struct Wifi { + /// iwd Device object path. + pub device: String, + /// Interface name, e.g. "wlan0". + pub iface: String, + pub powered: bool, + pub scanning: bool, + /// Strongest first, the connected one on top. + pub networks: Vec, +} + +fn busctl(args: &[&str], timeout: Duration) -> Result { + let mut all = vec!["--json=short"]; + all.extend_from_slice(args); + let out = run("busctl", &all, timeout).map_err(|e| { + let text = format!("{e:#}"); + if text.contains("not provided by any") || text.contains("ServiceUnknown") || text.contains("was not provided") { + anyhow::anyhow!("a Wi-Fi szolgáltatás (iwd) nem fut") + } else { + e + } + })?; + if out.trim().is_empty() { + return Ok(serde_json::Value::Null); + } + serde_json::from_str(&out).context("busctl: unexpected output") +} + +/// One D-Bus property from a GetManagedObjects entry. +fn prop<'a>(obj: &'a serde_json::Value, iface: &str, name: &str) -> Option<&'a serde_json::Value> { + obj.get(iface)?.get(name)?.get("data") +} + +/// Builds the state from `GetManagedObjects` data and the ordered +/// (network path, signal in 100 * dBm) list of the station. +fn parse_wifi(objects: &serde_json::Value, ordered: &[(String, i64)]) -> Option { + let objs = objects.as_object()?; + let (device, dev) = objs + .iter() + .filter(|(_, o)| o.get("net.connman.iwd.Device").is_some()) + .min_by_key(|(p, _)| p.len())?; + let text = |o: &serde_json::Value, i: &str, n: &str| prop(o, i, n).and_then(|v| v.as_str()).unwrap_or("").to_string(); + let flag = |o: &serde_json::Value, i: &str, n: &str| prop(o, i, n).and_then(|v| v.as_bool()).unwrap_or(false); + let mut wifi = Wifi { + device: device.clone(), + iface: text(dev, "net.connman.iwd.Device", "Name"), + powered: flag(dev, "net.connman.iwd.Device", "Powered"), + scanning: flag(dev, "net.connman.iwd.Station", "Scanning"), + networks: Vec::new(), + }; + for (path, signal) in ordered { + let Some(net) = objs.get(path) else { continue }; + let name = text(net, "net.connman.iwd.Network", "Name"); + if name.is_empty() { + continue; + } + let security = match text(net, "net.connman.iwd.Network", "Type").as_str() { + "open" | "owe" => Security::Open, + "wep" => Security::Wep, + "8021x" => Security::Enterprise, + _ => Security::Psk, + }; + wifi.networks.push(WifiNetwork { + path: path.clone(), + name, + security, + signal: (*signal / 100) as i32, + connected: flag(net, "net.connman.iwd.Network", "Connected"), + known: prop(net, "net.connman.iwd.Network", "KnownNetwork").and_then(|v| v.as_str()).map(str::to_string), + }); + } + // Stable sort keeps iwd's signal order inside each group. + wifi.networks.sort_by_key(|n| !n.connected); + Some(wifi) +} + +static DEMO_WIFI: Mutex> = Mutex::new(None); + +fn with_demo_wifi(f: impl FnOnce(&mut Wifi) -> T) -> T { + let mut guard = DEMO_WIFI.lock().unwrap(); + let wifi = guard.get_or_insert_with(|| { + let n = |i: usize, name: &str, security, signal, known: bool| WifiNetwork { + path: format!("/net/connman/iwd/0/4/demo{i}"), + name: name.into(), + security, + signal, + connected: false, + known: known.then(|| format!("/net/connman/iwd/known/demo{i}")), + }; + Wifi { + device: "/net/connman/iwd/0/4".into(), + iface: "wlan0".into(), + powered: true, + scanning: false, + networks: vec![ + n(1, "Otthon-5G", Security::Psk, -48, false), + n(2, "Otthon", Security::Psk, -58, true), + n(3, "Kávézó vendég", Security::Open, -69, false), + n(4, "Szomszéd_WiFi", Security::Psk, -77, false), + n(5, "Iroda", Security::Enterprise, -81, false), + ], + } + }); + f(wifi) +} + +/// Ok(None) when there is no Wi-Fi adapter. +pub fn wifi() -> Result> { + if demo() { + return Ok(Some(with_demo_wifi(|w| { + let mut w = w.clone(); + if !w.powered { + w.networks.clear(); + } + w + }))); + } + let t = Duration::from_secs(3); + let objects = busctl(&["call", IWD, "/", "org.freedesktop.DBus.ObjectManager", "GetManagedObjects"], t)?; + let objects = &objects["data"][0]; + let station = objects.as_object().and_then(|o| { + o.iter() + .filter(|(_, v)| v.get("net.connman.iwd.Station").is_some()) + .map(|(p, _)| p.clone()) + .min_by_key(|p| p.len()) + }); + let mut ordered = Vec::new(); + if let Some(station) = station { + // {"type":"a(on)","data":[[["/net/connman/iwd/0/4/..._psk",-5400], ...]]} + let v = busctl(&["call", IWD, &station, "net.connman.iwd.Station", "GetOrderedNetworks"], t)?; + if let Some(list) = v["data"][0].as_array() { + for item in list { + if let (Some(p), Some(s)) = (item[0].as_str(), item[1].as_i64()) { + ordered.push((p.to_string(), s)); + } + } + } + } + Ok(parse_wifi(objects, &ordered)) +} + +/// Starts a scan; results show up in `wifi()` a few seconds later. +pub fn wifi_scan(device: &str) -> Result<()> { + if demo() { + return Ok(()); + } + match busctl(&["call", IWD, device, "net.connman.iwd.Station", "Scan"], Duration::from_secs(5)) { + Err(e) if format!("{e:#}").contains("InProgress") => Ok(()), + r => r.map(|_| ()), + } +} + +pub fn wifi_set_powered(device: &str, on: bool) -> Result<()> { + if demo() { + with_demo_wifi(|w| w.powered = on); + return Ok(()); + } + let t = Duration::from_secs(5); + let value = if on { "true" } else { "false" }; + if on { + // The adapter (radio) has to be on before the device can be. + let adapter = busctl(&["get-property", IWD, device, "net.connman.iwd.Device", "Adapter"], t)?; + if let Some(adapter) = adapter["data"].as_str() { + busctl(&["set-property", IWD, adapter, "net.connman.iwd.Adapter", "Powered", "b", "true"], t)?; + } + } + busctl(&["set-property", IWD, device, "net.connman.iwd.Device", "Powered", "b", value], t)?; + Ok(()) +} + +/// Connects and waits until iwd reports the network connected. +/// `passphrase` is needed only for a protected network that isn't saved yet. +pub fn wifi_connect(iface: &str, net: &WifiNetwork, passphrase: Option<&str>) -> Result<()> { + if demo() { + std::thread::sleep(Duration::from_millis(1500)); + if passphrase.is_some_and(|p| p == "rosszjelszo") { + bail!("hibás jelszó"); + } + with_demo_wifi(|w| { + for n in &mut w.networks { + n.connected = n.path == net.path; + if n.connected && n.known.is_none() && n.security != Security::Open { + n.known = Some(format!("/net/connman/iwd/known/{}", n.name)); + } + } + w.networks.sort_by_key(|n| !n.connected); + }); + return Ok(()); + } + let t = Duration::from_secs(40); + let attempt = match passphrase { + Some(p) => run("iwctl", &["--passphrase", p, "station", iface, "connect", &net.name], t), + None => busctl(&["call", IWD, &net.path, "net.connman.iwd.Network", "Connect"], t).map(|_| String::new()), + }; + // iwctl doesn't always exit non-zero on failure: trust iwd's state instead. + let connected = wifi().ok().flatten().is_some_and(|w| w.networks.iter().any(|n| n.connected && n.name == net.name)); + if connected { + return Ok(()); + } + let detail = match attempt { + Ok(out) => out.trim().to_string(), + Err(e) => format!("{e:#}"), + }; + log::warn!("wifi: connecting to {} failed: {detail}", net.name); + if passphrase.is_some() || detail.contains("Failed") || detail.contains("Operation failed") { + bail!("hibás jelszó, vagy a hálózat nem érhető el"); + } + bail!("{}", if detail.is_empty() { "a kapcsolat nem jött létre".to_string() } else { detail }) +} + +pub fn wifi_disconnect(device: &str) -> Result<()> { + if demo() { + with_demo_wifi(|w| w.networks.iter_mut().for_each(|n| n.connected = false)); + return Ok(()); + } + busctl(&["call", IWD, device, "net.connman.iwd.Station", "Disconnect"], Duration::from_secs(10))?; + Ok(()) +} + +/// Deletes the saved password (and disconnects if it is the current network). +pub fn wifi_forget(known: &str) -> Result<()> { + if demo() { + with_demo_wifi(|w| { + for n in &mut w.networks { + if n.known.as_deref() == Some(known) { + n.known = None; + n.connected = false; + } + } + }); + return Ok(()); + } + busctl(&["call", IWD, known, "net.connman.iwd.KnownNetwork", "Forget"], Duration::from_secs(10))?; + Ok(()) +} + +#[derive(Debug, Clone, Default)] +pub struct DeviceInfo { + pub hostname: String, + pub os: String, + pub kernel: String, +} + +pub fn device_info() -> DeviceInfo { + if !cfg!(target_os = "linux") { + return DeviceInfo { + hostname: std::env::var("COMPUTERNAME").unwrap_or_else(|_| "smartfox".into()).to_lowercase(), + os: "Windows (fejlesztői mód)".into(), + kernel: "-".into(), + }; + } + let read = |p: &str| std::fs::read_to_string(p).unwrap_or_default().trim().to_string(); + let os = read("/etc/os-release") + .lines() + .find_map(|l| l.strip_prefix("PRETTY_NAME=").map(|v| v.trim_matches('"').to_string())) + .unwrap_or_else(|| "Linux".into()); + DeviceInfo { hostname: read("/etc/hostname"), os, kernel: read("/proc/sys/kernel/osrelease") } +} + +// ---- remote debugging (ssh) ---------------------------------------------- + +/// The launcher runs as `tv`, so it can't start sshd itself: it writes this +/// flag and sf-remote-debug.path (root) starts or stops ssh.service. +const DEBUG_FLAG: &str = "/var/lib/smartfox/remote-debug"; + +static DEMO_DEBUG: Mutex = Mutex::new(false); + +#[derive(Debug, Clone, Default, PartialEq)] +pub struct RemoteDebug { + /// sshd is running. + pub on: bool, + /// When it turns off by itself ("21:45"); None without a time limit (VM). + pub until: Option, +} + +pub fn remote_debug() -> RemoteDebug { + if demo() { + let on = *DEMO_DEBUG.lock().unwrap(); + return RemoteDebug { on, until: on.then(|| "21:45".into()) }; + } + let t = Duration::from_secs(2); + // `is-active` exits non-zero unless the unit is active. + let on = run("systemctl", &["is-active", "ssh.service"], t).is_ok(); + let until = if on { + run("systemctl", &["show", "sf-remote-debug-off.timer", "--property=NextElapseUSecRealtime", "--value"], t) + .ok() + .and_then(|v| clock(&v)) + } else { + None + }; + RemoteDebug { on, until } +} + +/// "Fri 2026-10-23 21:45:00 CEST" -> "21:45". +fn clock(timestamp: &str) -> Option { + timestamp + .split_whitespace() + .find(|w| w.len() == 8 && w.as_bytes()[2] == b':' && w.as_bytes()[5] == b':') + .map(|w| w[..5].to_string()) +} + +/// Turns sshd on or off and waits until it has happened. +pub fn set_remote_debug(on: bool) -> Result<()> { + if demo() { + *DEMO_DEBUG.lock().unwrap() = on; + return Ok(()); + } + std::fs::write(DEBUG_FLAG, if on { "on\n" } else { "off\n" }).with_context(|| format!("writing {DEBUG_FLAG}"))?; + let deadline = Instant::now() + Duration::from_secs(8); + while Instant::now() < deadline { + if remote_debug().on == on { + return Ok(()); + } + std::thread::sleep(Duration::from_millis(250)); + } + bail!("ssh.service is still {}", if on { "stopped" } else { "running" }) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn parses_wlr_randr() { + let text = "HDMI-A-1 \"Samsung Electric Company SAMSUNG (HDMI-A-1)\"\n Enabled: yes\n Modes:\n 3840x2160 px, 30.000000 Hz\n 1920x1080 px, 60.000000 Hz (preferred, current)\n 1920x1080 px, 59.940002 Hz\n 3840x2160 px, 60.000000 Hz\n 720x400 px, 70.082001 Hz\n Position: 0,0\n Transform: normal\n Scale: 1.000000\n"; + let d = parse_wlr_randr(text).unwrap(); + assert_eq!(d.output, "HDMI-A-1"); + assert!(d.description.starts_with("Samsung")); + assert_eq!(d.modes.len(), 4); + assert_eq!((d.modes[0].w, d.modes[0].hz), (3840, 60.0)); + let cur = d.current_mode().unwrap(); + assert_eq!((cur.w, cur.h, cur.preferred), (1920, 1080, true)); + assert_eq!(cur.label(), "1920 × 1080 · 60 Hz"); + assert_eq!(d.modes[3].label(), "1920 × 1080 · 59.94 Hz"); + assert!(cur.matches_key(&cur.key())); + } + + #[test] + fn parses_bluetoothctl() { + let list = "\x1b[0;94m[bluetooth]\x1b[0m# Device F0:B3:EC:12:7A:41 Siri Remote\nDevice 4C:87:5D:0E:22:9B AirPods Pro\nnoise"; + let devs = parse_device_list(&strip_ansi(list)); + assert_eq!(devs.len(), 2); + assert_eq!(devs[0], ("F0:B3:EC:12:7A:41".into(), "Siri Remote".into())); + let info = "Device F0:B3:EC:12:7A:41 (public)\n\tName: Siri Remote\n\tAlias: Nappali távirányító\n\tIcon: input-gaming\n\tConnected: yes\n\tModalias: bluetooth:v004Cp0315d0001\n\tBattery Percentage: 0x52 (82)\n"; + let d = parse_info("F0:B3:EC:12:7A:41", "x", info); + assert!(d.remote && d.connected); + assert_eq!(d.battery, Some(82)); + assert_eq!(d.name, "Nappali távirányító"); + } + + #[test] + fn parses_iwd_objects() { + let objects: serde_json::Value = serde_json::from_str( + r#"{ + "/net/connman/iwd/0": {"net.connman.iwd.Adapter": {"Powered": {"type":"b","data":true}}}, + "/net/connman/iwd/0/4": { + "net.connman.iwd.Device": {"Name": {"type":"s","data":"wlan0"}, "Powered": {"type":"b","data":true}, "Mode": {"type":"s","data":"station"}}, + "net.connman.iwd.Station": {"State": {"type":"s","data":"connected"}, "Scanning": {"type":"b","data":false}} + }, + "/net/connman/iwd/0/4/4f74686f6e_psk": {"net.connman.iwd.Network": { + "Name": {"type":"s","data":"Otthon"}, "Type": {"type":"s","data":"psk"}, "Connected": {"type":"b","data":true}, + "KnownNetwork": {"type":"o","data":"/net/connman/iwd/4f74686f6e_psk"}}}, + "/net/connman/iwd/0/4/4b617665_open": {"net.connman.iwd.Network": { + "Name": {"type":"s","data":"Kávé"}, "Type": {"type":"s","data":"open"}, "Connected": {"type":"b","data":false}}} + }"#, + ) + .unwrap(); + let ordered = vec![ + ("/net/connman/iwd/0/4/4b617665_open".to_string(), -4500), + ("/net/connman/iwd/0/4/4f74686f6e_psk".to_string(), -7000), + ]; + let w = parse_wifi(&objects, &ordered).unwrap(); + assert_eq!((w.iface.as_str(), w.powered, w.device.as_str()), ("wlan0", true, "/net/connman/iwd/0/4")); + assert_eq!(w.networks.len(), 2); + // Connected first, then by signal. + assert_eq!(w.networks[0].name, "Otthon"); + assert!(w.networks[0].connected && w.networks[0].known.is_some()); + assert_eq!((w.networks[0].signal, w.networks[0].bars()), (-70, 2)); + assert_eq!((w.networks[1].security, w.networks[1].bars()), (Security::Open, 4)); + assert!(parse_wifi(&serde_json::json!({}), &[]).is_none()); + } + + #[test] + fn parses_timer_clock() { + assert_eq!(clock("Fri 2026-10-23 21:45:07 CEST\n").as_deref(), Some("21:45")); + assert_eq!(clock(""), None); + } +} diff --git a/crates/sf-launcher/src/winfade.rs b/crates/sf-launcher/src/winfade.rs new file mode 100644 index 0000000..3d195c4 --- /dev/null +++ b/crates/sf-launcher/src/winfade.rs @@ -0,0 +1,109 @@ +//! Windows-only helpers for local testing: keep a freshly started app window +//! invisible while the launcher plays its transition, then fade it in. +//! (On the TV the compositor does this.) + +use std::time::{Duration, Instant}; + +use windows_sys::Win32::Foundation::{HWND, LPARAM}; +use windows_sys::Win32::UI::WindowsAndMessaging::{ + EnumWindows, GW_OWNER, GWL_EXSTYLE, GetWindow, GetWindowLongPtrW, GetWindowTextW, GetWindowThreadProcessId, + IsWindowVisible, LWA_ALPHA, SetForegroundWindow, SetLayeredWindowAttributes, SetWindowLongPtrW, WS_EX_LAYERED, +}; + +struct Search { + pid: u32, + found: HWND, +} + +unsafe extern "system" fn enum_cb(hwnd: HWND, lparam: LPARAM) -> i32 { + let search = unsafe { &mut *(lparam as *mut Search) }; + let mut pid = 0u32; + unsafe { GetWindowThreadProcessId(hwnd, &mut pid) }; + let top_level = unsafe { GetWindow(hwnd, GW_OWNER) }.is_null(); + if pid == search.pid && top_level && unsafe { IsWindowVisible(hwnd) } != 0 { + search.found = hwnd; + return 0; // stop + } + 1 +} + +fn find_window(pid: u32) -> Option { + let mut s = Search { pid, found: std::ptr::null_mut() }; + unsafe { EnumWindows(Some(enum_cb), &mut s as *mut Search as LPARAM) }; + (!s.found.is_null()).then_some(s.found) +} + +fn title(hwnd: HWND) -> String { + let mut buf = [0u16; 256]; + let n = unsafe { GetWindowTextW(hwnd, buf.as_mut_ptr(), buf.len() as i32) }; + String::from_utf16_lossy(&buf[..n.max(0) as usize]) +} + +fn set_alpha(hwnd: HWND, alpha: u8) { + unsafe { + let ex = GetWindowLongPtrW(hwnd, GWL_EXSTYLE); + if ex & WS_EX_LAYERED as isize == 0 { + SetWindowLongPtrW(hwnd, GWL_EXSTYLE, ex | WS_EX_LAYERED as isize); + } + SetLayeredWindowAttributes(hwnd, 0, alpha, LWA_ALPHA); + } +} + +fn clear_layered(hwnd: HWND) { + unsafe { + let ex = GetWindowLongPtrW(hwnd, GWL_EXSTYLE); + SetWindowLongPtrW(hwnd, GWL_EXSTYLE, ex & !(WS_EX_LAYERED as isize)); + } +} + +/// Hides the app's window as soon as it appears, waits until `not_before` +/// and until the page has a title (or a timeout), then fades it in. +/// Runs on its own thread; `on_shown` is called after the fade. +pub fn reveal_when_ready(pid: u32, not_before: Instant, on_shown: impl FnOnce() + Send + 'static) { + std::thread::spawn(move || { + let start = Instant::now(); + let hwnd = loop { + if let Some(h) = find_window(pid) { + set_alpha(h, 0); + break h as usize; + } + if start.elapsed() > Duration::from_secs(20) { + log::warn!("app window for pid {pid} not found"); + on_shown(); + return; + } + std::thread::sleep(Duration::from_millis(5)); + }; + let hwnd = hwnd as HWND; + let found_at = Instant::now(); + // Wait for the page to load: Chrome app windows take the page title. + loop { + let t = title(hwnd); + let loaded = !t.is_empty() && !t.starts_with("http") && !t.contains("about:blank"); + let waited = found_at.elapsed() > Duration::from_millis(3500); + if Instant::now() >= not_before && (loaded || waited) { + break; + } + std::thread::sleep(Duration::from_millis(30)); + } + let fade = Duration::from_millis(340); + let t0 = Instant::now(); + while t0.elapsed() < fade { + let x = t0.elapsed().as_secs_f32() / fade.as_secs_f32(); + let eased = 1.0 - (1.0 - x).powi(3); + set_alpha(hwnd, (eased * 255.0) as u8); + std::thread::sleep(Duration::from_millis(8)); + } + set_alpha(hwnd, 255); + clear_layered(hwnd); + unsafe { SetForegroundWindow(hwnd) }; + on_shown(); + }); +} + +/// Brings this process's own window back to the front. +pub fn focus_self() { + if let Some(h) = find_window(std::process::id()) { + unsafe { SetForegroundWindow(h) }; + } +} diff --git a/crates/sf-launcher/ui/app.slint b/crates/sf-launcher/ui/app.slint new file mode 100644 index 0000000..7f2a118 --- /dev/null +++ b/crates/sf-launcher/ui/app.slint @@ -0,0 +1,1030 @@ +// SmartFox launcher UI. +// +// Everything is laid out on a 1920x1080 design grid scaled by `u`. +// The frosted glass surfaces are NOT drawn here: Slint exports their geometry +// (`glass-rects` plus the card-row properties) and the Rust OpenGL layer draws +// them underneath. Slint only draws text, icons and simple overlays on top. + +import "fonts/Inter-Regular.ttf"; +import "fonts/Inter-Medium.ttf"; +import "fonts/Inter-SemiBold.ttf"; +import "fonts/InterDisplay-Bold.ttf"; +import "fonts/InterDisplay-ExtraBold.ttf"; + +import { AppIcon, WifiIcon, BluetoothIcon, PlayIcon, InfoIcon } from "icons.slint"; +import { PairingGuide } from "pairing.slint"; +import { SettingsView, SettingRow } from "settings.slint"; +import { KeyboardView } from "keyboard.slint"; + +export struct AppEntry { + id: string, + name: string, + category: string, + description: string, + icon: string, + accent: color, + kind: string, + kind-label: string, + target: string, +} + +export struct GlassRect { + x: length, + y: length, + w: length, + h: length, + r: length, + focus: float, + alpha: float, + // Frost (mip level). Negative = nested glass that sits on another pane. + blur: float, + glow: color, + // alpha channel = tint amount + tint: color, + // Consecutive rects with the same group (> 0) melt together like liquid. + group: int, +} + +export component App inherits Window { + title: "SmartFox"; + background: #050506; + default-font-family: "Inter"; + preferred-width: 1600px; + preferred-height: 900px; + forward-focus: keys; + + // ---- data from Rust ------------------------------------------------- + in property <[AppEntry]> apps; + in property clock: "21:42"; + in property date: "csütörtök, okt. 23."; + in property remote-status: "Nincs párosítva"; + // Remote pairing guide (state comes from sf-remote). + in-out property remote-state; + in-out property pairing-open: false; + callback pairing-dismissed(); + in-out property pairing-skipped: false; + out property pair-t: self.pairing-open ? 1 : 0; + animate pair-t { duration: 650ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } + // Slint draws on top of the glass, so content under a pane must go fully away. + out property dim: max(0, 1 - 1.6 * max(self.pair-t, self.set-t)); + in-out property toast-text; + // Standby (power button): black screen; any key wakes (power.rs). + in-out property standby: false; + callback wake-requested(); + out property standby-t: self.standby ? 1 : 0; + animate standby-t { duration: 450ms; easing: ease-in-out; } + in-out property toast-shown; + + // ---- settings screen (rows and actions come from settings_screen.rs) ---- + in-out property settings-open: false; + in-out property set-area: 0; // 0 = categories, 1 = rows + in-out property set-nav: 0; + in-out property set-row: 0; + in property set-sub: false; // inside a sub page (picker, confirm) + in property set-title; + in property set-subtitle; + in property <[SettingRow]> set-rows; + // Keep in sync with the category constants in settings_screen.rs. + out property <[string]> set-categories: ["Kijelző", "Távirányító és Bluetooth", "Hálózat", "Energia", "Rendszer"]; + out property set-nav-count: self.set-categories.length; + callback settings-opened(); + callback settings-nav-changed(int); + callback settings-activate(int); + callback settings-back(); + changed set-nav => { root.settings-nav-changed(self.set-nav); } + + out property set-t: self.settings-open ? 1 : 0; + animate set-t { duration: 600ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } + out property nav-pos: self.set-nav; + animate nav-pos { duration: 360ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } + out property row-pos: self.set-row; + animate row-pos { duration: 360ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } + out property nav-active: (self.settings-open && self.set-area == 0) ? 1 : 0; + animate nav-active { duration: 300ms; easing: ease-out; } + out property content-active: (self.settings-open && self.set-area == 1) ? 1 : 0; + animate content-active { duration: 300ms; easing: ease-out; } + // Geometry, mirrored by settings_screen::glass. + out property sp-x: 96 * self.u; + out property sp-y: 150 * self.u + (1 - self.set-t) * 40 * self.u; + out property sp-w: 1728 * self.u; + out property sp-h: 870 * self.u; + out property nav-x: self.sp-x + 40 * self.u; + out property nav-y: self.sp-y + 176 * self.u; + out property nav-w: 480 * self.u; + out property nav-h: 92 * self.u; + out property nav-step: 106 * self.u; + out property rows-x: self.sp-x + 576 * self.u; + out property rows-y: self.sp-y + 176 * self.u; + out property rows-w: self.sp-w - 624 * self.u; + out property set-row-h: 88 * self.u; + out property set-row-step: 100 * self.u; + out property rows-view-h: 600 * self.u; + out property rows-scroll: max(0, self.set-row - 5) * self.set-row-step; + animate rows-scroll { duration: 420ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } + + // ---- on-screen keyboard (text and callbacks: keyboard.rs) ---------------- + // Opens inside the settings pane; Rust owns the text and validation. + in-out property kb-open: false; + in property kb-title; + in property kb-subtitle; + in property kb-text; + in property kb-masked; + in property kb-placeholder; + in property kb-hint; + in property kb-hint-error; + in property kb-secret; + in property kb-can-submit; + in property kb-submit-label: "Kész"; + in-out property kb-reveal: false; + in-out property kb-mode: 0; // abc, ABC, 123, #+= + in-out property kb-index: 1; + in-out property kb-area: 0; // 0 = keys, 1 = chips + in-out property kb-chip: 0; + callback kb-type(string); + callback kb-delete(); + callback kb-clear(); + callback kb-submit(); + callback kb-closed(); + changed kb-open => { if !self.kb-open { root.kb-closed(); } } + changed settings-open => { if !self.settings-open { self.kb-open = false; } } + + out property <[string]> kb-keys: self.kb-mode == 1 + ? ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"] + : self.kb-mode == 2 + ? ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", ".", ",", "-", "_", "@", "!", "?", "#", "$", "%", "&", "*"] + : self.kb-mode == 3 + ? ["+", "=", "/", "\\", ":", ";", "'", "\"", "(", ")", "[", "]", "{", "}", "<", ">", "^", "`", "|", "~"] + : ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]; + out property kb-n: self.kb-keys.length + 2; + out property <[string]> kb-chips: [ + "abc", "ABC", ".?123", "#+=", + self.kb-secret ? (self.kb-reveal ? "Elrejtés" : "Megjelenítés") : "Törlés", + self.kb-submit-label, + ]; + out property kb-t: self.kb-open ? 1 : 0; + animate kb-t { duration: 480ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } + out property kb-pos: self.kb-index; + animate kb-pos { duration: 200ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } + out property kb-cpos: self.kb-chip; + animate kb-cpos { duration: 300ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } + out property kb-keys-active: (self.kb-open && self.kb-area == 0) ? 1 : 0; + animate kb-keys-active { duration: 260ms; easing: ease-out; } + out property kb-chips-active: (self.kb-open && self.kb-area == 1) ? 1 : 0; + animate kb-chips-active { duration: 260ms; easing: ease-out; } + // Geometry, mirrored by keyboard::glass. + out property kb-field-w: 1300 * self.u; + out property kb-field-h: 100 * self.u; + out property kb-field-x: self.sp-x + (self.sp-w - self.kb-field-w) / 2; + out property kb-field-y: self.sp-y + 210 * self.u; + out property kb-key-w: min(58 * self.u, 1600 * self.u / self.kb-n); + out property kb-row-x: self.sp-x + (self.sp-w - self.kb-n * self.kb-key-w) / 2; + out property kb-row-y: self.sp-y + 410 * self.u; + out property kb-row-h: 120 * self.u; + out property kb-chip-w: 200 * self.u; + out property kb-chip-h: 76 * self.u; + out property kb-chip-step: 220 * self.u; + out property kb-chip-x: self.sp-x + (self.sp-w - 6 * self.kb-chip-step + 20 * self.u) / 2; + out property kb-chip-y: self.sp-y + 600 * self.u; + + function kb-press-key() { + if root.kb-index == 0 { + root.kb-type(" "); + } else if root.kb-index >= root.kb-n - 1 { + root.kb-delete(); + } else { + root.kb-type(root.kb-keys[root.kb-index - 1]); + } + } + + function kb-press-chip() { + if root.kb-chip < 4 { + root.kb-mode = root.kb-chip; + root.kb-index = min(root.kb-index, root.kb-keys.length + 1); + root.kb-area = 0; + } else if root.kb-chip == 4 { + if root.kb-secret { + root.kb-reveal = !root.kb-reveal; + } else { + root.kb-clear(); + } + } else { + root.kb-submit(); + } + } + + callback launch(int); + callback cancel-launch(); + in property launch-detail: "indítása…"; + + // ---- home grid (tvOS layout; exported so the glass layer can mirror it) ---- + // Five icons per row. The first row sits under the top shelf (the backdrop + // in the focused app's colours); further rows scroll up and the shelf dims. + out property u: min(self.width / 1920, self.height / 1080); + out property cols: 5; + out property row-x: 90 * self.u; + out property row-y: 774 * self.u; + out property card-w: 308 * self.u; + out property card-h: 185 * self.u; + out property card-gap: 50 * self.u; + out property row-step: 249 * self.u; + out property card-r: 40 * self.u; + // Focused icon lift (tvOS-like) and the press-in while OK is held. + out property lift: 0.14; + out property press-in: 0.06; + + // ---- focus state ----------------------------------------------------- + in-out property focus-index: 0; + in-out property sheet-open: false; + in-out property launching: false; + + out property focus-col: Math.mod(self.focus-index, self.cols); + out property focus-row: Math.floor(self.focus-index / self.cols); + out property focus-x: self.focus-col; + animate focus-x { duration: 380ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } + out property focus-y: self.focus-row; + animate focus-y { duration: 420ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } + + out property row-active: (!self.sheet-open && !self.launching && !self.settings-open) ? 1 : 0; + animate row-active { duration: 320ms; easing: ease-out; } + + // Row 0: the shelf is showing. Deeper rows: the focused row moves to the middle, the row above stays in view. + out property grid-scroll: self.focus-row == 0 ? 0 : self.row-y + self.focus-row * self.row-step - 470 * self.u; + animate grid-scroll { duration: 560ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } + out property shelf-t: self.focus-row == 0 ? 1 : 0; + animate shelf-t { duration: 600ms; easing: ease-in-out; } + + out property intro: 0; + animate intro { duration: 1700ms; easing: ease-out; } + + // ---- OK: short press opens, long press (hold) shows the context menu ---- + in-out property ok-down: false; + out property press: (self.ok-down && !self.menu-open) ? 1 : 0; + animate press { duration: 160ms; easing: ease-out; } + in-out property menu-open: false; + in-out property menu-index: 0; + out property menu-t: self.menu-open ? 1 : 0; + animate menu-t { duration: 460ms; easing: cubic-bezier(0.3, 1.18, 0.4, 1); } + out property menu-pos: self.menu-index; + animate menu-pos { duration: 240ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } + out property <[string]> menu-items: ["Megnyitás", "Részletek"]; + hold-timer := Timer { + interval: 520ms; + running: false; + triggered => { + self.running = false; + if root.ok-down && root.apps.length > 0 && !root.sheet-open && !root.launching && !root.settings-open { + root.menu-index = 0; + root.menu-open = true; + } + } + } + // Context menu geometry: it buds out of the focused icon (merged glass), + // above it when there is room, otherwise below. + property fc-w: self.card-w * (1 + self.lift); + property fc-h: self.card-h * (1 + self.lift); + property fc-x: self.row-x + self.focus-col * (self.card-w + self.card-gap) + (self.card-w - self.fc-w) / 2; + property fc-y: self.row-y + self.focus-row * self.row-step - self.grid-scroll + (self.card-h - self.fc-h) / 2; + out property menu-w: 440 * self.u; + out property menu-item-h: 76 * self.u; + out property menu-pad: 12 * self.u; + property menu-h: self.menu-items.length * self.menu-item-h + 2 * self.menu-pad; + property menu-above: self.fc-y - 36 * self.u - self.menu-h > 40 * self.u; + property menu-x-end: clamp(self.fc-x, 60 * self.u, self.width - 60 * self.u - self.menu-w); + property menu-y-end: self.menu-above ? self.fc-y - 36 * self.u - self.menu-h : self.fc-y + self.fc-h + 36 * self.u; + property me: clamp(self.menu-t, 0, 1.2); + out property mx: self.fc-x + (self.menu-x-end - self.fc-x) * self.me; + out property my: self.fc-y + (self.menu-y-end - self.fc-y) * self.me; + out property mw: self.fc-w + (self.menu-w - self.fc-w) * self.me; + out property mh: self.fc-h + (self.menu-h - self.fc-h) * self.me; + property menu-in: clamp((self.menu-t - 0.45) * 2.5, 0, 1); + + property toast-t: self.toast-shown ? 1 : 0; + animate toast-t { duration: 520ms; easing: cubic-bezier(0.22, 1.25, 0.36, 1); } + + out property sheet-t: self.sheet-open ? 1 : 0; + animate sheet-t { duration: 560ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } + + out property launch-t: self.launching ? 1 : 0; + animate launch-t { duration: 900ms; easing: cubic-bezier(0.72, 0, 0.16, 1); } + // Set by Rust once the app window is visible on top. + in property app-ready: false; + + // Launch morph: the focused card's glass grows into a full-screen pane. + property le: self.launch-t; + property lc-w: self.fc-w; + property lc-h: self.fc-h; + property lc-x: self.fc-x; + property lc-y: self.fc-y; + property lm-x: self.lc-x * (1 - self.le); + property lm-y: self.lc-y * (1 - self.le); + property lm-w: self.lc-w + (self.width - self.lc-w) * self.le; + property lm-h: self.lc-h + (self.height - self.lc-h) * self.le; + // Splash content appears in the second half of the morph. + property splash: clamp((self.le - 0.55) / 0.45, 0, 1); + + property focused: self.apps.length > 0 ? self.apps[self.focus-index] : { name: "SmartFox" }; + + property top-in: clamp(self.intro * 2.0 - 0.15, 0, 1); + + // geometry of the static glass surfaces + property capsule-w: 404 * self.u; + property capsule-h: 66 * self.u; + property capsule-x: 1920 * self.u - 96 * self.u - self.capsule-w; + property capsule-y: 50 * self.u; + // The toast buds off the status capsule like a droplet (merged glass). + property toast-w-end: 620 * self.u; + property toast-h-end: 76 * self.u; + property toast-e: clamp(self.toast-t, 0, 1.2); + property toast-w: self.capsule-w + (self.toast-w-end - self.capsule-w) * clamp(self.toast-e, 0, 1); + property toast-h: self.capsule-h + (self.toast-h-end - self.capsule-h) * clamp(self.toast-e, 0, 1); + property toast-x: self.capsule-x + self.capsule-w - self.toast-w; + property toast-y: self.capsule-y + self.toast-e * (self.capsule-h + 18 * self.u); + // Pairing pane and the glass bits inside it (see pairing.slint for the layout). + property pane-x: (self.width - 1300 * self.u) / 2; + property pane-y: (self.height - 720 * self.u) / 2 + (1 - self.pair-t) * 50 * self.u; + property pc-x: self.pane-x + 420 * self.u; + property pc-y: self.pane-y + 70 * self.u; + property remote-ok: self.remote-state == "paired" || self.remote-state == "connected"; + property remote-broken: self.remote-state == "no-adapter"; + property pair-in: self.pair-t * self.pair-t; + // Launch splash bits. + property splash-bar: self.splash * (self.app-ready ? 0 : 1); + animate splash-bar { duration: 300ms; } + property sheet-w: 700 * self.u; + property sheet-x: 1920 * self.u - 64 * self.u - self.sheet-w + (1 - self.sheet-t) * 90 * self.u; + property sheet-y: 64 * self.u; + property sheet-h: 952 * self.u; + + // Drawn below the app cards. + out property <[GlassRect]> glass-under: [ + // Status capsule and the toast that grows out of it (group 1). + { + x: self.capsule-x, y: self.capsule-y, w: self.capsule-w, h: self.capsule-h, + r: self.capsule-h / 2, focus: 0, alpha: self.top-in * (1 - self.launch-t) * (1 - self.sheet-t), blur: 1.2, + glow: #ffffff, tint: #ffffff06, group: 1, + }, + { + x: self.toast-x, y: self.toast-y, w: self.toast-w, h: self.toast-h, + r: self.toast-h / 2, focus: 0.35, alpha: clamp(self.toast-t * 3, 0, 1) * (1 - self.launch-t), blur: 1.4, + glow: self.focused.accent, tint: #ffffff08, group: 1, + }, + ]; + + // Context menu, drawn right after the focused card (same group, so it + // buds out of the icon like a droplet). Then the selected-item pill. + out property <[GlassRect]> glass-menu: [ + { + x: self.mx, y: self.my, w: self.mw, h: self.mh, + r: self.card-r * (1 + self.lift) + (34 * self.u - self.card-r * (1 + self.lift)) * clamp(self.me, 0, 1), + focus: 0.12, alpha: clamp(self.menu-t * 3, 0, 1), blur: 3.0, + glow: self.focused.accent, tint: #0b0c12.with-alpha(0.42), group: 2, + }, + { + x: self.mx + self.menu-pad, y: self.my + self.menu-pad + self.menu-pos * self.menu-item-h, + w: self.mw - 2 * self.menu-pad, h: self.menu-item-h, + r: self.menu-item-h / 2, focus: 0.6, alpha: self.menu-in, blur: -1, + glow: #ffffff, tint: #ffffff.with-alpha(0.86), + }, + ]; + + // Drawn above the app cards. + out property <[GlassRect]> glass-over: [ + { + x: self.lm-x, y: self.lm-y, w: self.lm-w, h: self.lm-h, + r: self.card-r * (1 + self.lift) * pow(1 - self.le, 0.7), focus: 1 - 0.7 * self.le, + alpha: clamp(self.le * 8, 0, 1), blur: 1.6 + 2.6 * self.le, + glow: self.focused.accent, tint: self.focused.accent.darker(0.75).with-alpha(0.10 + 0.55 * self.le), + }, + // Splash: loading track and the back hint, nested on the full-screen glass. + { + x: (self.width - 280 * self.u) / 2, y: self.height / 2 + 144 * self.u, w: 280 * self.u, h: 16 * self.u, + r: 8 * self.u, focus: 0, alpha: self.splash-bar, blur: -1, + glow: self.focused.accent, tint: #00000030, + }, + { + x: (self.width - 440 * self.u) / 2, y: self.height - 112 * self.u, w: 440 * self.u, h: 56 * self.u, + r: 28 * self.u, focus: 0, alpha: self.splash, blur: -1, + glow: #ffffff, tint: #ffffff08, + }, + { + x: self.pane-x, y: self.pane-y, + w: 1300 * self.u, h: 720 * self.u, + r: 56 * self.u, focus: 0.2 * self.pair-t, alpha: self.pair-t, blur: 3.8, + glow: #ff7a35, tint: #0b0c12.with-alpha(0.48), + }, + // Pairing: step numbers, live status pill and the skip chip. + { + x: self.pc-x - 2 * self.u, y: self.pc-y + 152 * self.u, w: 44 * self.u, h: 44 * self.u, + r: 22 * self.u, focus: 0.3, alpha: self.pair-in, blur: -1, + glow: #ff7a35, tint: #ff7a3526, + }, + { + x: self.pc-x - 2 * self.u, y: self.pc-y + 228 * self.u, w: 44 * self.u, h: 44 * self.u, + r: 22 * self.u, focus: 0.3, alpha: self.pair-in, blur: -1, + glow: #ff7a35, tint: #ff7a3526, + }, + { + x: self.pc-x - 2 * self.u, y: self.pc-y + 332 * self.u, w: 44 * self.u, h: 44 * self.u, + r: 22 * self.u, focus: 0.3, alpha: self.pair-in, blur: -1, + glow: #ff7a35, tint: #ff7a3526, + }, + { + x: self.pc-x, y: self.pc-y + 510 * self.u, w: 520 * self.u, h: 64 * self.u, + r: 32 * self.u, focus: self.remote-ok ? 0.6 : 0.15, alpha: self.pair-in, blur: -1, + glow: self.remote-ok ? #34c759 : self.remote-broken ? #ff9f0a : #ff7a35, + tint: self.remote-ok ? #34c75940 : self.remote-broken ? #ff9f0a38 : #ffffff0a, + }, + { + x: self.pc-x + 556 * self.u, y: self.pc-y + 512 * self.u, w: 204 * self.u, h: 60 * self.u, + r: 30 * self.u, focus: 0, alpha: self.pair-in, blur: -1, + glow: #ffffff, tint: #ffffff06, + }, + { + x: self.sheet-x, y: self.sheet-y, w: self.sheet-w, h: self.sheet-h, + r: 44 * self.u, focus: 0.15 * self.sheet-t, alpha: self.sheet-t, blur: 3.4, + glow: self.focused.accent, tint: #0a0b10.with-alpha(0.34), + }, + // Sheet: icon tile, info rows and the back chip, nested on the sheet. + { + x: self.sheet-x + 40 * self.u, y: self.sheet-y + 48 * self.u, w: 120 * self.u, h: 120 * self.u, + r: 34 * self.u, focus: 0.25, alpha: self.sheet-t, blur: -1, + glow: self.focused.accent, tint: self.focused.accent.darker(0.6).with-alpha(0.10), + }, + { + x: self.sheet-x + 56 * self.u, y: self.sheet-y + 420 * self.u, w: self.sheet-w - 112 * self.u, h: 92 * self.u, + r: 26 * self.u, focus: 0, alpha: self.sheet-t, blur: -1, glow: #ffffff, tint: #ffffff06, + }, + { + x: self.sheet-x + 56 * self.u, y: self.sheet-y + 530 * self.u, w: self.sheet-w - 112 * self.u, h: 92 * self.u, + r: 26 * self.u, focus: 0, alpha: self.sheet-t, blur: -1, glow: #ffffff, tint: #ffffff06, + }, + { + x: self.sheet-x + 56 * self.u, y: self.sheet-y + 640 * self.u, w: self.sheet-w - 112 * self.u, h: 92 * self.u, + r: 26 * self.u, focus: 0, alpha: self.sheet-t, blur: -1, glow: #ffffff, tint: #ffffff06, + }, + { + x: self.sheet-x + 56 * self.u, y: self.sheet-y + self.sheet-h - 86 * self.u, w: 250 * self.u, h: 56 * self.u, + r: 28 * self.u, focus: 0, alpha: self.sheet-t, blur: -1, glow: #ffffff, tint: #ffffff06, + }, + ]; + + function open-settings() { + root.set-area = 0; + root.settings-open = true; + root.settings-opened(); + } + + function menu-choose() { + root.menu-open = false; + if root.menu-index == 0 { + root.activate(); + } else { + root.sheet-open = true; + } + } + + function activate() { + if root.apps.length == 0 { return; } + if root.focused.kind == "builtin" { + root.open-settings(); + } else { + root.launching = true; + root.launch(root.focus-index); + } + } + + keys := FocusScope { + key-pressed(event) => { + if root.standby { + root.wake-requested(); + return accept; + } + if root.kb-open { + // Siri Remote: arrows/swipes move, select types, Back (Esc) cancels. + // A real keyboard can type directly; Backspace deletes. + if event.text == Key.Escape { + root.kb-open = false; + } else if event.text == Key.Backspace { + root.kb-delete(); + } else if event.text == Key.Return { + if root.kb-area == 0 { root.kb-press-key(); } else { root.kb-press-chip(); } + } else if event.text == Key.LeftArrow { + if root.kb-area == 0 { + root.kb-index = root.kb-index <= 0 ? root.kb-n - 1 : root.kb-index - 1; + } else { + root.kb-chip = max(0, root.kb-chip - 1); + } + } else if event.text == Key.RightArrow { + if root.kb-area == 0 { + root.kb-index = root.kb-index >= root.kb-n - 1 ? 0 : root.kb-index + 1; + } else { + root.kb-chip = min(5, root.kb-chip + 1); + } + } else if event.text == Key.DownArrow { + if root.kb-area == 0 { + root.kb-area = 1; + root.kb-chip = root.kb-can-submit ? 5 : root.kb-mode; + } + } else if event.text == Key.UpArrow { + root.kb-area = 0; + } else if !event.modifiers.control && !event.modifiers.alt && !event.modifiers.meta { + root.kb-type(event.text); + } + return accept; + } + if root.pairing-open { + if event.text == Key.Escape || event.text == Key.Backspace || event.text == Key.Return { + root.pairing-open = false; + root.pairing-skipped = true; + root.pairing-dismissed(); + } + return accept; + } + if root.launching { + if event.text == Key.Escape || event.text == Key.Backspace { + root.launching = false; + root.cancel-launch(); + } + return accept; + } + if root.settings-open { + let back = event.text == Key.Escape || event.text == Key.Backspace; + let ok = event.text == Key.Return || event.text == " "; + if root.set-area == 0 { + if event.text == Key.UpArrow { + root.set-nav = max(0, root.set-nav - 1); + } else if event.text == Key.DownArrow { + root.set-nav = min(root.set-nav-count - 1, root.set-nav + 1); + } else if ok || event.text == Key.RightArrow { + root.set-area = 1; + root.set-row = 0; + } else if back { + root.settings-open = false; + } + } else { + if event.text == Key.UpArrow { + root.set-row = max(0, root.set-row - 1); + } else if event.text == Key.DownArrow { + root.set-row = min(root.set-rows.length - 1, root.set-row + 1); + } else if ok { + root.settings-activate(root.set-row); + } else if back || event.text == Key.LeftArrow { + if root.set-sub { + root.settings-back(); + } else { + root.set-area = 0; + } + } + } + return accept; + } + if root.sheet-open { + if event.text == Key.Escape || event.text == Key.Backspace || event.text == Key.Return { + root.sheet-open = false; + } + return accept; + } + let ok = event.text == Key.Return || event.text == " "; + if root.menu-open { + if event.text == Key.UpArrow { + root.menu-index = max(0, root.menu-index - 1); + } else if event.text == Key.DownArrow { + root.menu-index = min(root.menu-items.length - 1, root.menu-index + 1); + } else if ok && !event.repeat && !root.ok-down { + root.menu-choose(); + } else if event.text == Key.Escape || event.text == Key.Backspace { + root.menu-open = false; + } + return accept; + } + // Grid: arrows move focus, OK acts on release (short) or after a hold (menu). + if event.text == Key.LeftArrow { + if root.focus-col > 0 { root.focus-index -= 1; } + } else if event.text == Key.RightArrow { + if root.focus-col < root.cols - 1 && root.focus-index < root.apps.length - 1 { root.focus-index += 1; } + } else if event.text == Key.DownArrow { + if root.focus-index + root.cols < root.apps.length { + root.focus-index += root.cols; + } else if (root.focus-row + 1) * root.cols < root.apps.length { + root.focus-index = root.apps.length - 1; + } + } else if event.text == Key.UpArrow { + if root.focus-row > 0 { root.focus-index -= root.cols; } + } else if event.text == Key.Escape || event.text == Key.Backspace { + // Back from a lower row jumps to the top (like tvOS). + if root.focus-row > 0 { root.focus-index = root.focus-col; } + } else if ok && !event.repeat { + root.ok-down = true; + hold-timer.running = false; + hold-timer.running = true; + } + accept + } + key-released(event) => { + if (event.text == Key.Return || event.text == " ") && root.ok-down { + root.ok-down = false; + // Released before the hold timer fired: a normal click. + if hold-timer.running { + hold-timer.running = false; + if !root.menu-open && !root.sheet-open && !root.launching && !root.settings-open { + root.activate(); + } + } + return accept; + } + reject + } + } + + init => { + root.intro = 1; + keys.focus(); + } + + // ---- status capsule --------------------------------------------------- + Rectangle { + x: root.capsule-x; + y: root.capsule-y; + width: root.capsule-w; + height: root.capsule-h; + opacity: root.top-in * (1 - root.launch-t) * (1 - root.sheet-t); + WifiIcon { + x: 28 * root.u; + y: (parent.height - self.height) / 2; + width: 30 * root.u; + height: 30 * root.u; + } + BluetoothIcon { + x: 70 * root.u; + y: (parent.height - self.height) / 2; + width: 30 * root.u; + height: 30 * root.u; + ink: #ffffffb0; + } + Rectangle { + x: 118 * root.u; + y: 18 * root.u; + width: 1.5 * root.u; + height: parent.height - 36 * root.u; + background: #ffffff38; + } + Text { + x: 138 * root.u; + width: parent.width - 138 * root.u - 30 * root.u; + height: parent.height; + vertical-alignment: center; + text: root.date; + font-size: 21 * root.u; + color: #ffffffb8; + } + Text { + width: parent.width - 30 * root.u; + height: parent.height; + vertical-alignment: center; + horizontal-alignment: right; + text: root.clock; + font-size: 28 * root.u; + font-weight: 600; + color: #ffffff; + } + } + + // ---- app grid (no names: tvOS-like icons only) --------------------------- + for app[i] in root.apps: Rectangle { + // Keep these formulas in sync with `card_rects` in src/main.rs. + property gc: Math.mod(i, root.cols); + property gr: Math.floor(i / root.cols); + property f: max(0, 1 - abs(root.focus-x - self.gc)) * max(0, 1 - abs(root.focus-y - self.gr)) * root.row-active; + property s: 1 + (root.lift - root.press-in * root.press) * self.f; + property appear: clamp(root.intro * 2.2 - self.gc * 0.12 - self.gr * 0.2 - 0.4, 0, 1); + property others: i == root.focus-index ? 1 : 1 - 0.55 * clamp(root.menu-t, 0, 1); + // Slint draws above the glass, so icons under the menu must go away entirely. + property under-menu: i != root.focus-index + && self.x < root.menu-x-end + root.menu-w && self.x + self.width > root.menu-x-end + && self.y < root.menu-y-end + root.menu-h && self.y + self.height > root.menu-y-end; + property covered: self.under-menu ? clamp(root.menu-t * 2, 0, 1) : 0; + width: root.card-w * self.s; + height: root.card-h * self.s; + x: root.row-x + self.gc * (root.card-w + root.card-gap) + (root.card-w - self.width) / 2; + y: root.row-y + self.gr * root.row-step - root.grid-scroll + (root.card-h - self.height) / 2 + (1 - self.appear) * 60 * root.u; + opacity: self.appear * self.others * (1 - self.covered) * (1 - root.launch-t) * (1 - root.sheet-t) * root.dim; + + AppIcon { + icon: app.icon; + width: 92 * root.u * parent.s; + height: self.width; + x: (parent.width - self.width) / 2; + y: (parent.height - self.height) / 2; + } + } + + // ---- context menu (long press on OK) ------------------------------------- + if root.menu-t > 0.001: Rectangle { + x: root.mx; + y: root.my; + width: root.mw; + height: root.mh; + opacity: root.menu-in; + for item[k] in root.menu-items: Rectangle { + property sel: max(0, 1 - abs(root.menu-pos - k)); + property ink: self.sel > 0.5 ? #101114 : #ffffff; + x: root.menu-pad; + y: root.menu-pad + k * root.menu-item-h; + width: parent.width - 2 * root.menu-pad; + height: root.menu-item-h; + if k == 0: PlayIcon { + x: 30 * root.u; + y: (parent.height - self.height) / 2; + width: 26 * root.u; + height: 26 * root.u; + ink: parent.ink; + } + if k == 1: InfoIcon { + x: 29 * root.u; + y: (parent.height - self.height) / 2; + width: 28 * root.u; + height: 28 * root.u; + ink: parent.ink; + } + Text { + x: 80 * root.u; + width: parent.width - 100 * root.u; + height: parent.height; + vertical-alignment: center; + text: item; + color: parent.ink; + font-size: 27 * root.u; + font-weight: 600; + } + } + } + + // ---- details / settings sheet --------------------------------------- + Rectangle { + x: root.sheet-x; + y: root.sheet-y; + width: root.sheet-w; + height: root.sheet-h; + opacity: root.sheet-t; + + AppIcon { + x: 56 * root.u; + y: 64 * root.u; + width: 88 * root.u; + height: 88 * root.u; + icon: root.focused.icon; + } + Text { + x: 56 * root.u; + y: 176 * root.u; + text: root.focused.name; + font-family: "Inter Display"; + font-weight: 800; + font-size: 64 * root.u; + letter-spacing: -2 * root.u; + color: #ffffff; + } + Text { + x: 56 * root.u; + y: 262 * root.u; + width: parent.width - 112 * root.u; + text: root.focused.description; + wrap: word-wrap; + font-size: 24 * root.u; + color: #ffffffbb; + } + + VerticalLayout { + x: 56 * root.u; + y: 420 * root.u; + width: parent.width - 112 * root.u; + spacing: 18 * root.u; + + for row in [ + { k: "Típus", v: root.focused.kind-label }, + { k: root.focused.kind == "web" ? (root.focused.id == "netflex" ? "Szerver" : "Cím") : "Parancs", v: root.focused.target }, + { k: "Azonosító", v: root.focused.id }, + ]: Rectangle { + height: 92 * root.u; + Text { + x: 28 * root.u; + y: 16 * root.u; + text: row.k; + font-size: 19 * root.u; + font-weight: 600; + color: #ffffff80; + } + Text { + x: 28 * root.u; + y: 44 * root.u; + width: parent.width - 56 * root.u; + text: row.v; + font-size: 25 * root.u; + color: #ffffff; + overflow: elide; + } + } + } + + Text { + x: 56 * root.u; + y: parent.height - 86 * root.u; + width: 250 * root.u; + height: 56 * root.u; + horizontal-alignment: center; + vertical-alignment: center; + text: "‹ Vissza · Esc"; + font-size: 21 * root.u; + font-weight: 500; + color: #ffffffc0; + } + } + + // ---- settings screen ------------------------------------------------------ + if root.set-t > 0.001 && root.kb-t < 0.999: SettingsView { + width: 100%; + height: 100%; + opacity: root.set-t * (1 - root.kb-t); + u: root.u; + pane-x: root.sp-x; + pane-y: root.sp-y; + pane-h: root.sp-h; + nav-x: root.nav-x; + nav-y: root.nav-y; + nav-w: root.nav-w; + nav-h: root.nav-h; + nav-step: root.nav-step; + rows-x: root.rows-x; + rows-y: root.rows-y; + rows-w: root.rows-w; + row-h: root.set-row-h; + row-step: root.set-row-step; + rows-view-h: root.rows-view-h; + rows-scroll: root.rows-scroll; + nav-pos: root.nav-pos; + nav-active: root.nav-active; + row-pos: root.row-pos; + content-active: root.content-active; + title: root.set-title; + subtitle: root.set-subtitle; + rows: root.set-rows; + categories: root.set-categories; + } + + // ---- on-screen keyboard --------------------------------------------------------- + if root.kb-t > 0.001: KeyboardView { + width: 100%; + height: 100%; + opacity: root.kb-t * root.set-t; + u: root.u; + pane-x: root.sp-x; + pane-y: root.sp-y; + pane-w: root.sp-w; + pane-h: root.sp-h; + back-x: root.nav-x; + field-x: root.kb-field-x; + field-y: root.kb-field-y; + field-w: root.kb-field-w; + field-h: root.kb-field-h; + row-x: root.kb-row-x; + row-y: root.kb-row-y; + row-h: root.kb-row-h; + key-w: root.kb-key-w; + chip-x: root.kb-chip-x; + chip-y: root.kb-chip-y; + chip-w: root.kb-chip-w; + chip-h: root.kb-chip-h; + chip-step: root.kb-chip-step; + keys: root.kb-keys; + chips: root.kb-chips; + mode: root.kb-mode; + pos: root.kb-pos; + cpos: root.kb-cpos; + keys-active: root.kb-keys-active; + chips-active: root.kb-chips-active; + title: root.kb-title; + subtitle: root.kb-subtitle; + shown-text: (root.kb-secret && !root.kb-reveal) ? root.kb-masked : root.kb-text; + placeholder: root.kb-placeholder; + hint: root.kb-hint; + hint-error: root.kb-hint-error; + can-submit: root.kb-can-submit; + } + + // ---- remote pairing guide ------------------------------------------------- + if root.pair-t > 0.001: PairingGuide { + x: root.pane-x; + y: root.pane-y; + width: 1300 * root.u; + height: 720 * root.u; + u: root.u; + state: root.remote-state; + opacity: root.pair-t; + } + + // ---- launch splash ------------------------------------------------------- + if root.launch-t > 0.001: Rectangle { + width: 100%; + height: 100%; + + // The app icon flies from its card to the center and grows. + AppIcon { + property size: (92 * (1 + root.lift) + 90 * root.le) * root.u; + property cx: (root.lc-x + root.lc-w / 2) * (1 - root.le) + (parent.width / 2) * root.le; + property cy: (root.lc-y + root.lc-h / 2) * (1 - root.le) + (parent.height / 2 - 50 * root.u) * root.le; + icon: root.focused.icon; + width: self.size; + height: self.size; + x: self.cx - self.size / 2; + y: self.cy - self.size / 2; + } + Text { + y: parent.height / 2 + 70 * root.u + (1 - root.splash) * 20 * root.u; + width: parent.width; + horizontal-alignment: center; + text: root.focused.name; + font-family: "Inter Display"; + font-weight: 800; + font-size: 44 * root.u; + letter-spacing: -1.2 * root.u; + color: #ffffff; + opacity: root.splash; + } + // Indeterminate shimmer while the app loads (inside the glass track). + Rectangle { + property phase: mod(animation-tick() / 1400ms, 1); + x: (parent.width - self.width) / 2; + y: parent.height / 2 + 149 * root.u; + width: 264 * root.u; + height: 6 * root.u; + border-radius: self.height / 2; + clip: true; + opacity: root.splash-bar; + Rectangle { + x: (parent.width + self.width) * parent.phase - self.width; + width: 90 * root.u; + height: parent.height; + border-radius: self.height / 2; + background: @linear-gradient(90deg, #ffffff00 0%, root.focused.accent.brighter(0.6) 50%, #ffffff00 100%); + } + } + Text { + y: parent.height - 112 * root.u; + width: parent.width; + height: 56 * root.u; + horizontal-alignment: center; + vertical-alignment: center; + text: "‹ Bezárás és vissza · Esc"; + font-size: 21 * root.u; + font-weight: 500; + color: #ffffffc0; + opacity: root.splash; + } + } + // ---- toast --------------------------------------------------------- + Rectangle { + x: root.toast-x; + y: root.toast-y; + width: root.toast-w; + height: root.toast-h; + opacity: clamp((root.toast-t - 0.55) * 2.5, 0, 1); + Rectangle { + x: 26 * root.u; + y: (parent.height - self.height) / 2; + width: 14 * root.u; + height: 14 * root.u; + border-radius: self.width / 2; + background: root.focused.accent.brighter(0.3); + } + Text { + x: 56 * root.u; + width: parent.width - 82 * root.u; + height: parent.height; + vertical-alignment: center; + text: root.toast-text; + font-size: 24 * root.u; + font-weight: 500; + color: #ffffff; + overflow: elide; + } + } + + + // ---- standby ------------------------------------------------------------- + if root.standby-t > 0.001: Rectangle { + width: 100%; + height: 100%; + background: #000000; + opacity: root.standby-t; + // Only seen if the TV signal stays on (or in dev mode). + Text { + width: 100%; + height: 100%; + horizontal-alignment: center; + vertical-alignment: center; + text: "Készenlét · nyomj meg egy gombot"; + font-size: 22 * root.u; + color: #ffffff30; + } + } +} diff --git a/crates/sf-launcher/ui/fonts/Inter-Medium.ttf b/crates/sf-launcher/ui/fonts/Inter-Medium.ttf new file mode 100644 index 0000000..458cd06 Binary files /dev/null and b/crates/sf-launcher/ui/fonts/Inter-Medium.ttf differ diff --git a/crates/sf-launcher/ui/fonts/Inter-Regular.ttf b/crates/sf-launcher/ui/fonts/Inter-Regular.ttf new file mode 100644 index 0000000..b7aaca8 Binary files /dev/null and b/crates/sf-launcher/ui/fonts/Inter-Regular.ttf differ diff --git a/crates/sf-launcher/ui/fonts/Inter-SemiBold.ttf b/crates/sf-launcher/ui/fonts/Inter-SemiBold.ttf new file mode 100644 index 0000000..47f8ab1 Binary files /dev/null and b/crates/sf-launcher/ui/fonts/Inter-SemiBold.ttf differ diff --git a/crates/sf-launcher/ui/fonts/InterDisplay-Bold.ttf b/crates/sf-launcher/ui/fonts/InterDisplay-Bold.ttf new file mode 100644 index 0000000..b8f0d82 Binary files /dev/null and b/crates/sf-launcher/ui/fonts/InterDisplay-Bold.ttf differ diff --git a/crates/sf-launcher/ui/fonts/InterDisplay-ExtraBold.ttf b/crates/sf-launcher/ui/fonts/InterDisplay-ExtraBold.ttf new file mode 100644 index 0000000..4ad8a62 Binary files /dev/null and b/crates/sf-launcher/ui/fonts/InterDisplay-ExtraBold.ttf differ diff --git a/crates/sf-launcher/ui/fonts/OFL-LICENSE.txt b/crates/sf-launcher/ui/fonts/OFL-LICENSE.txt new file mode 100644 index 0000000..9b2ca37 --- /dev/null +++ b/crates/sf-launcher/ui/fonts/OFL-LICENSE.txt @@ -0,0 +1,92 @@ +Copyright (c) 2016 The Inter Project Authors (https://github.com/rsms/inter) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION AND CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/crates/sf-launcher/ui/icons.slint b/crates/sf-launcher/ui/icons.slint new file mode 100644 index 0000000..c82d9c7 --- /dev/null +++ b/crates/sf-launcher/ui/icons.slint @@ -0,0 +1,295 @@ +// Vector icons (32x32 viewbox). Brand marks are simplified, original drawings. + +export component AppIcon inherits Rectangle { + in property icon; + in property ink: #ffffff; + + if root.icon == "netflex": Rectangle { + // Netflex mark: mirrored "N" in three ribbons (from netflex/apps/web/public/favicon.svg). + Path { + width: 100%; height: 100%; + viewbox-width: 32; viewbox-height: 32; + commands: "M7 3h6v26H7z"; + fill: @linear-gradient(180deg, #b20710 0%, #831010 100%); + } + Path { + width: 100%; height: 100%; + viewbox-width: 32; viewbox-height: 32; + commands: "M19 3h6v26h-6z"; + fill: @linear-gradient(0deg, #b20710 0%, #831010 100%); + } + Path { + width: 100%; height: 100%; + viewbox-width: 32; viewbox-height: 32; + commands: "M18.4 3h6.6L13.6 29H7z"; + fill: #00000059; + } + Path { + width: 100%; height: 100%; + viewbox-width: 32; viewbox-height: 32; + commands: "M19 3h6L13 29H7z"; + fill: @linear-gradient(35deg, #e50914 0%, #f6303a 100%); + } + } + + if root.icon == "youtube": Rectangle { + Path { + width: 100%; height: 100%; + viewbox-width: 32; viewbox-height: 32; + commands: "M3 11.2C3 8.4 5 6.6 7.8 6.4 11.4 6.1 20.6 6.1 24.2 6.4 27 6.6 29 8.4 29 11.2v9.6c0 2.8-2 4.6-4.8 4.8-3.6.3-12.8.3-16.4 0C5 25.4 3 23.6 3 20.8z"; + fill: @linear-gradient(160deg, #ff3b30 0%, #d90d1d 100%); + } + Path { + width: 100%; height: 100%; + viewbox-width: 32; viewbox-height: 32; + commands: "M13.2 11.6v8.8l7.6-4.4z"; + fill: #ffffff; + } + } + + if root.icon == "airplay": Rectangle { + Path { + width: 100%; height: 100%; + viewbox-width: 32; viewbox-height: 32; + commands: "M9.5 22.5H6.5a3 3 0 0 1-3-3V7.5a3 3 0 0 1 3-3h19a3 3 0 0 1 3 3v12a3 3 0 0 1-3 3h-3"; + stroke: root.ink; + stroke-width: 2.4px; + stroke-line-cap: round; + } + Path { + width: 100%; height: 100%; + viewbox-width: 32; viewbox-height: 32; + commands: "M16 18.5l7 9.5H9z"; + fill: @linear-gradient(180deg, #8fd0ff 0%, #3d8bff 100%); + } + } + + if root.icon == "miracast": Rectangle { + Path { + width: 100%; height: 100%; + viewbox-width: 32; viewbox-height: 32; + commands: "M6.5 5h19a3 3 0 0 1 3 3v12a3 3 0 0 1-3 3h-19a3 3 0 0 1-3-3V8a3 3 0 0 1 3-3zM11 28h10"; + stroke: root.ink; + stroke-width: 2.4px; + stroke-line-cap: round; + } + Path { + width: 100%; height: 100%; + viewbox-width: 32; viewbox-height: 32; + commands: "M10.5 13.2a8 8 0 0 1 11 0M13.3 16.3a4 4 0 0 1 5.4 0"; + stroke: #5ff0d4; + stroke-width: 2.4px; + stroke-line-cap: round; + } + Path { + width: 100%; height: 100%; + viewbox-width: 32; viewbox-height: 32; + commands: "M14.4 19.4a1.6 1.6 0 1 0 3.2 0a1.6 1.6 0 1 0-3.2 0z"; + fill: #5ff0d4; + } + } + + if root.icon == "settings": Rectangle { + Path { + width: 100%; height: 100%; + viewbox-width: 32; viewbox-height: 32; + commands: "M5 10h22M5 22h22"; + stroke: root.ink; + stroke-width: 2.4px; + stroke-line-cap: round; + } + Path { + width: 100%; height: 100%; + viewbox-width: 32; viewbox-height: 32; + commands: "M8.2 10a3.8 3.8 0 1 0 7.6 0a3.8 3.8 0 1 0-7.6 0zM16.2 22a3.8 3.8 0 1 0 7.6 0a3.8 3.8 0 1 0-7.6 0z"; + fill: @linear-gradient(180deg, #ffffff 0%, #b9c4d4 100%); + } + } +} + +// SmartFox brand mark: a geometric fox head. +export component FoxMark inherits Rectangle { + Path { + width: 100%; height: 100%; + viewbox-width: 32; viewbox-height: 32; + commands: "M3 5l8 6h10l8-6-2.2 13.5L16 28 5.2 18.5z"; + fill: @linear-gradient(150deg, #ffb14a 0%, #ff6a2b 55%, #ff3d6e 100%); + } + Path { + width: 100%; height: 100%; + viewbox-width: 32; viewbox-height: 32; + commands: "M5.2 18.5L16 15l10.8 3.5L16 28z"; + fill: #ffffff2e; + } + Path { + width: 100%; height: 100%; + viewbox-width: 32; viewbox-height: 32; + commands: "M14 21.5h4L16 24z"; + fill: #1b0d08; + } +} + +export component WifiIcon inherits Rectangle { + in property ink: #ffffff; + Path { + width: 100%; height: 100%; + viewbox-width: 32; viewbox-height: 32; + commands: "M4.5 12.5a16.5 16.5 0 0 1 23 0M8.8 16.8a10.4 10.4 0 0 1 14.4 0M13 21a4.3 4.3 0 0 1 6 0"; + stroke: root.ink; + stroke-width: 2.2px; + stroke-line-cap: round; + } + Path { + width: 100%; height: 100%; + viewbox-width: 32; viewbox-height: 32; + commands: "M14.4 25.4a1.6 1.6 0 1 0 3.2 0a1.6 1.6 0 1 0-3.2 0z"; + fill: root.ink; + } +} + +export component BluetoothIcon inherits Rectangle { + in property ink: #ffffff; + Path { + width: 100%; height: 100%; + viewbox-width: 32; viewbox-height: 32; + commands: "M9.5 10.5l13 11-6.5 5.5V5l6.5 5.5-13 11"; + stroke: root.ink; + stroke-width: 2.2px; + stroke-line-cap: round; + stroke-line-join: round; + } +} + +export component PlayIcon inherits Rectangle { + in property ink: #ffffff; + Path { + width: 100%; height: 100%; + viewbox-width: 32; viewbox-height: 32; + commands: "M9 5.5v21c0 1.2 1.3 1.9 2.3 1.3l16.5-10.5a1.5 1.5 0 0 0 0-2.6L11.3 4.2C10.3 3.6 9 4.3 9 5.5z"; + fill: root.ink; + } +} + +export component InfoIcon inherits Rectangle { + in property ink: #ffffff; + Path { + width: 100%; height: 100%; + viewbox-width: 32; viewbox-height: 32; + commands: "M4 16a12 12 0 1 0 24 0a12 12 0 1 0-24 0zM16 14.5v8"; + stroke: root.ink; + stroke-width: 2.4px; + stroke-line-cap: round; + } + Path { + width: 100%; height: 100%; + viewbox-width: 32; viewbox-height: 32; + commands: "M14.4 10a1.6 1.6 0 1 0 3.2 0a1.6 1.6 0 1 0-3.2 0z"; + fill: root.ink; + } +} + +export component DisplayIcon inherits Rectangle { + in property ink: #ffffff; + Path { + width: 100%; height: 100%; + viewbox-width: 32; viewbox-height: 32; + commands: "M6.5 6h19a2.5 2.5 0 0 1 2.5 2.5v11a2.5 2.5 0 0 1-2.5 2.5h-19A2.5 2.5 0 0 1 4 19.5v-11A2.5 2.5 0 0 1 6.5 6zM11 27h10"; + stroke: root.ink; + stroke-width: 2.2px; + stroke-line-cap: round; + stroke-line-join: round; + } +} + +// Wi-Fi strength: `level` arcs (1-4) lit, the rest dimmed. +export component SignalIcon inherits Rectangle { + in property ink: #ffffff; + in property level: 4; + Path { + width: 100%; height: 100%; + viewbox-width: 32; viewbox-height: 32; + commands: "M4.5 12.5a16.5 16.5 0 0 1 23 0"; + stroke: root.level >= 4 ? root.ink : root.ink.transparentize(0.75); + stroke-width: 2.4px; + stroke-line-cap: round; + } + Path { + width: 100%; height: 100%; + viewbox-width: 32; viewbox-height: 32; + commands: "M8.8 16.8a10.4 10.4 0 0 1 14.4 0"; + stroke: root.level >= 3 ? root.ink : root.ink.transparentize(0.75); + stroke-width: 2.4px; + stroke-line-cap: round; + } + Path { + width: 100%; height: 100%; + viewbox-width: 32; viewbox-height: 32; + commands: "M13 21a4.3 4.3 0 0 1 6 0"; + stroke: root.level >= 2 ? root.ink : root.ink.transparentize(0.75); + stroke-width: 2.4px; + stroke-line-cap: round; + } + Path { + width: 100%; height: 100%; + viewbox-width: 32; viewbox-height: 32; + commands: "M14.4 25.4a1.6 1.6 0 1 0 3.2 0a1.6 1.6 0 1 0-3.2 0z"; + fill: root.ink; + } +} + +export component LockIcon inherits Rectangle { + in property ink: #ffffff; + Path { + width: 100%; height: 100%; + viewbox-width: 32; viewbox-height: 32; + commands: "M10.5 14.5v-3.5a5.5 5.5 0 0 1 11 0v3.5"; + stroke: root.ink; + stroke-width: 2.4px; + stroke-line-cap: round; + } + Path { + width: 100%; height: 100%; + viewbox-width: 32; viewbox-height: 32; + commands: "M9 14.5h14a2 2 0 0 1 2 2v8.5a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2v-8.5a2 2 0 0 1 2-2z"; + fill: root.ink; + } +} + +// Keyboard keys. +export component SpaceIcon inherits Rectangle { + in property ink: #ffffff; + Path { + width: 100%; height: 100%; + viewbox-width: 32; viewbox-height: 32; + commands: "M5 13.5v5h22v-5"; + stroke: root.ink; + stroke-width: 2.4px; + stroke-line-cap: round; + stroke-line-join: round; + } +} + +export component DeleteIcon inherits Rectangle { + in property ink: #ffffff; + Path { + width: 100%; height: 100%; + viewbox-width: 32; viewbox-height: 32; + commands: "M12.5 7.5h13a2.5 2.5 0 0 1 2.5 2.5v12a2.5 2.5 0 0 1-2.5 2.5h-13L4 16zM15.5 12.5l7 7M22.5 12.5l-7 7"; + stroke: root.ink; + stroke-width: 2.2px; + stroke-line-cap: round; + stroke-line-join: round; + } +} + +export component PowerIcon inherits Rectangle { + in property ink: #ffffff; + Path { + width: 100%; height: 100%; + viewbox-width: 32; viewbox-height: 32; + commands: "M10.3 8.6a10.5 10.5 0 1 0 11.4 0M16 4.5v11"; + stroke: root.ink; + stroke-width: 2.4px; + stroke-line-cap: round; + } +} diff --git a/crates/sf-launcher/ui/keyboard.slint b/crates/sf-launcher/ui/keyboard.slint new file mode 100644 index 0000000..955f83e --- /dev/null +++ b/crates/sf-launcher/ui/keyboard.slint @@ -0,0 +1,190 @@ +// On-screen keyboard in the tvOS style: one horizontal row of characters, +// the text field above it and the mode chips below. +// +// Drawn inside the settings pane, which stays; the settings content fades out. +// Only text and icons are drawn here. The glass (field, key track, focus lens, +// chips) comes from `keyboard::glass` in Rust, which mirrors the geometry the +// App exports (kb-* properties): keep the two in sync. +// +// Key row: index 0 = space, 1..n-2 = characters, n-1 = delete. + +import { SpaceIcon, DeleteIcon } from "icons.slint"; + +export component KeyboardView inherits Rectangle { + in property u; + in property pane-x; + in property pane-y; + in property pane-w; + in property pane-h; + in property back-x; + in property field-x; + in property field-y; + in property field-w; + in property field-h; + in property row-x; + in property row-y; + in property row-h; + in property key-w; + in property chip-x; + in property chip-y; + in property chip-w; + in property chip-h; + in property chip-step; + in property <[string]> keys; + in property <[string]> chips; + in property mode; + in property pos; + in property cpos; + in property keys-active; + in property chips-active; + in property title; + in property subtitle; + in property shown-text; + in property placeholder; + in property hint; + in property hint-error; + in property can-submit; + + property n: self.keys.length + 2; + + // ---- heading ---------------------------------------------------------- + Text { + x: root.pane-x; + y: root.pane-y + 58 * root.u; + width: root.pane-w; + horizontal-alignment: center; + text: root.title; + font-family: "Inter Display"; + font-weight: 800; + font-size: 46 * root.u; + letter-spacing: -1.2 * root.u; + color: #ffffff; + overflow: elide; + } + Text { + x: root.pane-x + 80 * root.u; + y: root.pane-y + 128 * root.u; + width: root.pane-w - 160 * root.u; + horizontal-alignment: center; + text: root.subtitle; + font-size: 23 * root.u; + color: #ffffffa8; + overflow: elide; + } + + // ---- text field --------------------------------------------------------- + Rectangle { + x: root.field-x; + y: root.field-y; + width: root.field-w; + height: root.field-h; + clip: true; + HorizontalLayout { + padding-left: 36 * root.u; + padding-right: 36 * root.u; + alignment: start; + spacing: 4 * root.u; + if root.shown-text == "": Text { + vertical-alignment: center; + text: root.placeholder; + font-size: 32 * root.u; + color: #ffffff59; + } + if root.shown-text != "": Text { + vertical-alignment: center; + text: root.shown-text; + font-size: 34 * root.u; + font-weight: 500; + letter-spacing: 1 * root.u; + color: #ffffff; + } + // Blinking caret. + Rectangle { + width: 3 * root.u; + Rectangle { + y: (parent.height - self.height) / 2; + width: 100%; + height: 44 * root.u; + border-radius: self.width / 2; + background: #ff9a5c; + opacity: mod(animation-tick() / 1000ms, 1) < 0.55 ? 1 : 0; + } + } + } + } + Text { + x: root.field-x; + y: root.field-y + root.field-h + 18 * root.u; + width: root.field-w; + horizontal-alignment: center; + text: root.hint; + font-size: 21 * root.u; + color: root.hint-error ? #ff8278 : #ffffff8c; + } + + // ---- key row --------------------------------------------------------------- + // Keys grow as the focus lens passes them (fish-eye), like on tvOS. + for key[i] in root.keys: Text { + property f: max(0, 1 - abs(root.pos - (i + 1))) * root.keys-active; + x: root.row-x + (i + 1) * root.key-w - 20 * root.u; + y: root.row-y; + width: root.key-w + 40 * root.u; + height: root.row-h; + horizontal-alignment: center; + vertical-alignment: center; + text: key; + font-size: (31 + 17 * self.f) * root.u; + font-weight: self.f > 0.5 ? 700 : 500; + color: self.f > 0.5 ? #121317 : #ffffffd8; + } + SpaceIcon { + property f: max(0, 1 - abs(root.pos)) * root.keys-active; + property size: (30 + 10 * self.f) * root.u; + x: root.row-x + (root.key-w - self.size) / 2; + y: root.row-y + (root.row-h - self.size) / 2; + width: self.size; + height: self.size; + ink: self.f > 0.5 ? #121317 : #ffffffd8; + } + DeleteIcon { + property f: max(0, 1 - abs(root.pos - (root.n - 1))) * root.keys-active; + property size: (32 + 10 * self.f) * root.u; + x: root.row-x + (root.n - 1) * root.key-w + (root.key-w - self.size) / 2; + y: root.row-y + (root.row-h - self.size) / 2; + width: self.size; + height: self.size; + ink: self.f > 0.5 ? #121317 : #ffffffd8; + } + + // ---- mode and action chips ------------------------------------------------------- + for label[i] in root.chips: Text { + property f: max(0, 1 - abs(root.cpos - i)) * root.chips-active; + property submit: i == root.chips.length - 1; + property selected: i < 4 && i == root.mode; + x: root.chip-x + i * root.chip-step; + y: root.chip-y; + width: root.chip-w; + height: root.chip-h; + horizontal-alignment: center; + vertical-alignment: center; + text: label; + font-size: 24 * root.u; + font-weight: self.submit || self.selected ? 700 : 500; + color: self.submit + ? (root.can-submit ? #ffffff : #ffffff66) + : self.f > 0.5 ? #121317 : self.selected ? #ff9a5c : #ffffffc8; + } + + Text { + x: root.back-x; + y: root.pane-y + root.pane-h - 92 * root.u; + width: 300 * root.u; + height: 56 * root.u; + horizontal-alignment: center; + vertical-alignment: center; + text: "‹ Mégse · Vissza"; + font-size: 21 * root.u; + font-weight: 500; + color: #ffffffc0; + } +} diff --git a/crates/sf-launcher/ui/pairing.slint b/crates/sf-launcher/ui/pairing.slint new file mode 100644 index 0000000..3a04260 --- /dev/null +++ b/crates/sf-launcher/ui/pairing.slint @@ -0,0 +1,318 @@ +// First-run pairing guide for the Apple Siri Remote. The frosted pane behind +// it is drawn by the glass layer (see `glass-over` in app.slint). + +// Pulsing ring that draws the eye to a button. +component Pulse inherits Rectangle { + in property size; + in property tint; + in property delay; + property phase: mod((animation-tick() + root.delay) / 1400ms, 1); + width: self.size * (1 + 0.9 * self.phase); + height: self.width; + border-radius: self.width / 2; + border-width: 3px; + border-color: root.tint.with-alpha(0.9 * (1 - self.phase)); + background: root.tint.with-alpha(0.18 * (1 - self.phase)); +} + +component RemoteButton inherits Rectangle { + in property u; + in property glyph; + in property hot; + in property accent; + width: 52 * self.u; + height: self.width; + border-radius: self.width / 2; + background: self.hot ? #2a2a2e : #1b1b1d; + drop-shadow-blur: 3 * self.u; + drop-shadow-color: #00000080; + drop-shadow-offset-y: 1 * self.u; + if root.hot: Pulse { + size: root.width; + tint: root.accent; + x: (parent.width - self.width) / 2; + y: (parent.height - self.height) / 2; + } + if root.hot: Pulse { + size: root.width; + tint: root.accent; + delay: 700ms; + x: (parent.width - self.width) / 2; + y: (parent.height - self.height) / 2; + } + Text { + text: root.glyph; + color: root.hot ? root.accent.brighter(0.5) : #e8e8ea; + font-size: 24 * root.u; + font-weight: 600; + horizontal-alignment: center; + vertical-alignment: center; + } +} + +// Apple Siri Remote (2nd gen, aluminium), drawn front-on. +export component SiriRemote inherits Rectangle { + in property u; + in property accent; + width: 150 * self.u; + height: 560 * self.u; + border-radius: 44 * self.u; + background: @linear-gradient(90deg, #8d929a 0%, #d9dde2 22%, #f1f3f5 45%, #c6cad0 75%, #959aa2 100%); + drop-shadow-blur: 30 * self.u; + drop-shadow-color: #000000a0; + drop-shadow-offset-y: 16 * self.u; + + // Siri button on the right edge. + Rectangle { + x: parent.width - 2 * root.u; + y: 200 * root.u; + width: 5 * root.u; + height: 46 * root.u; + border-radius: 2 * root.u; + background: #8b9097; + } + // Power button. + Rectangle { + x: parent.width - 34 * root.u; + y: 16 * root.u; + width: 18 * root.u; + height: 18 * root.u; + border-radius: self.width / 2; + background: #1b1b1d; + Text { + text: "⏻"; + color: #d0d0d4; + font-size: 11 * root.u; + horizontal-alignment: center; + vertical-alignment: center; + } + } + // Clickpad: outer touch ring and center. + Rectangle { + x: (parent.width - self.width) / 2; + y: 44 * root.u; + width: 128 * root.u; + height: self.width; + border-radius: self.width / 2; + background: @radial-gradient(circle, #2b2c30 0%, #1a1b1d 100%); + Rectangle { + x: (parent.width - self.width) / 2; + y: (parent.height - self.height) / 2; + width: 64 * root.u; + height: self.width; + border-radius: self.width / 2; + background: #232427; + border-width: 1px; + border-color: #ffffff14; + } + for d in [{ x: 0.5, y: 0.1 }, { x: 0.5, y: 0.9 }, { x: 0.1, y: 0.5 }, { x: 0.9, y: 0.5 }]: Rectangle { + x: parent.width * d.x - 2.5 * root.u; + y: parent.height * d.y - 2.5 * root.u; + width: 5 * root.u; + height: self.width; + border-radius: self.width / 2; + background: #ffffff60; + } + } + + // Button grid below the clickpad. + property col1: 18 * root.u; + property col2: root.width - 18 * root.u - 52 * root.u; + RemoteButton { u: root.u; accent: root.accent; x: root.col1; y: 200 * root.u; glyph: "‹"; hot: true; } + RemoteButton { u: root.u; accent: root.accent; x: root.col2; y: 200 * root.u; glyph: "▭"; } + RemoteButton { u: root.u; accent: root.accent; x: root.col1; y: 268 * root.u; glyph: "⏯"; } + RemoteButton { u: root.u; accent: root.accent; x: root.col1; y: 336 * root.u; glyph: "🔇"; } + // Volume rocker: + is the one to hold. + Rectangle { + x: root.col2; + y: 268 * root.u; + width: 52 * root.u; + height: 120 * root.u; + border-radius: self.width / 2; + background: #1b1b1d; + RemoteButton { + u: root.u; + accent: root.accent; + x: 0; + y: 0; + glyph: "+"; + hot: true; + background: transparent; + } + Text { + y: parent.height - 52 * root.u; + width: parent.width; + height: 52 * root.u; + text: "−"; + color: #e8e8ea; + font-size: 24 * root.u; + horizontal-alignment: center; + vertical-alignment: center; + } + } +} + +component Step inherits Rectangle { + in property u; + in property n; + in property label; + in property accent; + height: 70 * self.u; + Rectangle { + x: 0; + y: 4 * root.u; + width: 40 * root.u; + height: self.width; + // The glass bead behind the number is drawn by the glass layer (app.slint). + Text { + text: root.n; + color: root.accent.brighter(0.6); + font-size: 20 * root.u; + font-weight: 700; + horizontal-alignment: center; + vertical-alignment: center; + } + } + Text { + x: 60 * root.u; + y: 10 * root.u; + width: parent.width - 60 * root.u; + text: root.label; + wrap: word-wrap; + font-size: 24 * root.u; + color: #ffffffd8; + } +} + +// Pane content; `state` is the remote status from sf-remote. +export component PairingGuide inherits Rectangle { + in property u; + in property state; + in property accent: #ff7a35; + property ok: self.state == "paired" || self.state == "connected"; + property broken: self.state == "no-adapter"; + + SiriRemote { + u: root.u; + accent: root.accent; + x: 120 * root.u; + y: (parent.height - self.height) / 2; + } + + Rectangle { + x: 420 * root.u; + y: 70 * root.u; + width: parent.width - 420 * root.u - 80 * root.u; + height: parent.height - 140 * root.u; + + Text { + x: 0; + y: 0; + text: "ELSŐ LÉPÉS"; + font-size: 20 * root.u; + font-weight: 600; + letter-spacing: 3 * root.u; + color: root.accent.brighter(0.3); + } + Text { + x: 0; + y: 34 * root.u; + width: parent.width; + text: "Párosítsd a Siri Remote-ot"; + wrap: word-wrap; + font-family: "Inter Display"; + font-weight: 800; + font-size: 58 * root.u; + letter-spacing: -1.6 * root.u; + color: #ffffff; + } + Step { + u: root.u; + accent: root.accent; + x: 0; + y: 150 * root.u; + width: parent.width; + n: 1; + label: "Vidd a távirányítót a TV közelébe."; + } + Step { + u: root.u; + accent: root.accent; + x: 0; + y: 226 * root.u; + width: parent.width; + n: 2; + label: "Tartsd nyomva egyszerre a Vissza (‹) és a Hangerő + gombot kb. 5 másodpercig."; + } + Step { + u: root.u; + accent: root.accent; + x: 0; + y: 330 * root.u; + width: parent.width; + n: 3; + label: "Engedd el. A TV magától megtalálja és párosítja."; + } + + // Live status. + Rectangle { + x: 0; + y: parent.height - 70 * root.u; + width: 520 * root.u; + height: 64 * root.u; + // Glass pill (tinted by state) is drawn by the glass layer (app.slint). + + // Searching: three breathing dots. Done: check mark. Error: "!". + if !root.ok && !root.broken: HorizontalLayout { + x: 26 * root.u; + width: 60 * root.u; + spacing: 8 * root.u; + alignment: start; + for i in 3: Rectangle { + property p: mod((animation-tick() + i * 180ms) / 900ms, 1); + y: (parent.height - self.height) / 2; + width: 10 * root.u; + height: self.width; + border-radius: self.width / 2; + background: root.accent.brighter(0.4); + opacity: 0.25 + 0.75 * abs(sin(self.p * 180deg)); + } + } + if root.ok || root.broken: Text { + x: 26 * root.u; + width: 40 * root.u; + height: parent.height; + text: root.ok ? "✓" : "!"; + color: root.ok ? #34c759 : #ff9f0a; + font-size: 30 * root.u; + font-weight: 800; + vertical-alignment: center; + } + Text { + x: 92 * root.u; + width: parent.width - 110 * root.u; + height: parent.height; + vertical-alignment: center; + font-size: 24 * root.u; + font-weight: 500; + color: #ffffff; + text: root.ok ? "Sikeres párosítás!" + : root.broken ? "Nem található Bluetooth adapter" + : root.state == "pairing" ? "Párosítás…" + : "Távirányító keresése…"; + } + } + Text { + x: 556 * root.u; + y: parent.height - 68 * root.u; + width: 204 * root.u; + height: 60 * root.u; + horizontal-alignment: center; + vertical-alignment: center; + text: "Kihagyás · Esc"; + font-size: 21 * root.u; + font-weight: 500; + color: #ffffffc0; + } + } +} diff --git a/crates/sf-launcher/ui/settings.slint b/crates/sf-launcher/ui/settings.slint new file mode 100644 index 0000000..c7fa3d5 --- /dev/null +++ b/crates/sf-launcher/ui/settings.slint @@ -0,0 +1,210 @@ +// Settings screen: categories on the left, rows on the right. +// +// Only text and icons are drawn here. The glass (pane, rows, chips) comes from +// `settings_screen::glass` in Rust, which mirrors the geometry below: keep the +// row/nav formulas (position, focus `f`, visibility `vis`) in sync with it. + +import { WifiIcon, BluetoothIcon, InfoIcon, DisplayIcon, PowerIcon, SignalIcon, LockIcon } from "icons.slint"; + +export struct SettingRow { + title: string, + value: string, + detail: string, + // info | choice | device | action | danger | option | network + kind: string, + // network rows: signal bars (1-4) and a lock for protected networks + level: int, + lock: bool, +} + +component NavIcon inherits Rectangle { + in property index; + in property ink; + if root.index == 0: DisplayIcon { width: 100%; height: 100%; ink: root.ink; } + if root.index == 1: BluetoothIcon { width: 100%; height: 100%; ink: root.ink; } + if root.index == 2: WifiIcon { width: 100%; height: 100%; ink: root.ink; } + if root.index == 3: PowerIcon { width: 100%; height: 100%; ink: root.ink; } + if root.index == 4: InfoIcon { width: 100%; height: 100%; ink: root.ink; } +} + +export component SettingsView inherits Rectangle { + in property u; + in property pane-x; + in property pane-y; + in property pane-h; + in property nav-x; + in property nav-y; + in property nav-w; + in property nav-h; + in property nav-step; + in property rows-x; + in property rows-y; + in property rows-w; + in property row-h; + in property row-step; + in property rows-view-h; + in property rows-scroll; + in property nav-pos; + in property nav-active; + in property row-pos; + in property content-active; + in property title; + in property subtitle; + in property <[SettingRow]> rows; + in property <[string]> categories; + + // ---- left column ---------------------------------------------------- + Text { + x: root.nav-x + 8 * root.u; + y: root.pane-y + 50 * root.u; + text: "Beállítások"; + font-family: "Inter Display"; + font-weight: 800; + font-size: 50 * root.u; + letter-spacing: -1.5 * root.u; + color: #ffffff; + } + + for name[i] in root.categories: Rectangle { + property f: max(0, 1 - abs(root.nav-pos - i)) * root.nav-active; + property sel: max(0, 1 - abs(root.nav-pos - i)); + property ink: self.f > 0.5 ? #121317 : #ffffff.with-alpha(0.72 + 0.28 * self.sel); + x: root.nav-x; + y: root.nav-y + i * root.nav-step; + width: root.nav-w; + height: root.nav-h; + NavIcon { + x: 28 * root.u; + y: (parent.height - self.height) / 2; + width: 34 * root.u; + height: 34 * root.u; + index: i; + ink: parent.ink; + } + Text { + x: 82 * root.u; + width: parent.width - 100 * root.u; + height: parent.height; + vertical-alignment: center; + text: name; + font-size: 26 * root.u; + font-weight: 600; + color: parent.ink; + overflow: elide; + } + } + + Text { + x: root.nav-x; + y: root.pane-y + root.pane-h - 92 * root.u; + width: 300 * root.u; + height: 56 * root.u; + horizontal-alignment: center; + vertical-alignment: center; + text: "‹ Vissza · Esc"; + font-size: 21 * root.u; + font-weight: 500; + color: #ffffffc0; + } + + // ---- right column --------------------------------------------------- + Text { + x: root.rows-x + 8 * root.u; + y: root.pane-y + 44 * root.u; + width: root.rows-w - 16 * root.u; + text: root.title; + font-family: "Inter Display"; + font-weight: 800; + font-size: 40 * root.u; + letter-spacing: -1 * root.u; + color: #ffffff; + overflow: elide; + } + Text { + x: root.rows-x + 8 * root.u; + y: root.pane-y + 102 * root.u; + width: root.rows-w - 16 * root.u; + height: 64 * root.u; + text: root.subtitle; + wrap: word-wrap; + overflow: elide; + font-size: 21 * root.u; + color: #ffffffa8; + } + + for row[j] in root.rows: r := Rectangle { + property f: max(0, 1 - abs(root.row-pos - j)) * root.content-active; + property top: root.rows-y + j * root.row-step - root.rows-scroll; + property over: max(root.rows-y - self.top, self.top + root.row-h - (root.rows-y + root.rows-view-h)) / root.row-h; + property vis: clamp(1 - self.over, 0, 1); + property hot: self.f > 0.5; + property danger: row.kind == "danger"; + property ink: self.hot ? (self.danger ? #ffffff : #121317) : (self.danger ? #ff8278 : #ffffff); + property ink-dim: self.hot ? (self.danger ? #ffffffd0 : #121317b0) : #ffffff99; + property chevron: row.kind == "choice" || row.kind == "device"; + property network: row.kind == "network"; + x: root.rows-x; + y: self.top; + width: root.rows-w; + height: root.row-h; + opacity: self.vis; + visible: self.vis > 0.01; + + Text { + x: 30 * root.u; + y: row.detail == "" ? (parent.height - self.height) / 2 : 15 * root.u; + width: parent.width * 0.55; + text: row.title; + font-size: 26 * root.u; + font-weight: 600; + color: r.ink; + overflow: elide; + } + if row.detail != "": Text { + x: 30 * root.u; + y: 51 * root.u; + width: parent.width * 0.55; + text: row.detail; + font-size: 19 * root.u; + color: r.ink-dim; + overflow: elide; + } + Text { + x: parent.width * 0.4; + width: parent.width * 0.6 - (r.network ? 124 : r.chevron ? 64 : 32) * root.u; + height: parent.height; + horizontal-alignment: right; + vertical-alignment: center; + text: row.value; + font-size: row.kind == "option" ? 30 * root.u : 23 * root.u; + font-weight: row.kind == "option" ? 700 : 400; + color: row.kind == "option" ? (r.hot ? #121317 : #ff9a5c) : r.ink-dim; + overflow: elide; + } + if r.chevron: Text { + x: parent.width - 50 * root.u; + width: 24 * root.u; + height: parent.height; + vertical-alignment: center; + text: "›"; + font-size: 36 * root.u; + color: r.ink-dim; + } + // Wi-Fi network: lock (protected) and signal strength on the right. + if r.network && row.lock: LockIcon { + x: parent.width - 104 * root.u; + y: (parent.height - self.height) / 2; + width: 24 * root.u; + height: 24 * root.u; + ink: r.ink-dim; + } + if r.network: SignalIcon { + x: parent.width - 66 * root.u; + y: (parent.height - self.height) / 2; + width: 34 * root.u; + height: 34 * root.u; + level: row.level; + ink: r.ink; + } + } +} diff --git a/crates/sf-remote/Cargo.toml b/crates/sf-remote/Cargo.toml new file mode 100644 index 0000000..32ef99e --- /dev/null +++ b/crates/sf-remote/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "sf-remote" +description = "SmartFox Apple Siri Remote driver: BLE GATT -> uinput keys + touch gestures" +version.workspace = true +edition.workspace = true +license.workspace = true + +[dependencies] +anyhow.workspace = true +log.workspace = true +env_logger.workspace = true + +[target.'cfg(target_os = "linux")'.dependencies] +bluer = { version = "0.17", features = ["bluetoothd"] } +tokio = { version = "1", features = ["rt", "macros", "time", "signal", "sync"] } +futures = "0.3" +evdev = { version = "0.13", features = ["tokio"] } +libc = "0.2" diff --git a/crates/sf-remote/src/keyboard.rs b/crates/sf-remote/src/keyboard.rs new file mode 100644 index 0000000..9148abd --- /dev/null +++ b/crates/sf-remote/src/keyboard.rs @@ -0,0 +1,85 @@ +//! Global hotkeys from physical keyboards. Apps (Chromium) own keyboard focus, +//! so the launcher can't see these; we read evdev directly (without grabbing). +//! F12 -> home +//! Esc held 0.8 s -> home (a short press still means "back" in the app) + +use std::collections::HashSet; +use std::path::PathBuf; +use std::sync::{Arc, Mutex}; +use std::time::Duration; + +use evdev::{EventType, KeyCode}; + +use crate::link::Link; + +const ESC_HOLD: Duration = Duration::from_millis(800); +const OWN_DEVICE: &str = "SmartFox Siri Remote"; + +pub fn spawn(link: Link) { + std::thread::spawn(move || { + let rt = match tokio::runtime::Builder::new_current_thread().enable_all().build() { + Ok(rt) => rt, + Err(e) => return log::error!("keyboard watcher: {e}"), + }; + rt.block_on(watch(link)); + }); +} + +async fn watch(link: Link) { + let watched: Arc>> = Arc::default(); + let mut rescan = tokio::time::interval(Duration::from_secs(3)); + loop { + rescan.tick().await; + link.resend(); + for (path, dev) in evdev::enumerate() { + if watched.lock().unwrap().contains(&path) || dev.name() == Some(OWN_DEVICE) { + continue; + } + let is_keyboard = dev + .supported_keys() + .is_some_and(|k| k.contains(KeyCode::KEY_ESC) && k.contains(KeyCode::KEY_F12)); + if !is_keyboard { + continue; + } + let Ok(mut stream) = dev.into_event_stream() else { continue }; + log::info!("watching keyboard {}", path.display()); + watched.lock().unwrap().insert(path.clone()); + let (link, watched) = (link.clone(), watched.clone()); + tokio::spawn(async move { + // Deadline at which a still-held Esc turns into "home". + let mut esc_deadline: Option = None; + loop { + let ev = match esc_deadline { + Some(deadline) => tokio::select! { + ev = stream.next_event() => ev, + _ = tokio::time::sleep_until(deadline) => { + log::info!("Esc held -> home"); + esc_deadline = None; + link.home(); + continue; + } + }, + None => stream.next_event().await, + }; + let Ok(ev) = ev else { break }; + if ev.event_type() != EventType::KEY { + continue; + } + let (code, value) = (KeyCode::new(ev.code()), ev.value()); + if code == KeyCode::KEY_F12 && value == 1 { + log::info!("F12 -> home"); + link.home(); + } else if code == KeyCode::KEY_ESC { + match value { + 1 => esc_deadline = Some(tokio::time::Instant::now() + ESC_HOLD), + 0 => esc_deadline = None, + _ => {} + } + } + } + log::info!("keyboard {} gone", path.display()); + watched.lock().unwrap().remove(&path); + }); + } + } +} diff --git a/crates/sf-remote/src/link.rs b/crates/sf-remote/src/link.rs new file mode 100644 index 0000000..90060a5 --- /dev/null +++ b/crates/sf-remote/src/link.rs @@ -0,0 +1,160 @@ +//! Connection to the launcher's command socket: global `home`, remote status +//! and standby. The launcher answers every command with its standby state +//! (`standby off|screen|suspend `), which we cache here. + +use std::io::{BufRead, BufReader, Write}; +use std::os::unix::net::UnixStream; +use std::path::PathBuf; +use std::sync::{Arc, Mutex}; +use std::time::Duration; + +use tokio::sync::watch; + +/// Remote states the launcher understands. +pub mod state { + /// No Bluetooth controller present. + pub const NO_ADAPTER: &str = "no-adapter"; + /// No paired remote: scanning for one in pairing mode. + pub const SEARCHING: &str = "searching"; + /// A remote in pairing mode was found; pairing in progress. + pub const PAIRING: &str = "pairing"; + /// Paired but not connected (asleep). + pub const PAIRED: &str = "paired"; + pub const CONNECTED: &str = "connected"; +} + +/// The launcher's standby state. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] +pub enum Standby { + #[default] + Off, + /// Screen off, machine running. + Screen, + /// The launcher wants the machine suspended; the number changes with + /// every request (also when it asks again after a stray wake-up). + Suspend(u64), +} + +impl Standby { + pub fn parse(line: &str) -> Option { + let mut w = line.split_whitespace(); + if w.next()? != "standby" { + return None; + } + match w.next()? { + "off" => Some(Standby::Off), + "screen" => Some(Standby::Screen), + "suspend" => Some(Standby::Suspend(w.next().and_then(|n| n.parse().ok()).unwrap_or(0))), + _ => None, + } + } + + pub fn active(self) -> bool { + self != Standby::Off + } +} + +#[derive(Clone)] +pub struct Link { + socket: Option, + status: Arc>, + standby: Arc>, +} + +impl Link { + pub fn new(socket: Option) -> Self { + Self { socket, status: Arc::default(), standby: Arc::new(watch::Sender::new(Standby::Off)) } + } + + /// Sends one command and reads the launcher's standby reply. + fn send(&self, line: &str) -> bool { + let Some(path) = &self.socket else { return false }; + let result = UnixStream::connect(path).and_then(|mut s| { + s.set_read_timeout(Some(Duration::from_millis(500)))?; + s.write_all(format!("{line}\n").as_bytes())?; + let mut reply = String::new(); + // An older launcher doesn't answer; the timeout covers that. + let _ = BufReader::new(&s).read_line(&mut reply); + Ok(reply) + }); + match result { + Ok(reply) => { + if let Some(state) = Standby::parse(&reply) { + self.standby.send_if_modified(|cur| { + let changed = *cur != state; + if changed { + log::info!("standby: {state:?}"); + *cur = state; + } + changed + }); + } + true + } + Err(e) => { + log::trace!("launcher socket {}: {e}", path.display()); + false + } + } + } + + /// Asks the launcher to come to the front. False if it isn't listening. + pub fn home(&self) -> bool { + self.send("home") + } + + /// Power button: the launcher toggles standby. + pub fn power(&self) -> Standby { + self.send("power"); + self.standby() + } + + /// Leave standby. + pub fn wake(&self) { + self.send("wake"); + } + + /// Last known standby state (refreshed with every command, at least every 3 s). + pub fn standby(&self) -> Standby { + *self.standby.borrow() + } + + pub fn watch_standby(&self) -> watch::Receiver { + self.standby.subscribe() + } + + pub fn status(&self, s: &str) { + let changed = { + let mut cur = self.status.lock().unwrap(); + let changed = *cur != s; + *cur = s.to_string(); + changed + }; + if changed { + log::info!("remote status: {s}"); + } + self.send(&format!("remote {s}")); + } + + /// Re-sends the last status (the launcher may have restarted). + pub fn resend(&self) { + let s = self.status.lock().unwrap().clone(); + if !s.is_empty() { + self.send(&format!("remote {s}")); + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn parses_standby_reply() { + assert_eq!(Standby::parse("standby off\n"), Some(Standby::Off)); + assert_eq!(Standby::parse("standby screen"), Some(Standby::Screen)); + assert_eq!(Standby::parse("standby suspend 7"), Some(Standby::Suspend(7))); + assert_eq!(Standby::parse(""), None); + assert!(Standby::Screen.active() && !Standby::Off.active()); + } +} diff --git a/crates/sf-remote/src/linux.rs b/crates/sf-remote/src/linux.rs new file mode 100644 index 0000000..b23b7a9 --- /dev/null +++ b/crates/sf-remote/src/linux.rs @@ -0,0 +1,542 @@ +use std::pin::Pin; +use std::sync::{Arc, Mutex}; +use std::time::{Duration, Instant}; + +use anyhow::{Context, Result}; +use bluer::{Adapter, AddressType, Device, Uuid}; +use evdev::uinput::VirtualDevice; +use evdev::{AttributeSet, EventType, InputEvent, KeyCode}; +use futures::{Stream, StreamExt}; + +use crate::link::{Link, Standby, state}; +use crate::protocol::{self, Gestures, Report, Swipe, button}; +use crate::wake; + +const APPLE: u32 = 0x004C; +/// Known Siri Remote product ids (0x0314/0x0315: 2nd/3rd gen aluminium). +const PRODUCTS: [u32; 3] = [0x0314, 0x0315, 0x0266]; +const HID_SERVICE: u16 = 0x1812; +const HID_REPORT: u16 = 0x2A4D; + +const REPEAT_DELAY: Duration = Duration::from_millis(450); +const REPEAT_EVERY: Duration = Duration::from_millis(110); + +struct Options { + dry_run: bool, + step: i32, + /// Launcher command socket; the TV button sends `home` there instead of a key. + home_socket: Option, +} + +fn parse_args() -> Options { + let mut o = Options { + dry_run: false, + step: 300, + home_socket: std::env::var_os("SMARTFOX_SOCKET").map(Into::into), + }; + let mut args = std::env::args().skip(1); + while let Some(a) = args.next() { + match a.as_str() { + "--dry-run" | "-n" => o.dry_run = true, + "--step" => o.step = args.next().and_then(|v| v.parse().ok()).unwrap_or(o.step), + "--home-socket" => o.home_socket = args.next().map(Into::into), + other => log::warn!("unknown argument {other}"), + } + } + o +} + +fn key_for(bit: u16) -> Option { + Some(match bit { + button::UP => KeyCode::KEY_UP, + button::DOWN => KeyCode::KEY_DOWN, + button::LEFT => KeyCode::KEY_LEFT, + button::RIGHT => KeyCode::KEY_RIGHT, + button::SELECT => KeyCode::KEY_ENTER, + button::BACK => KeyCode::KEY_ESC, + button::HOME => KeyCode::KEY_HOMEPAGE, + button::PLAY_PAUSE => KeyCode::KEY_PLAYPAUSE, + button::VOL_UP => KeyCode::KEY_VOLUMEUP, + button::VOL_DOWN => KeyCode::KEY_VOLUMEDOWN, + button::MUTE => KeyCode::KEY_MUTE, + button::SIRI => KeyCode::KEY_VOICECOMMAND, + // Not KEY_POWER: logind would shut the machine down. The launcher + // handles standby (`power` on its socket), see serve(). + button::POWER => return None, + _ => return None, + }) +} + +fn repeats(bit: u16) -> bool { + matches!( + bit, + button::UP + | button::DOWN + | button::LEFT + | button::RIGHT + | button::VOL_UP + | button::VOL_DOWN + ) +} + +/// Virtual keyboard (or a logger in --dry-run mode). +struct Keys { + dev: Option, +} + +impl Keys { + fn new(dry_run: bool) -> Result { + if dry_run { + return Ok(Self { dev: None }); + } + let mut keys = AttributeSet::::new(); + for (bit, _) in button::ALL { + if let Some(k) = key_for(bit) { + keys.insert(k); + } + } + // Sent when going into standby: pauses playback in the app. + keys.insert(KeyCode::KEY_PAUSECD); + let dev = VirtualDevice::builder() + .context("opening /dev/uinput (is the user in the smartfox group?)")? + .name("SmartFox Siri Remote") + .with_keys(&keys)? + .build()?; + Ok(Self { dev: Some(dev) }) + } + + fn send(&mut self, key: KeyCode, value: i32) { + log::debug!("key {key:?} {}", ["up", "down", "repeat"][value as usize]); + if let Some(dev) = self.dev.as_mut() { + let ev = InputEvent::new(EventType::KEY.0, key.code(), value); + if let Err(e) = dev.emit(&[ev]) { + log::warn!("uinput: {e}"); + } + } + } + + fn tap(&mut self, key: KeyCode) { + self.send(key, 1); + self.send(key, 0); + } +} + +fn short_uuid(u: Uuid) -> Option { + let s = u.to_string(); + s.ends_with("-0000-1000-8000-00805f9b34fb") + .then(|| u16::from_str_radix(&s[4..8], 16).ok()) + .flatten() +} + +async fn find_remote(adapter: &Adapter) -> Result> { + for addr in adapter.device_addresses().await? { + let dev = adapter.device(addr)?; + let Ok(Some(m)) = dev.modalias().await else { + continue; + }; + if m.vendor == APPLE + && PRODUCTS.contains(&m.product) + && dev.is_paired().await.unwrap_or(false) + { + return Ok(Some(dev)); + } + } + Ok(None) +} + +type Notify = Pin> + Send>>; + +async fn subscribe(dev: &Device) -> Result> { + let mut streams: Vec = Vec::new(); + for svc in dev.services().await? { + if short_uuid(svc.uuid().await?) != Some(HID_SERVICE) { + continue; + } + for ch in svc.characteristics().await? { + if short_uuid(ch.uuid().await?) != Some(HID_REPORT) || !ch.flags().await?.notify { + continue; + } + log::info!("subscribing to report characteristic {:#06x}", ch.id()); + streams.push(Box::pin(ch.notify().await?)); + } + } + if streams.is_empty() { + anyhow::bail!("no HID report characteristics visible - is BlueZ's input plugin disabled?"); + } + Ok(streams) +} + +/// Power toggles standby; in standby any other button just wakes the TV. +fn standby_button(bit: u16, link: &Link, keys: &mut Keys) { + let before = link.standby(); + if bit != button::POWER { + log::info!("button in standby -> wake"); + link.wake(); + return; + } + let after = link.power(); + log::info!("power: {before:?} -> {after:?}"); + if !before.active() && after.active() { + keys.tap(KeyCode::KEY_PAUSECD); + } +} + +/// Puts the machine to sleep whenever the launcher asks for it (a new +/// `standby suspend `). The launcher runs as `tv` and can't do this. +async fn suspend_on_request(link: Link, target: Arc>>) { + let mut rx = link.watch_standby(); + let mut done = None; + loop { + let Standby::Suspend(n) = *rx.borrow_and_update() else { + if rx.changed().await.is_err() { + return; + } + continue; + }; + if done == Some(n) { + if rx.changed().await.is_err() { + return; + } + continue; + } + done = Some(n); + // Give the screen time to go dark and the app to pause. + tokio::time::sleep(Duration::from_millis(1500)).await; + if link.standby() != Standby::Suspend(n) { + log::info!("suspend {n} cancelled"); + continue; + } + let target = *target.lock().unwrap(); + let result = tokio::task::spawn_blocking(move || suspend(target)).await; + if let Ok(Err(e)) | Err(e) = result.map_err(anyhow::Error::from) { + log::warn!("suspend: {e:#}"); + } + } +} + +fn suspend(target: Option) -> Result<()> { + let n = wake::enable_controller_wakeup(); + log::info!("wake: controller wakeup ready ({n} switched on)"); + match target { + Some(t) => match wake::allow_remote_wakeup(&t) { + Ok(()) => log::info!("wake: remote may wake the machine"), + Err(e) => log::warn!("wake: {e:#} (only the PC's own button will wake it)"), + }, + None => log::warn!("wake: no paired remote known"), + } + log::info!("suspending"); + let status = std::process::Command::new("systemctl").arg("suspend").status().context("systemctl suspend")?; + if !status.success() { + anyhow::bail!("systemctl suspend: {status}"); + } + Ok(()) +} + +async fn wake_target(adapter: &Adapter, dev: &Device) -> Option { + let index = adapter.name().strip_prefix("hci")?.parse().ok()?; + let public = match dev.address_type().await.ok()? { + AddressType::LePublic => true, + AddressType::LeRandom => false, + AddressType::BrEdr => return None, + }; + Some(wake::Target { index, addr: dev.address().0, public }) +} + +/// Handles one connection until the remote disconnects. +async fn serve(dev: &Device, keys: &mut Keys, step: i32, link: &Link) -> Result<()> { + let mut reports = futures::stream::select_all(subscribe(dev).await?); + let mut gestures = Gestures::new(step); + let mut held: u16 = 0; + // Buttons whose press woke (or put to sleep) the TV: their release and + // auto-repeat must not reach the app. + let mut swallowed: u16 = 0; + let mut held_since = Instant::now(); + let mut last_repeat = Instant::now(); + let mut tick = tokio::time::interval(Duration::from_millis(20)); + + loop { + tokio::select! { + item = reports.next() => { + let Some(data) = item else { return Ok(()) }; + match protocol::parse(&data) { + Report::Buttons(state) => { + let changed = state ^ held; + for (bit, name) in button::ALL { + if changed & bit == 0 { continue; } + let down = state & bit != 0; + log::info!("{name} {}", if down { "pressed" } else { "released" }); + if !down && swallowed & bit != 0 { + swallowed &= !bit; + continue; + } + if down && (bit == button::POWER || link.standby().active()) { + swallowed |= bit; + standby_button(bit, link, keys); + continue; + } + if bit == button::HOME && down && link.home() { + continue; + } + if let Some(k) = key_for(bit) { keys.send(k, down as i32); } + } + if state & !held != 0 { + gestures.on_button(); + held_since = Instant::now(); + } + held = state; + } + Report::Touch(f) => { + log::trace!("touch {:5} {:5} size {:?}{}", f.x, f.y, f.size, if f.released { " released" } else { "" }); + if let Some(s) = gestures.on_touch(&f) { + log::info!("swipe {s:?}"); + if link.standby().active() { + continue; // a swipe doesn't wake the TV + } + keys.tap(match s { + Swipe::Up => KeyCode::KEY_UP, + Swipe::Down => KeyCode::KEY_DOWN, + Swipe::Left => KeyCode::KEY_LEFT, + Swipe::Right => KeyCode::KEY_RIGHT, + }); + } + } + Report::Audio => log::trace!("siri audio packet"), + Report::Unknown(n) => log::debug!("unknown report ({n} bytes): {data:02x?}"), + } + } + _ = tick.tick() => { + // Auto-repeat for held d-pad and volume keys. + if held != 0 && held_since.elapsed() >= REPEAT_DELAY && last_repeat.elapsed() >= REPEAT_EVERY { + last_repeat = Instant::now(); + for (bit, _) in button::ALL { + if held & !swallowed & bit != 0 && repeats(bit) { + if let Some(k) = key_for(bit) { keys.send(k, 2); } + } + } + } + } + } + } +} + +/// The remote advertises with a rotating private address. The controller's +/// accept list only knows its identity address, so BlueZ's passive +/// auto-connect never sees it. An active scan lets the kernel resolve the +/// address with the bonded IRK; we connect as soon as an advert arrives. +async fn wait_for_advert(adapter: &Adapter, dev: &Device) -> Result<()> { + use bluer::{DeviceEvent, DeviceProperty, DiscoveryFilter, DiscoveryTransport}; + + adapter + .set_discovery_filter(DiscoveryFilter { + transport: DiscoveryTransport::Le, + duplicate_data: true, + ..Default::default() + }) + .await?; + let mut discovery = adapter.discover_devices_with_changes().await?; + let mut events = dev.events().await?; + let mut recheck = tokio::time::interval(Duration::from_secs(2)); + loop { + tokio::select! { + // A connection may come up between our checks (e.g. a pending Connect()). + _ = recheck.tick() => { + if dev.is_connected().await.unwrap_or(false) { + return Ok(()); + } + // Removed in the launcher's settings: go back to pairing. + if !dev.is_paired().await.unwrap_or(false) { + anyhow::bail!("remote {} was unpaired", dev.address()); + } + } + ev = events.next() => match ev { + Some(DeviceEvent::PropertyChanged(DeviceProperty::Rssi(rssi))) => { + log::info!("remote advertising (rssi {rssi}), connecting"); + return Ok(()); + } + Some(DeviceEvent::PropertyChanged(DeviceProperty::Connected(true))) => return Ok(()), + Some(_) => {} + None => anyhow::bail!("device event stream ended"), + }, + // Keep the discovery session alive and drained. + _ = discovery.next() => {} + } + } +} + +fn is_remote_advert(md: Option<&std::collections::HashMap>>, uuids: Option<&std::collections::HashSet>, appearance: Option) -> bool { + let apple = md.is_some_and(|m| m.contains_key(&(APPLE as u16))); + let hid = uuids.is_some_and(|u| u.iter().any(|u| short_uuid(*u) == Some(HID_SERVICE))); + apple && (hid || appearance == Some(0x03C0)) +} + +/// Pairing mode: scan until a Siri Remote in pairing mode (Back + Volume Up) +/// shows up and pair it at once. It only advertises for ~0.2 s at a time with a +/// fresh private address, so we react to the first advert. +async fn pair_new(adapter: &Adapter, link: &Link) -> Result { + use bluer::{AdapterEvent, DiscoveryFilter, DiscoveryTransport}; + + adapter.set_pairable(true).await?; + adapter + .set_discovery_filter(DiscoveryFilter { + transport: DiscoveryTransport::Le, + duplicate_data: true, + ..Default::default() + }) + .await?; + let mut events = adapter.discover_devices_with_changes().await?; + link.status(state::SEARCHING); + let mut resend = tokio::time::interval(Duration::from_secs(5)); + loop { + let addr = tokio::select! { + ev = events.next() => match ev { + Some(AdapterEvent::DeviceAdded(addr)) => addr, + Some(_) => continue, + None => anyhow::bail!("discovery ended"), + }, + _ = resend.tick() => { + // Another paired remote may have appeared meanwhile. + if let Some(dev) = find_remote(adapter).await? { + return Ok(dev); + } + continue; + } + }; + let dev = adapter.device(addr)?; + if dev.is_paired().await.unwrap_or(false) { + continue; + } + let md = dev.manufacturer_data().await.ok().flatten(); + let uuids = dev.uuids().await.ok().flatten(); + let appearance = dev.appearance().await.ok().flatten(); + if !is_remote_advert(md.as_ref(), uuids.as_ref(), appearance) { + continue; + } + log::info!("remote in pairing mode: {addr}, pairing"); + link.status(state::PAIRING); + match tokio::time::timeout(Duration::from_secs(30), dev.pair()).await { + Ok(Ok(())) => { + dev.set_trusted(true).await?; + log::info!("paired {}", dev.address()); + return Ok(dev); + } + Ok(Err(e)) => log::info!("pair attempt failed: {e} (will retry on next advert)"), + Err(_) => log::info!("pair attempt timed out"), + } + link.status(state::SEARCHING); + } +} + +async fn connect(adapter: &Adapter, dev: &Device) -> Result { + if dev.is_connected().await.unwrap_or(false) { + return Ok(true); + } + wait_for_advert(adapter, dev).await?; + if dev.is_connected().await.unwrap_or(false) { + return Ok(true); + } + match tokio::time::timeout(Duration::from_secs(10), dev.connect()).await { + Ok(Ok(())) => Ok(true), + Ok(Err(e)) if e.kind == bluer::ErrorKind::InProgress => { + tokio::time::sleep(Duration::from_secs(2)).await; + Ok(false) + } + Ok(Err(e)) => { + log::debug!("connect: {e}"); + Ok(false) + } + Err(_) => { + log::debug!("connect timed out"); + Ok(false) + } + } +} + +pub fn run() -> Result<()> { + let opts = parse_args(); + let link = Link::new(opts.home_socket.clone()); + crate::keyboard::spawn(link.clone()); + + let rt = tokio::runtime::Builder::new_current_thread().enable_all().build()?; + rt.block_on(async move { + let mut keys = Keys::new(opts.dry_run)?; + let target: Arc>> = Arc::default(); + tokio::spawn(suspend_on_request(link.clone(), target.clone())); + let session = bluer::Session::new().await?; + // NoInputNoOutput agent that accepts "just works" pairing (registered once bluetoothd is up). + let mut agent = None; + + loop { + // Without a controller bluetoothd isn't even running and D-Bus calls just hang. + let has_controller = std::fs::read_dir("/sys/class/bluetooth").is_ok_and(|mut d| d.next().is_some()); + let adapter = if has_controller { + tokio::time::timeout(Duration::from_secs(5), session.default_adapter()).await.ok() + } else { + None + }; + let adapter = match adapter { + Some(Ok(a)) if a.set_powered(true).await.is_ok() => a, + _ => { + link.status(state::NO_ADAPTER); + tokio::time::sleep(Duration::from_secs(3)).await; + continue; + } + }; + if agent.is_none() { + agent = session + .register_agent(bluer::agent::Agent { request_default: true, ..Default::default() }) + .await + .ok(); + } + let dev = match find_remote(&adapter).await { + Ok(Some(dev)) => dev, + Ok(None) => match pair_new(&adapter, &link).await { + Ok(dev) => dev, + Err(e) => { + log::warn!("pairing: {e:#}"); + tokio::time::sleep(Duration::from_secs(2)).await; + continue; + } + }, + Err(e) => { + log::warn!("{e:#}"); + tokio::time::sleep(Duration::from_secs(2)).await; + continue; + } + }; + if !dev.is_connected().await.unwrap_or(false) { + link.status(state::PAIRED); + log::info!("waiting for {} (press any button)", dev.address()); + match connect(&adapter, &dev).await { + Ok(true) => {} + Ok(false) => continue, + Err(e) => { + log::warn!("scan: {e:#}"); + tokio::time::sleep(Duration::from_secs(2)).await; + continue; + } + } + } + let battery = dev.battery_percentage().await.ok().flatten(); + log::info!("connected to {} (battery {:?}%)", dev.address(), battery); + link.status(state::CONNECTED); + // The remote only reconnects when a button is pressed, and that + // press is lost while connecting: after a suspend (or the remote's + // own sleep) the reconnect itself means "wake up". + if link.standby().active() { + log::info!("remote reconnected in standby -> wake"); + link.wake(); + } + if let Some(t) = wake_target(&adapter, &dev).await { + *target.lock().unwrap() = Some(t); + } + match serve(&dev, &mut keys, opts.step, &link).await { + Ok(()) => log::info!("remote disconnected"), + Err(e) => { + log::warn!("{e:#}"); + tokio::time::sleep(Duration::from_secs(2)).await; + } + } + link.status(state::PAIRED); + } + }) +} diff --git a/crates/sf-remote/src/main.rs b/crates/sf-remote/src/main.rs new file mode 100644 index 0000000..d5cab75 --- /dev/null +++ b/crates/sf-remote/src/main.rs @@ -0,0 +1,30 @@ +#![cfg_attr(not(target_os = "linux"), allow(dead_code))] + +//! sf-remote: Apple Siri Remote driver for SmartFox. +//! +//! Subscribes to the remote's HID report characteristics over BlueZ D-Bus +//! (BlueZ's own HID plugin must be disabled, it drops these reports) and +//! turns buttons and touchpad swipes into key presses on a uinput device. + +mod protocol; + +#[cfg(target_os = "linux")] +mod keyboard; +#[cfg(target_os = "linux")] +mod link; +#[cfg(target_os = "linux")] +mod linux; +#[cfg(target_os = "linux")] +mod wake; + +fn main() -> anyhow::Result<()> { + env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("info")).init(); + #[cfg(target_os = "linux")] + { + linux::run() + } + #[cfg(not(target_os = "linux"))] + { + anyhow::bail!("sf-remote needs Linux (BlueZ + uinput)") + } +} diff --git a/crates/sf-remote/src/protocol.rs b/crates/sf-remote/src/protocol.rs new file mode 100644 index 0000000..030a794 --- /dev/null +++ b/crates/sf-remote/src/protocol.rs @@ -0,0 +1,200 @@ +//! Siri Remote (2nd gen, Apple 0x004C:0x0315) wire format, reverse engineered +//! from btmon captures (see docs/siri-remote.md). +//! +//! All data arrives as HID Report (0x2A4D) GATT notifications, told apart by length: +//! - 2 bytes: button bitmask (u16 little-endian) +//! - 11 bytes: touchpad frame (~66 Hz while touched) +//! - 99 bytes: Siri microphone audio (not decoded) + +/// Button bits (u16 little-endian of the 2-byte report). +pub mod button { + pub const HOME: u16 = 0x0001; // TV / Home + pub const VOL_UP: u16 = 0x0002; + pub const VOL_DOWN: u16 = 0x0004; + pub const SELECT: u16 = 0x0008; // center click + pub const POWER: u16 = 0x0010; + pub const SIRI: u16 = 0x0020; + pub const BACK: u16 = 0x0040; + pub const MUTE: u16 = 0x0080; + pub const PLAY_PAUSE: u16 = 0x0100; + pub const UP: u16 = 0x0200; + pub const RIGHT: u16 = 0x0400; + pub const DOWN: u16 = 0x0800; + pub const LEFT: u16 = 0x1000; + + pub const ALL: [(u16, &str); 13] = [ + (HOME, "home"), + (VOL_UP, "vol_up"), + (VOL_DOWN, "vol_down"), + (SELECT, "select"), + (POWER, "power"), + (SIRI, "siri"), + (BACK, "back"), + (MUTE, "mute"), + (PLAY_PAUSE, "play_pause"), + (UP, "up"), + (RIGHT, "right"), + (DOWN, "down"), + (LEFT, "left"), + ]; + +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Report { + Buttons(u16), + Touch(TouchFrame), + Audio, + Unknown(usize), +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct TouchFrame { + /// Device timestamp (wraps), roughly 0.47 ms per unit. + pub stamp: u16, + /// Signed coordinates: +x right, +y up. Roughly -1100..+400 / -1100..+250. + pub x: i16, + pub y: i16, + /// Contact size / pressure-like values. + pub size: [u8; 3], + /// Last frame of a touch (finger lifted). + pub released: bool, +} + +fn s12(v: u16) -> i16 { + if v >= 2048 { v as i16 - 4096 } else { v as i16 } +} + +pub fn parse(data: &[u8]) -> Report { + match data.len() { + 2 => Report::Buttons(u16::from_le_bytes([data[0], data[1]])), + 11 => { + let x = s12(data[4] as u16 | ((data[5] as u16 & 0x0f) << 8)); + let y = s12((data[5] as u16 >> 4) | ((data[6] as u16) << 4)); + let size = [data[7], data[8], data[9]]; + Report::Touch(TouchFrame { + stamp: u16::from_le_bytes([data[1], data[2]]), + x, + y, + size, + released: size == [0, 0, 0], + }) + } + 99 => Report::Audio, + n => Report::Unknown(n), + } +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Swipe { + Up, + Down, + Left, + Right, +} + +/// Turns touch movement into discrete steps, like tvOS: every `step` units of +/// travel along the dominant axis emits one swipe. Touches that end in a +/// button click (ring/center press) are ignored. +pub struct Gestures { + pub step: i32, + origin: Option<(i32, i32)>, + suppressed: bool, +} + +impl Default for Gestures { + fn default() -> Self { + Self { step: 300, origin: None, suppressed: false } + } +} + +impl Gestures { + pub fn new(step: i32) -> Self { + Self { step, ..Default::default() } + } + + /// A button press during a touch means the user is clicking, not swiping. + pub fn on_button(&mut self) { + if self.origin.is_some() { + self.suppressed = true; + } + } + + pub fn on_touch(&mut self, f: &TouchFrame) -> Option { + if f.released { + self.origin = None; + self.suppressed = false; + return None; + } + let p = (f.x as i32, f.y as i32); + let Some(o) = self.origin else { + self.origin = Some(p); + return None; + }; + if self.suppressed { + return None; + } + let (dx, dy) = (p.0 - o.0, p.1 - o.1); + let swipe = if dx.abs() >= self.step && dx.abs() * 2 > dy.abs() * 3 { + Some(if dx > 0 { Swipe::Right } else { Swipe::Left }) + } else if dy.abs() >= self.step && dy.abs() * 2 > dx.abs() * 3 { + Some(if dy > 0 { Swipe::Up } else { Swipe::Down }) + } else { + None + }; + if swipe.is_some() { + self.origin = Some(p); + } + swipe + } +} + +#[cfg(test)] +mod tests { + use super::*; + + fn hex(s: &str) -> Vec { + s.split_whitespace().map(|b| u8::from_str_radix(b, 16).unwrap()).collect() + } + + #[test] + fn buttons_from_capture() { + assert_eq!(parse(&hex("00 02")), Report::Buttons(button::UP)); + assert_eq!(parse(&hex("08 00")), Report::Buttons(button::SELECT)); + assert_eq!(parse(&hex("00 01")), Report::Buttons(button::PLAY_PAUSE)); + assert_eq!(parse(&hex("40 00")), Report::Buttons(button::BACK)); + assert_eq!(parse(&hex("00 00")), Report::Buttons(0)); + } + + #[test] + fn touch_from_capture() { + // Swipe left -> right crossing x = 0 (captured 448.406 / 448.452). + let Report::Touch(a) = parse(&hex("32 0c e9 00 ea 9f e8 83 6f 14 84")) else { panic!() }; + let Report::Touch(b) = parse(&hex("32 68 e9 00 0b 50 e9 84 6c 13 84")) else { panic!() }; + assert_eq!((a.x, b.x), (-22, 11)); + assert!(b.y > a.y); + let Report::Touch(end) = parse(&hex("32 00 00 00 28 61 f4 00 00 00 67")) else { panic!() }; + assert!(end.released); + } + + #[test] + fn swipe_steps() { + let mut g = Gestures::default(); + let frame = |x, y| TouchFrame { stamp: 0, x, y, size: [100, 100, 10], released: false }; + assert_eq!(g.on_touch(&frame(-900, -500)), None); + assert_eq!(g.on_touch(&frame(-700, -480)), None); + assert_eq!(g.on_touch(&frame(-590, -470)), Some(Swipe::Right)); + assert_eq!(g.on_touch(&frame(-300, -460)), None); + assert_eq!(g.on_touch(&frame(-280, -460)), Some(Swipe::Right)); + // a button press without a finger on the pad must not swallow the next swipe + g.on_touch(&TouchFrame { released: true, ..frame(0, 0) }); + g.on_button(); + g.on_touch(&frame(0, 0)); + assert_eq!(g.on_touch(&frame(400, 0)), Some(Swipe::Right)); + // click during a touch suppresses + g.on_touch(&TouchFrame { released: true, ..frame(0, 0) }); + g.on_touch(&frame(0, 0)); + g.on_button(); + assert_eq!(g.on_touch(&frame(0, 600)), None); + } +} diff --git a/crates/sf-remote/src/wake.rs b/crates/sf-remote/src/wake.rs new file mode 100644 index 0000000..dbabcda --- /dev/null +++ b/crates/sf-remote/src/wake.rs @@ -0,0 +1,202 @@ +//! Waking the machine from suspend with the remote. +//! +//! Two things have to be in place: +//! 1. The Bluetooth controller may wake the system: `power/wakeup = enabled` +//! on its USB device and the ports above it. +//! 2. The kernel keeps scanning for the remote while suspended. It does that +//! for devices on its connect list that carry the "remote wakeup" flag. +//! BlueZ sets both only through its HID plugins, which SmartFox disables +//! (they drop the Siri Remote's reports), so we send the two management +//! commands ourselves: Add Device (auto-connect) and Set Device Flags. +//! +//! The remote advertises with a rotating private address. Without controller +//! side address resolution (kernel "LL privacy") the kernel can't filter for +//! it while suspended and accepts every advert, so other Bluetooth devices +//! nearby may wake the machine too; the launcher puts it back to sleep then. + +use std::os::fd::{AsRawFd, FromRawFd, OwnedFd}; +use std::path::Path; +use std::time::{Duration, Instant}; + +use anyhow::{Context, Result, bail}; + +/// The remote as the kernel knows it. +#[derive(Debug, Clone, Copy)] +pub struct Target { + /// Controller index (hci0 -> 0). + pub index: u16, + /// Address as printed ("10:B9:..." -> [0x10, 0xB9, ...]). + pub addr: [u8; 6], + /// true: LE public identity address, false: LE random (static). + pub public: bool, +} + +/// Enables wakeup on every Bluetooth controller's device and its parents +/// (USB device, hub, xHCI). Returns how many files were switched on. +pub fn enable_controller_wakeup() -> usize { + let mut changed = 0; + let Ok(entries) = std::fs::read_dir("/sys/class/bluetooth") else { return 0 }; + for e in entries.flatten() { + let name = e.file_name().to_string_lossy().to_string(); + if !name.starts_with("hci") || name.contains(':') { + continue; + } + let Ok(dev) = std::fs::canonicalize(e.path().join("device")) else { continue }; + for dir in dev.ancestors().take_while(|d| d.starts_with("/sys/devices")) { + changed += enable(&dir.join("power/wakeup")) as usize; + } + } + changed +} + +fn enable(file: &Path) -> bool { + match std::fs::read_to_string(file) { + Ok(v) if v.trim() == "disabled" => match std::fs::write(file, "enabled") { + Ok(()) => { + log::info!("wake: enabled {}", file.display()); + true + } + Err(e) => { + log::warn!("wake: {}: {e}", file.display()); + false + } + }, + _ => false, + } +} + +// ---- kernel Bluetooth management interface --------------------------------------- + +const AF_BLUETOOTH: libc::c_int = 31; +const BTPROTO_HCI: libc::c_int = 1; +const HCI_CHANNEL_CONTROL: u16 = 3; +const HCI_DEV_NONE: u16 = 0xffff; + +const MGMT_OP_ADD_DEVICE: u16 = 0x0033; +const MGMT_OP_SET_DEVICE_FLAGS: u16 = 0x0050; +const MGMT_EV_CMD_COMPLETE: u16 = 0x0001; +const MGMT_EV_CMD_STATUS: u16 = 0x0002; + +const ADDR_LE_PUBLIC: u8 = 1; +const ADDR_LE_RANDOM: u8 = 2; +/// Add Device action: connect automatically whenever it advertises. +const ACTION_AUTO_CONNECT: u8 = 2; +const DEVICE_FLAG_REMOTE_WAKEUP: u32 = 1; + +#[repr(C)] +struct SockaddrHci { + family: libc::sa_family_t, + dev: u16, + channel: u16, +} + +struct Mgmt(OwnedFd); + +impl Mgmt { + fn open() -> Result { + // SAFETY: plain socket/bind calls; the fd is owned right away. + unsafe { + let fd = libc::socket(AF_BLUETOOTH, libc::SOCK_RAW | libc::SOCK_CLOEXEC, BTPROTO_HCI); + if fd < 0 { + bail!("mgmt socket: {}", std::io::Error::last_os_error()); + } + let fd = OwnedFd::from_raw_fd(fd); + let addr = SockaddrHci { family: AF_BLUETOOTH as _, dev: HCI_DEV_NONE, channel: HCI_CHANNEL_CONTROL }; + let len = std::mem::size_of::() as libc::socklen_t; + if libc::bind(fd.as_raw_fd(), &addr as *const _ as *const libc::sockaddr, len) < 0 { + bail!("mgmt bind: {}", std::io::Error::last_os_error()); + } + Ok(Mgmt(fd)) + } + } + + /// Sends a command and waits for its completion; Err on a non-zero status. + fn call(&self, op: u16, index: u16, params: &[u8]) -> Result<()> { + let mut msg = Vec::with_capacity(6 + params.len()); + msg.extend_from_slice(&op.to_le_bytes()); + msg.extend_from_slice(&index.to_le_bytes()); + msg.extend_from_slice(&(params.len() as u16).to_le_bytes()); + msg.extend_from_slice(params); + // SAFETY: writing an initialised buffer to our own socket. + let n = unsafe { libc::write(self.0.as_raw_fd(), msg.as_ptr().cast(), msg.len()) }; + if n != msg.len() as isize { + bail!("mgmt write: {}", std::io::Error::last_os_error()); + } + let deadline = Instant::now() + Duration::from_secs(2); + let mut buf = [0u8; 512]; + loop { + let left = deadline.saturating_duration_since(Instant::now()); + if left.is_zero() { + bail!("mgmt {op:#06x}: no reply"); + } + let mut pfd = libc::pollfd { fd: self.0.as_raw_fd(), events: libc::POLLIN, revents: 0 }; + // SAFETY: one valid pollfd. + if unsafe { libc::poll(&mut pfd, 1, left.as_millis() as libc::c_int) } <= 0 { + continue; + } + // SAFETY: reading into our own buffer. + let n = unsafe { libc::read(self.0.as_raw_fd(), buf.as_mut_ptr().cast(), buf.len()) }; + if n < 9 { + continue; + } + let ev = u16::from_le_bytes([buf[0], buf[1]]); + let ev_index = u16::from_le_bytes([buf[2], buf[3]]); + let opcode = u16::from_le_bytes([buf[6], buf[7]]); + let status = buf[8]; + if (ev == MGMT_EV_CMD_COMPLETE || ev == MGMT_EV_CMD_STATUS) && opcode == op && ev_index == index { + if status != 0 { + bail!("mgmt {op:#06x}: status {status:#04x}{}", status_name(status)); + } + return Ok(()); + } + } + } +} + +fn status_name(status: u8) -> &'static str { + match status { + 0x01 => " (unknown command: kernel too old)", + 0x0b => " (rejected)", + 0x0c => " (not supported)", + 0x0d => " (invalid parameters)", + 0x11 => " (invalid index)", + _ => "", + } +} + +/// mgmt_addr_info: address in little-endian byte order plus its type. +fn addr_info(t: &Target) -> [u8; 7] { + let mut out = [0u8; 7]; + for (i, b) in t.addr.iter().rev().enumerate() { + out[i] = *b; + } + out[6] = if t.public { ADDR_LE_PUBLIC } else { ADDR_LE_RANDOM }; + out +} + +/// Lets the remote wake the machine: on the kernel's connect list, flagged +/// for remote wakeup. Safe to repeat. +pub fn allow_remote_wakeup(t: &Target) -> Result<()> { + let mgmt = Mgmt::open().context("Bluetooth management socket (needs root)")?; + let addr = addr_info(t); + + let mut add = addr.to_vec(); + add.push(ACTION_AUTO_CONNECT); + mgmt.call(MGMT_OP_ADD_DEVICE, t.index, &add).context("Add Device")?; + + let mut flags = addr.to_vec(); + flags.extend_from_slice(&DEVICE_FLAG_REMOTE_WAKEUP.to_le_bytes()); + mgmt.call(MGMT_OP_SET_DEVICE_FLAGS, t.index, &flags).context("Set Device Flags (remote wakeup)")?; + Ok(()) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn address_is_little_endian() { + let t = Target { index: 0, addr: [0x10, 0xB9, 0xC4, 0x17, 0xC0, 0x0F], public: true }; + assert_eq!(addr_info(&t), [0x0F, 0xC0, 0x17, 0xC4, 0xB9, 0x10, ADDR_LE_PUBLIC]); + } +} diff --git a/docs/siri-remote.md b/docs/siri-remote.md new file mode 100644 index 0000000..5a57575 --- /dev/null +++ b/docs/siri-remote.md @@ -0,0 +1,74 @@ +# Apple Siri Remote: visszafejtett protokoll + +A mérések egy `furrr` gépen (Fedora 44, BlueZ 5.87) készültek a 2. generációs alumínium Siri Remote-tal (Apple `0x004C:0x0315`). A nyers forrás a `btmon` rögzítés, amit a `tools/siri-remote/notifs.py` bont szét. + +## Párosítás +- Párosító mód: **Back + Hangerő fel** nyomva tartása kb. 5 másodpercig. +- A távirányító ilyenkor csak nagyon röviden (kb. 0,2 s-os sorozatokban) hirdeti magát, és minden sorozatban **új resolvable private címet** használ. A hirdetésben ezek vannak: + - Appearance `0x03C0`, + - a HID UUID `0x1812`, + - Apple gyártói adat `type 0x07`. +- A `bluetoothctl pair` túl lassú hozzá. A `tools/siri-remote/fastpair.py` a D-Bus `InterfacesAdded` eseményre azonnal `Pair()`-t hív. A gyakorlatban 1–4 próbálkozás után sikerül (közben `AuthenticationCanceled` hibák jöhetnek). +- Párosítás után az **identity cím** `10:B9:C4:17:C0:0F` (public). Ez szerepel a hirdetés gyártói adatában is. +- A név a sorozatszám (pl. `DL1JDXZU2330`), a modalias `bluetooth:v004Cp0315d0001`. +- GATT szolgáltatások: + - GAP, GATT, + - Device Info (`180A`), + - Battery (`180F`), + - **HID (`1812`)**, + - `181E` (Bond Management), + - két Apple vendor szolgáltatás: `8341f2b4-c013-4f04-8197-c4cdb42e26dc` és `f5873412-d314-b885-a5aa-efa546123981`. + +## HID +A Report Map 38 bájt, és csak vendor (usage page `0xFF00`) tartalmat ír le: +- feature report `0xB8`, +- input report `0x04` (17 bájt). + +A valódi adat **más report karakterisztikákon** jön, ezért a BlueZ HoG pluginja eldobja, és a `hidraw` csendben marad. Megoldás: a BlueZ `input,hog` plugin kikapcsolása (`tools/siri-remote/setup-host-2.sh`), utána az `sf-remote` közvetlenül iratkozik fel a `0x2A4D` karakterisztikákra. + +A riportokat a hosszuk alapján különítjük el: + +| Handle (furrr) | Hossz | Tartalom | +|---|---|---| +| `0x003a` | 2 | gombok bitmaszkja (u16 LE) | +| `0x003e` | 11 | touchpad frame, kb. 66 Hz | +| `0x0036` | 99 | Siri mikrofon hang (a Siri gomb lenyomása alatt), kódolt, nincs dekódolva | +| `0x004a` | 4 | egyszeri, csatlakozáskor (`00 00 20 00`) | +| `0x002f` | 1 | akkumulátor % | + +### Gombok (u16 LE) +| Bit | Gomb | +|---|---| +| `0x0001` | TV / Home | +| `0x0002` | Hangerő + | +| `0x0004` | Hangerő − | +| `0x0008` | Középső kattintás | +| `0x0010` | Power (mérve). Uinputra NEM KEY_POWER-ként megy, mert a logind leállítaná a gépet; az `sf-remote` a launchernek küldi (`power`), lásd README: Készenlét és alvás | +| `0x0020` | Siri | +| `0x0040` | Back | +| `0x0080` | Némítás | +| `0x0100` | Play/Pause | +| `0x0200` | Fel | +| `0x0400` | Jobbra | +| `0x0800` | Le | +| `0x1000` | Balra | + +Felengedéskor `00 00` jön. Több gomb egyszerre is lenyomható (ilyenkor a bitek VAGY-olva jönnek). + +### Touchpad frame (11 bájt) +``` +b0 0x32 (konstans) +b1-2 eszköz-időbélyeg (u16 LE, kb. 0x1E / 15 ms) +b3 1 = érintés eleje (első néhány frame), utána 0 +b4-6 X = s12(b4 | (b5 & 0x0F) << 8), Y = s12((b5 >> 4) | b6 << 4) + +X jobbra, +Y felfelé; a mért tartomány kb. X -960..+310, Y -1040..+200 +b7-9 kontaktméret vagy nyomás jellegű értékek; mind 0 = ujj felemelve (utolsó frame) +b10 flag-ek (0x44 / 0x64 / 0x84 / 0xA4; az utolsó frame-ben 0x67) +``` +A d-pad és a középső kattintás is generál touch-folyamot (az ujj a felületen van), ezért a gesztusfelismerő gombnyomás esetén elnyomja a swipe-ot. + +## Nyitott kérdések +- ~~Power bit~~: mérve, `0x0010`. +- A Siri hang kodekje ismeretlen (valószínűleg Opus-szerű). Ehhez külön rögzítés kell. +- Ismeretlen még, mire valók a vendor GATT szolgáltatások (`8341f2b4-…`, `f5873412-…`), és mit csinál a `0xB8` feature report (lehet, hogy haptika vagy beállítás). +- Visszacsatlakozás alvás után: a HoG plugin nélkül a BlueZ nem csatlakozik automatikusan, ezért az `sf-remote` hívja a `Connect()`-et. diff --git a/image/build-iso.sh b/image/build-iso.sh new file mode 100644 index 0000000..41be58f --- /dev/null +++ b/image/build-iso.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +# Builds the SmartFox installer ISO (UEFI, x86-64) for a USB stick. +# Run as root inside WSL Debian: +# sudo bash /mnt/g/source/smartfox/image/build-iso.sh +# Writes image/out/smartfox-installer.iso (in the source tree, so Rufus on +# Windows can pick it up). Rufus: "ISO image mode", GPT, UEFI, FAT32. +# Raw writers (Etcher, dd) work too: the ISO carries a GPT with an ESP holding +# the UKI, so UEFI firmware sees the stick as bootable. +# +# SKIP_BUILD=1 reuses the last SmartFox image instead of running build.sh. +# Don't do that after booting it in run-qemu.sh: the VM writes into that file. +set -euo pipefail + +SRC="$(cd "$(dirname "$0")/.." && pwd)" +WORK="${SMARTFOX_WORK:-/root/smartfox}" +OUT_DIR="$SRC/image/out" + +if [ "${SKIP_BUILD:-0}" != 1 ]; then + bash "$SRC/image/build.sh" +else + echo "== sync installer sources" + rsync -a --delete --chmod=Du=rwx,Dgo=rx,Fu=rw,Fgo=r "$SRC/image/installer/" "$WORK/image/installer/" \ + --exclude /mkosi.output --exclude /mkosi.cache +fi +RAW="$WORK/image/mkosi.output/smartfox.raw" +[ -f "$RAW" ] || { echo "missing $RAW"; exit 1; } + +for tool in xorriso mcopy mkfs.vfat zstd; do + command -v "$tool" >/dev/null || { apt-get update -qq && apt-get install -y -qq xorriso mtools dosfstools zstd; break; } +done + +echo "== installer (mkosi)" +cd "$WORK/image/installer" +chmod +x mkosi.postinst.chroot mkosi.extra/usr/bin/sf-install +mkdir -p mkosi.cache +mkosi -f build +UKI="$WORK/image/installer/mkosi.output/smartfox-installer.efi" +[ -f "$UKI" ] || { echo "missing $UKI"; exit 1; } + +echo "== payload" +STAGE="$WORK/image/iso" +rm -rf "$STAGE" +mkdir -p "$STAGE/tree/EFI/BOOT" "$STAGE/tree/smartfox" +cp "$UKI" "$STAGE/tree/EFI/BOOT/BOOTX64.EFI" +stat -c %s "$RAW" >"$STAGE/tree/smartfox/smartfox.size" +echo "SmartFox $(grep -m1 '^version' "$WORK/Cargo.toml" | cut -d'"' -f2) · $(date +%Y-%m-%d)" >"$STAGE/tree/smartfox/version" +zstd -T0 -10 -q "$RAW" -o "$STAGE/tree/smartfox/smartfox.raw.zst" +# Rufus puts the files on FAT32: no single file may reach 4 GiB. +[ "$(stat -c %s "$STAGE/tree/smartfox/smartfox.raw.zst")" -lt 4294967296 ] || { echo "payload too big for FAT32"; exit 1; } + +echo "== EFI boot image" +EFI_IMG="$STAGE/efiboot.img" +size_kb=$(( $(stat -c %s "$UKI") / 1024 + 4096 )) +mkfs.vfat -C -n SFBOOT "$EFI_IMG" "$size_kb" >/dev/null +mmd -i "$EFI_IMG" ::/EFI ::/EFI/BOOT +mcopy -i "$EFI_IMG" "$UKI" ::/EFI/BOOT/BOOTX64.EFI + +echo "== iso" +ISO="$STAGE/smartfox-installer.iso" +xorriso -as mkisofs \ + -iso-level 3 -full-iso9660-filenames -joliet -joliet-long -rational-rock \ + -volid SMARTFOX -appid "SmartFox installer" \ + -partition_offset 16 \ + -append_partition 2 C12A7328-F81F-11D2-BA4B-00A0C93EC93B "$EFI_IMG" -appended_part_as_gpt \ + -e --interval:appended_partition_2:all:: -no-emul-boot \ + -o "$ISO" "$STAGE/tree" 2>&1 | grep -v '^xorriso : UPDATE' || true +[ -f "$ISO" ] || { echo "xorriso failed"; exit 1; } + +mkdir -p "$OUT_DIR" +cp "$ISO" "$OUT_DIR/smartfox-installer.iso" +ls -lh "$OUT_DIR/smartfox-installer.iso" +echo "Rufus: válaszd ki az ISO-t, Partíciós séma: GPT, Cél: UEFI, majd ISO kép mód." diff --git a/image/build.sh b/image/build.sh new file mode 100644 index 0000000..02281ea --- /dev/null +++ b/image/build.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash +# Builds the SmartFox binaries and the OS disk image. +# Run as root inside WSL Debian (or any Debian/Ubuntu host): +# sudo bash /mnt/g/source/smartfox/image/build.sh +set -euo pipefail + +SRC="$(cd "$(dirname "$0")/.." && pwd)" +WORK="${SMARTFOX_WORK:-/root/smartfox}" + +echo "== sync $SRC -> $WORK" +mkdir -p "$WORK" +# Files on NTFS show up as 0777; normalize, the image must not get world-writable files. +rsync -a --delete --chmod=Du=rwx,Dgo=rx,Fu=rw,Fgo=r \ + --exclude /target --exclude /image/mkosi.output --exclude /image/mkosi.cache --exclude /image/stage --exclude /image/ovmf-vars.fd \ + --exclude /image/installer/mkosi.output --exclude /image/installer/mkosi.cache --exclude /image/iso --exclude /image/out \ + "$SRC/" "$WORK/" +cd "$WORK" + +echo "== cargo build" +if ! command -v cargo >/dev/null; then + [ -x "$HOME/.cargo/bin/cargo" ] || curl -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal + export PATH="$HOME/.cargo/bin:$PATH" +fi +cargo build --release -p sf-launcher -p sf-remote + +echo "== stage" +STAGE="$WORK/image/stage" +rm -rf "$STAGE" +install -Dm755 target/release/sf-launcher "$STAGE/usr/bin/sf-launcher" +install -Dm755 target/release/sf-remote "$STAGE/usr/bin/sf-remote" +install -Dm755 tools/siri-remote/fastpair.py "$STAGE/usr/bin/sf-pair" +mkdir -p "$STAGE/usr/share/smartfox" +cp -r apps "$STAGE/usr/share/smartfox/apps" +chmod +x image/mkosi.postinst.chroot image/mkosi.extra/usr/bin/sf-session image/mkosi.extra/usr/bin/sf-launcher-start image/mkosi.extra/usr/bin/sf-remote-debug image/mkosi.extra/usr/bin/sf-diag image/*.sh tools/vm/*.sh tools/siri-remote/*.sh tools/siri-remote/*.py + +echo "== mkosi" +# Cache and output stay on the Linux filesystem (NTFS mounts break mkosi). +mkdir -p image/mkosi.cache +cd image +mkosi -f build +ls -lh mkosi.output/ diff --git a/image/installer/mkosi.conf b/image/installer/mkosi.conf new file mode 100644 index 0000000..8a08d10 --- /dev/null +++ b/image/installer/mkosi.conf @@ -0,0 +1,39 @@ +# SmartFox installer: a tiny Debian that runs entirely from RAM (packed as a +# UKI) and writes the SmartFox disk image from the install stick to a disk. +# Built by ../build-iso.sh; not meant to be built on its own. + +[Distribution] +Distribution=debian +Release=trixie +Architecture=x86-64 +Repositories=main,contrib,non-free,non-free-firmware + +[Output] +Format=uki +ImageId=smartfox-installer +OutputDirectory=mkosi.output +CacheDirectory=mkosi.cache + +[Content] +Hostname=smartfox-installer +Locale=C.UTF-8 +WithDocs=no +KernelCommandLine=console=tty1 quiet loglevel=3 systemd.show_status=false rd.udev.log_level=3 vt.global_cursor_default=1 +Packages= + systemd + systemd-sysv + systemd-boot-efi + udev + kmod + linux-image-amd64 + util-linux + fdisk + gdisk + e2fsprogs + dosfstools + zstd + efibootmgr + procps + less + kbd + console-setup-linux diff --git a/image/installer/mkosi.extra/usr/bin/sf-install b/image/installer/mkosi.extra/usr/bin/sf-install new file mode 100644 index 0000000..097d4e5 --- /dev/null +++ b/image/installer/mkosi.extra/usr/bin/sf-install @@ -0,0 +1,175 @@ +#!/bin/bash +# SmartFox installer: writes the SmartFox disk image from the install stick +# onto an internal disk. The disk is wiped completely. +# +# The stick (written by Rufus in ISO mode, or dd) carries: +# smartfox/smartfox.raw.zst the disk image (zstd) +# smartfox/smartfox.size its uncompressed size in bytes +# +# After writing, the GPT backup header is moved to the end of the disk and the +# GUIDs are made unique. On first boot the installed system creates its data +# partition (/var) in the remaining space (systemd-repart). +set -u + +SRC=/run/sf-src +PAYLOAD=smartfox/smartfox.raw.zst + +say() { printf '%s\n' "$*"; } + +banner() { + clear + say "" + say " SmartFox telepítő" + say " =================" + say "" +} + +finish() { + say "" + say " Enter: újraindítás · k + Enter: kikapcsolás · s + Enter: parancssor" + read -r a + case "$a" in + s | S) exec /bin/bash -l ;; + k | K) systemctl poweroff ;; + *) systemctl reboot ;; + esac + sleep infinity +} + +die() { + say "" + say " HIBA: $*" + finish +} + +# Finds the partition (or whole disk, for dd-written sticks) with the payload +# and mounts it at $SRC. USB sticks can take a few seconds to show up. +find_payload() { + mkdir -p "$SRC" + for _ in $(seq 40); do + while read -r dev fstype; do + case "$fstype" in vfat | iso9660 | exfat | ntfs) ;; *) continue ;; esac + mount -o ro "$dev" "$SRC" 2>/dev/null || continue + if [ -f "$SRC/$PAYLOAD" ]; then + echo "$dev" + return 0 + fi + umount "$SRC" + done < <(lsblk -rpno NAME,FSTYPE) + sleep 1 + done + return 1 +} + +# Latin-2 console font (ő, ű), large on TV-sized screens. +font=Lat2-Terminus16 +w=$(cut -d, -f1 /sys/class/graphics/fb0/virtual_size 2>/dev/null || echo 0) +[ "${w:-0}" -ge 1600 ] && font=Lat2-Terminus32x16 +setfont "$font" 2>/dev/null + +human() { numfmt --to=iec --suffix=B --format=%.1f "$1"; } + +banner +say " A telepítő pendrive keresése…" +SRC_DEV=$(find_payload) || die "Nem találom a telepítő fájlokat ($PAYLOAD) egyik meghajtón sem." +SRC_DISK=$(lsblk -npo PKNAME "$SRC_DEV" | head -1) +[ -n "$SRC_DISK" ] || SRC_DISK=$SRC_DEV +NEED=$(cat "$SRC/smartfox/smartfox.size" 2>/dev/null || echo 0) +VERSION=$(cat "$SRC/smartfox/version" 2>/dev/null || echo "") + +# Candidate disks: everything except the stick itself, optical/loop/zram +# devices and disks too small for the image. +mapfile -t DISKS < <( + lsblk -dbpno NAME,SIZE,TYPE | while read -r name size type; do + [ "$type" = disk ] || continue + [ "$name" = "$SRC_DISK" ] && continue + case "$name" in /dev/loop* | /dev/zram* | /dev/sr* | /dev/ram*) continue ;; esac + [ "$size" -ge $((NEED + 1024 * 1024 * 1024)) ] || continue + echo "$name" + done +) + +describe() { + local d=$1 size model tran + size=$(lsblk -dbno SIZE "$d") + model=$(lsblk -dno MODEL "$d" | sed 's/ *$//') + tran=$(lsblk -dno TRAN "$d" | sed 's/ *$//') + printf '%s · %s · %s%s' "$d" "$(human "$size")" "${model:-ismeretlen típus}" "${tran:+ ($tran)}" +} + +banner +[ -n "$VERSION" ] && say " Verzió: $VERSION" && say "" +[ "${#DISKS[@]}" -gt 0 ] || die "Nincs olyan belső lemez, amire telepíteni lehetne (legalább $(human $((NEED + 1024 * 1024 * 1024))) kell)." + +say " Melyik lemezre telepítsem a SmartFoxot?" +say "" +for i in "${!DISKS[@]}"; do + say " $((i + 1))) $(describe "${DISKS[$i]}")" + lsblk -no NAME,SIZE,FSTYPE,LABEL "${DISKS[$i]}" | tail -n +2 | sed 's/^/ /' +done +say "" +while :; do + if [ "${#DISKS[@]}" -eq 1 ]; then + printf ' Válassz (1, vagy q = kilépés): ' + else + printf ' Válassz (1-%s, vagy q = kilépés): ' "${#DISKS[@]}" + fi + read -r pick + case "$pick" in q | Q) finish ;; esac + if [[ "$pick" =~ ^[0-9]+$ ]] && [ "$pick" -ge 1 ] && [ "$pick" -le "${#DISKS[@]}" ]; then + TARGET=${DISKS[$((pick - 1))]} + break + fi +done + +banner +say " FIGYELEM: a lemezen MINDEN adat törlődik:" +say "" +say " $(describe "$TARGET")" +say "" +printf ' A folytatáshoz írd be: igen ' +read -r ok +[ "$ok" = igen ] || finish + +banner +say " Telepítés ide: $(describe "$TARGET")" +say "" +say " 1/3 Lemez törlése…" +umount -q "$TARGET"* 2>/dev/null +wipefs -qa "$TARGET" || die "A lemez törlése nem sikerült." + +say " 2/3 Kiírás ($(human "$NEED"))…" +zstd -dcq "$SRC/$PAYLOAD" | dd of="$TARGET" bs=4M iflag=fullblock oflag=direct status=progress +st=("${PIPESTATUS[@]}") +[ "${st[0]}" = 0 ] && [ "${st[1]}" = 0 ] || die "A kiírás nem sikerült." +sync + +say "" +say " 3/3 Befejezés…" +# Backup GPT to the real end of the disk, fresh GUIDs for this machine. +sgdisk -q -e -G -A 2:clear:59 "$TARGET" >/dev/null || die "A partíciós tábla javítása nem sikerült." +partx -u "$TARGET" 2>/dev/null +udevadm settle + +# A unique machine id (DHCP lease, journal) on the otherwise read-only root. +ROOT=$(lsblk -rpno NAME,PARTN "$TARGET" | awk '$2 == 2 { print $1 }') +if [ -n "$ROOT" ] && mkdir -p /run/sf-root && mount "$ROOT" /run/sf-root; then + systemd-id128 new >/run/sf-root/etc/machine-id + umount /run/sf-root +fi + +# Boot entry, so firmware that ignores the fallback path still finds it. +ESP=$(lsblk -rpno NAME,PARTN "$TARGET" | awk '$2 == 1 { print $1 }') +if [ -d /sys/firmware/efi/efivars ] && [ -n "$ESP" ]; then + efibootmgr -q -c -d "$TARGET" -p 1 -L SmartFox -l '\EFI\systemd\systemd-bootx64.efi' 2>/dev/null || + say " (A UEFI boot bejegyzés nem jött létre, a gép a tartalék útvonalról indul.)" +fi +sync +umount "$SRC" 2>/dev/null + +banner +say " Kész! A SmartFox telepítve: $TARGET" +say "" +say " Húzd ki a pendrive-ot, majd nyomj Entert az újraindításhoz." +say " Az első indításkor a rendszer létrehozza az adatpartíciót, ez néhány másodperc." +finish diff --git a/image/installer/mkosi.extra/usr/lib/systemd/system/sf-install.service b/image/installer/mkosi.extra/usr/lib/systemd/system/sf-install.service new file mode 100644 index 0000000..c905cd2 --- /dev/null +++ b/image/installer/mkosi.extra/usr/lib/systemd/system/sf-install.service @@ -0,0 +1,21 @@ +[Unit] +Description=SmartFox installer +After=systemd-udevd.service systemd-udev-trigger.service +Conflicts=getty@tty1.service + +[Service] +Type=idle +ExecStart=/usr/bin/sf-install +StandardInput=tty +StandardOutput=tty +StandardError=tty +TTYPath=/dev/tty1 +TTYReset=yes +TTYVHangup=yes +TTYVTDisallocate=yes +# Never leave a blank screen: start over if the script dies. +Restart=on-failure +RestartSec=2 + +[Install] +WantedBy=multi-user.target diff --git a/image/installer/mkosi.postinst.chroot b/image/installer/mkosi.postinst.chroot new file mode 100644 index 0000000..29a93e2 --- /dev/null +++ b/image/installer/mkosi.postinst.chroot @@ -0,0 +1,8 @@ +#!/bin/sh +set -e +# The whole image is the initrd: the kernel starts /init. +ln -sf /usr/lib/systemd/systemd /init +chmod +x /usr/bin/sf-install +systemctl enable sf-install.service +systemctl mask getty@tty1.service serial-getty@ttyS0.service systemd-firstboot.service +systemctl set-default multi-user.target diff --git a/image/mkosi.conf b/image/mkosi.conf new file mode 100644 index 0000000..4ce29c7 --- /dev/null +++ b/image/mkosi.conf @@ -0,0 +1,85 @@ +# SmartFox OS image (dev build). Build with image/build.sh inside WSL/Linux. + +[Distribution] +Distribution=debian +Release=trixie +Architecture=x86-64 +Repositories=main,contrib,non-free,non-free-firmware + +[Output] +Format=disk +ImageId=smartfox +OutputDirectory=mkosi.output +CacheDirectory=mkosi.cache + +[Content] +Bootable=yes +Bootloader=systemd-boot +Hostname=smartfox +Timezone=Europe/Bratislava +Locale=C.UTF-8 +# Dev image: root password for ssh/console debugging. +RootPassword=smartfox +WithDocs=no +KernelCommandLine=ro video=Virtual-1:1920x1080 quiet loglevel=3 systemd.show_status=auto rd.udev.log_level=3 vt.global_cursor_default=0 +ExtraTrees=mkosi.extra +ExtraTrees=stage +Packages= + systemd + systemd-sysv + systemd-boot + systemd-boot-efi + systemd-resolved + udev + dbus + linux-image-amd64/trixie-backports + login + passwd + firmware-misc-nonfree + firmware-mediatek/trixie-backports + firmware-intel-graphics + firmware-iwlwifi/trixie-backports + firmware-realtek/trixie-backports + intel-media-va-driver-non-free + iproute2 + iputils-ping + ca-certificates + openssh-server + less + nano + usbutils + iwd + wireless-regdb + pciutils + kmod + iw + rfkill + ethtool + lshw + mesa-utils + intel-gpu-tools + htop + bluez + systemd-repart + e2fsprogs + python3-dbus + python3-gi + cage + wlr-randr + chromium + fonts-noto-core + fonts-dejavu-core + libgl1-mesa-dri + libegl1 + libgles2 + libgbm1 + libfontconfig1 + libfreetype6 + libxkbcommon0 + libwayland-client0 + libwayland-egl1 + pipewire + pipewire-pulse + wireplumber + avahi-daemon + uxplay diff --git a/image/mkosi.extra/etc/apt/sources.list.d/backports.sources b/image/mkosi.extra/etc/apt/sources.list.d/backports.sources new file mode 100644 index 0000000..a0544ec --- /dev/null +++ b/image/mkosi.extra/etc/apt/sources.list.d/backports.sources @@ -0,0 +1,5 @@ +Types: deb +URIs: http://deb.debian.org/debian +Suites: trixie-backports +Components: main contrib non-free non-free-firmware +Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg diff --git a/image/mkosi.extra/etc/fstab b/image/mkosi.extra/etc/fstab new file mode 100644 index 0000000..d3e44d3 --- /dev/null +++ b/image/mkosi.extra/etc/fstab @@ -0,0 +1,4 @@ +# Root is read-only (gpt-auto, "ro" on the kernel command line). +# Everything that must survive a reboot lives on the data partition at /var. +# nofail: without it the TV still boots (settings just aren't saved). +PARTLABEL=sf-data /var ext4 defaults,noatime,nofail,x-systemd.before=local-fs.target,x-systemd.after=systemd-repart.service,x-systemd.device-timeout=30s 0 2 diff --git a/image/mkosi.extra/etc/skel/.bash_profile b/image/mkosi.extra/etc/skel/.bash_profile new file mode 100644 index 0000000..cd6c3fd --- /dev/null +++ b/image/mkosi.extra/etc/skel/.bash_profile @@ -0,0 +1,4 @@ +# Start the SmartFox session on the first console. +if [ "$(tty)" = "/dev/tty1" ]; then + exec /usr/bin/sf-session +fi diff --git a/image/mkosi.extra/etc/ssh/sshd_config.d/smartfox-dev.conf b/image/mkosi.extra/etc/ssh/sshd_config.d/smartfox-dev.conf new file mode 100644 index 0000000..e82d978 --- /dev/null +++ b/image/mkosi.extra/etc/ssh/sshd_config.d/smartfox-dev.conf @@ -0,0 +1,2 @@ +# Dev image only. +PermitRootLogin yes diff --git a/image/mkosi.extra/etc/systemd/network/20-wired.network b/image/mkosi.extra/etc/systemd/network/20-wired.network new file mode 100644 index 0000000..81f36eb --- /dev/null +++ b/image/mkosi.extra/etc/systemd/network/20-wired.network @@ -0,0 +1,5 @@ +[Match] +Name=en* eth* + +[Network] +DHCP=yes diff --git a/image/mkosi.extra/etc/systemd/network/25-wireless.network b/image/mkosi.extra/etc/systemd/network/25-wireless.network new file mode 100644 index 0000000..16c7515 --- /dev/null +++ b/image/mkosi.extra/etc/systemd/network/25-wireless.network @@ -0,0 +1,6 @@ +[Match] +Name=wl* + +[Network] +DHCP=yes +IgnoreCarrierLoss=3s diff --git a/image/mkosi.extra/etc/systemd/system/bluetooth.service.d/smartfox.conf b/image/mkosi.extra/etc/systemd/system/bluetooth.service.d/smartfox.conf new file mode 100644 index 0000000..9733253 --- /dev/null +++ b/image/mkosi.extra/etc/systemd/system/bluetooth.service.d/smartfox.conf @@ -0,0 +1,4 @@ +# sf-remote reads the Siri Remote's HID reports itself; BlueZ's HoG plugin drops them. +[Service] +ExecStart= +ExecStart=/usr/libexec/bluetooth/bluetoothd --noplugin=input,hog diff --git a/image/mkosi.extra/etc/systemd/system/getty@tty1.service.d/autologin.conf b/image/mkosi.extra/etc/systemd/system/getty@tty1.service.d/autologin.conf new file mode 100644 index 0000000..a3b8f05 --- /dev/null +++ b/image/mkosi.extra/etc/systemd/system/getty@tty1.service.d/autologin.conf @@ -0,0 +1,3 @@ +[Service] +ExecStart= +ExecStart=-/sbin/agetty --autologin tv --noclear --skip-login --nonewline --noissue %I $TERM diff --git a/image/mkosi.extra/usr/bin/sf-diag b/image/mkosi.extra/usr/bin/sf-diag new file mode 100644 index 0000000..efce388 --- /dev/null +++ b/image/mkosi.extra/usr/bin/sf-diag @@ -0,0 +1,79 @@ +#!/bin/sh +# Hardware report for remote debugging: WiFi, GPU and rendering speed. +# ssh root@ sf-diag > report.txt +# Read-only, changes nothing. + +s() { printf '\n===== %s\n' "$*"; } +run() { s "$*"; "$@" 2>&1; } + +run uname -a +run cat /proc/cmdline +run systemd-detect-virt +s "dmi"; cat /sys/class/dmi/id/sys_vendor /sys/class/dmi/id/product_name /sys/class/dmi/id/board_name /sys/class/dmi/id/bios_version 2>&1 + +# ---- WiFi +run lspci -nnk +run lsusb +run ip -br link +run rfkill list +run iw dev +run networkctl list +run systemctl --no-pager status iwd +run id tv +s "iwd D-Bus as tv (what the Wi-Fi settings see)" +runuser -u tv -- busctl --json=short call net.connman.iwd / org.freedesktop.DBus.ObjectManager GetManagedObjects 2>&1 | head -c 2000; echo +s "loaded wifi modules"; lsmod | grep -E 'iwl|rtw|rtl|mt7|ath|cfg80211|mac80211' +s "kernel log: wifi/firmware" +journalctl -k -b --no-pager | grep -iE 'firmware|iwlwifi|rtw|rtl8|mt79|mt76|ath1|wlan|wlp|cfg80211|regdom|pcie.*(error|fail)' +s "firmware files"; ls /lib/firmware | head -100 + +# ---- GPU and rendering +run ls -l /dev/dri +run id tv +s "kernel log: graphics" +journalctl -k -b --no-pager | grep -iE 'i915|xe |drm|guc|huc|dmc' +s "drm modes" +for c in /sys/class/drm/card*-*; do + [ "$(cat "$c/status" 2>/dev/null)" = connected ] || continue + echo "$c"; head -5 "$c/modes" +done +s "gpu / cpu clocks" +cat /sys/class/drm/card*/gt_cur_freq_mhz /sys/class/drm/card*/gt_max_freq_mhz 2>/dev/null +cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq 2>/dev/null +run free -h + +# ---- Standby / wake from suspend (Settings > Energia) +run cat /sys/power/state /sys/power/mem_sleep +s "acpi wakeup"; cat /proc/acpi/wakeup 2>&1 +s "bluetooth controller wakeup" +for h in /sys/class/bluetooth/hci*; do + case "$h" in *:*) continue ;; esac + d=$(readlink -f "$h/device") + while [ -n "$d" ] && [ "$d" != / ] && [ "$d" != /sys/devices ]; do + [ -f "$d/power/wakeup" ] && echo "$d: $(cat "$d/power/wakeup")" + d=${d%/*} + done +done +command -v btmgmt >/dev/null && run btmgmt info +s "sf-remote: standby / suspend / wake" +journalctl -b --no-pager -u sf-remote | grep -iE 'standby|suspend|wake|power' | tail -40 +s "kernel log: suspend / resume" +journalctl -k -b --no-pager | grep -iE 'PM: suspend|PM: resume|ACPI: PM|wake' | tail -30 + +# The cage session of user tv. +RT=/run/user/1000 +for w in "$RT"/wayland-*; do + case "$w" in *.lock) continue ;; esac + [ -S "$w" ] || continue + s "wlr-randr ($w)" + runuser -u tv -- env XDG_RUNTIME_DIR="$RT" WAYLAND_DISPLAY="${w##*/}" wlr-randr 2>&1 + s "eglinfo -B ($w)" + runuser -u tv -- env XDG_RUNTIME_DIR="$RT" WAYLAND_DISPLAY="${w##*/}" eglinfo -B -p wayland 2>&1 | head -40 + break +done + +s "launcher log (OpenGL, fps, errors)" +LOG=/var/home/tv/smartfox.log +grep -iE 'opengl|fps|error|warn|panic|llvmpipe|softpipe' "$LOG" 2>/dev/null | tail -60 +s "launcher log tail"; tail -40 "$LOG" 2>/dev/null +s "top"; top -b -n1 | head -25 diff --git a/image/mkosi.extra/usr/bin/sf-launcher-start b/image/mkosi.extra/usr/bin/sf-launcher-start new file mode 100644 index 0000000..20ad470 --- /dev/null +++ b/image/mkosi.extra/usr/bin/sf-launcher-start @@ -0,0 +1,8 @@ +#!/bin/sh +# Runs inside cage: apply the output mode, then start the launcher. +if [ -n "${SMARTFOX_MODE:-}" ]; then + OUT=$(wlr-randr | awk 'NR==1 {print $1}') + wlr-randr --output "$OUT" --custom-mode "$SMARTFOX_MODE" || + echo "sf-launcher-start: could not set $SMARTFOX_MODE on $OUT" +fi +exec /usr/bin/sf-launcher --fullscreen --apps /usr/share/smartfox/apps diff --git a/image/mkosi.extra/usr/bin/sf-remote-debug b/image/mkosi.extra/usr/bin/sf-remote-debug new file mode 100644 index 0000000..c6760dd --- /dev/null +++ b/image/mkosi.extra/usr/bin/sf-remote-debug @@ -0,0 +1,49 @@ +#!/bin/sh +# Remote debugging switch: starts or stops sshd from the flag the launcher +# writes (Settings > System). Runs as root: +# sf-remote-debug the flag changed (sf-remote-debug.path) +# sf-remote-debug boot at boot (sf-remote-debug-boot.service) +# sf-remote-debug expire the time limit is up (transient timer) +# +# The flag holds "on" or "off". On real hardware ssh never stays on for long: +# it turns off after LIMIT and on every boot. In a VM it stays on without a +# flag and has no limit, because the dev tools (tools/vm) need ssh. +FLAG=/var/lib/smartfox/remote-debug +LIMIT=1h +TIMER=sf-remote-debug-off + +vm() { systemd-detect-virt -q; } + +stop_timer() { + systemctl stop "$TIMER.timer" 2>/dev/null + systemctl reset-failed "$TIMER.timer" "$TIMER.service" 2>/dev/null +} + +off() { + stop_timer + exec systemctl --no-block stop ssh.service +} + +case "${1:-}" in + boot | expire) + # Missing flag = off; tv owns the folder and can write it again. + vm && [ "$1" = boot ] || rm -f "$FLAG" + ;; +esac + +if [ -f "$FLAG" ]; then + state=$(cat "$FLAG") +elif vm; then + state=on +else + state=off +fi + +[ "$state" = on ] || off + +stop_timer +if ! vm; then + systemd-run --quiet --unit="$TIMER" --on-active="$LIMIT" --timer-property=AccuracySec=1s \ + /usr/bin/sf-remote-debug expire +fi +exec systemctl --no-block start ssh.service diff --git a/image/mkosi.extra/usr/bin/sf-session b/image/mkosi.extra/usr/bin/sf-session new file mode 100644 index 0000000..772b37c --- /dev/null +++ b/image/mkosi.extra/usr/bin/sf-session @@ -0,0 +1,35 @@ +#!/bin/sh +# SmartFox session: kiosk compositor (cage) with the launcher. +# Apps the launcher starts (Chromium etc.) appear full screen on top of it. + +CONF="$HOME/.config/smartfox" +LOG="$HOME/smartfox.log" +# $HOME is on the data partition (/var). If it's missing, /var is the +# read-only root: still start the TV, just without saving anything. +if ! mkdir -p "$CONF" 2>/dev/null || ! touch "$LOG" 2>/dev/null; then + echo "sf-session: $HOME is read-only, settings will not be saved" >&2 + CONF="$XDG_RUNTIME_DIR/smartfox" + LOG="$XDG_RUNTIME_DIR/smartfox.log" + mkdir -p "$CONF" +fi +[ -f "$CONF/settings.toml" ] || cp /usr/share/smartfox/settings.toml "$CONF/settings.toml" + +export XDG_CONFIG_HOME="$(dirname "$CONF")" +export SMARTFOX_SOCKET="$XDG_RUNTIME_DIR/smartfox.sock" +export RUST_LOG="${RUST_LOG:-info}" +# No mouse on the TV: a transparent cursor theme (built in mkosi.postinst.chroot). +export XCURSOR_THEME=smartfox-blank XCURSOR_SIZE=24 + +# Output mode: the TV's preferred mode, except in VMs where the host window +# reports odd sizes. Override with SMARTFOX_MODE=WxH in /etc/default/smartfox. +[ -f /etc/default/smartfox ] && . /etc/default/smartfox +# Same, on the writable data partition (root is read-only), e.g. for debugging: +# echo 'RUST_LOG=sf_launcher=debug' > /var/lib/smartfox/session.env (fps every 5 s) +[ -f /var/lib/smartfox/session.env ] && . /var/lib/smartfox/session.env +export RUST_LOG +if [ -z "${SMARTFOX_MODE:-}" ] && systemd-detect-virt -q; then + SMARTFOX_MODE=1920x1080 +fi +export SMARTFOX_MODE + +exec cage -d -s -- /usr/bin/sf-launcher-start >>"$LOG" 2>&1 diff --git a/image/mkosi.extra/usr/lib/repart.d/50-sf-data.conf b/image/mkosi.extra/usr/lib/repart.d/50-sf-data.conf new file mode 100644 index 0000000..0c404d3 --- /dev/null +++ b/image/mkosi.extra/usr/lib/repart.d/50-sf-data.conf @@ -0,0 +1,8 @@ +# Writable data partition: created on first boot in the free space after the +# (read-only) root partition and mounted at /var (see /etc/fstab). +# Holds /var/home (settings, app profiles), Bluetooth pairings, logs. +[Partition] +Type=linux-generic +Label=sf-data +Format=ext4 +SizeMinBytes=1G diff --git a/image/mkosi.extra/usr/lib/systemd/system/sf-data-init.service b/image/mkosi.extra/usr/lib/systemd/system/sf-data-init.service new file mode 100644 index 0000000..e522ccc --- /dev/null +++ b/image/mkosi.extra/usr/lib/systemd/system/sf-data-init.service @@ -0,0 +1,18 @@ +[Unit] +Description=SmartFox: fill the new data partition (/var) with the factory defaults +Documentation=file:/usr/lib/repart.d/50-sf-data.conf +DefaultDependencies=no +RequiresMountsFor=/var +ConditionPathIsMountPoint=/var +ConditionPathExists=!/var/.sf-data +After=local-fs.target +Before=sysinit.target systemd-tmpfiles-setup.service systemd-journal-flush.service systemd-random-seed.service + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/bin/cp -a /usr/share/factory/var/. /var/ +ExecStart=/bin/touch /var/.sf-data + +[Install] +WantedBy=sysinit.target diff --git a/image/mkosi.extra/usr/lib/systemd/system/sf-remote-debug-boot.service b/image/mkosi.extra/usr/lib/systemd/system/sf-remote-debug-boot.service new file mode 100644 index 0000000..f2bfcc4 --- /dev/null +++ b/image/mkosi.extra/usr/lib/systemd/system/sf-remote-debug-boot.service @@ -0,0 +1,10 @@ +[Unit] +Description=SmartFox: remote debugging (ssh) off after boot +After=network.target + +[Service] +Type=oneshot +ExecStart=/usr/bin/sf-remote-debug boot + +[Install] +WantedBy=multi-user.target diff --git a/image/mkosi.extra/usr/lib/systemd/system/sf-remote-debug.path b/image/mkosi.extra/usr/lib/systemd/system/sf-remote-debug.path new file mode 100644 index 0000000..d94cb51 --- /dev/null +++ b/image/mkosi.extra/usr/lib/systemd/system/sf-remote-debug.path @@ -0,0 +1,9 @@ +[Unit] +Description=SmartFox: watch the remote debugging switch + +[Path] +PathModified=/var/lib/smartfox/remote-debug +Unit=sf-remote-debug.service + +[Install] +WantedBy=paths.target diff --git a/image/mkosi.extra/usr/lib/systemd/system/sf-remote-debug.service b/image/mkosi.extra/usr/lib/systemd/system/sf-remote-debug.service new file mode 100644 index 0000000..b6d2313 --- /dev/null +++ b/image/mkosi.extra/usr/lib/systemd/system/sf-remote-debug.service @@ -0,0 +1,7 @@ +[Unit] +Description=SmartFox: remote debugging (ssh) on or off +After=network.target + +[Service] +Type=oneshot +ExecStart=/usr/bin/sf-remote-debug diff --git a/image/mkosi.extra/usr/lib/systemd/system/sf-remote.service b/image/mkosi.extra/usr/lib/systemd/system/sf-remote.service new file mode 100644 index 0000000..5d3ec3c --- /dev/null +++ b/image/mkosi.extra/usr/lib/systemd/system/sf-remote.service @@ -0,0 +1,13 @@ +[Unit] +Description=SmartFox Siri Remote driver +After=bluetooth.service +Wants=bluetooth.service + +[Service] +ExecStart=/usr/bin/sf-remote --home-socket /run/user/1000/smartfox.sock +Environment=RUST_LOG=info +Restart=always +RestartSec=2 + +[Install] +WantedBy=multi-user.target diff --git a/image/mkosi.extra/usr/lib/tmpfiles.d/smartfox.conf b/image/mkosi.extra/usr/lib/tmpfiles.d/smartfox.conf new file mode 100644 index 0000000..41986f0 --- /dev/null +++ b/image/mkosi.extra/usr/lib/tmpfiles.d/smartfox.conf @@ -0,0 +1,2 @@ +# The launcher (user tv) writes the remote debugging switch here. +d /var/lib/smartfox 0755 tv tv - diff --git a/image/mkosi.extra/usr/share/smartfox/settings.toml b/image/mkosi.extra/usr/share/smartfox/settings.toml new file mode 100644 index 0000000..9ad9638 --- /dev/null +++ b/image/mkosi.extra/usr/share/smartfox/settings.toml @@ -0,0 +1 @@ +netflex_server = "https://netflex.furbidden.cloud" diff --git a/image/mkosi.postinst.chroot b/image/mkosi.postinst.chroot new file mode 100644 index 0000000..c97967d --- /dev/null +++ b/image/mkosi.postinst.chroot @@ -0,0 +1,73 @@ +#!/bin/sh +# Runs inside the image after packages and extra trees are installed. +set -e + +# Homes live on the writable data partition (/var); root is read-only. +if [ ! -L /home ]; then + mkdir -p /var/home + cp -a /home/. /var/home/ 2>/dev/null || true + rm -rf /home + ln -s var/home /home +fi + +# The TV user (uid 1000): auto-login on tty1 starts the SmartFox session. +if ! id tv >/dev/null 2>&1; then + useradd -m -d /var/home/tv -u 1000 -s /bin/bash -G video,render,input,audio,bluetooth tv +fi +# Wi-Fi settings: iwd's D-Bus policy lets the netdev group manage networks. +getent group netdev >/dev/null || groupadd -r netdev +usermod -aG netdev tv + +systemctl enable systemd-networkd systemd-resolved iwd bluetooth sf-remote.service sf-data-init.service sf-remote-debug-boot.service sf-remote-debug.path +# sshd only runs when remote debugging is on (Settings > System, sf-remote-debug). +systemctl disable ssh.service ssh.socket 2>/dev/null || true +systemctl set-default multi-user.target +# No interactive first-boot questions on a TV (locale, timezone, etc. come from mkosi.conf). +systemctl mask systemd-firstboot.service +# Root is read-only and stays its built size; the data partition takes the rest. +systemctl mask systemd-growfs-root.service +ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf || true + +# Invisible mouse cursor: the TV only has a keyboard and the remote. Every +# cursor name is a 1x1 transparent image; cage, the launcher and Chromium all +# load cursors from this theme (XCURSOR_THEME in sf-session, and "default"). +python3 - <<'EOF' +import os, struct +d = "/usr/share/icons/smartfox-blank/cursors" +os.makedirs(d, exist_ok=True) +img = struct.pack("<9I", 36, 0xFFFD0002, 24, 1, 1, 1, 0, 0, 0) + struct.pack("/usr/share/icons/smartfox-blank/index.theme +mkdir -p /usr/share/icons/default +printf '[Icon Theme]\nInherits=smartfox-blank\n' >/usr/share/icons/default/index.theme + +chmod +x /usr/bin/sf-session /usr/bin/sf-pair /usr/bin/sf-remote-debug /usr/bin/sf-diag 2>/dev/null || true + +# Factory copy of /var: sf-data-init.service fills the empty data partition from it. +rm -rf /usr/share/factory/var +mkdir -p /usr/share/factory +cp -a /var /usr/share/factory/var +rm -rf /usr/share/factory/var/cache/apt/* /usr/share/factory/var/lib/apt/lists/* /usr/share/factory/var/log/* +mkdir -p /usr/share/factory/var/lib/bluetooth +chmod 700 /usr/share/factory/var/lib/bluetooth diff --git a/image/mkosi.sandbox/etc/apt/sources.list.d/backports.sources b/image/mkosi.sandbox/etc/apt/sources.list.d/backports.sources new file mode 100644 index 0000000..a0544ec --- /dev/null +++ b/image/mkosi.sandbox/etc/apt/sources.list.d/backports.sources @@ -0,0 +1,5 @@ +Types: deb +URIs: http://deb.debian.org/debian +Suites: trixie-backports +Components: main contrib non-free non-free-firmware +Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg diff --git a/image/run-qemu.sh b/image/run-qemu.sh new file mode 100644 index 0000000..ed44b11 --- /dev/null +++ b/image/run-qemu.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env bash +# Boots the SmartFox image in QEMU (KVM). Under WSL the window shows up via WSLg. +# sudo bash image/run-qemu.sh [--no-gl] [--bt VID:PID] +# ssh into the VM: ssh -p 2222 root@localhost (password: smartfox) +set -euo pipefail + +WORK="${SMARTFOX_WORK:-/root/smartfox}" +IMG="$WORK/image/mkosi.output/smartfox.raw" +VARS="$WORK/image/ovmf-vars.fd" +GL=1 +BT="" +while [ $# -gt 0 ]; do + case "$1" in + --no-gl) GL=0 ;; + --bt) BT="$2"; shift ;; + esac + shift +done + +# Free space for the data partition (/var) that the image creates on first boot. +if [ "$(stat -c %s "$IMG")" -lt $((8 * 1024 * 1024 * 1024)) ]; then + truncate -s 8G "$IMG" +fi + +CODE=/usr/share/OVMF/OVMF_CODE_4M.fd +[ -f "$VARS" ] || cp /usr/share/OVMF/OVMF_VARS_4M.fd "$VARS" + +if [ "$GL" = 1 ]; then + GPU=(-device virtio-vga-gl,edid=on,xres=1920,yres=1080 -display gtk,gl=on,zoom-to-fit=on) +else + GPU=(-device virtio-vga,edid=on,xres=1920,yres=1080 -display gtk,zoom-to-fit=on) +fi + +USB=(-device qemu-xhci,id=xhci) +if [ -n "$BT" ]; then + USB+=(-device "usb-host,bus=xhci.0,vendorid=0x${BT%%:*},productid=0x${BT##*:}") +fi + +AUDIO=() +if [ -n "${PULSE_SERVER:-}" ] || [ -S /mnt/wslg/PulseServer ]; then + export PULSE_SERVER="${PULSE_SERVER:-unix:/mnt/wslg/PulseServer}" + AUDIO=(-audiodev pa,id=snd0 -device ich9-intel-hda -device hda-output,audiodev=snd0) +fi + +exec qemu-system-x86_64 \ + -name SmartFox -machine q35,accel=kvm -cpu host -smp 4 -m 4096 \ + -drive if=pflash,format=raw,readonly=on,file="$CODE" \ + -drive if=pflash,format=raw,file="$VARS" \ + -drive file="$IMG",format=raw,if=virtio \ + "${GPU[@]}" "${USB[@]}" "${AUDIO[@]}" \ + -device usb-tablet,bus=xhci.0 \ + -monitor unix:/root/qemu-monitor.sock,server,nowait \ + -nic user,model=virtio-net-pci,hostfwd=tcp::2222-:22 diff --git a/tools/siri-remote/autopair.sh b/tools/siri-remote/autopair.sh new file mode 100644 index 0000000..87e2610 --- /dev/null +++ b/tools/siri-remote/autopair.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +# Scans for an Apple BLE HID device (Siri Remote in pairing mode) and pairs, +# trusts and connects it as soon as it shows up. +# usage: autopair.sh [seconds] +LIMIT="${1:-180}" +strip() { sed 's/\x1b\[[0-9;]*m//g'; } + +bluetoothctl pairable on >/dev/null +# Background scan for the whole window. +timeout "$LIMIT" bluetoothctl --timeout "$LIMIT" scan le >/dev/null 2>&1 & +SCAN=$! +trap 'kill $SCAN 2>/dev/null' EXIT + +end=$((SECONDS + LIMIT)) +while [ $SECONDS -lt $end ]; do + for m in $(bluetoothctl devices | strip | awk '{print $2}'); do + info=$(bluetoothctl info "$m" | strip) + if grep -q "00001812" <<<"$info" && grep -q "Key: 0x004c" <<<"$info" && grep -q "Paired: no" <<<"$info"; then + echo "found Apple HID $m, pairing..." + kill $SCAN 2>/dev/null + { echo "agent NoInputNoOutput"; echo "default-agent"; sleep 1 + echo "pair $m"; sleep 15; echo "trust $m"; sleep 1 + echo "connect $m"; sleep 6; echo quit; } | bluetoothctl 2>&1 | strip \ + | grep -E "Pairing|Paired|Bonded|trust|Connected|Failed|Error|ServicesResolved" | sort -u + bluetoothctl info "$m" | strip | grep -E "Name|Alias|Paired|Bonded|Trusted|Connected|Modalias" + exit 0 + fi + done + sleep 1 +done +echo "TIMEOUT: no Apple HID device in pairing mode" +exit 1 diff --git a/tools/siri-remote/fastpair.py b/tools/siri-remote/fastpair.py new file mode 100644 index 0000000..c37ece5 --- /dev/null +++ b/tools/siri-remote/fastpair.py @@ -0,0 +1,158 @@ +#!/usr/bin/env python3 +"""Event-driven Siri Remote pairing over BlueZ D-Bus. + +The remote only advertises for a fraction of a second at a time in pairing +mode, so we react to the very first advertisement (InterfacesAdded / +PropertiesChanged) and call Pair() immediately. + +usage: fastpair.py [timeout_seconds] +""" +import sys +import time + +import dbus +import dbus.mainloop.glib +import dbus.service +from gi.repository import GLib + +BUS = "org.bluez" +AGENT_PATH = "/smartfox/agent" +APPLE = 0x004C +HID_UUID = "00001812-0000-1000-8000-00805f9b34fb" + +dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) +bus = dbus.SystemBus() +loop = GLib.MainLoop() +t0 = time.monotonic() +busy = set() +done = {"ok": False} + + +def log(*a): + print(f"{time.monotonic() - t0:7.3f}", *a, flush=True) + + +class Agent(dbus.service.Object): + """NoInputNoOutput agent: accept everything (just works pairing).""" + + @dbus.service.method("org.bluez.Agent1", in_signature="", out_signature="") + def Release(self): + pass + + @dbus.service.method("org.bluez.Agent1", in_signature="os", out_signature="") + def AuthorizeService(self, device, uuid): + log("authorize service", uuid) + + @dbus.service.method("org.bluez.Agent1", in_signature="o", out_signature="") + def RequestAuthorization(self, device): + log("authorize pairing") + + @dbus.service.method("org.bluez.Agent1", in_signature="ou", out_signature="") + def RequestConfirmation(self, device, passkey): + log("confirm passkey", passkey) + + @dbus.service.method("org.bluez.Agent1", in_signature="", out_signature="") + def Cancel(self): + log("agent cancel") + + +def adapter_path(): + om = dbus.Interface(bus.get_object(BUS, "/"), "org.freedesktop.DBus.ObjectManager") + for path, ifaces in om.GetManagedObjects().items(): + if "org.bluez.Adapter1" in ifaces: + return path + sys.exit("no adapter") + + +def is_remote(props): + md = props.get("ManufacturerData", {}) + uuids = [str(u).lower() for u in props.get("UUIDs", [])] + appearance = int(props.get("Appearance", 0)) + return APPLE in [int(k) for k in md.keys()] and (HID_UUID in uuids or appearance == 0x03C0) + + +def pair(path): + if path in busy or done["ok"]: + return + busy.add(path) + dev = bus.get_object(BUS, path) + props = dbus.Interface(dev, "org.freedesktop.DBus.Properties") + addr = props.Get("org.bluez.Device1", "Address") + if props.Get("org.bluez.Device1", "Paired"): + log("already paired", addr) + return + log("remote seen", addr, "-> Pair()") + + def ok(): + log("PAIRED", addr) + props.Set("org.bluez.Device1", "Trusted", True) + done["ok"] = True + try: + dbus.Interface(dev, "org.bluez.Device1").Connect(timeout=20) + except dbus.DBusException as e: + log("connect:", e.get_dbus_name()) # usually already connected after pairing + for k in ("Name", "Alias", "Modalias", "Connected", "Bonded", "UUIDs"): + try: + log(f" {k}:", props.Get("org.bluez.Device1", k)) + except dbus.DBusException: + pass + GLib.timeout_add(1500, loop.quit) + + def err(e): + log("pair failed", addr, e.get_dbus_name(), e.get_dbus_message()) + busy.discard(path) + + dbus.Interface(dev, "org.bluez.Device1").Pair(reply_handler=ok, error_handler=err, timeout=30) + + +def on_added(path, ifaces): + p = ifaces.get("org.bluez.Device1") + if p and is_remote(p): + pair(path) + + +def on_changed(iface, changed, invalidated, path=None): + if iface != "org.bluez.Device1" or not ("ManufacturerData" in changed or "RSSI" in changed): + return + props = dbus.Interface(bus.get_object(BUS, path), "org.freedesktop.DBus.Properties").GetAll("org.bluez.Device1") + if is_remote(props): + pair(path) + + +def main(): + limit = int(sys.argv[1]) if len(sys.argv) > 1 else 180 + Agent(bus, AGENT_PATH) + mgr = dbus.Interface(bus.get_object(BUS, "/org/bluez"), "org.bluez.AgentManager1") + mgr.RegisterAgent(AGENT_PATH, "NoInputNoOutput") + mgr.RequestDefaultAgent(AGENT_PATH) + + ad_path = adapter_path() + ad = dbus.Interface(bus.get_object(BUS, ad_path), "org.bluez.Adapter1") + adp = dbus.Interface(bus.get_object(BUS, ad_path), "org.freedesktop.DBus.Properties") + adp.Set("org.bluez.Adapter1", "Pairable", True) + + bus.add_signal_receiver(on_added, "InterfacesAdded", "org.freedesktop.DBus.ObjectManager", BUS) + bus.add_signal_receiver(on_changed, "PropertiesChanged", "org.freedesktop.DBus.Properties", BUS, + path_keyword="path") + + # Devices already known from earlier scans (stale, unpaired) get removed so we see fresh adverts. + om = dbus.Interface(bus.get_object(BUS, "/"), "org.freedesktop.DBus.ObjectManager") + for path, ifaces in om.GetManagedObjects().items(): + d = ifaces.get("org.bluez.Device1") + if d and is_remote(d) and not d.get("Paired"): + ad.RemoveDevice(path) + + ad.SetDiscoveryFilter({"Transport": "le", "DuplicateData": True}) + ad.StartDiscovery() + log(f"scanning for {limit}s - hold Back + Volume Up on the remote now") + GLib.timeout_add_seconds(limit, loop.quit) + loop.run() + try: + ad.StopDiscovery() + except dbus.DBusException: + pass + print("RESULT:", "paired" if done["ok"] else "not paired", flush=True) + + +if __name__ == "__main__": + main() diff --git a/tools/siri-remote/notifs.py b/tools/siri-remote/notifs.py new file mode 100644 index 0000000..86a1f52 --- /dev/null +++ b/tools/siri-remote/notifs.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 +"""Extracts ATT notifications from `btmon -r capture.btsnoop` text output. + +usage: btmon -r cap.btsnoop | notifs.py [handle ...] +Prints: time handle hexdata +""" +import re +import sys + +want = set(sys.argv[1:]) +ts = 0.0 +lines = sys.stdin.read().split("\n") +i = 0 +while i < len(lines): + l = lines[i] + m = re.search(r"LE-ACL:.*\]\s+(\d+\.\d+)\s*$", l) + if m: + ts = float(m.group(1)) + if "Handle Value Notification" in l: + h = re.search(r"Handle: (0x[0-9a-f]+)", lines[i + 1]).group(1) + data = [] + j = i + 3 + while j < len(lines): + m2 = re.match(r"^\s{8}((?:[0-9a-f]{2} )+)", lines[j] + " ") + if not m2: + break + data += m2.group(1).split() + j += 1 + if not want or h in want: + print(f"{ts:9.3f} {h} {' '.join(data)}") + i = j + continue + i += 1 diff --git a/tools/siri-remote/probe.py b/tools/siri-remote/probe.py new file mode 100644 index 0000000..ce490e3 --- /dev/null +++ b/tools/siri-remote/probe.py @@ -0,0 +1,89 @@ +#!/usr/bin/env python3 +"""Siri Remote probe: lists Apple HID devices, dumps report descriptors and +streams raw hidraw reports (hex, with changed bytes marked). + +usage: + probe.py list # devices + descriptors + probe.py watch [hidrawN] [-o log.txt] +""" +import glob +import os +import select +import sys +import time + +APPLE = "0000004C" + + +def devices(): + out = [] + for path in sorted(glob.glob("/sys/class/hidraw/hidraw*")): + dev = os.path.realpath(os.path.join(path, "device")) + uevent = open(os.path.join(dev, "uevent")).read() + info = dict(l.split("=", 1) for l in uevent.split() if "=" in l) + hid_id = info.get("HID_ID", "") # bus:vendor:product + desc = open(os.path.join(dev, "report_descriptor"), "rb").read() + out.append({ + "node": "/dev/" + os.path.basename(path), + "name": info.get("HID_NAME", "?"), + "id": hid_id, + "driver": info.get("DRIVER", "?"), + "apple": APPLE in hid_id.upper(), + "desc": desc, + }) + return out + + +def cmd_list(): + for d in devices(): + mark = " <-- Apple" if d["apple"] else "" + print(f'{d["node"]} {d["name"]} id={d["id"]} driver={d["driver"]}{mark}') + if d["apple"]: + print(" report descriptor (%d bytes):" % len(d["desc"])) + h = d["desc"].hex(" ") + for i in range(0, len(h), 96): + print(" ", h[i:i + 96]) + + +def cmd_watch(args): + log = None + if "-o" in args: + i = args.index("-o") + log = open(args[i + 1], "a") + args = args[:i] + args[i + 2:] + nodes = args or [d["node"] for d in devices() if d["apple"]] + if not nodes: + sys.exit("no Apple hidraw device found (is the remote paired and connected?)") + fds = {os.open(n, os.O_RDONLY | os.O_NONBLOCK): n for n in nodes} + last = {} + print("watching", ", ".join(nodes), "- Ctrl+C to stop", flush=True) + t0 = time.monotonic() + while True: + r, _, _ = select.select(list(fds), [], []) + for fd in r: + try: + data = os.read(fd, 256) + except BlockingIOError: + continue + key = (fd, data[0] if data else None) + prev = last.get(key) + last[key] = data + cells = [] + for i, b in enumerate(data): + changed = prev is not None and (i >= len(prev) or prev[i] != b) + cells.append(("*" if changed else " ") + f"{b:02x}") + line = f"{time.monotonic() - t0:9.3f} {fds[fd]} len={len(data):3d} |{''.join(cells)}" + print(line, flush=True) + if log: + log.write(line + "\n") + log.flush() + + +if __name__ == "__main__": + a = sys.argv[1:] + if not a or a[0] == "list": + cmd_list() + elif a[0] == "watch": + cmd_watch(a[1:]) + else: + print(__doc__) diff --git a/tools/siri-remote/setup-host-2.sh b/tools/siri-remote/setup-host-2.sh new file mode 100644 index 0000000..ec72e32 --- /dev/null +++ b/tools/siri-remote/setup-host-2.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +# Second root step: let sf-remote own the Siri Remote's HID service. +# BlueZ's HID (HoG) plugin drops the remote's vendor reports, so we disable it +# and sf-remote reads the GATT characteristics itself over D-Bus. +# Run: sudo bash setup-host-2.sh +set -euo pipefail + +if command -v dnf >/dev/null; then + dnf install -y dbus-devel pkgconf-pkg-config +elif command -v apt-get >/dev/null; then + apt-get install -y libdbus-1-dev pkg-config +fi + +BTD=$(systemctl cat bluetooth | sed -n 's/^ExecStart=\(\/[^ ]*bluetoothd\).*/\1/p' | head -1) +mkdir -p /etc/systemd/system/bluetooth.service.d +cat >/etc/systemd/system/bluetooth.service.d/smartfox.conf < +set -euo pipefail +USER_NAME="${1:-${SUDO_USER:-}}" +[ -n "$USER_NAME" ] || { echo "usage: sudo bash $0 "; exit 1; } + +echo "== packages" +if command -v dnf >/dev/null; then + dnf install -y evtest hid-tools bluez bluez-tools || dnf install -y evtest bluez +elif command -v apt-get >/dev/null; then + apt-get install -y evtest bluez python3-hid-tools || apt-get install -y evtest bluez +fi + +echo "== unblock bluetooth (persistent)" +rfkill unblock bluetooth +systemctl enable --now bluetooth +# Keep the adapter on after reboot. +sed -i 's/^#\?AutoEnable=.*/AutoEnable=true/' /etc/bluetooth/main.conf || true + +echo "== device access for group 'smartfox'" +groupadd -f smartfox +usermod -aG smartfox,input "$USER_NAME" +cat >/etc/udev/rules.d/70-smartfox.rules <<'EOF' +# SmartFox: remote daemon reads raw HID and writes virtual key events. +KERNEL=="hidraw*", SUBSYSTEM=="hidraw", GROUP="smartfox", MODE="0660" +KERNEL=="uinput", SUBSYSTEM=="misc", GROUP="smartfox", MODE="0660", OPTIONS+="static_node=uinput" +EOF +modprobe uinput || true +udevadm control --reload-rules +udevadm trigger --subsystem-match=hidraw --subsystem-match=misc + +# Read-only debugging without a password: btmon capture. +cat >/etc/sudoers.d/smartfox-btmon <&1 | grep -E "^(error|warning)|-->|Finished" -A6 || true +for c in "$@"; do + bash "$VM/vmcp.sh" "target/release/$c" "vm:/usr/bin/$c.new" + bash "$VM/vmssh.sh" "mv /usr/bin/$c.new /usr/bin/$c && chmod 755 /usr/bin/$c" +done +for c in "$@"; do + case "$c" in + sf-remote) bash "$VM/vmssh.sh" "systemctl restart sf-remote" ;; + sf-launcher) bash "$VM/vmssh.sh" "pkill -x sf-launcher || true; systemctl restart getty@tty1" ;; + esac +done +echo "swapped: $*" diff --git a/tools/vm/screenshot.sh b/tools/vm/screenshot.sh new file mode 100644 index 0000000..4da522d --- /dev/null +++ b/tools/vm/screenshot.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +# Saves a screenshot of the QEMU VM display (PNG) via the monitor socket. +# usage: screenshot.sh /path/out.png +OUT="${1:-/root/vm-shot.png}" +echo "screendump $OUT -f png" | socat - UNIX-CONNECT:/root/qemu-monitor.sock >/dev/null +sleep 0.5 +ls -la "$OUT" diff --git a/tools/vm/start-vm.ps1 b/tools/vm/start-vm.ps1 new file mode 100644 index 0000000..8429b70 --- /dev/null +++ b/tools/vm/start-vm.ps1 @@ -0,0 +1,10 @@ +# Starts the SmartFox OS VM (QEMU in WSL Debian). The window appears via WSLg. +# powershell -File tools\vm\start-vm.ps1 # boot the last built image +# powershell -File tools\vm\start-vm.ps1 -Build # rebuild image first +param([switch]$Build, [string]$Bt = "") +if ($Build) { + wsl -d Debian -u root -- bash /mnt/g/source/smartfox/image/build.sh +} +$extra = "" +if ($Bt) { $extra = "--bt $Bt" } +wsl -d Debian -u root -- bash -c "cd /root/smartfox && bash image/run-qemu.sh $extra" diff --git a/tools/vm/vmcp.sh b/tools/vm/vmcp.sh new file mode 100644 index 0000000..2e8a4f2 --- /dev/null +++ b/tools/vm/vmcp.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +# Copies files to/from the SmartFox VM. Use "vm:" prefix for the remote side. +# vmcp.sh local vm:/remote vmcp.sh vm:/remote local +OPTS=(-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR -P 2222) +args=() +for a in "$@"; do args+=("${a/#vm:/root@localhost:}"); done +exec sshpass -p smartfox scp "${OPTS[@]}" "${args[@]}" diff --git a/tools/vm/vmkey.sh b/tools/vm/vmkey.sh new file mode 100644 index 0000000..5ece0f5 --- /dev/null +++ b/tools/vm/vmkey.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +# Sends key presses to the VM through the QEMU monitor (like a real keyboard). +# vmkey.sh esc ret f12 vmkey.sh --hold esc 1.2 +if [ "$1" = "--hold" ]; then + # QEMU sendkey with a hold time in ms + ms=$(awk "BEGIN {print int(${3:-1} * 1000)}") + echo "sendkey $2 $ms" | socat - UNIX-CONNECT:/root/qemu-monitor.sock >/dev/null + sleep "${3:-1}" + exit 0 +fi +for k in "$@"; do + echo "sendkey $k" | socat - UNIX-CONNECT:/root/qemu-monitor.sock >/dev/null + sleep 0.3 +done diff --git a/tools/vm/vmshot.sh b/tools/vm/vmshot.sh new file mode 100644 index 0000000..f133b4c --- /dev/null +++ b/tools/vm/vmshot.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +# Screenshot of the VM's Wayland session (needs grim in the VM). +# vmshot.sh /local/out.png +D="$(dirname "$0")" +OUT="${1:-/root/vm-shot.png}" +if ! "$D/vmssh.sh" 'command -v grim >/dev/null || test -x /usr/local/bin/grim'; then + "$D/vmcp.sh" /usr/bin/grim vm:/usr/local/bin/grim +fi +"$D/vmssh.sh" 'G=$(command -v grim || echo /usr/local/bin/grim); runuser -u tv -- env XDG_RUNTIME_DIR=/run/user/1000 WAYLAND_DISPLAY=wayland-0 "$G" /tmp/shot.png' && +"$D/vmcp.sh" vm:/tmp/shot.png "$OUT" && echo "saved $OUT" diff --git a/tools/vm/vmssh.sh b/tools/vm/vmssh.sh new file mode 100644 index 0000000..07c3bb2 --- /dev/null +++ b/tools/vm/vmssh.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +# Runs a command in the SmartFox QEMU VM (dev image, root/smartfox). +# usage: vmssh.sh [--wait] 'command' +OPTS=(-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR -p 2222) +if [ "$1" = "--wait" ]; then + shift + for _ in $(seq 1 60); do + sshpass -p smartfox ssh "${OPTS[@]}" -o ConnectTimeout=3 root@localhost true 2>/dev/null && break + sleep 2 + done +fi +exec sshpass -p smartfox ssh "${OPTS[@]}" root@localhost "$@"