Temporary fix of old keyboard+lightbar

This commit is contained in:
Luke D. Jones
2024-05-13 23:53:25 +12:00
parent f2f090a88f
commit a0368d4345
10 changed files with 480 additions and 287 deletions

View File

@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Allow X11 GUI. This is *not* supported.
- Fixes to some GUI widget layouts and sizing
- Do a backup HID raw write fro brightness if the read-back value does not match. This is a temporary solve for some G14 and G16 until the kernel patch is ready.
- Reimplement the older 0x1866 MCU keyboard control power bits
## [v6.0.6]

160
Cargo.lock generated
View File

@@ -4,9 +4,9 @@ version = 3
[[package]]
name = "ab_glyph"
version = "0.2.25"
version = "0.2.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f90148830dac590fac7ccfe78ec4a8ea404c60f75a24e16407a71f0f40de775"
checksum = "2e53b0a3d5760cd2ba9b787ae0c6440ad18ee294ff71b05e3381c900a7d16cfd"
dependencies = [
"ab_glyph_rasterizer",
"owned_ttf_parser",
@@ -148,7 +148,7 @@ dependencies = [
"config-traits",
"dmi_id",
"env_logger",
"futures-lite 1.13.0",
"futures-lite 2.3.0",
"inotify",
"log",
"logind-zbus",
@@ -209,9 +209,9 @@ dependencies = [
[[package]]
name = "async-channel"
version = "2.2.1"
version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "136d4d23bcc79e27423727b36823d86233aad06dfea531837b038394d11e9928"
checksum = "9f2776ead772134d55b62dd45e59a79e21612d85d0af729b8b7d3967d601a62a"
dependencies = [
"concurrent-queue",
"event-listener 5.3.0",
@@ -349,7 +349,7 @@ version = "2.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a53fc6301894e04a92cb2584fedde80cb25ba8e02d9dc39d4a87d036e22f397d"
dependencies = [
"async-channel 2.2.1",
"async-channel 2.3.0",
"async-io 2.3.2",
"async-lock 3.3.0",
"async-signal",
@@ -371,7 +371,7 @@ checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.61",
"syn 2.0.63",
]
[[package]]
@@ -406,7 +406,7 @@ checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.61",
"syn 2.0.63",
]
[[package]]
@@ -424,7 +424,7 @@ dependencies = [
"derive_utils",
"proc-macro2",
"quote",
"syn 2.0.61",
"syn 2.0.63",
]
[[package]]
@@ -498,7 +498,7 @@ dependencies = [
"regex",
"rustc-hash",
"shlex",
"syn 2.0.61",
"syn 2.0.63",
"which",
]
@@ -573,7 +573,7 @@ version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "495f7104e962b7356f0aeb34247aca1fe7d2e783b346582db7f2904cb5717e88"
dependencies = [
"async-channel 2.2.1",
"async-channel 2.3.0",
"async-lock 3.3.0",
"async-task",
"futures-io",
@@ -610,7 +610,7 @@ checksum = "4da9a32f3fed317401fa3c862968128267c3106685286e15d5aaa3d7389c2f60"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.61",
"syn 2.0.63",
]
[[package]]
@@ -697,9 +697,9 @@ checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"
[[package]]
name = "cfg_aliases"
version = "0.2.0"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77e53693616d3075149f4ead59bdeecd204ac6b8192d8969757601b74bddf00f"
checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
[[package]]
name = "cgl"
@@ -820,7 +820,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f76990911f2267d837d9d0ad060aa63aaad170af40904b29461734c339030d4d"
dependencies = [
"quote",
"syn 2.0.61",
"syn 2.0.63",
]
[[package]]
@@ -845,7 +845,7 @@ dependencies = [
[[package]]
name = "const-field-offset"
version = "0.1.5"
source = "git+https://github.com/slint-ui/slint.git#65160638a1c36cf8ee19047554f7bb4384c69ddf"
source = "git+https://github.com/slint-ui/slint.git#7b3e2fcf32d2937a8ed58bcc742e45dd4852bced"
dependencies = [
"const-field-offset-macro",
"field-offset",
@@ -854,11 +854,11 @@ dependencies = [
[[package]]
name = "const-field-offset-macro"
version = "0.1.5"
source = "git+https://github.com/slint-ui/slint.git#65160638a1c36cf8ee19047554f7bb4384c69ddf"
source = "git+https://github.com/slint-ui/slint.git#7b3e2fcf32d2937a8ed58bcc742e45dd4852bced"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.61",
"syn 2.0.63",
]
[[package]]
@@ -1019,12 +1019,12 @@ dependencies = [
[[package]]
name = "ctor"
version = "0.2.7"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad291aa74992b9b7a7e88c38acbbf6ad7e107f1d90ee8775b7bc1fc3394f485c"
checksum = "edb49164822f3ee45b17acd4a208cfc1251410cf0cad9a833234c9890774dd9f"
dependencies = [
"quote",
"syn 2.0.61",
"syn 2.0.63",
]
[[package]]
@@ -1080,7 +1080,7 @@ checksum = "61bb5a1014ce6dfc2a378578509abe775a5aa06bff584a547555d9efdb81b926"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.61",
"syn 2.0.63",
]
[[package]]
@@ -1245,7 +1245,7 @@ checksum = "5c785274071b1b420972453b306eeca06acf4633829db4223b58a2a8c5953bc4"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.61",
"syn 2.0.63",
]
[[package]]
@@ -1483,7 +1483,7 @@ dependencies = [
"memmap2 0.9.4",
"slotmap",
"tinyvec",
"ttf-parser",
"ttf-parser 0.20.0",
]
[[package]]
@@ -1493,7 +1493,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9099a2f86b8e674b75d03ff154b3fe4c5208ed249ced8d69cc313a9fa40bb488"
dependencies = [
"hashbrown",
"ttf-parser",
"ttf-parser 0.20.0",
]
[[package]]
@@ -1514,7 +1514,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.61",
"syn 2.0.63",
]
[[package]]
@@ -1890,7 +1890,7 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
[[package]]
name = "i-slint-backend-linuxkms"
version = "1.6.0"
source = "git+https://github.com/slint-ui/slint.git#65160638a1c36cf8ee19047554f7bb4384c69ddf"
source = "git+https://github.com/slint-ui/slint.git#7b3e2fcf32d2937a8ed58bcc742e45dd4852bced"
dependencies = [
"calloop",
"drm",
@@ -1910,7 +1910,7 @@ dependencies = [
[[package]]
name = "i-slint-backend-selector"
version = "1.6.0"
source = "git+https://github.com/slint-ui/slint.git#65160638a1c36cf8ee19047554f7bb4384c69ddf"
source = "git+https://github.com/slint-ui/slint.git#7b3e2fcf32d2937a8ed58bcc742e45dd4852bced"
dependencies = [
"cfg-if",
"i-slint-backend-linuxkms",
@@ -1922,10 +1922,10 @@ dependencies = [
[[package]]
name = "i-slint-backend-winit"
version = "1.6.0"
source = "git+https://github.com/slint-ui/slint.git#65160638a1c36cf8ee19047554f7bb4384c69ddf"
source = "git+https://github.com/slint-ui/slint.git#7b3e2fcf32d2937a8ed58bcc742e45dd4852bced"
dependencies = [
"cfg-if",
"cfg_aliases 0.2.0",
"cfg_aliases 0.2.1",
"cocoa",
"const-field-offset",
"copypasta",
@@ -1952,7 +1952,7 @@ dependencies = [
[[package]]
name = "i-slint-common"
version = "1.6.0"
source = "git+https://github.com/slint-ui/slint.git#65160638a1c36cf8ee19047554f7bb4384c69ddf"
source = "git+https://github.com/slint-ui/slint.git#7b3e2fcf32d2937a8ed58bcc742e45dd4852bced"
dependencies = [
"cfg-if",
"derive_more",
@@ -1963,7 +1963,7 @@ dependencies = [
[[package]]
name = "i-slint-compiler"
version = "1.6.0"
source = "git+https://github.com/slint-ui/slint.git#65160638a1c36cf8ee19047554f7bb4384c69ddf"
source = "git+https://github.com/slint-ui/slint.git#7b3e2fcf32d2937a8ed58bcc742e45dd4852bced"
dependencies = [
"by_address",
"codemap",
@@ -1992,7 +1992,7 @@ dependencies = [
[[package]]
name = "i-slint-core"
version = "1.6.0"
source = "git+https://github.com/slint-ui/slint.git#65160638a1c36cf8ee19047554f7bb4384c69ddf"
source = "git+https://github.com/slint-ui/slint.git#7b3e2fcf32d2937a8ed58bcc742e45dd4852bced"
dependencies = [
"auto_enums",
"bitflags 2.5.0",
@@ -2035,16 +2035,16 @@ dependencies = [
[[package]]
name = "i-slint-core-macros"
version = "1.6.0"
source = "git+https://github.com/slint-ui/slint.git#65160638a1c36cf8ee19047554f7bb4384c69ddf"
source = "git+https://github.com/slint-ui/slint.git#7b3e2fcf32d2937a8ed58bcc742e45dd4852bced"
dependencies = [
"quote",
"syn 2.0.61",
"syn 2.0.63",
]
[[package]]
name = "i-slint-renderer-femtovg"
version = "1.6.0"
source = "git+https://github.com/slint-ui/slint.git#65160638a1c36cf8ee19047554f7bb4384c69ddf"
source = "git+https://github.com/slint-ui/slint.git#7b3e2fcf32d2937a8ed58bcc742e45dd4852bced"
dependencies = [
"cfg-if",
"const-field-offset",
@@ -2064,7 +2064,7 @@ dependencies = [
"raw-window-handle 0.5.2",
"rgb",
"scoped-tls-hkt",
"ttf-parser",
"ttf-parser 0.20.0",
"unicode-script",
"unicode-segmentation",
"wasm-bindgen",
@@ -2075,11 +2075,11 @@ dependencies = [
[[package]]
name = "i-slint-renderer-skia"
version = "1.6.0"
source = "git+https://github.com/slint-ui/slint.git#65160638a1c36cf8ee19047554f7bb4384c69ddf"
source = "git+https://github.com/slint-ui/slint.git#7b3e2fcf32d2937a8ed58bcc742e45dd4852bced"
dependencies = [
"bytemuck",
"cfg-if",
"cfg_aliases 0.2.0",
"cfg_aliases 0.2.1",
"cocoa",
"const-field-offset",
"core-foundation",
@@ -2850,7 +2850,7 @@ dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
"syn 2.0.61",
"syn 2.0.63",
]
[[package]]
@@ -2970,11 +2970,11 @@ dependencies = [
[[package]]
name = "owned_ttf_parser"
version = "0.20.0"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4586edfe4c648c71797a74c84bacb32b52b212eff5dfe2bb9f2c599844023e7"
checksum = "6b41438d2fc63c46c74a2203bf5ccd82c41ba04347b2fcf5754f230b167067d5"
dependencies = [
"ttf-parser",
"ttf-parser 0.21.1",
]
[[package]]
@@ -3041,7 +3041,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.61",
"syn 2.0.63",
]
[[package]]
@@ -3064,9 +3064,9 @@ checksum = "b330c9d1b92dfe68442ca20b009c717d5f0b1e3cf4965e62f704c3c6e95a1305"
[[package]]
name = "piper"
version = "0.2.1"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "668d31b1c4eba19242f2088b2bf3316b82ca31082a8335764db4e083db7485d4"
checksum = "464db0c665917b13ebb5d453ccdec4add5658ee1adc7affc7677615356a8afaf"
dependencies = [
"atomic-waker",
"fastrand 2.1.0",
@@ -3167,7 +3167,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e"
dependencies = [
"proc-macro2",
"syn 2.0.61",
"syn 2.0.63",
]
[[package]]
@@ -3608,7 +3608,7 @@ dependencies = [
"bitflags 2.5.0",
"bytemuck",
"smallvec",
"ttf-parser",
"ttf-parser 0.20.0",
"unicode-bidi-mirroring",
"unicode-ccc",
"unicode-properties",
@@ -3707,7 +3707,7 @@ checksum = "c5e405930b9796f1c00bee880d03fc7e0bb4b9a11afc776885ffe84320da2865"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.61",
"syn 2.0.63",
]
[[package]]
@@ -3729,7 +3729,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.61",
"syn 2.0.63",
]
[[package]]
@@ -3829,7 +3829,7 @@ dependencies = [
[[package]]
name = "slint"
version = "1.6.0"
source = "git+https://github.com/slint-ui/slint.git#65160638a1c36cf8ee19047554f7bb4384c69ddf"
source = "git+https://github.com/slint-ui/slint.git#7b3e2fcf32d2937a8ed58bcc742e45dd4852bced"
dependencies = [
"const-field-offset",
"i-slint-backend-selector",
@@ -3845,7 +3845,7 @@ dependencies = [
[[package]]
name = "slint-build"
version = "1.6.0"
source = "git+https://github.com/slint-ui/slint.git#65160638a1c36cf8ee19047554f7bb4384c69ddf"
source = "git+https://github.com/slint-ui/slint.git#7b3e2fcf32d2937a8ed58bcc742e45dd4852bced"
dependencies = [
"i-slint-compiler",
"spin_on",
@@ -3856,7 +3856,7 @@ dependencies = [
[[package]]
name = "slint-macros"
version = "1.6.0"
source = "git+https://github.com/slint-ui/slint.git#65160638a1c36cf8ee19047554f7bb4384c69ddf"
source = "git+https://github.com/slint-ui/slint.git#7b3e2fcf32d2937a8ed58bcc742e45dd4852bced"
dependencies = [
"i-slint-compiler",
"proc-macro2",
@@ -4049,7 +4049,7 @@ dependencies = [
"proc-macro2",
"quote",
"rustversion",
"syn 2.0.61",
"syn 2.0.63",
]
[[package]]
@@ -4090,9 +4090,9 @@ dependencies = [
[[package]]
name = "syn"
version = "2.0.61"
version = "2.0.63"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9"
checksum = "bf5be731623ca1a1fb7d8be6f261a3be6d3e2337b8a1f97be944d020c8fcb704"
dependencies = [
"proc-macro2",
"quote",
@@ -4170,7 +4170,7 @@ checksum = "e2470041c06ec3ac1ab38d0356a6119054dedaea53e12fbefc0de730a1c08524"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.61",
"syn 2.0.63",
]
[[package]]
@@ -4280,7 +4280,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.61",
"syn 2.0.63",
]
[[package]]
@@ -4347,7 +4347,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.61",
"syn 2.0.63",
]
[[package]]
@@ -4365,6 +4365,12 @@ version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17f77d76d837a7830fe1d4f12b7b4ba4192c1888001c7164257e4bc6d21d96b4"
[[package]]
name = "ttf-parser"
version = "0.21.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c591d83f69777866b9126b24c6dd9a18351f177e49d625920d19f989fd31cf8"
[[package]]
name = "typenum"
version = "1.17.0"
@@ -4390,7 +4396,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a615d6c2764852a2e88a4f16e9ce1ea49bb776b5872956309e170d63a042a34f"
dependencies = [
"quote",
"syn 2.0.61",
"syn 2.0.63",
]
[[package]]
@@ -4580,7 +4586,7 @@ dependencies = [
[[package]]
name = "vtable"
version = "0.2.0"
source = "git+https://github.com/slint-ui/slint.git#65160638a1c36cf8ee19047554f7bb4384c69ddf"
source = "git+https://github.com/slint-ui/slint.git#7b3e2fcf32d2937a8ed58bcc742e45dd4852bced"
dependencies = [
"const-field-offset",
"portable-atomic",
@@ -4591,18 +4597,18 @@ dependencies = [
[[package]]
name = "vtable-macro"
version = "0.2.0"
source = "git+https://github.com/slint-ui/slint.git#65160638a1c36cf8ee19047554f7bb4384c69ddf"
source = "git+https://github.com/slint-ui/slint.git#7b3e2fcf32d2937a8ed58bcc742e45dd4852bced"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.61",
"syn 2.0.63",
]
[[package]]
name = "waker-fn"
version = "1.1.1"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3c4517f54858c779bbcbf228f4fca63d121bf85fbecb2dc578cdf4a39395690"
checksum = "317211a0dc0ceedd78fb2ca9a44aed3d7b9b26f81870d485c07122b4350673b7"
[[package]]
name = "walkdir"
@@ -4641,7 +4647,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
"syn 2.0.61",
"syn 2.0.63",
"wasm-bindgen-shared",
]
@@ -4675,7 +4681,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.61",
"syn 2.0.63",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@@ -4961,7 +4967,7 @@ checksum = "f6fc35f58ecd95a9b71c4f2329b911016e6bec66b3f2e6a4aad86bd2e99e2f9b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.61",
"syn 2.0.63",
]
[[package]]
@@ -4972,7 +4978,7 @@ checksum = "08990546bf4edef8f431fa6326e032865f27138718c587dc21bc0265bbcb57cc"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.61",
"syn 2.0.63",
]
[[package]]
@@ -5233,7 +5239,7 @@ dependencies = [
"web-time 0.2.4",
"windows-sys 0.48.0",
"x11-dl",
"x11rb 0.13.0",
"x11rb 0.13.1",
"xkbcommon-dl",
]
@@ -5271,7 +5277,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b98785a09322d7446e28a13203d2cae1059a0dd3dfb32cb06d0a225f023d8286"
dependencies = [
"libc",
"x11rb 0.13.0",
"x11rb 0.13.1",
]
[[package]]
@@ -5304,9 +5310,9 @@ dependencies = [
[[package]]
name = "x11rb"
version = "0.13.0"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8f25ead8c7e4cba123243a6367da5d3990e0d3affa708ea19dce96356bd9f1a"
checksum = "5d91ffca73ee7f68ce055750bf9f6eca0780b8c85eff9bc046a3b0da41755e12"
dependencies = [
"as-raw-xcb-connection",
"gethostname 0.4.3",
@@ -5314,7 +5320,7 @@ dependencies = [
"libloading 0.8.3",
"once_cell",
"rustix 0.38.34",
"x11rb-protocol 0.13.0",
"x11rb-protocol 0.13.1",
]
[[package]]
@@ -5328,9 +5334,9 @@ dependencies = [
[[package]]
name = "x11rb-protocol"
version = "0.13.0"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e63e71c4b8bd9ffec2c963173a4dc4cbde9ee96961d4fcb4429db9929b606c34"
checksum = "ec107c4503ea0b4a98ef47356329af139c0a4f7750e621cf2973cd3385ebcb3d"
[[package]]
name = "xattr"
@@ -5482,7 +5488,7 @@ checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.61",
"syn 2.0.63",
]
[[package]]

View File

@@ -82,10 +82,16 @@ impl AuraPowerState {
if self.sleep {
a |= OldAuraPower::Sleep as u32;
}
if matches!(self.zone, PowerZones::Keyboard) {
if matches!(
self.zone,
PowerZones::Keyboard | PowerZones::KeyboardAndLightbar
) {
a |= OldAuraPower::Keyboard as u32;
}
if matches!(self.zone, PowerZones::Lightbar) {
if matches!(
self.zone,
PowerZones::Lightbar | PowerZones::KeyboardAndLightbar
) {
a |= OldAuraPower::Lightbar as u32;
}
vec![
@@ -128,7 +134,7 @@ impl AuraPowerState {
| (self.sleep as u32) << (23 + 3)
| (self.shutdown as u32) << (23 + 4)
}
PowerZones::None => 0,
PowerZones::None | PowerZones::KeyboardAndLightbar => 0,
}
}
}
@@ -189,9 +195,13 @@ impl LaptopAuraPower {
Self { states }
}
AuraDeviceType::LaptopPre2021 => {
// The older devices are tri-state if have lightbar:
// 1. Keyboard
// 2. Lightbar
// 3. KeyboardAndLightbar
if support_data.power_zones.contains(&PowerZones::Lightbar) {
Self {
states: vec![AuraPowerState::default_for(PowerZones::Lightbar)],
states: vec![AuraPowerState::default_for(PowerZones::KeyboardAndLightbar)],
}
} else {
Self {
@@ -209,12 +219,25 @@ impl LaptopAuraPower {
pub fn to_bytes(&self, aura_type: AuraDeviceType) -> Vec<u8> {
match aura_type {
AuraDeviceType::LaptopPost2021 => self.new_to_bytes(),
AuraDeviceType::LaptopPre2021 => self
.states
.first()
.cloned()
.unwrap_or_default()
.old_to_bytes(),
AuraDeviceType::LaptopPre2021 => {
if self.states.len() == 1 {
self.states
.first()
.cloned()
.unwrap_or_default()
.old_to_bytes()
} else {
let mut bytes: Vec<Vec<u8>> =
self.states.iter().map(|s| s.old_to_bytes()).collect();
let mut b = bytes.pop().unwrap();
for i in bytes {
for (i, n) in i.iter().enumerate() {
b[i] |= n;
}
}
b
}
}
AuraDeviceType::LaptopTuf => self
.states
.first()
@@ -225,7 +248,7 @@ impl LaptopAuraPower {
warn!("Trying to create bytes for an unknown device");
self.new_to_bytes()
}
AuraDeviceType::ScsiExtDisk => todo!(),
AuraDeviceType::ScsiExtDisk => todo!("scsi disk not implemented yet"),
}
}
}
@@ -274,76 +297,75 @@ mod test {
use crate::keyboard::{AuraPowerState, LaptopAuraPower};
use crate::{AuraDeviceType, PowerZones};
fn to_binary_string_post2021(power: &LaptopAuraPower) -> String {
let bytes = power.to_bytes(AuraDeviceType::LaptopPost2021);
format!(
"{:08b}, {:08b}, {:08b}, {:08b}",
bytes[0], bytes[1], bytes[2], bytes[3]
)
}
#[test]
fn check_0x1866_control_bytes() {
let state = AuraPowerState {
zone: PowerZones::Keyboard,
awake: true,
boot: false,
sleep: false,
shutdown: false,
let power = LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::Keyboard,
boot: false,
awake: true,
sleep: false,
shutdown: false,
}],
};
let bytes = state.old_to_bytes();
let bytes = power.to_bytes(AuraDeviceType::LaptopPre2021);
println!("{:08b}, {:08b}, {:08b}", bytes[0], bytes[1], bytes[2]);
assert_eq!(bytes, [0x08, 0x00, 0x02, 0x00]);
let state = AuraPowerState {
zone: PowerZones::Lightbar,
awake: true,
boot: false,
sleep: false,
shutdown: false,
let power = LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::Lightbar,
boot: false,
awake: true,
sleep: false,
shutdown: false,
}],
};
let bytes = state.old_to_bytes();
let bytes = power.to_bytes(AuraDeviceType::LaptopPre2021);
println!("{:08b}, {:08b}, {:08b}", bytes[0], bytes[1], bytes[2]);
assert_eq!(bytes, [0x04, 0x05, 0x02, 0x00]);
let bytes = AuraPowerState {
zone: PowerZones::None,
awake: false,
boot: false,
sleep: true,
shutdown: false,
// let bytes = [
// OldAuraPower::Keyboard,
// OldAuraPower::Lightbar,
// OldAuraPower::Awake,
// OldAuraPower::Sleep,
// OldAuraPower::Boot,
// ];
let power = LaptopAuraPower {
states: vec![
AuraPowerState {
zone: PowerZones::Keyboard,
boot: true,
awake: true,
sleep: true,
shutdown: false,
},
AuraPowerState {
zone: PowerZones::Lightbar,
boot: true,
awake: true,
sleep: true,
shutdown: false,
},
],
};
let bytes = bytes.old_to_bytes();
let bytes = power.to_bytes(AuraDeviceType::LaptopPre2021);
println!("{:08b}, {:08b}, {:08b}", bytes[0], bytes[1], bytes[2]);
assert_eq!(bytes, [0x30, 0x08, 0x04, 0x00]);
let bytes = AuraPowerState {
zone: PowerZones::None,
awake: false,
boot: true,
sleep: false,
shutdown: false,
};
let bytes = bytes.old_to_bytes();
println!("{:08b}, {:08b}, {:08b}", bytes[0], bytes[1], bytes[2]);
assert_eq!(bytes, [0xc3, 0x12, 0x09, 0x00]);
let power = AuraPowerState {
zone: PowerZones::Keyboard,
awake: true,
boot: true,
sleep: true,
shutdown: false,
};
let bytes = power.old_to_bytes();
println!("{:08b}, {:08b}, {:08b}", bytes[0], bytes[1], bytes[2]);
assert_eq!(bytes, [251, 26, 15, 0]);
assert_eq!(bytes, [0xff, 0x1f, 0x000f, 0x00]);
}
#[test]
fn check_0x19b6_control_bytes_binary_rep() {
fn to_binary_string(power: &LaptopAuraPower) -> String {
let bytes = power.to_bytes(AuraDeviceType::LaptopPost2021);
format!(
"{:08b}, {:08b}, {:08b}, {:08b}",
bytes[0], bytes[1], bytes[2], bytes[3]
)
}
let boot_logo_ = to_binary_string(&LaptopAuraPower {
let boot_logo_ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::Logo,
boot: true,
@@ -352,7 +374,7 @@ mod test {
shutdown: false,
}],
});
let boot_keyb_ = to_binary_string(&LaptopAuraPower {
let boot_keyb_ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::Keyboard,
boot: true,
@@ -361,7 +383,7 @@ mod test {
shutdown: false,
}],
});
let sleep_logo = to_binary_string(&LaptopAuraPower {
let sleep_logo = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::Logo,
boot: false,
@@ -370,7 +392,7 @@ mod test {
shutdown: false,
}],
});
let sleep_keyb = to_binary_string(&LaptopAuraPower {
let sleep_keyb = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::Keyboard,
boot: false,
@@ -379,7 +401,7 @@ mod test {
shutdown: false,
}],
});
let awake_logo = to_binary_string(&LaptopAuraPower {
let awake_logo = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::Logo,
boot: false,
@@ -388,7 +410,7 @@ mod test {
shutdown: false,
}],
});
let awake_keyb = to_binary_string(&LaptopAuraPower {
let awake_keyb = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::Keyboard,
boot: false,
@@ -397,7 +419,7 @@ mod test {
shutdown: false,
}],
});
let shut_logo_ = to_binary_string(&LaptopAuraPower {
let shut_logo_ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::Logo,
boot: false,
@@ -406,7 +428,7 @@ mod test {
shutdown: true,
}],
});
let shut_keyb_ = to_binary_string(&LaptopAuraPower {
let shut_keyb_ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::Keyboard,
boot: false,
@@ -415,7 +437,7 @@ mod test {
shutdown: true,
}],
});
let boot_bar__ = to_binary_string(&LaptopAuraPower {
let boot_bar__ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::Lightbar,
boot: true,
@@ -424,7 +446,7 @@ mod test {
shutdown: false,
}],
});
let awake_bar_ = to_binary_string(&LaptopAuraPower {
let awake_bar_ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::Lightbar,
boot: false,
@@ -433,7 +455,7 @@ mod test {
shutdown: false,
}],
});
let sleep_bar_ = to_binary_string(&LaptopAuraPower {
let sleep_bar_ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::Lightbar,
boot: false,
@@ -442,7 +464,7 @@ mod test {
shutdown: false,
}],
});
let shut_bar__ = to_binary_string(&LaptopAuraPower {
let shut_bar__ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::Lightbar,
boot: false,
@@ -451,7 +473,7 @@ mod test {
shutdown: true,
}],
});
let boot_lid__ = to_binary_string(&LaptopAuraPower {
let boot_lid__ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::Lid,
boot: true,
@@ -460,7 +482,7 @@ mod test {
shutdown: false,
}],
});
let awake_lid_ = to_binary_string(&LaptopAuraPower {
let awake_lid_ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::Lid,
boot: false,
@@ -469,7 +491,7 @@ mod test {
shutdown: false,
}],
});
let sleep_lid_ = to_binary_string(&LaptopAuraPower {
let sleep_lid_ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::Lid,
boot: false,
@@ -478,7 +500,7 @@ mod test {
shutdown: false,
}],
});
let shut_lid__ = to_binary_string(&LaptopAuraPower {
let shut_lid__ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::Lid,
boot: false,
@@ -487,7 +509,7 @@ mod test {
shutdown: true,
}],
});
let boot_rear_ = to_binary_string(&LaptopAuraPower {
let boot_rear_ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::RearGlow,
boot: true,
@@ -496,7 +518,7 @@ mod test {
shutdown: false,
}],
});
let awake_rear = to_binary_string(&LaptopAuraPower {
let awake_rear = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::RearGlow,
boot: false,
@@ -505,7 +527,7 @@ mod test {
shutdown: false,
}],
});
let sleep_rear = to_binary_string(&LaptopAuraPower {
let sleep_rear = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::RearGlow,
boot: false,
@@ -514,7 +536,7 @@ mod test {
shutdown: false,
}],
});
let shut_rear_ = to_binary_string(&LaptopAuraPower {
let shut_rear_ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::RearGlow,
boot: false,
@@ -549,7 +571,7 @@ mod test {
assert_eq!(shut_rear_, "00000000, 00000000, 00000000, 00001000");
// All on
let byte1 = to_binary_string(&LaptopAuraPower {
let byte1 = to_binary_string_post2021(&LaptopAuraPower {
states: vec![
AuraPowerState {
zone: PowerZones::Keyboard,

View File

@@ -126,5 +126,7 @@ pub enum PowerZones {
Lid = 3,
/// The led strip on the rear of some laptops
RearGlow = 4,
/// Exists for the older 0x1866 models
KeyboardAndLightbar = 5,
None = 255,
}

View File

@@ -1,5 +1,6 @@
use crate::slint_generatedMainWindow::{
AuraPowerState as SlintAuraPowerState, LaptopAuraPower as SlintLaptopAuraPower,
AuraDevType as SlintDeviceType, AuraPowerState as SlintAuraPowerState,
LaptopAuraPower as SlintLaptopAuraPower,
};
impl From<rog_aura::AuraEffect> for crate::slint_generatedMainWindow::AuraEffect {
@@ -51,7 +52,7 @@ impl From<crate::slint_generatedMainWindow::AuraEffect> for rog_aura::AuraEffect
}
use rog_aura::keyboard::{AuraPowerState, LaptopAuraPower};
use rog_aura::PowerZones;
use rog_aura::{AuraDeviceType, PowerZones};
use slint::{Model, ModelRc, RgbaColor};
use crate::slint_generatedMainWindow::PowerZones as SlintPowerZones;
@@ -63,6 +64,7 @@ impl From<PowerZones> for SlintPowerZones {
PowerZones::Lightbar => SlintPowerZones::Lightbar,
PowerZones::Lid => SlintPowerZones::Lid,
PowerZones::RearGlow => SlintPowerZones::RearGlow,
PowerZones::KeyboardAndLightbar => SlintPowerZones::KeyboardAndLightbar,
PowerZones::None => SlintPowerZones::Keyboard,
}
}
@@ -76,6 +78,7 @@ impl From<SlintPowerZones> for PowerZones {
SlintPowerZones::Lightbar => PowerZones::Lightbar,
SlintPowerZones::Lid => PowerZones::Lid,
SlintPowerZones::RearGlow => PowerZones::RearGlow,
SlintPowerZones::KeyboardAndLightbar => PowerZones::KeyboardAndLightbar,
}
}
}
@@ -139,3 +142,27 @@ impl From<LaptopAuraPower> for SlintLaptopAuraPower {
}
}
}
impl From<SlintDeviceType> for AuraDeviceType {
fn from(value: SlintDeviceType) -> Self {
match value {
SlintDeviceType::New => Self::LaptopPost2021,
SlintDeviceType::Old => Self::LaptopPre2021,
SlintDeviceType::Tuf => Self::LaptopTuf,
SlintDeviceType::ScsiExtDisk => Self::ScsiExtDisk,
SlintDeviceType::Unknown => Self::Unknown,
}
}
}
impl From<AuraDeviceType> for SlintDeviceType {
fn from(value: AuraDeviceType) -> Self {
match value {
AuraDeviceType::LaptopPost2021 => SlintDeviceType::New,
AuraDeviceType::LaptopPre2021 => SlintDeviceType::Old,
AuraDeviceType::LaptopTuf => SlintDeviceType::Tuf,
AuraDeviceType::ScsiExtDisk => SlintDeviceType::ScsiExtDisk,
AuraDeviceType::Unknown => SlintDeviceType::Unknown,
}
}
}

View File

@@ -82,6 +82,7 @@ pub fn setup_aura_page(ui: &MainWindow, _states: Arc<Mutex<Config>>) {
set_ui_props_async!(handle, aura, AuraPageData, led_mode);
set_ui_props_async!(handle, aura, AuraPageData, led_mode_data);
set_ui_props_async!(handle, aura, AuraPageData, led_power);
set_ui_props_async!(handle, aura, AuraPageData, device_type);
if let Ok(power) = aura.supported_power_zones().await {
log::debug!("Available LED power modes {power:?}");

View File

@@ -2,7 +2,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2024-05-09 22:04+0000\n"
"POT-Creation-Date: 2024-05-13 04:18+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -137,81 +137,121 @@ msgctxt "PageAnime"
msgid "Off when on battery"
msgstr ""
#: rog-control-center/ui/pages/app_settings.slint:29
msgctxt "PageAppSettings"
msgid "Run in background after closing"
msgstr ""
#: rog-control-center/ui/pages/app_settings.slint:38
msgctxt "PageAppSettings"
msgid "Start app in background (UI closed)"
msgstr ""
#: rog-control-center/ui/pages/app_settings.slint:50
msgctxt "PageAppSettings"
msgid "Enable system tray icon"
msgstr ""
#: rog-control-center/ui/pages/app_settings.slint:59
msgctxt "PageAppSettings"
msgid "Enable dGPU notifications"
msgstr ""
#: rog-control-center/ui/pages/fans.slint:27
#: rog-control-center/ui/pages/fans.slint:26
msgctxt "FanTab"
msgid "This fan is not avilable on this machine"
msgstr ""
#: rog-control-center/ui/pages/fans.slint:35
#: rog-control-center/ui/pages/fans.slint:34
msgctxt "FanTab"
msgid "Enabled"
msgstr ""
#: rog-control-center/ui/pages/fans.slint:44
#: rog-control-center/ui/pages/fans.slint:43
msgctxt "FanTab"
msgid "Apply"
msgstr ""
#: rog-control-center/ui/pages/fans.slint:52
#: rog-control-center/ui/pages/fans.slint:51
msgctxt "FanTab"
msgid "Cancel"
msgstr ""
#: rog-control-center/ui/pages/fans.slint:60
#: rog-control-center/ui/pages/fans.slint:59
msgctxt "FanTab"
msgid "Factory Default (all fans)"
msgstr ""
#: rog-control-center/ui/pages/fans.slint:73
#: rog-control-center/ui/pages/fans.slint:72
msgctxt "PageFans"
msgid "Balanced"
msgstr ""
#: rog-control-center/ui/pages/fans.slint:76 rog-control-center/ui/pages/fans.slint:135 rog-control-center/ui/pages/fans.slint:194
#: rog-control-center/ui/pages/fans.slint:75 rog-control-center/ui/pages/fans.slint:134 rog-control-center/ui/pages/fans.slint:193
msgctxt "PageFans"
msgid "CPU"
msgstr ""
#: rog-control-center/ui/pages/fans.slint:94 rog-control-center/ui/pages/fans.slint:153 rog-control-center/ui/pages/fans.slint:212
#: rog-control-center/ui/pages/fans.slint:93 rog-control-center/ui/pages/fans.slint:152 rog-control-center/ui/pages/fans.slint:211
msgctxt "PageFans"
msgid "Mid"
msgstr ""
#: rog-control-center/ui/pages/fans.slint:112 rog-control-center/ui/pages/fans.slint:171 rog-control-center/ui/pages/fans.slint:230
#: rog-control-center/ui/pages/fans.slint:111 rog-control-center/ui/pages/fans.slint:170 rog-control-center/ui/pages/fans.slint:229
msgctxt "PageFans"
msgid "GPU"
msgstr ""
#: rog-control-center/ui/pages/fans.slint:132
#: rog-control-center/ui/pages/fans.slint:131
msgctxt "PageFans"
msgid "Performance"
msgstr ""
#: rog-control-center/ui/pages/fans.slint:191
#: rog-control-center/ui/pages/fans.slint:190
msgctxt "PageFans"
msgid "Quiet"
msgstr ""
#: rog-control-center/ui/pages/app_settings.slint:26
msgctxt "PageAppSettings"
msgid "Run in background after closing"
msgstr ""
#: rog-control-center/ui/pages/app_settings.slint:34
msgctxt "PageAppSettings"
msgid "Start app in background (UI closed)"
msgstr ""
#: rog-control-center/ui/pages/app_settings.slint:42
msgctxt "PageAppSettings"
msgid "Enable system tray icon"
msgstr ""
#: rog-control-center/ui/pages/app_settings.slint:50
msgctxt "PageAppSettings"
msgid "Enable dGPU notifications"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:28
msgctxt "PageAura"
msgid "Brightness"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:39
msgctxt "PageAura"
msgid "Aura mode"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:59
msgctxt "PageAura"
msgid "Colour 1"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:85
msgctxt "PageAura"
msgid "Colour 2"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:119
msgctxt "PageAura"
msgid "Zone"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:142
msgctxt "PageAura"
msgid "Direction"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:164
msgctxt "PageAura"
msgid "Speed"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:185
msgctxt "PageAura"
msgid "Power Settings"
msgstr ""
#: rog-control-center/ui/pages/system.slint:26
msgctxt "SystemPageData"
msgid "Balanced"
@@ -247,181 +287,126 @@ msgctxt "SystemPageData"
msgid "Power"
msgstr ""
#: rog-control-center/ui/pages/system.slint:106
#: rog-control-center/ui/pages/system.slint:110
msgctxt "PageSystem"
msgid "Base system settings"
msgstr ""
#: rog-control-center/ui/pages/system.slint:111
#: rog-control-center/ui/pages/system.slint:115
msgctxt "PageSystem"
msgid "Charge limit"
msgstr ""
#: rog-control-center/ui/pages/system.slint:123
#: rog-control-center/ui/pages/system.slint:127
msgctxt "PageSystem"
msgid "Throttle Policy"
msgstr ""
#: rog-control-center/ui/pages/system.slint:133
#: rog-control-center/ui/pages/system.slint:137
msgctxt "PageSystem"
msgid "Advanced"
msgstr ""
#: rog-control-center/ui/pages/system.slint:145
#: rog-control-center/ui/pages/system.slint:149
msgctxt "PageSystem"
msgid "Panel Overdrive"
msgstr ""
#: rog-control-center/ui/pages/system.slint:153
#: rog-control-center/ui/pages/system.slint:157
msgctxt "PageSystem"
msgid "MiniLED Mode"
msgstr ""
#: rog-control-center/ui/pages/system.slint:161
#: rog-control-center/ui/pages/system.slint:165
msgctxt "PageSystem"
msgid "POST boot sound"
msgstr ""
#: rog-control-center/ui/pages/system.slint:179
#: rog-control-center/ui/pages/system.slint:183
msgctxt "PageSystem"
msgid "System performance settings"
msgstr ""
#: rog-control-center/ui/pages/system.slint:184
#: rog-control-center/ui/pages/system.slint:188
msgctxt "ppt_pl1_spl"
msgid "ppt_pl1_spl"
msgstr ""
#: rog-control-center/ui/pages/system.slint:194
#: rog-control-center/ui/pages/system.slint:198
msgctxt "ppt_pl2_sppt"
msgid "ppt_pl2_sppt"
msgstr ""
#: rog-control-center/ui/pages/system.slint:204
#: rog-control-center/ui/pages/system.slint:208
msgctxt "ppt_fppt"
msgid "ppt_fppt"
msgstr ""
#: rog-control-center/ui/pages/system.slint:214
#: rog-control-center/ui/pages/system.slint:218
msgctxt "ppt_apu_sppt"
msgid "ppt_apu_sppt"
msgstr ""
#: rog-control-center/ui/pages/system.slint:224
#: rog-control-center/ui/pages/system.slint:228
msgctxt "ppt_platform_sppt"
msgid "ppt_platform_sppt"
msgstr ""
#: rog-control-center/ui/pages/system.slint:234
#: rog-control-center/ui/pages/system.slint:238
msgctxt "nv_dynamic_boost"
msgid "nv_dynamic_boost"
msgstr ""
#: rog-control-center/ui/pages/system.slint:244
#: rog-control-center/ui/pages/system.slint:248
msgctxt "nv_temp_target"
msgid "nv_temp_target"
msgstr ""
#: rog-control-center/ui/pages/system.slint:290
#: rog-control-center/ui/pages/system.slint:294
msgctxt "PageSystem"
msgid "Energy Performance Preference linked to Throttle Policy"
msgstr ""
#: rog-control-center/ui/pages/system.slint:294
#: rog-control-center/ui/pages/system.slint:298
msgctxt "PageSystem"
msgid "Change EPP based on Throttle Policy"
msgstr ""
#: rog-control-center/ui/pages/system.slint:302
#: rog-control-center/ui/pages/system.slint:306
msgctxt "PageSystem"
msgid "EPP for Balanced Policy"
msgstr ""
#: rog-control-center/ui/pages/system.slint:312
#: rog-control-center/ui/pages/system.slint:316
msgctxt "PageSystem"
msgid "EPP for Performance Policy"
msgstr ""
#: rog-control-center/ui/pages/system.slint:322
#: rog-control-center/ui/pages/system.slint:326
msgctxt "PageSystem"
msgid "EPP for Quiet Policy"
msgstr ""
#: rog-control-center/ui/pages/system.slint:340
#: rog-control-center/ui/pages/system.slint:344
msgctxt "PageSystem"
msgid "Throttle Policy for power state"
msgstr ""
#: rog-control-center/ui/pages/system.slint:344
#: rog-control-center/ui/pages/system.slint:350
msgctxt "PageSystem"
msgid "Throttle Policy on Battery"
msgstr ""
#: rog-control-center/ui/pages/system.slint:354
#: rog-control-center/ui/pages/system.slint:360 rog-control-center/ui/pages/system.slint:381
msgctxt "PageSystem"
msgid "Enabled"
msgstr ""
#: rog-control-center/ui/pages/system.slint:371
msgctxt "PageSystem"
msgid "Throttle Policy on AC"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:27
msgctxt "PageAura"
msgid "Brightness"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:38
msgctxt "PageAura"
msgid "Aura mode"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:56
msgctxt "PageAura"
msgid "Colour 1"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:82
msgctxt "PageAura"
msgid "Colour 2"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:114
msgctxt "PageAura"
msgid "Zone"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:137
msgctxt "PageAura"
msgid "Direction"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:159
msgctxt "PageAura"
msgid "Speed"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:180
msgctxt "PageAura"
msgid "Power Settings"
msgstr ""
#: rog-control-center/ui/widgets/aura_power.slint:32
msgctxt "AuraPowerGroup"
msgid "Boot"
msgstr ""
#: rog-control-center/ui/widgets/aura_power.slint:42
msgctxt "AuraPowerGroup"
msgid "Awake"
msgstr ""
#: rog-control-center/ui/widgets/aura_power.slint:52
msgctxt "AuraPowerGroup"
msgid "Sleep"
msgstr ""
#: rog-control-center/ui/widgets/aura_power.slint:62
msgctxt "AuraPowerGroup"
msgid "Shutdown"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:45
msgctxt "Aura power zone"
msgid "Logo"
@@ -612,6 +597,26 @@ msgctxt "Aura speed"
msgid "High"
msgstr ""
#: rog-control-center/ui/widgets/aura_power.slint:32
msgctxt "AuraPowerGroup"
msgid "Boot"
msgstr ""
#: rog-control-center/ui/widgets/aura_power.slint:42
msgctxt "AuraPowerGroup"
msgid "Awake"
msgstr ""
#: rog-control-center/ui/widgets/aura_power.slint:52
msgctxt "AuraPowerGroup"
msgid "Sleep"
msgstr ""
#: rog-control-center/ui/widgets/aura_power.slint:62
msgctxt "AuraPowerGroup"
msgid "Shutdown"
msgstr ""
#: rog-control-center/ui/main_window.slint:50
msgctxt "MainWindow"
msgid "ROG"

View File

@@ -3,7 +3,7 @@ import { Palette, Button, ComboBox, VerticalBox, GroupBox } from "std-widgets.sl
import { StyleMetrics, Slider, HorizontalBox, TextEdit, SpinBox, LineEdit, ScrollView } from "std-widgets.slint";
import { ColourSlider } from "../widgets/colour_picker.slint";
import { AuraPageData, AuraDevType, PowerZones, LaptopAuraPower, AuraEffect } from "../types/aura_types.slint";
import { AuraPowerGroup } from "../widgets/aura_power.slint";
import { AuraPowerGroup, AuraPowerGroupOld } from "../widgets/aura_power.slint";
export component PageAura inherits Rectangle {
property <bool> show_fade_cover: false;
@@ -192,8 +192,6 @@ export component PageAura inherits Rectangle {
}
if root.show_fade_cover: Rectangle {
width: 100%;
height: 100%;
background: Palette.background;
opacity: 0.8;
TouchArea {
@@ -203,7 +201,7 @@ export component PageAura inherits Rectangle {
}
}
if root.show_aura_power && AuraPageData.aura_type == AuraDevType.New: Rectangle {
if root.show_aura_power && AuraPageData.device_type == AuraDevType.New: Rectangle {
width: 100%;
height: 100%;
opacity: 1;
@@ -217,7 +215,7 @@ export component PageAura inherits Rectangle {
for state[idx] in AuraPageData.led_power.states: zone := AuraPowerGroup {
group-title: AuraPageData.power_zone_names[state.zone_name_idx];
// TODO: use the zone name
boot_checked: state.boot;
boot_checked: state.boot;
boot_toggled => {
AuraPageData.led_power.states[idx].boot = zone.boot_checked;
AuraPageData.set_led_power(AuraPageData.led_power);
@@ -252,4 +250,57 @@ export component PageAura inherits Rectangle {
}
}
}
if root.show_aura_power && AuraPageData.device_type == AuraDevType.Old: Rectangle {
width: 100%;
height: 100%;
opacity: 1;
ScrollView {
VerticalLayout {
padding: 30px;
padding-top: 10px;
spacing: 10px;
alignment: LayoutAlignment.start;
Text {
text: "TODO: In progress";
}
for state[idx] in AuraPageData.led_power.states: old_zone := AuraPowerGroupOld {
group-title: @tr("Power Zones");
zone_strings <=> AuraPageData.power_zone_names;
selected_zone => {
AuraPageData.led_power.states[idx].zone = AuraPageData.supported_power_zones[old_zone.current_zone];
AuraPageData.set_led_power(AuraPageData.led_power);
}
boot_checked: state.boot;
boot_toggled => {
AuraPageData.led_power.states[idx].boot = old_zone.boot_checked;
AuraPageData.set_led_power(AuraPageData.led_power);
}
awake_checked: state.awake;
awake_toggled => {
AuraPageData.led_power.states[idx].awake = old_zone.awake_checked;
AuraPageData.set_led_power(AuraPageData.led_power);
}
sleep_checked: state.sleep;
sleep_toggled => {
AuraPageData.led_power.states[idx].sleep = old_zone.sleep_checked;
AuraPageData.set_led_power(AuraPageData.led_power);
}
}
}
Button {
x: root.width - self.width - 6px;
y: 6px;
text: "X";
height: 40px;
clicked => {
root.show_aura_power = false;
root.show_fade_cover = false;
}
}
}
}
}

View File

@@ -2,6 +2,8 @@ export enum AuraDevType {
New,
Old,
Tuf,
ScsiExtDisk,
Unknown,
}
export struct AuraEffect {
@@ -25,6 +27,7 @@ export enum PowerZones {
Lightbar,
Lid,
RearGlow,
KeyboardAndLightbar,
}
export struct AuraPowerState {
@@ -41,6 +44,7 @@ export struct LaptopAuraPower {
}
export global AuraPageData {
// The ordering must match the rog-aura crate
in-out property <[string]> power_zone_names: [
@tr("Aura power zone" => "Logo"),
@tr("Aura power zone" => "Keyboard"),
@@ -134,13 +138,15 @@ export global AuraPageData {
}
callback set_hex_from_colour(color) -> string;
callback set_hex_to_colour(string) -> color;
in-out property <AuraDevType> aura_type: AuraDevType.New;
in-out property <AuraDevType> device_type: AuraDevType.New;
// List of indexes to power_zone_names. Must correspond to rog-aura crate
in-out property <[PowerZones]> supported_power_zones: [
PowerZones.Keyboard,
PowerZones.RearGlow,
PowerZones.Lid,
PowerZones.Lightbar,
PowerZones.Logo
PowerZones.Logo,
PowerZones.KeyboardAndLightbar,
];
in-out property <LaptopAuraPower> led_power: {
states: [{

View File

@@ -1,5 +1,6 @@
import { Palette, VerticalBox, HorizontalBox, GroupBox } from "std-widgets.slint";
import { SystemToggleVert } from "common.slint";
import { SystemToggleVert, SystemDropdown } from "common.slint";
import { PowerZones } from "../types/aura_types.slint";
export component AuraPowerGroup inherits Rectangle {
min-width: row.min-width;
@@ -68,3 +69,74 @@ export component AuraPowerGroup inherits Rectangle {
}
}
}
export component AuraPowerGroupOld inherits Rectangle {
min-width: row.min-width;
border-radius: 20px;
background: Palette.alternate-background;
opacity: 0.9;
in-out property <int> current_zone;
in-out property <[int]> zones;
in-out property <[string]> zone_strings;
in-out property <string> group-title;
in-out property <bool> boot_checked;
in-out property <bool> awake_checked;
in-out property <bool> sleep_checked;
callback boot_toggled(bool);
callback awake_toggled(bool);
callback sleep_toggled(bool);
callback selected_zone(int);
VerticalBox {
spacing: 10px;
Text {
font-size: 18px;
color: Palette.alternate-foreground;
horizontal-alignment: TextHorizontalAlignment.center;
text <=> root.group-title;
}
row := HorizontalBox {
alignment: LayoutAlignment.center;
SystemDropdown {
text: @tr("Zone Selection");
current_index <=> root.current_zone;
current_value: root.zone_strings[root.current_zone];
model <=> root.zone_strings;
selected => {
root.selected_zone(root.current_zone);
}
}
SystemToggleVert {
min-width: 96px;
max-height: 42px;
text: @tr("Boot");
checked <=> root.boot_checked;
toggled => {
root.boot_toggled(self.checked);
}
}
SystemToggleVert {
min-width: 96px;
max-height: 42px;
text: @tr("Awake");
checked <=> root.awake_checked;
toggled => {
root.awake_toggled(self.checked);
}
}
SystemToggleVert {
min-width: 96px;
max-height: 42px;
text: @tr("Sleep");
checked <=> root.sleep_checked;
toggled => {
root.sleep_toggled(self.checked);
}
}
}
}
}