mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 14bf07ba79 | |||
| e76d01eaed | |||
| 072a066f28 | |||
| 165c6f8ab3 | |||
| 5728a9af62 | |||
| 17a880b2c5 | |||
| 6ba9b9d75d | |||
| eb1f6c83ce | |||
| af653ea405 | |||
| bc13891cdf | |||
| aad4dc909e | |||
| ad79adcbfa | |||
| 73b1a7050a | |||
| 762bfea102 | |||
| b41fdf5cfe | |||
| bf13ebebd3 | |||
| 3a73e3a526 |
+1
-2
@@ -1,7 +1,7 @@
|
||||
image: rust:latest
|
||||
|
||||
before_script:
|
||||
- apt-get update -qq && apt-get install -y -qq libdbus-1-dev libclang-dev libudev-dev libfontconfig1-dev
|
||||
- apt-get update -qq && apt-get install -y -qq libudev-dev libgtk-3-dev
|
||||
|
||||
stages:
|
||||
- test
|
||||
@@ -26,4 +26,3 @@ build:
|
||||
|
||||
variables:
|
||||
GIT_SUBMODULE_STRATEGY: normal
|
||||
|
||||
|
||||
+7
-1
@@ -5,13 +5,19 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
## [v4.5.1- RC1]
|
||||
## [v4.5.2]
|
||||
### Changed
|
||||
- Update dependencies and bump version
|
||||
|
||||
## [v4.5.1]
|
||||
### Added
|
||||
- Support for FA506IE LED modes (Author: Herohtar)
|
||||
### Changed
|
||||
- Add a basic system tray with dGPU status and gpu mode switch actions
|
||||
- Fixup some notifications in ROGCC
|
||||
- Add config options for notifications for ROGCC
|
||||
- Share states with tray process in ROGCC
|
||||
- Share tates with tray process in ROGCC
|
||||
|
||||
## [v4.5.0]
|
||||
### Added
|
||||
|
||||
Generated
+88
-124
@@ -26,9 +26,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
||||
|
||||
[[package]]
|
||||
name = "ahash"
|
||||
version = "0.8.1"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "464b3811b747f8f7ebc8849c9c728c39f6ac98a055edad93baf9eb330e3f8f9d"
|
||||
checksum = "bf6ccdb167abbf410dcb915cabd428929d7f6a04980b54a11f26a39f1c7f7107"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"getrandom",
|
||||
@@ -38,9 +38,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "0.7.19"
|
||||
version = "0.7.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e"
|
||||
checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
@@ -83,7 +83,7 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
|
||||
|
||||
[[package]]
|
||||
name = "asusctl"
|
||||
version = "4.5.1-RC1"
|
||||
version = "4.5.2"
|
||||
dependencies = [
|
||||
"daemon",
|
||||
"gif",
|
||||
@@ -112,11 +112,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "async-channel"
|
||||
version = "1.7.1"
|
||||
version = "1.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e14485364214912d3b19cc3435dde4df66065127f05fa0d75c712f36f12c2f28"
|
||||
checksum = "cf46fee83e5ccffc220104713af3292ff9bc7c64c7de289f66dae8e38d826833"
|
||||
dependencies = [
|
||||
"concurrent-queue 1.2.4",
|
||||
"concurrent-queue",
|
||||
"event-listener",
|
||||
"futures-core",
|
||||
]
|
||||
@@ -129,7 +129,7 @@ checksum = "17adb73da160dfb475c183343c8cccd80721ea5a605d3eb57125f0a7b7a92d0b"
|
||||
dependencies = [
|
||||
"async-lock",
|
||||
"async-task",
|
||||
"concurrent-queue 2.0.0",
|
||||
"concurrent-queue",
|
||||
"fastrand",
|
||||
"futures-lite",
|
||||
"slab",
|
||||
@@ -149,13 +149,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "async-io"
|
||||
version = "1.10.0"
|
||||
version = "1.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e8121296a9f05be7f34aa4196b1747243b3b62e048bb7906f644f3fbfc490cf7"
|
||||
checksum = "8c374dda1ed3e7d8f0d9ba58715f924862c63eae6849c92d3a18e7fbde9e2794"
|
||||
dependencies = [
|
||||
"async-lock",
|
||||
"autocfg",
|
||||
"concurrent-queue 1.2.4",
|
||||
"concurrent-queue",
|
||||
"futures-lite",
|
||||
"libc",
|
||||
"log",
|
||||
@@ -164,7 +164,7 @@ dependencies = [
|
||||
"slab",
|
||||
"socket2",
|
||||
"waker-fn",
|
||||
"winapi",
|
||||
"windows-sys 0.42.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -191,20 +191,20 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "async-process"
|
||||
version = "1.5.0"
|
||||
version = "1.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "02111fd8655a613c25069ea89fc8d9bb89331fa77486eb3bc059ee757cfa481c"
|
||||
checksum = "6381ead98388605d0d9ff86371043b5aa922a3905824244de40dc263a14fcba4"
|
||||
dependencies = [
|
||||
"async-io",
|
||||
"async-lock",
|
||||
"autocfg",
|
||||
"blocking",
|
||||
"cfg-if",
|
||||
"event-listener",
|
||||
"futures-lite",
|
||||
"libc",
|
||||
"once_cell",
|
||||
"signal-hook",
|
||||
"winapi",
|
||||
"windows-sys 0.42.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -226,9 +226,9 @@ checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524"
|
||||
|
||||
[[package]]
|
||||
name = "async-trait"
|
||||
version = "0.1.58"
|
||||
version = "0.1.59"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e805d94e6b5001b651426cf4cd446b1ab5f319d27bab5c644f61de0a804360c"
|
||||
checksum = "31e6e93155431f3931513b243d371981bb2770112b370c82745a1d19d2f99364"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -317,16 +317,16 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "blocking"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c6ccb65d468978a086b69884437ded69a90faab3bbe6e67f242173ea728acccc"
|
||||
checksum = "3c67b173a56acffd6d2326fb7ab938ba0b00a71480e14902b2591c87bc5741e8"
|
||||
dependencies = [
|
||||
"async-channel",
|
||||
"async-lock",
|
||||
"async-task",
|
||||
"atomic-waker",
|
||||
"fastrand",
|
||||
"futures-lite",
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -363,15 +363,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
|
||||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "1.2.1"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db"
|
||||
|
||||
[[package]]
|
||||
name = "cache-padded"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c"
|
||||
checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c"
|
||||
|
||||
[[package]]
|
||||
name = "cairo-rs"
|
||||
@@ -399,12 +393,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "calloop"
|
||||
version = "0.10.2"
|
||||
version = "0.10.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "595eb0438b3c6d262395fe30e6de9a61beb57ea56290b00a07f227fe6e20cbf2"
|
||||
checksum = "5bcf530afb40e45e14440701e5e996d7fd139e84a912a4d83a8d6a0fb3e58663"
|
||||
dependencies = [
|
||||
"log",
|
||||
"nix 0.24.2",
|
||||
"nix 0.25.0",
|
||||
"slotmap",
|
||||
"thiserror",
|
||||
"vec_map",
|
||||
@@ -412,9 +406,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.76"
|
||||
version = "1.0.77"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "76a284da2e6fe2092f2353e51713435363112dfd60030e22add80be333fb928f"
|
||||
checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4"
|
||||
|
||||
[[package]]
|
||||
name = "cesu8"
|
||||
@@ -523,15 +517,6 @@ dependencies = [
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "concurrent-queue"
|
||||
version = "1.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af4780a44ab5696ea9e28294517f1fffb421a83a25af521333c838635509db9c"
|
||||
dependencies = [
|
||||
"cache-padded",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "concurrent-queue"
|
||||
version = "2.0.0"
|
||||
@@ -614,9 +599,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.12"
|
||||
version = "0.8.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac"
|
||||
checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
@@ -662,7 +647,7 @@ checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35"
|
||||
|
||||
[[package]]
|
||||
name = "daemon"
|
||||
version = "4.5.1-RC1"
|
||||
version = "4.5.2"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"concat-idents",
|
||||
@@ -681,12 +666,11 @@ dependencies = [
|
||||
"tokio",
|
||||
"toml",
|
||||
"zbus",
|
||||
"zvariant",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "daemon-user"
|
||||
version = "4.5.1-RC1"
|
||||
version = "4.5.2"
|
||||
dependencies = [
|
||||
"dirs",
|
||||
"rog_anime",
|
||||
@@ -698,8 +682,6 @@ dependencies = [
|
||||
"serde_json",
|
||||
"smol",
|
||||
"zbus",
|
||||
"zvariant",
|
||||
"zvariant_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -750,9 +732,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "digest"
|
||||
version = "0.10.5"
|
||||
version = "0.10.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c"
|
||||
checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f"
|
||||
dependencies = [
|
||||
"block-buffer",
|
||||
"crypto-common",
|
||||
@@ -1020,12 +1002,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "flate2"
|
||||
version = "1.0.24"
|
||||
version = "1.0.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6"
|
||||
checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841"
|
||||
dependencies = [
|
||||
"crc32fast",
|
||||
"miniz_oxide 0.5.4",
|
||||
"miniz_oxide 0.6.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1765,13 +1747,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "logind-zbus"
|
||||
version = "3.0.2"
|
||||
version = "3.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1c2bd5667a34b046e66f21ac2c016b1f4b41318423f9282b4e04f755ad947817"
|
||||
checksum = "214b1739f5cf1b467329c1a7b42e9b142aee6dce3f38a86cf902b5b6ac1b55b3"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"zbus",
|
||||
"zvariant",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1842,15 +1823,6 @@ dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.5.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "96590ba8f175222643a85693f33d26e9c8a015f599c216509b1a6894af675d34"
|
||||
dependencies = [
|
||||
"adler",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.6.2"
|
||||
@@ -1923,9 +1895,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ndk-sys"
|
||||
version = "0.4.0"
|
||||
version = "0.4.1+23.1.7779620"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "21d83ec9c63ec5bf950200a8e508bdad6659972187b625469f58ef8c08e29046"
|
||||
checksum = "3cf2aae958bd232cac5069850591667ad422d263686d75b52a065f9badeee5a3"
|
||||
dependencies = [
|
||||
"jni-sys",
|
||||
]
|
||||
@@ -1984,15 +1956,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "notify-rust"
|
||||
version = "4.5.11"
|
||||
source = "git+https://github.com/flukejones/notify-rust.git#6033d06377d6d601207ae31861cda560d03a9aa8"
|
||||
version = "4.6.0"
|
||||
source = "git+https://github.com/flukejones/notify-rust.git#c83082a2549932bde52a4ec449b9981fc39e9a0d"
|
||||
dependencies = [
|
||||
"mac-notification-sys",
|
||||
"serde",
|
||||
"tauri-winrt-notification",
|
||||
"zbus",
|
||||
"zvariant",
|
||||
"zvariant_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2097,9 +2067,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "owned_ttf_parser"
|
||||
version = "0.17.0"
|
||||
version = "0.17.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4665508572151759e8d60404e20dc096ef93a99801a05ac2ac6e43bf5b4ca187"
|
||||
checksum = "18904d3c65493a9f0d7542293d1a7f69bfdc309a6b9ef4f46dc3e58b0577edc5"
|
||||
dependencies = [
|
||||
"ttf-parser",
|
||||
]
|
||||
@@ -2147,9 +2117,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot_core"
|
||||
version = "0.9.4"
|
||||
version = "0.9.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0"
|
||||
checksum = "7ff9f3fef3968a3ec5945535ed654cb38ff72d7495a25619e2247fb15a2ed9ba"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
@@ -2166,9 +2136,9 @@ checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"
|
||||
|
||||
[[package]]
|
||||
name = "pest"
|
||||
version = "2.4.1"
|
||||
version = "2.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a528564cc62c19a7acac4d81e01f39e53e25e17b934878f4c6d25cc2836e62f8"
|
||||
checksum = "5f400b0f7905bf702f9f3dc3df5a121b16c54e9e8012c082905fdf09a931861a"
|
||||
dependencies = [
|
||||
"thiserror",
|
||||
"ucd-trie",
|
||||
@@ -2222,16 +2192,16 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "polling"
|
||||
version = "2.4.0"
|
||||
version = "2.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ab4609a838d88b73d8238967b60dd115cc08d38e2bbaf51ee1e4b695f89122e2"
|
||||
checksum = "166ca89eb77fd403230b9c156612965a81e094ec6ec3aa13663d4c8b113fa748"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"log",
|
||||
"wepoll-ffi",
|
||||
"winapi",
|
||||
"windows-sys 0.42.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2398,7 +2368,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog-control-center"
|
||||
version = "4.5.1-RC1"
|
||||
version = "4.5.2"
|
||||
dependencies = [
|
||||
"daemon",
|
||||
"dirs",
|
||||
@@ -2428,7 +2398,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_anime"
|
||||
version = "4.5.1-RC1"
|
||||
version = "4.5.2"
|
||||
dependencies = [
|
||||
"gif",
|
||||
"glam",
|
||||
@@ -2439,36 +2409,33 @@ dependencies = [
|
||||
"serde_derive",
|
||||
"sysfs-class",
|
||||
"zbus",
|
||||
"zvariant",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rog_aura"
|
||||
version = "4.5.1-RC1"
|
||||
version = "4.5.2"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"toml",
|
||||
"zvariant",
|
||||
"zbus",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rog_dbus"
|
||||
version = "4.5.1-RC1"
|
||||
version = "4.5.2"
|
||||
dependencies = [
|
||||
"rog_anime",
|
||||
"rog_aura",
|
||||
"rog_platform",
|
||||
"rog_profiles",
|
||||
"zbus",
|
||||
"zbus_macros",
|
||||
"zvariant",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rog_platform"
|
||||
version = "4.5.1-RC1"
|
||||
version = "4.5.2"
|
||||
dependencies = [
|
||||
"concat-idents",
|
||||
"inotify",
|
||||
@@ -2479,19 +2446,17 @@ dependencies = [
|
||||
"serde_derive",
|
||||
"sysfs-class",
|
||||
"udev",
|
||||
"zvariant",
|
||||
"zvariant_derive",
|
||||
"zbus",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rog_profiles"
|
||||
version = "4.5.1-RC1"
|
||||
version = "4.5.2"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"udev",
|
||||
"zvariant",
|
||||
"zvariant_derive",
|
||||
"zbus",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2581,18 +2546,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.147"
|
||||
version = "1.0.148"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965"
|
||||
checksum = "e53f64bb4ba0191d6d0676e1b141ca55047d83b74f5607e6d8eb88126c52c2dc"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.147"
|
||||
version = "1.0.148"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852"
|
||||
checksum = "a55492425aa53521babf6137309e7d34c20bbfbbfcfe2c7f3a047fd1f6b92c0c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -2601,9 +2566,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.87"
|
||||
version = "1.0.89"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45"
|
||||
checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
@@ -2737,9 +2702,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "smol"
|
||||
version = "1.2.5"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85cf3b5351f3e783c1d79ab5fc604eeed8b8ae9abd36b166e8b87a089efd85e4"
|
||||
checksum = "13f2b548cd8447f8de0fdf1c592929f70f4fc7039a05e47404b0d096ec6987a1"
|
||||
dependencies = [
|
||||
"async-channel",
|
||||
"async-executor",
|
||||
@@ -2750,7 +2715,6 @@ dependencies = [
|
||||
"async-process",
|
||||
"blocking",
|
||||
"futures-lite",
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2821,9 +2785,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.103"
|
||||
version = "1.0.104"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d"
|
||||
checksum = "4ae548ec36cf198c0ef7710d3c230987c2d6d7bd98ad6edc0274462724c585ce"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -2974,9 +2938,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.21.2"
|
||||
version = "1.22.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a9e03c497dc955702ba729190dc4aac6f2a0ce97f913e5b1b5912fc5039d9099"
|
||||
checksum = "d76ce4a75fb488c605c54bf610f221cea8b0dafb53333c1a67e8ee199dcd2ae3"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"libc",
|
||||
@@ -2990,9 +2954,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tokio-macros"
|
||||
version = "1.8.0"
|
||||
version = "1.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484"
|
||||
checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -3587,9 +3551,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "x11-dl"
|
||||
version = "2.20.0"
|
||||
version = "2.20.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0c83627bc137605acc00bb399c7b908ef460b621fc37c953db2b09f88c449ea6"
|
||||
checksum = "b1536d6965a5d4e573c7ef73a2c15ebcd0b2de3347bdf526c34c297c00ac40f0"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"libc",
|
||||
@@ -3635,9 +3599,9 @@ checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3"
|
||||
|
||||
[[package]]
|
||||
name = "zbus"
|
||||
version = "3.4.0"
|
||||
version = "3.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "78a0b85c5608c27d2306d67e955b9c6e23a42d824205c85038a7afbe19c0ae22"
|
||||
checksum = "a25ae891bd547674b368906552115143031c16c23a0f2f4b2f5f5436ab2e6a9f"
|
||||
dependencies = [
|
||||
"async-broadcast",
|
||||
"async-channel",
|
||||
@@ -3674,9 +3638,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zbus_macros"
|
||||
version = "3.4.0"
|
||||
version = "3.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b18018648e7e10ed856809befe7309002b87b2b12d5b282cb5040d7974b58677"
|
||||
checksum = "8aa37701ce7b3a43632d2b0ad9d4aef602b46be6bdd7fba3b7c5007f9f6eb2c2"
|
||||
dependencies = [
|
||||
"proc-macro-crate",
|
||||
"proc-macro2",
|
||||
@@ -3687,9 +3651,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zbus_names"
|
||||
version = "2.2.0"
|
||||
version = "2.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41a408fd8a352695690f53906dc7fd036be924ec51ea5e05666ff42685ed0af5"
|
||||
checksum = "d69bb79b44e1901ed8b217e485d0f01991aec574479b68cb03415f142bc7ae67"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"static_assertions",
|
||||
@@ -3698,9 +3662,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zvariant"
|
||||
version = "3.7.1"
|
||||
version = "3.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b794fb7f59af4105697b0449ba31731ee5dbb3e773a17dbdf3d36206ea1b1644"
|
||||
checksum = "5c817f416f05fcbc833902f1e6064b72b1778573978cfeac54731451ccc9e207"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"enumflags2",
|
||||
@@ -3712,9 +3676,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zvariant_derive"
|
||||
version = "3.7.1"
|
||||
version = "3.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd58d4b6c8e26d3dd2149c8c40c6613ef6451b9885ff1296d1ac86c388351a54"
|
||||
checksum = "fdd24fffd02794a76eb10109de463444064c88f5adb9e9d1a78488adc332bfef"
|
||||
dependencies = [
|
||||
"proc-macro-crate",
|
||||
"proc-macro2",
|
||||
|
||||
+3
-6
@@ -2,7 +2,7 @@
|
||||
members = ["asusctl", "daemon", "daemon-user", "rog-platform", "rog-dbus", "rog-anime", "rog-aura", "rog-profiles", "rog-control-center"]
|
||||
|
||||
[workspace.package]
|
||||
version = "4.5.1-RC1"
|
||||
version = "4.5.2"
|
||||
|
||||
[workspace.dependencies]
|
||||
async-trait = "^0.1"
|
||||
@@ -11,11 +11,8 @@ concat-idents = "^1.1"
|
||||
dirs = "^4.0"
|
||||
smol = "^1.2"
|
||||
|
||||
zbus = "^3.4"
|
||||
zbus_macros = "^3.4"
|
||||
zvariant = "^3.7"
|
||||
zvariant_derive = "^3.7"
|
||||
logind-zbus = { version = "^3.0" } #, default-features = false, features = ["non_blocking"] }
|
||||
zbus = "^3.5"
|
||||
logind-zbus = { version = "^3.0.3" } #, default-features = false, features = ["non_blocking"] }
|
||||
|
||||
serde = "^1.0"
|
||||
serde_derive = "^1.0"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
[](https://www.paypal.com/donate/?hosted_button_id=4V2DEPS7K6APC) - [Asus Linux Website](https://asus-linux.org/)
|
||||
|
||||
**WARNING:** Do not run the main branch of this repo unless you have all the asus-wmi kernel patches. You should use stable kernels + tagged releases.
|
||||
**WARNING:** Many features are developed in tandem with kernel patches. If you see a feature is missing you either need a patched kernel, or v6.1 which has all my work merged upstream.
|
||||
|
||||
`asusd` is a utility for Linux to control many aspects of various ASUS laptops
|
||||
but can also be used with non-asus laptops with reduced features.
|
||||
@@ -81,7 +81,7 @@ Requirements are rust >= 1.57 installed from rustup.io if the distro provided ve
|
||||
|
||||
**fedora:**
|
||||
|
||||
dnf install cmake clang-devel systemd-devel gtk3-devel
|
||||
dnf install cmake clang-devel systemd-devel gtk3-devel cargo
|
||||
make
|
||||
sudo make install
|
||||
|
||||
|
||||
@@ -539,7 +539,6 @@ fn handle_led_power_1_do_tuf(
|
||||
x19b6: vec![],
|
||||
tuf: enabled,
|
||||
};
|
||||
dbg!(&data);
|
||||
dbus.proxies().led().set_leds_power(data, true)?;
|
||||
|
||||
let data = AuraPowerDev {
|
||||
|
||||
@@ -27,6 +27,4 @@ rog_aura = { path = "../rog-aura" }
|
||||
rog_dbus = { path = "../rog-dbus" }
|
||||
rog_platform = { path = "../rog-platform" }
|
||||
|
||||
zbus.workspace = true
|
||||
zvariant.workspace = true
|
||||
zvariant_derive.workspace = true
|
||||
zbus.workspace = true
|
||||
@@ -11,9 +11,10 @@ use std::{
|
||||
},
|
||||
};
|
||||
use std::{sync::Arc, thread::sleep, time::Instant};
|
||||
use zbus::dbus_interface;
|
||||
use zvariant::ObjectPath;
|
||||
use zvariant_derive::Type;
|
||||
use zbus::{
|
||||
dbus_interface,
|
||||
zvariant::{ObjectPath, Type},
|
||||
};
|
||||
|
||||
use crate::user_config::ConfigLoadSave;
|
||||
use crate::{error::Error, user_config::UserAnimeConfig};
|
||||
|
||||
@@ -32,7 +32,6 @@ log.workspace = true
|
||||
env_logger.workspace = true
|
||||
|
||||
zbus.workspace = true
|
||||
zvariant.workspace = true
|
||||
logind-zbus.workspace = true
|
||||
|
||||
# serialisation
|
||||
|
||||
@@ -145,7 +145,7 @@ impl AnimeConfig {
|
||||
.read(true)
|
||||
.write(true)
|
||||
.create(true)
|
||||
.open(&ANIME_CONFIG_PATH)
|
||||
.open(ANIME_CONFIG_PATH)
|
||||
.unwrap_or_else(|_| {
|
||||
panic!(
|
||||
"The file {} or directory /etc/asusd/ is missing",
|
||||
@@ -249,7 +249,7 @@ impl AnimeConfig {
|
||||
pub fn read(&mut self) {
|
||||
let mut file = OpenOptions::new()
|
||||
.read(true)
|
||||
.open(&ANIME_CONFIG_PATH)
|
||||
.open(ANIME_CONFIG_PATH)
|
||||
.unwrap_or_else(|err| panic!("Error reading {}: {}", ANIME_CONFIG_PATH, err));
|
||||
let mut buf = String::new();
|
||||
if let Ok(l) = file.read_to_string(&mut buf) {
|
||||
|
||||
@@ -192,7 +192,7 @@ impl AuraConfig {
|
||||
.read(true)
|
||||
.write(true)
|
||||
.create(true)
|
||||
.open(&AURA_CONFIG_PATH)
|
||||
.open(AURA_CONFIG_PATH)
|
||||
.unwrap_or_else(|_| {
|
||||
panic!(
|
||||
"The file {} or directory /etc/asusd/ is missing",
|
||||
@@ -264,7 +264,7 @@ impl AuraConfig {
|
||||
pub fn read(&mut self) {
|
||||
let mut file = OpenOptions::new()
|
||||
.read(true)
|
||||
.open(&AURA_CONFIG_PATH)
|
||||
.open(AURA_CONFIG_PATH)
|
||||
.unwrap_or_else(|err| panic!("Error reading {}: {}", AURA_CONFIG_PATH, err));
|
||||
let mut buf = String::new();
|
||||
if let Ok(l) = file.read_to_string(&mut buf) {
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
use async_trait::async_trait;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use zbus::dbus_interface;
|
||||
use zbus::Connection;
|
||||
use zvariant::Type;
|
||||
use zbus::{dbus_interface, zvariant::Type, Connection};
|
||||
|
||||
use crate::{
|
||||
ctrl_anime::CtrlAnime, ctrl_aura::controller::CtrlKbdLed, ctrl_platform::CtrlPlatform,
|
||||
|
||||
+1
-3
@@ -25,8 +25,7 @@ use crate::error::RogError;
|
||||
use async_trait::async_trait;
|
||||
use log::warn;
|
||||
use logind_zbus::manager::ManagerProxy;
|
||||
use zbus::{export::futures_util::StreamExt, Connection, SignalContext};
|
||||
use zvariant::ObjectPath;
|
||||
use zbus::{export::futures_util::StreamExt, zvariant::ObjectPath, Connection, SignalContext};
|
||||
|
||||
/// This macro adds a function which spawns an `inotify` task on the passed in `Executor`.
|
||||
///
|
||||
@@ -64,7 +63,6 @@ macro_rules! task_watch_item {
|
||||
let mut buffer = [0; 32];
|
||||
watch.event_stream(&mut buffer).unwrap().for_each(|_| async {
|
||||
let value = ctrl.$name();
|
||||
dbg!(&value);
|
||||
concat_idents::concat_idents!(notif_fn = notify_, $name {
|
||||
Self::notif_fn(&signal_ctxt, value).await.ok();
|
||||
});
|
||||
|
||||
+2
-2
@@ -9,7 +9,7 @@ ENV{DMI_FAMILY}=="*TUF*", GOTO="asusd_start"
|
||||
ENV{DMI_FAMILY}=="*ROG*", GOTO="asusd_start"
|
||||
ENV{DMI_FAMILY}=="*Zephyrus*", GOTO="asusd_start"
|
||||
ENV{DMI_FAMILY}=="*Strix*", GOTO="asusd_start"
|
||||
ENV{DMI_FAMILY}=="*Vivobook*", GOTO="asusd_start"
|
||||
ENV{DMI_FAMILY}=="*Vivo*ook*", GOTO="asusd_start"
|
||||
# No match so
|
||||
GOTO="asusd_end"
|
||||
|
||||
@@ -17,4 +17,4 @@ LABEL="asusd_start"
|
||||
ACTION=="add|change", DRIVER=="asus-nb-wmi", TAG+="systemd", ENV{SYSTEMD_WANTS}="asusd.service"
|
||||
ACTION=="add|remove", DRIVER=="asus-nb-wmi", TAG+="systemd", RUN+="systemctl restart asusd.service"
|
||||
|
||||
LABEL="asusd_end"
|
||||
LABEL="asusd_end"
|
||||
|
||||
@@ -14,7 +14,7 @@ exclude = ["data"]
|
||||
|
||||
[features]
|
||||
default = ["dbus", "detect"]
|
||||
dbus = ["zvariant", "zbus"]
|
||||
dbus = ["zbus"]
|
||||
detect = ["sysfs-class"]
|
||||
|
||||
[dependencies]
|
||||
@@ -28,7 +28,6 @@ serde_derive.workspace = true
|
||||
|
||||
glam.workspace = true
|
||||
|
||||
zvariant = { workspace = true, optional = true }
|
||||
zbus = { workspace = true, optional = true }
|
||||
|
||||
sysfs-class = { workspace = true, optional = true }
|
||||
@@ -7,7 +7,7 @@ use std::{
|
||||
use log::info;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
#[cfg(feature = "dbus")]
|
||||
use zvariant::Type;
|
||||
use zbus::zvariant::Type;
|
||||
|
||||
use crate::{
|
||||
error::{AnimeError, Result},
|
||||
|
||||
+2
-2
@@ -14,13 +14,13 @@ exclude = ["data"]
|
||||
|
||||
[features]
|
||||
default = ["dbus", "toml"]
|
||||
dbus = ["zvariant"]
|
||||
dbus = ["zbus"]
|
||||
|
||||
[dependencies]
|
||||
serde.workspace = true
|
||||
serde_derive.workspace = true
|
||||
toml = { workspace = true, optional = true }
|
||||
zvariant = { workspace = true, optional = true }
|
||||
zbus = { workspace = true, optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
serde_json.workspace = true
|
||||
@@ -5,9 +5,9 @@ pub const LED_INIT4: &str = "^ASUS Tech.Inc."; // ^ == 0x5e
|
||||
pub const LED_INIT5: [u8; 6] = [0x5e, 0x05, 0x20, 0x31, 0, 0x08];
|
||||
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use std::str::FromStr;
|
||||
use std::{fmt::Display, str::FromStr};
|
||||
#[cfg(feature = "dbus")]
|
||||
use zvariant::Type;
|
||||
use zbus::zvariant::Type;
|
||||
|
||||
use crate::{error::Error, LED_MSG_LEN};
|
||||
|
||||
@@ -171,6 +171,12 @@ pub enum AuraModeNum {
|
||||
Flash = 12,
|
||||
}
|
||||
|
||||
impl Display for AuraModeNum {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{}", <&str>::from(self))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<AuraModeNum> for String {
|
||||
fn from(mode: AuraModeNum) -> Self {
|
||||
match mode {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::keys::Key;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
#[cfg(feature = "dbus")]
|
||||
use zvariant::Type;
|
||||
use zbus::zvariant::Type;
|
||||
|
||||
/// Represents the per-key raw USB packets
|
||||
pub type PerKeyRaw = Vec<Vec<u8>>;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
#[cfg(feature = "dbus")]
|
||||
use zvariant::Type;
|
||||
use zbus::zvariant::Type;
|
||||
|
||||
/// Represents the zoned raw USB packets
|
||||
pub type ZonedRaw = Vec<u8>;
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::ops::{BitAnd, BitOr};
|
||||
#[cfg(feature = "dbus")]
|
||||
use zvariant::Type;
|
||||
use zbus::zvariant::Type;
|
||||
|
||||
pub const LED_INIT1: [u8; 2] = [0x5d, 0xb9];
|
||||
pub const LED_INIT2: &str = "]ASUS Tech.Inc."; // ] == 0x5d
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
use std::{
|
||||
f64::consts::PI,
|
||||
io::Write,
|
||||
sync::{
|
||||
atomic::{AtomicBool, AtomicU8, Ordering},
|
||||
mpsc::Receiver,
|
||||
Arc,
|
||||
Arc, Mutex,
|
||||
},
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
@@ -13,17 +11,15 @@ use egui::{Button, RichText};
|
||||
use rog_platform::supported::SupportedFunctions;
|
||||
|
||||
use crate::{
|
||||
config::Config, error::Result, get_ipc_file, page_states::PageDataStates, tray::TrayToApp,
|
||||
Page, RogDbusClientBlocking, SHOW_GUI,
|
||||
config::Config, error::Result, system_state::SystemState, Page, RogDbusClientBlocking,
|
||||
};
|
||||
|
||||
pub struct RogApp<'a> {
|
||||
pub struct RogApp {
|
||||
pub page: Page,
|
||||
pub states: PageDataStates,
|
||||
pub states: Arc<Mutex<SystemState>>,
|
||||
pub supported: SupportedFunctions,
|
||||
// TODO: can probably just open and read whenever
|
||||
pub config: Config,
|
||||
pub asus_dbus: RogDbusClientBlocking<'a>,
|
||||
/// Oscillator in percentage
|
||||
pub oscillator1: Arc<AtomicU8>,
|
||||
pub oscillator2: Arc<AtomicU8>,
|
||||
@@ -32,15 +28,13 @@ pub struct RogApp<'a> {
|
||||
pub oscillator_freq: Arc<AtomicU8>,
|
||||
/// A toggle that toggles true/false when the oscillator reaches 0
|
||||
pub oscillator_toggle: Arc<AtomicBool>,
|
||||
pub app_cmd: Arc<Receiver<TrayToApp>>,
|
||||
}
|
||||
|
||||
impl<'a> RogApp<'a> {
|
||||
impl RogApp {
|
||||
/// Called once before the first frame.
|
||||
pub fn new(
|
||||
config: Config,
|
||||
states: PageDataStates,
|
||||
app_cmd: Arc<Receiver<TrayToApp>>,
|
||||
states: Arc<Mutex<SystemState>>,
|
||||
_cc: &eframe::CreationContext<'_>,
|
||||
) -> Result<Self> {
|
||||
let (dbus, _) = RogDbusClientBlocking::new()?;
|
||||
@@ -60,6 +54,7 @@ impl<'a> RogApp<'a> {
|
||||
let oscillator_freq1 = oscillator_freq.clone();
|
||||
let oscillator_toggle = Arc::new(AtomicBool::new(false));
|
||||
let oscillator_toggle1 = oscillator_toggle.clone();
|
||||
|
||||
std::thread::spawn(move || {
|
||||
let started = Instant::now();
|
||||
let mut toggled = false;
|
||||
@@ -88,6 +83,7 @@ impl<'a> RogApp<'a> {
|
||||
oscillator1_1.store(tmp1, Ordering::SeqCst);
|
||||
oscillator1_2.store(tmp2, Ordering::SeqCst);
|
||||
oscillator1_3.store(tmp3, Ordering::SeqCst);
|
||||
|
||||
std::thread::sleep(Duration::from_millis(33));
|
||||
}
|
||||
});
|
||||
@@ -97,88 +93,72 @@ impl<'a> RogApp<'a> {
|
||||
states,
|
||||
page: Page::System,
|
||||
config,
|
||||
asus_dbus: dbus,
|
||||
oscillator1,
|
||||
oscillator2,
|
||||
oscillator3,
|
||||
oscillator_toggle,
|
||||
oscillator_freq,
|
||||
app_cmd,
|
||||
})
|
||||
}
|
||||
|
||||
fn check_app_cmds(&mut self, _ctx: &egui::Context, _frame: &mut eframe::Frame) {
|
||||
let Self { app_cmd, .. } = self;
|
||||
|
||||
if let Ok(cmd) = app_cmd.try_recv() {
|
||||
match cmd {
|
||||
TrayToApp::Open => {
|
||||
dbg!();
|
||||
get_ipc_file().unwrap().write_all(&[SHOW_GUI]).ok();
|
||||
}
|
||||
TrayToApp::Quit => _frame.close(),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> eframe::App for RogApp<'a> {
|
||||
impl eframe::App for RogApp {
|
||||
/// Called each time the UI needs repainting, which may be many times per second.
|
||||
/// Put your widgets into a `SidePanel`, `TopPanel`, `CentralPanel`, `Window` or `Area`.
|
||||
fn update(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) {
|
||||
self.check_app_cmds(ctx, frame);
|
||||
let states = self.states.clone();
|
||||
|
||||
let Self {
|
||||
supported,
|
||||
asus_dbus: dbus,
|
||||
states,
|
||||
..
|
||||
} = self;
|
||||
|
||||
states
|
||||
.refresh_if_notfied(supported, dbus)
|
||||
.map(|repaint| {
|
||||
if repaint {
|
||||
ctx.request_repaint();
|
||||
}
|
||||
})
|
||||
.map_err(|e| self.states.error = Some(e.to_string()))
|
||||
.ok();
|
||||
if let Ok(mut states) = states.try_lock() {
|
||||
if states.app_should_update {
|
||||
states.app_should_update = false;
|
||||
ctx.request_repaint();
|
||||
}
|
||||
}
|
||||
|
||||
let page = self.page;
|
||||
|
||||
self.top_bar(ctx, frame);
|
||||
self.side_panel(ctx);
|
||||
|
||||
if let Some(err) = self.states.error.clone() {
|
||||
egui::CentralPanel::default().show(ctx, |ui| {
|
||||
ui.heading(RichText::new("Error!").size(28.0));
|
||||
let mut was_error = false;
|
||||
|
||||
ui.centered_and_justified(|ui| {
|
||||
ui.label(RichText::new(format!("The error was: {:?}", err)).size(22.0));
|
||||
});
|
||||
});
|
||||
egui::TopBottomPanel::bottom("error_bar")
|
||||
.default_height(26.0)
|
||||
.show(ctx, |ui| {
|
||||
ui.with_layout(egui::Layout::right_to_left(egui::Align::TOP), |ui| {
|
||||
if ui
|
||||
.add(Button::new(RichText::new("Okay").size(20.0)))
|
||||
.clicked()
|
||||
{
|
||||
self.states.error = None;
|
||||
}
|
||||
if let Ok(mut states) = states.try_lock() {
|
||||
if let Some(err) = states.error.clone() {
|
||||
was_error = true;
|
||||
egui::CentralPanel::default().show(ctx, |ui| {
|
||||
ui.heading(RichText::new("Error!").size(28.0));
|
||||
|
||||
ui.centered_and_justified(|ui| {
|
||||
ui.label(RichText::new(format!("The error was: {:?}", err)).size(22.0));
|
||||
});
|
||||
});
|
||||
} else if page == Page::System {
|
||||
self.system_page(ctx);
|
||||
} else if page == Page::AuraEffects {
|
||||
self.aura_page(ctx);
|
||||
// TODO: Anime page is not complete
|
||||
// } else if page == Page::AnimeMatrix {
|
||||
// self.anime_page(ctx);
|
||||
} else if page == Page::FanCurves {
|
||||
self.fan_curve_page(ctx);
|
||||
egui::TopBottomPanel::bottom("error_bar")
|
||||
.default_height(26.0)
|
||||
.show(ctx, |ui| {
|
||||
ui.with_layout(egui::Layout::right_to_left(egui::Align::TOP), |ui| {
|
||||
if ui
|
||||
.add(Button::new(RichText::new("Okay").size(20.0)))
|
||||
.clicked()
|
||||
{
|
||||
states.error = None;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
if !was_error {
|
||||
if let Ok(mut states) = states.try_lock() {
|
||||
if page == Page::System {
|
||||
self.system_page(&mut states, ctx);
|
||||
} else if page == Page::AuraEffects {
|
||||
self.aura_page(&mut states, ctx);
|
||||
// TODO: Anime page is not complete
|
||||
// } else if page == Page::AnimeMatrix {
|
||||
// self.anime_page(ctx);
|
||||
} else if page == Page::FanCurves {
|
||||
self.fan_curve_page(&mut states, ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use log::{error, info, warn};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use std::{
|
||||
fs::{create_dir, OpenOptions},
|
||||
io::{Read, Write},
|
||||
};
|
||||
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
//use log::{error, info, warn};
|
||||
|
||||
use crate::{error::Error, notify::EnabledNotifications};
|
||||
@@ -34,14 +34,17 @@ impl Default for Config {
|
||||
impl Config {
|
||||
pub fn load() -> Result<Config, Error> {
|
||||
let mut path = if let Some(dir) = dirs::config_dir() {
|
||||
info!("Found XDG config dir {dir:?}");
|
||||
dir
|
||||
} else {
|
||||
error!("Could not get XDG config dir");
|
||||
return Err(Error::XdgVars);
|
||||
};
|
||||
|
||||
path.push(CFG_DIR);
|
||||
if !path.exists() {
|
||||
create_dir(path.clone())?;
|
||||
info!("Created {path:?}");
|
||||
}
|
||||
|
||||
path.push(CFG_FILE_NAME);
|
||||
@@ -56,11 +59,13 @@ impl Config {
|
||||
|
||||
if let Ok(read_len) = file.read_to_string(&mut buf) {
|
||||
if read_len == 0 {
|
||||
warn!("Zero len read of Config file");
|
||||
let default = Config::default();
|
||||
let t = toml::to_string_pretty(&default).unwrap();
|
||||
file.write_all(t.as_bytes())?;
|
||||
return Ok(default);
|
||||
} else if let Ok(data) = toml::from_str::<Config>(&buf) {
|
||||
info!("Loaded config file {path:?}");
|
||||
return Ok(data);
|
||||
}
|
||||
}
|
||||
@@ -77,6 +82,7 @@ impl Config {
|
||||
path.push(CFG_DIR);
|
||||
if !path.exists() {
|
||||
create_dir(path.clone())?;
|
||||
info!("Created {path:?}");
|
||||
}
|
||||
|
||||
path.push(CFG_FILE_NAME);
|
||||
@@ -90,6 +96,7 @@ impl Config {
|
||||
self.enabled_notifications = enabled_notifications.clone();
|
||||
let t = toml::to_string_pretty(&self).unwrap();
|
||||
file.write_all(t.as_bytes())?;
|
||||
info!("Saved config file {path:?}");
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,9 +14,9 @@ pub mod error;
|
||||
#[cfg(feature = "mocking")]
|
||||
pub mod mocking;
|
||||
pub mod notify;
|
||||
pub mod page_states;
|
||||
pub mod pages;
|
||||
pub mod startup_error;
|
||||
pub mod system_state;
|
||||
pub mod tray;
|
||||
pub mod widgets;
|
||||
|
||||
|
||||
@@ -1,21 +1,20 @@
|
||||
use eframe::{IconData, NativeOptions};
|
||||
use log::{error, LevelFilter};
|
||||
use log::{error, info, LevelFilter};
|
||||
use rog_aura::layouts::KeyLayout;
|
||||
use rog_control_center::notify::EnabledNotifications;
|
||||
use rog_control_center::tray::{AppToTray, TrayToApp};
|
||||
use rog_control_center::tray::init_tray;
|
||||
use rog_control_center::{
|
||||
config::Config, error::Result, get_ipc_file, notify::start_notifications, on_tmp_dir_exists,
|
||||
page_states::PageDataStates, print_versions, startup_error::AppErrorShow, tray::init_tray,
|
||||
RogApp, RogDbusClientBlocking, SHOWING_GUI, SHOW_GUI,
|
||||
print_versions, startup_error::AppErrorShow, system_state::SystemState, RogApp,
|
||||
RogDbusClientBlocking, SHOWING_GUI, SHOW_GUI,
|
||||
};
|
||||
use rog_platform::supported::SupportedFunctions;
|
||||
use std::sync::mpsc::{channel, Receiver, Sender};
|
||||
use std::sync::Mutex;
|
||||
use std::{
|
||||
fs::OpenOptions,
|
||||
io::{Read, Write},
|
||||
path::PathBuf,
|
||||
sync::{atomic::AtomicBool, Arc},
|
||||
sync::Arc,
|
||||
};
|
||||
use tokio::runtime::Runtime;
|
||||
|
||||
@@ -73,10 +72,6 @@ fn main() -> Result<()> {
|
||||
}
|
||||
};
|
||||
|
||||
let (send, recv) = channel();
|
||||
let update_tray = Arc::new(Mutex::new(send));
|
||||
let app_cmd = Arc::new(init_tray(supported.clone(), recv));
|
||||
|
||||
// Startup
|
||||
let mut config = Config::load()?;
|
||||
let mut start_closed = config.startup_in_background;
|
||||
@@ -123,21 +118,16 @@ fn main() -> Result<()> {
|
||||
Err(_) => on_tmp_dir_exists().unwrap(),
|
||||
};
|
||||
|
||||
let states = setup_page_state_and_notifs(
|
||||
layout,
|
||||
&dbus,
|
||||
enabled_notifications,
|
||||
update_tray,
|
||||
&supported,
|
||||
)
|
||||
.unwrap();
|
||||
let states = setup_page_state_and_notifs(layout, enabled_notifications, &supported)?;
|
||||
|
||||
init_tray(supported, states.clone());
|
||||
|
||||
loop {
|
||||
if !start_closed {
|
||||
start_app(states.clone(), native_options.clone(), app_cmd.clone())?;
|
||||
start_app(states.clone(), native_options.clone())?;
|
||||
}
|
||||
|
||||
let config = Config::load().unwrap();
|
||||
let config = Config::load()?;
|
||||
if !config.run_in_background {
|
||||
break;
|
||||
}
|
||||
@@ -146,7 +136,7 @@ fn main() -> Result<()> {
|
||||
let mut buf = [0u8; 4];
|
||||
// blocks until it is read, typically the read will happen after a second
|
||||
// process writes to the IPC (so there is data to actually read)
|
||||
if get_ipc_file().unwrap().read(&mut buf).is_ok() && buf[0] == SHOW_GUI {
|
||||
if get_ipc_file()?.read(&mut buf).is_ok() && buf[0] == SHOW_GUI {
|
||||
start_closed = false;
|
||||
continue;
|
||||
}
|
||||
@@ -162,58 +152,27 @@ fn main() -> Result<()> {
|
||||
|
||||
fn setup_page_state_and_notifs(
|
||||
keyboard_layout: KeyLayout,
|
||||
dbus: &RogDbusClientBlocking,
|
||||
enabled_notifications: Arc<Mutex<EnabledNotifications>>,
|
||||
update_tray: Arc<Mutex<Sender<AppToTray>>>,
|
||||
supported: &SupportedFunctions,
|
||||
) -> Result<PageDataStates> {
|
||||
// Cheap method to alert to notifications rather than spinning a thread for each
|
||||
// This is quite different when done in a retained mode app
|
||||
let charge_notified = Arc::new(AtomicBool::new(false));
|
||||
let bios_notified = Arc::new(AtomicBool::new(false));
|
||||
let aura_notified = Arc::new(AtomicBool::new(false));
|
||||
let anime_notified = Arc::new(AtomicBool::new(false));
|
||||
let profiles_notified = Arc::new(AtomicBool::new(false));
|
||||
let fans_notified = Arc::new(AtomicBool::new(false));
|
||||
|
||||
start_notifications(
|
||||
charge_notified.clone(),
|
||||
bios_notified.clone(),
|
||||
aura_notified.clone(),
|
||||
anime_notified.clone(),
|
||||
profiles_notified.clone(),
|
||||
fans_notified.clone(),
|
||||
enabled_notifications.clone(),
|
||||
update_tray,
|
||||
)?;
|
||||
|
||||
PageDataStates::new(
|
||||
) -> Result<Arc<Mutex<SystemState>>> {
|
||||
let page_states = Arc::new(Mutex::new(SystemState::new(
|
||||
keyboard_layout,
|
||||
enabled_notifications,
|
||||
charge_notified,
|
||||
bios_notified,
|
||||
aura_notified,
|
||||
anime_notified,
|
||||
profiles_notified,
|
||||
fans_notified,
|
||||
enabled_notifications.clone(),
|
||||
supported,
|
||||
dbus,
|
||||
)
|
||||
)?));
|
||||
|
||||
start_notifications(page_states.clone(), enabled_notifications)?;
|
||||
|
||||
Ok(page_states)
|
||||
}
|
||||
|
||||
fn start_app(
|
||||
states: PageDataStates,
|
||||
native_options: NativeOptions,
|
||||
app_cmd: Arc<Receiver<TrayToApp>>,
|
||||
) -> Result<()> {
|
||||
let mut ipc_file = get_ipc_file().unwrap();
|
||||
ipc_file.write_all(&[SHOWING_GUI]).unwrap();
|
||||
fn start_app(states: Arc<Mutex<SystemState>>, native_options: NativeOptions) -> Result<()> {
|
||||
let mut ipc_file = get_ipc_file()?;
|
||||
ipc_file.write_all(&[SHOWING_GUI])?;
|
||||
eframe::run_native(
|
||||
"ROG Control Center",
|
||||
native_options,
|
||||
Box::new(move |cc| {
|
||||
Box::new(RogApp::new(Config::load().unwrap(), states, app_cmd, cc).unwrap())
|
||||
}),
|
||||
Box::new(move |cc| Box::new(RogApp::new(Config::load().unwrap(), states, cc).unwrap())),
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
@@ -243,6 +202,7 @@ fn load_icon() -> IconData {
|
||||
rgba = ras.as_u8_slice().to_vec();
|
||||
width = ras.width();
|
||||
height = ras.height();
|
||||
info!("Loaded app icon. Not actually supported in Wayland yet");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use crate::{config::Config, error::Result, tray::AppToTray};
|
||||
use crate::{config::Config, error::Result, system_state::SystemState};
|
||||
use log::{error, info, trace};
|
||||
use notify_rust::{Hint, Notification, NotificationHandle, Urgency};
|
||||
use rog_dbus::{
|
||||
zbus_anime::AnimeProxy, zbus_led::LedProxy, zbus_platform::RogBiosProxy,
|
||||
@@ -10,11 +11,7 @@ use serde::{Deserialize, Serialize};
|
||||
use std::{
|
||||
fmt::Display,
|
||||
process::Command,
|
||||
sync::{
|
||||
atomic::{AtomicBool, Ordering},
|
||||
mpsc::Sender,
|
||||
Arc, Mutex,
|
||||
},
|
||||
sync::{Arc, Mutex},
|
||||
};
|
||||
use supergfxctl::{pci_device::GfxPower, zbus_proxy::DaemonProxy as SuperProxy};
|
||||
use zbus::export::futures_util::{future, StreamExt};
|
||||
@@ -77,33 +74,47 @@ macro_rules! notify {
|
||||
};
|
||||
}
|
||||
|
||||
// TODO: drop the macro and use generics plus closure
|
||||
macro_rules! recv_notif {
|
||||
($proxy:ident,
|
||||
$signal:ident,
|
||||
$was_notified:ident,
|
||||
$last_notif:ident,
|
||||
$notif_enabled:ident,
|
||||
[$($out_arg:ident)+],
|
||||
$page_states:ident,
|
||||
($($args: tt)*),
|
||||
($($out_arg:tt)+),
|
||||
$msg:literal,
|
||||
$notifier:ident) => {
|
||||
|
||||
let last_notif = $last_notif.clone();
|
||||
let notifs_enabled1 = $notif_enabled.clone();
|
||||
let notified = $was_notified.clone();
|
||||
// TODO: make a macro or generic function or something...
|
||||
let page_states1 = $page_states.clone();
|
||||
|
||||
tokio::spawn(async move {
|
||||
let conn = zbus::Connection::system().await.unwrap();
|
||||
let proxy = $proxy::new(&conn).await.unwrap();
|
||||
let conn = zbus::Connection::system().await.map_err(|e| {
|
||||
log::error!("zbus signal: {}: {e}", stringify!($signal));
|
||||
e
|
||||
}).unwrap();
|
||||
let proxy = $proxy::new(&conn).await.map_err(|e| {
|
||||
log::error!("zbus signal: {}: {e}", stringify!($signal));
|
||||
e
|
||||
}).unwrap();
|
||||
if let Ok(mut p) = proxy.$signal().await {
|
||||
info!("Started zbus signal thread: {}", stringify!($signal));
|
||||
while let Some(e) = p.next().await {
|
||||
if let Ok(out) = e.args() {
|
||||
if let Ok(config) = notifs_enabled1.lock() {
|
||||
if config.all_enabled && config.$signal {
|
||||
if let Ok(ref mut lock) = last_notif.try_lock() {
|
||||
notify!($notifier($msg, &out$(.$out_arg)+()), lock);
|
||||
if let Ok(ref mut lock) = last_notif.lock() {
|
||||
trace!("zbus signal {} locked last_notif", stringify!($signal));
|
||||
notify!($notifier($msg, &out.$($out_arg)+()), lock);
|
||||
}
|
||||
notified.store(true, Ordering::SeqCst);
|
||||
}
|
||||
}
|
||||
if let Ok(mut lock) = page_states1.lock() {
|
||||
lock.$($args)+ = *out.$($out_arg)+();
|
||||
lock.set_notified();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -114,14 +125,8 @@ macro_rules! recv_notif {
|
||||
type SharedHandle = Arc<Mutex<Option<NotificationHandle>>>;
|
||||
|
||||
pub fn start_notifications(
|
||||
charge_notified: Arc<AtomicBool>,
|
||||
bios_notified: Arc<AtomicBool>,
|
||||
aura_notified: Arc<AtomicBool>,
|
||||
anime_notified: Arc<AtomicBool>,
|
||||
profiles_notified: Arc<AtomicBool>,
|
||||
_fans_notified: Arc<AtomicBool>,
|
||||
page_states: Arc<Mutex<SystemState>>,
|
||||
enabled_notifications: Arc<Mutex<EnabledNotifications>>,
|
||||
update_tray: Arc<std::sync::Mutex<Sender<AppToTray>>>,
|
||||
) -> Result<()> {
|
||||
let last_notification: SharedHandle = Arc::new(Mutex::new(None));
|
||||
|
||||
@@ -129,10 +134,11 @@ pub fn start_notifications(
|
||||
recv_notif!(
|
||||
RogBiosProxy,
|
||||
receive_notify_post_boot_sound,
|
||||
bios_notified,
|
||||
last_notification,
|
||||
enabled_notifications,
|
||||
[on],
|
||||
page_states,
|
||||
(bios.post_sound),
|
||||
(on),
|
||||
"BIOS Post sound",
|
||||
do_notification
|
||||
);
|
||||
@@ -140,10 +146,11 @@ pub fn start_notifications(
|
||||
recv_notif!(
|
||||
RogBiosProxy,
|
||||
receive_notify_panel_od,
|
||||
bios_notified,
|
||||
last_notification,
|
||||
enabled_notifications,
|
||||
[overdrive],
|
||||
page_states,
|
||||
(bios.panel_overdrive),
|
||||
(overdrive),
|
||||
"Panel Overdrive enabled:",
|
||||
do_notification
|
||||
);
|
||||
@@ -151,10 +158,11 @@ pub fn start_notifications(
|
||||
recv_notif!(
|
||||
RogBiosProxy,
|
||||
receive_notify_dgpu_disable,
|
||||
bios_notified,
|
||||
last_notification,
|
||||
enabled_notifications,
|
||||
[disable],
|
||||
page_states,
|
||||
(bios.dgpu_disable),
|
||||
(disable),
|
||||
"BIOS dGPU disabled",
|
||||
do_notification
|
||||
);
|
||||
@@ -162,10 +170,11 @@ pub fn start_notifications(
|
||||
recv_notif!(
|
||||
RogBiosProxy,
|
||||
receive_notify_egpu_enable,
|
||||
bios_notified,
|
||||
last_notification,
|
||||
enabled_notifications,
|
||||
[enable],
|
||||
page_states,
|
||||
(bios.egpu_enable),
|
||||
(enable),
|
||||
"BIOS eGPU enabled",
|
||||
do_notification
|
||||
);
|
||||
@@ -173,10 +182,11 @@ pub fn start_notifications(
|
||||
recv_notif!(
|
||||
RogBiosProxy,
|
||||
receive_notify_gpu_mux_mode,
|
||||
bios_notified,
|
||||
last_notification,
|
||||
enabled_notifications,
|
||||
[mode],
|
||||
page_states,
|
||||
(bios.dedicated_gfx),
|
||||
(mode),
|
||||
"Reboot required. BIOS GPU MUX mode set to",
|
||||
do_mux_notification
|
||||
);
|
||||
@@ -185,10 +195,11 @@ pub fn start_notifications(
|
||||
recv_notif!(
|
||||
PowerProxy,
|
||||
receive_notify_charge_control_end_threshold,
|
||||
charge_notified,
|
||||
last_notification,
|
||||
enabled_notifications,
|
||||
[limit],
|
||||
page_states,
|
||||
(power_state.charge_limit),
|
||||
(limit),
|
||||
"Battery charge limit changed to",
|
||||
do_notification
|
||||
);
|
||||
@@ -196,10 +207,11 @@ pub fn start_notifications(
|
||||
recv_notif!(
|
||||
PowerProxy,
|
||||
receive_notify_mains_online,
|
||||
bios_notified,
|
||||
last_notification,
|
||||
enabled_notifications,
|
||||
[on],
|
||||
page_states,
|
||||
(power_state.ac_power),
|
||||
(on),
|
||||
"AC Power power is",
|
||||
ac_power_notification
|
||||
);
|
||||
@@ -208,10 +220,11 @@ pub fn start_notifications(
|
||||
recv_notif!(
|
||||
ProfileProxy,
|
||||
receive_notify_profile,
|
||||
profiles_notified,
|
||||
last_notification,
|
||||
enabled_notifications,
|
||||
[profile],
|
||||
page_states,
|
||||
(profiles.current),
|
||||
(profile),
|
||||
"Profile changed to",
|
||||
do_thermal_notif
|
||||
);
|
||||
@@ -221,32 +234,37 @@ pub fn start_notifications(
|
||||
recv_notif!(
|
||||
LedProxy,
|
||||
receive_notify_led,
|
||||
aura_notified,
|
||||
last_notification,
|
||||
enabled_notifications,
|
||||
[data mode_name],
|
||||
page_states,
|
||||
(aura.current_mode),
|
||||
(data.mode),
|
||||
"Keyboard LED mode changed to",
|
||||
do_notification
|
||||
);
|
||||
|
||||
let page_states1 = page_states.clone();
|
||||
tokio::spawn(async move {
|
||||
let conn = zbus::Connection::system().await.unwrap();
|
||||
let proxy = LedProxy::new(&conn).await.unwrap();
|
||||
if let Ok(p) = proxy.receive_all_signals().await {
|
||||
p.for_each(|_| {
|
||||
aura_notified.store(true, Ordering::SeqCst);
|
||||
future::ready(())
|
||||
let conn = zbus::Connection::system()
|
||||
.await
|
||||
.map_err(|e| {
|
||||
error!("zbus signal: receive_power_states: {e}");
|
||||
e
|
||||
})
|
||||
.await;
|
||||
};
|
||||
});
|
||||
|
||||
tokio::spawn(async move {
|
||||
let conn = zbus::Connection::system().await.unwrap();
|
||||
let proxy = AnimeProxy::new(&conn).await.unwrap();
|
||||
.unwrap();
|
||||
let proxy = AnimeProxy::new(&conn)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
error!("zbus signal: receive_power_states: {e}");
|
||||
e
|
||||
})
|
||||
.unwrap();
|
||||
if let Ok(p) = proxy.receive_power_states().await {
|
||||
info!("Started zbus signal thread: receive_power_states");
|
||||
p.for_each(|_| {
|
||||
anime_notified.store(true, Ordering::SeqCst);
|
||||
if let Ok(_lock) = page_states1.lock() {
|
||||
// TODO: lock.anime.
|
||||
}
|
||||
future::ready(())
|
||||
})
|
||||
.await;
|
||||
@@ -256,10 +274,11 @@ pub fn start_notifications(
|
||||
recv_notif!(
|
||||
SuperProxy,
|
||||
receive_notify_gfx,
|
||||
bios_notified,
|
||||
last_notification,
|
||||
enabled_notifications,
|
||||
[mode],
|
||||
page_states,
|
||||
(gfx_state.mode),
|
||||
(mode),
|
||||
"Gfx mode changed to",
|
||||
do_notification
|
||||
);
|
||||
@@ -275,51 +294,78 @@ pub fn start_notifications(
|
||||
// do_gfx_action_notif
|
||||
// );
|
||||
|
||||
let bios_notified1 = bios_notified.clone();
|
||||
tokio::spawn(async move {
|
||||
let conn = zbus::Connection::system().await.unwrap();
|
||||
let proxy = SuperProxy::new(&conn).await.unwrap();
|
||||
let conn = zbus::Connection::system()
|
||||
.await
|
||||
.map_err(|e| {
|
||||
error!("zbus signal: receive_notify_action: {e}");
|
||||
e
|
||||
})
|
||||
.unwrap();
|
||||
let proxy = SuperProxy::new(&conn)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
error!("zbus signal: receive_notify_action: {e}");
|
||||
e
|
||||
})
|
||||
.unwrap();
|
||||
if let Ok(mut p) = proxy.receive_notify_action().await {
|
||||
info!("Started zbus signal thread: receive_notify_action");
|
||||
while let Some(e) = p.next().await {
|
||||
if let Ok(out) = e.args() {
|
||||
let action = out.action();
|
||||
do_gfx_action_notif("Gfx mode change requires", &format!("{action:?}",))
|
||||
.map_err(|e| {
|
||||
error!("zbus signal: do_gfx_action_notif: {e}");
|
||||
e
|
||||
})
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
bios_notified1.store(true, Ordering::SeqCst);
|
||||
};
|
||||
});
|
||||
|
||||
let notifs_enabled1 = enabled_notifications;
|
||||
let last_notif = last_notification;
|
||||
let bios_notified1 = bios_notified;
|
||||
tokio::spawn(async move {
|
||||
let conn = zbus::Connection::system().await.unwrap();
|
||||
let proxy = SuperProxy::new(&conn).await.unwrap();
|
||||
let conn = zbus::Connection::system()
|
||||
.await
|
||||
.map_err(|e| {
|
||||
error!("zbus signal: receive_notify_gfx_status: {e}");
|
||||
e
|
||||
})
|
||||
.unwrap();
|
||||
let proxy = SuperProxy::new(&conn)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
error!("zbus signal: receive_notify_gfx_status: {e}");
|
||||
e
|
||||
})
|
||||
.unwrap();
|
||||
if let Ok(mut p) = proxy.receive_notify_gfx_status().await {
|
||||
info!("Started zbus signal thread: receive_notify_gfx_status");
|
||||
while let Some(e) = p.next().await {
|
||||
if let Ok(out) = e.args() {
|
||||
let status = out.status();
|
||||
if *status != GfxPower::Unknown {
|
||||
let status = out.status;
|
||||
if status != GfxPower::Unknown {
|
||||
if let Ok(config) = notifs_enabled1.lock() {
|
||||
if config.all_enabled && config.receive_notify_gfx_status {
|
||||
// Required check because status cycles through active/unknown/suspended
|
||||
if let Ok(ref mut lock) = last_notif.try_lock() {
|
||||
if let Ok(ref mut lock) = last_notif.lock() {
|
||||
notify!(
|
||||
do_gpu_status_notif("dGPU status changed:", status),
|
||||
do_gpu_status_notif("dGPU status changed:", &status),
|
||||
lock
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Ok(lock) = update_tray.try_lock() {
|
||||
lock.send(AppToTray::DgpuStatus(*status)).ok();
|
||||
if let Ok(mut lock) = page_states.lock() {
|
||||
lock.gfx_state.power_status = status;
|
||||
lock.set_notified();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
bios_notified1.store(true, Ordering::SeqCst);
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::RogApp;
|
||||
|
||||
impl<'a> RogApp<'a> {
|
||||
impl RogApp {
|
||||
pub fn anime_page(&mut self, ctx: &egui::Context) {
|
||||
egui::CentralPanel::default().show(ctx, |ui| {
|
||||
ui.label("In progress");
|
||||
|
||||
@@ -4,16 +4,15 @@ use egui::Color32;
|
||||
use rog_aura::{AuraEffect, AuraModeNum};
|
||||
|
||||
use crate::{
|
||||
system_state::SystemState,
|
||||
widgets::{aura_modes_group, keyboard},
|
||||
RogApp,
|
||||
};
|
||||
|
||||
impl<'a> RogApp<'a> {
|
||||
pub fn aura_page(&mut self, ctx: &egui::Context) {
|
||||
impl RogApp {
|
||||
pub fn aura_page(&mut self, states: &mut SystemState, ctx: &egui::Context) {
|
||||
let Self {
|
||||
supported,
|
||||
states,
|
||||
asus_dbus: dbus,
|
||||
oscillator1,
|
||||
oscillator2,
|
||||
oscillator3,
|
||||
@@ -26,7 +25,6 @@ impl<'a> RogApp<'a> {
|
||||
let blue = oscillator3.load(Ordering::SeqCst) as u32;
|
||||
states.aura.nudge_wave(red as u8, green as u8, blue as u8);
|
||||
// let osc = c.0 * 255 / osc;
|
||||
// dbg!(osc);
|
||||
let c1 = states
|
||||
.aura
|
||||
.modes
|
||||
@@ -72,7 +70,7 @@ impl<'a> RogApp<'a> {
|
||||
|
||||
// TODO: animation of colour changes/periods/blending
|
||||
egui::CentralPanel::default().show(ctx, |ui| {
|
||||
aura_modes_group(supported, states, oscillator_freq, dbus, ui);
|
||||
aura_modes_group(supported, states, oscillator_freq, ui);
|
||||
|
||||
keyboard(ui, &states.keyboard_layout, &mut states.aura, colour);
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::{
|
||||
page_states::{FanCurvesState, ProfilesState},
|
||||
system_state::{FanCurvesState, ProfilesState, SystemState},
|
||||
widgets::fan_graphs,
|
||||
RogApp, RogDbusClientBlocking,
|
||||
};
|
||||
@@ -7,14 +7,9 @@ use egui::Ui;
|
||||
use rog_platform::supported::SupportedFunctions;
|
||||
use rog_profiles::Profile;
|
||||
|
||||
impl<'a> RogApp<'a> {
|
||||
pub fn fan_curve_page(&mut self, ctx: &egui::Context) {
|
||||
let Self {
|
||||
supported,
|
||||
states,
|
||||
asus_dbus: dbus,
|
||||
..
|
||||
} = self;
|
||||
impl RogApp {
|
||||
pub fn fan_curve_page(&mut self, states: &mut SystemState, ctx: &egui::Context) {
|
||||
let Self { supported, .. } = self;
|
||||
|
||||
egui::CentralPanel::default().show(ctx, |ui| {
|
||||
ui.heading("Custom fan curves");
|
||||
@@ -23,11 +18,11 @@ impl<'a> RogApp<'a> {
|
||||
supported,
|
||||
&mut states.profiles,
|
||||
&mut states.fan_curves,
|
||||
dbus, &mut states.error,
|
||||
&states.asus_dbus, &mut states.error,
|
||||
ui,
|
||||
);
|
||||
|
||||
fan_graphs(supported, &mut states.profiles, &mut states.fan_curves, dbus, &mut states.error, ui);
|
||||
fan_graphs(supported, &mut states.profiles, &mut states.fan_curves, &states.asus_dbus, &mut states.error, ui);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -76,8 +71,7 @@ impl<'a> RogApp<'a> {
|
||||
let selected_profile = curves.show_curve;
|
||||
let selected_pu = curves.show_graph;
|
||||
|
||||
let notif = curves.was_notified.clone();
|
||||
match FanCurvesState::new(notif, supported, dbus) {
|
||||
match FanCurvesState::new(supported, dbus) {
|
||||
Ok(f) => *curves = f,
|
||||
Err(e) => *do_error = Some(e.to_string()),
|
||||
}
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
use crate::{
|
||||
system_state::SystemState,
|
||||
widgets::{
|
||||
anime_power_group, app_settings, aura_power_group, platform_profile, rog_bios_group,
|
||||
},
|
||||
RogApp,
|
||||
};
|
||||
|
||||
impl<'a> RogApp<'a> {
|
||||
pub fn system_page(&mut self, ctx: &egui::Context) {
|
||||
impl RogApp {
|
||||
pub fn system_page(&mut self, states: &mut SystemState, ctx: &egui::Context) {
|
||||
let Self {
|
||||
config,
|
||||
supported,
|
||||
states,
|
||||
asus_dbus: dbus,
|
||||
..
|
||||
config, supported, ..
|
||||
} = self;
|
||||
|
||||
egui::CentralPanel::default().show(ctx, |ui| {
|
||||
@@ -28,12 +25,12 @@ impl<'a> RogApp<'a> {
|
||||
ui.vertical(|ui| {
|
||||
ui.separator();
|
||||
if supported.platform_profile.platform_profile {
|
||||
platform_profile(states, dbus, ui);
|
||||
platform_profile(states, ui);
|
||||
}
|
||||
});
|
||||
ui.vertical(|ui| {
|
||||
ui.separator();
|
||||
aura_power_group(supported, states, dbus, ui);
|
||||
aura_power_group(supported, states, ui);
|
||||
});
|
||||
ui.end_row();
|
||||
|
||||
@@ -44,7 +41,7 @@ impl<'a> RogApp<'a> {
|
||||
});
|
||||
ui.vertical(|ui| {
|
||||
ui.separator();
|
||||
rog_bios_group(supported, states, dbus, ui);
|
||||
rog_bios_group(supported, states, ui);
|
||||
});
|
||||
ui.end_row();
|
||||
|
||||
@@ -52,7 +49,7 @@ impl<'a> RogApp<'a> {
|
||||
ui.vertical(|ui| {
|
||||
ui.separator();
|
||||
if supported.anime_ctrl.0 {
|
||||
anime_power_group(supported, states, dbus, ui);
|
||||
anime_power_group(supported, states, ui);
|
||||
}
|
||||
});
|
||||
ui.vertical(|ui| {
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
use std::{
|
||||
collections::{BTreeMap, HashSet},
|
||||
sync::{
|
||||
atomic::{AtomicBool, Ordering},
|
||||
Arc, Mutex,
|
||||
},
|
||||
sync::{Arc, Mutex},
|
||||
};
|
||||
|
||||
use egui::Vec2;
|
||||
use rog_aura::{layouts::KeyLayout, usb::AuraPowerDev, AuraEffect, AuraModeNum};
|
||||
use rog_platform::{platform::GpuMode, supported::SupportedFunctions};
|
||||
use rog_profiles::{fan_curve_set::FanCurveSet, FanCurvePU, Profile};
|
||||
use supergfxctl::{
|
||||
pci_device::{GfxMode, GfxPower},
|
||||
zbus_proxy::DaemonProxyBlocking as GfxProxyBlocking,
|
||||
};
|
||||
|
||||
use crate::{error::Result, notify::EnabledNotifications, RogDbusClientBlocking};
|
||||
|
||||
@@ -18,7 +19,6 @@ pub struct BiosState {
|
||||
/// To be shared to a thread that checks notifications.
|
||||
/// It's a bit general in that it won't provide *what* was
|
||||
/// updated, so the full state needs refresh
|
||||
pub was_notified: Arc<AtomicBool>,
|
||||
pub post_sound: bool,
|
||||
pub dedicated_gfx: GpuMode,
|
||||
pub panel_overdrive: bool,
|
||||
@@ -27,13 +27,8 @@ pub struct BiosState {
|
||||
}
|
||||
|
||||
impl BiosState {
|
||||
pub fn new(
|
||||
was_notified: Arc<AtomicBool>,
|
||||
supported: &SupportedFunctions,
|
||||
dbus: &RogDbusClientBlocking,
|
||||
) -> Result<Self> {
|
||||
pub fn new(supported: &SupportedFunctions, dbus: &RogDbusClientBlocking) -> Result<Self> {
|
||||
Ok(Self {
|
||||
was_notified,
|
||||
post_sound: if supported.rog_bios_ctrl.post_sound {
|
||||
dbus.proxies().rog_bios().post_boot_sound()? != 0
|
||||
} else {
|
||||
@@ -58,19 +53,13 @@ impl BiosState {
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct ProfilesState {
|
||||
pub was_notified: Arc<AtomicBool>,
|
||||
pub list: Vec<Profile>,
|
||||
pub current: Profile,
|
||||
}
|
||||
|
||||
impl ProfilesState {
|
||||
pub fn new(
|
||||
was_notified: Arc<AtomicBool>,
|
||||
supported: &SupportedFunctions,
|
||||
dbus: &RogDbusClientBlocking,
|
||||
) -> Result<Self> {
|
||||
pub fn new(supported: &SupportedFunctions, dbus: &RogDbusClientBlocking) -> Result<Self> {
|
||||
Ok(Self {
|
||||
was_notified,
|
||||
list: if supported.platform_profile.platform_profile {
|
||||
let mut list = dbus.proxies().profile().profiles()?;
|
||||
list.sort();
|
||||
@@ -89,7 +78,6 @@ impl ProfilesState {
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct FanCurvesState {
|
||||
pub was_notified: Arc<AtomicBool>,
|
||||
pub show_curve: Profile,
|
||||
pub show_graph: FanCurvePU,
|
||||
pub enabled: HashSet<Profile>,
|
||||
@@ -98,11 +86,7 @@ pub struct FanCurvesState {
|
||||
}
|
||||
|
||||
impl FanCurvesState {
|
||||
pub fn new(
|
||||
was_notified: Arc<AtomicBool>,
|
||||
supported: &SupportedFunctions,
|
||||
dbus: &RogDbusClientBlocking,
|
||||
) -> Result<Self> {
|
||||
pub fn new(supported: &SupportedFunctions, dbus: &RogDbusClientBlocking) -> Result<Self> {
|
||||
let profiles = if supported.platform_profile.platform_profile {
|
||||
dbus.proxies().profile().profiles()?
|
||||
} else {
|
||||
@@ -143,7 +127,6 @@ impl FanCurvesState {
|
||||
};
|
||||
|
||||
Ok(Self {
|
||||
was_notified,
|
||||
show_curve,
|
||||
show_graph: FanCurvePU::CPU,
|
||||
enabled,
|
||||
@@ -155,7 +138,6 @@ impl FanCurvesState {
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct AuraState {
|
||||
pub was_notified: Arc<AtomicBool>,
|
||||
pub current_mode: AuraModeNum,
|
||||
pub modes: BTreeMap<AuraModeNum, AuraEffect>,
|
||||
pub enabled: AuraPowerDev,
|
||||
@@ -167,13 +149,8 @@ pub struct AuraState {
|
||||
}
|
||||
|
||||
impl AuraState {
|
||||
pub fn new(
|
||||
was_notified: Arc<AtomicBool>,
|
||||
supported: &SupportedFunctions,
|
||||
dbus: &RogDbusClientBlocking,
|
||||
) -> Result<Self> {
|
||||
pub fn new(supported: &SupportedFunctions, dbus: &RogDbusClientBlocking) -> Result<Self> {
|
||||
Ok(Self {
|
||||
was_notified,
|
||||
current_mode: if !supported.keyboard_led.stock_led_modes.is_empty() {
|
||||
dbus.proxies().led().led_mode().unwrap_or_default()
|
||||
} else {
|
||||
@@ -214,7 +191,6 @@ impl AuraState {
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct AnimeState {
|
||||
pub was_notified: Arc<AtomicBool>,
|
||||
pub bright: u8,
|
||||
pub boot: bool,
|
||||
pub awake: bool,
|
||||
@@ -222,13 +198,8 @@ pub struct AnimeState {
|
||||
}
|
||||
|
||||
impl AnimeState {
|
||||
pub fn new(
|
||||
was_notified: Arc<AtomicBool>,
|
||||
supported: &SupportedFunctions,
|
||||
dbus: &RogDbusClientBlocking,
|
||||
) -> Result<Self> {
|
||||
pub fn new(supported: &SupportedFunctions, dbus: &RogDbusClientBlocking) -> Result<Self> {
|
||||
Ok(Self {
|
||||
was_notified,
|
||||
boot: if supported.anime_ctrl.0 {
|
||||
dbus.proxies().anime().boot_enabled()?
|
||||
} else {
|
||||
@@ -246,11 +217,41 @@ impl AnimeState {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct PageDataStates {
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct GfxState {
|
||||
pub mode: GfxMode,
|
||||
pub power_status: GfxPower,
|
||||
}
|
||||
|
||||
impl GfxState {
|
||||
pub fn new(_supported: &SupportedFunctions, dbus: &GfxProxyBlocking) -> Result<Self> {
|
||||
Ok(Self {
|
||||
mode: dbus.mode()?,
|
||||
power_status: dbus.power()?,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct PowerState {
|
||||
pub charge_limit: u8,
|
||||
pub ac_power: bool,
|
||||
}
|
||||
|
||||
impl PowerState {
|
||||
pub fn new(_supported: &SupportedFunctions, dbus: &RogDbusClientBlocking) -> Result<Self> {
|
||||
Ok(Self {
|
||||
charge_limit: dbus.proxies().charge().charge_control_end_threshold()?,
|
||||
ac_power: dbus.proxies().charge().mains_online()?,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/// State stored from system daemons. This is shared with: tray, zbus notifications thread
|
||||
/// and the GUI app thread.
|
||||
pub struct SystemState {
|
||||
pub keyboard_layout: KeyLayout,
|
||||
pub enabled_notifications: Arc<Mutex<EnabledNotifications>>,
|
||||
pub was_notified: Arc<AtomicBool>,
|
||||
/// Because much of the app state here is the same as `RogBiosSupportedFunctions`
|
||||
/// we can re-use that structure.
|
||||
pub bios: BiosState,
|
||||
@@ -258,87 +259,59 @@ pub struct PageDataStates {
|
||||
pub anime: AnimeState,
|
||||
pub profiles: ProfilesState,
|
||||
pub fan_curves: FanCurvesState,
|
||||
pub charge_limit: u8,
|
||||
pub gfx_state: GfxState,
|
||||
pub power_state: PowerState,
|
||||
pub error: Option<String>,
|
||||
/// Specific field for the tray only so that we can know when it does need update.
|
||||
/// The tray should set this to false when done.
|
||||
pub tray_should_update: bool,
|
||||
pub app_should_update: bool,
|
||||
pub asus_dbus: RogDbusClientBlocking<'static>,
|
||||
pub gfx_dbus: GfxProxyBlocking<'static>,
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
impl PageDataStates {
|
||||
impl SystemState {
|
||||
/// Creates self, including the relevant dbus connections and proixies for internal use
|
||||
pub fn new(
|
||||
keyboard_layout: KeyLayout,
|
||||
enabled_notifications: Arc<Mutex<EnabledNotifications>>,
|
||||
charge_notified: Arc<AtomicBool>,
|
||||
bios_notified: Arc<AtomicBool>,
|
||||
aura_notified: Arc<AtomicBool>,
|
||||
anime_notified: Arc<AtomicBool>,
|
||||
profiles_notified: Arc<AtomicBool>,
|
||||
fans_notified: Arc<AtomicBool>,
|
||||
supported: &SupportedFunctions,
|
||||
dbus: &RogDbusClientBlocking,
|
||||
) -> Result<Self> {
|
||||
let (asus_dbus, conn) = RogDbusClientBlocking::new().unwrap();
|
||||
let gfx_dbus = GfxProxyBlocking::new(&conn).unwrap();
|
||||
Ok(Self {
|
||||
keyboard_layout,
|
||||
enabled_notifications,
|
||||
was_notified: charge_notified,
|
||||
charge_limit: dbus.proxies().charge().charge_control_end_threshold()?,
|
||||
bios: BiosState::new(bios_notified, supported, dbus)?,
|
||||
aura: AuraState::new(aura_notified, supported, dbus)?,
|
||||
anime: AnimeState::new(anime_notified, supported, dbus)?,
|
||||
profiles: ProfilesState::new(profiles_notified, supported, dbus)?,
|
||||
fan_curves: FanCurvesState::new(fans_notified, supported, dbus)?,
|
||||
power_state: PowerState::new(supported, &asus_dbus)?,
|
||||
bios: BiosState::new(supported, &asus_dbus)?,
|
||||
aura: AuraState::new(supported, &asus_dbus)?,
|
||||
anime: AnimeState::new(supported, &asus_dbus)?,
|
||||
profiles: ProfilesState::new(supported, &asus_dbus)?,
|
||||
fan_curves: FanCurvesState::new(supported, &asus_dbus)?,
|
||||
gfx_state: GfxState::new(supported, &gfx_dbus)?,
|
||||
error: None,
|
||||
tray_should_update: true,
|
||||
app_should_update: true,
|
||||
asus_dbus,
|
||||
gfx_dbus,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn refresh_if_notfied(
|
||||
&mut self,
|
||||
supported: &SupportedFunctions,
|
||||
dbus: &RogDbusClientBlocking,
|
||||
) -> Result<bool> {
|
||||
let mut notified = false;
|
||||
if self.was_notified.load(Ordering::SeqCst) {
|
||||
self.charge_limit = dbus.proxies().charge().charge_control_end_threshold()?;
|
||||
self.was_notified.store(false, Ordering::SeqCst);
|
||||
notified = true;
|
||||
}
|
||||
|
||||
if self.aura.was_notified.load(Ordering::SeqCst) {
|
||||
self.aura = AuraState::new(self.aura.was_notified.clone(), supported, dbus)?;
|
||||
self.aura.was_notified.store(false, Ordering::SeqCst);
|
||||
notified = true;
|
||||
}
|
||||
|
||||
if self.bios.was_notified.load(Ordering::SeqCst) {
|
||||
self.bios = BiosState::new(self.bios.was_notified.clone(), supported, dbus)?;
|
||||
self.bios.was_notified.store(false, Ordering::SeqCst);
|
||||
notified = true;
|
||||
}
|
||||
|
||||
if self.profiles.was_notified.load(Ordering::SeqCst) {
|
||||
self.profiles =
|
||||
ProfilesState::new(self.profiles.was_notified.clone(), supported, dbus)?;
|
||||
self.profiles.was_notified.store(false, Ordering::SeqCst);
|
||||
notified = true;
|
||||
}
|
||||
|
||||
if self.fan_curves.was_notified.load(Ordering::SeqCst) {
|
||||
self.fan_curves =
|
||||
FanCurvesState::new(self.fan_curves.was_notified.clone(), supported, dbus)?;
|
||||
self.fan_curves.was_notified.store(false, Ordering::SeqCst);
|
||||
notified = true;
|
||||
}
|
||||
Ok(notified)
|
||||
pub fn set_notified(&mut self) {
|
||||
self.tray_should_update = true;
|
||||
self.app_should_update = true;
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for PageDataStates {
|
||||
impl Default for SystemState {
|
||||
fn default() -> Self {
|
||||
let (asus_dbus, conn) = RogDbusClientBlocking::new().unwrap();
|
||||
let gfx_dbus = GfxProxyBlocking::new(&conn).unwrap();
|
||||
|
||||
Self {
|
||||
keyboard_layout: KeyLayout::ga401_layout(),
|
||||
enabled_notifications: Default::default(),
|
||||
was_notified: Default::default(),
|
||||
bios: BiosState {
|
||||
was_notified: Default::default(),
|
||||
post_sound: Default::default(),
|
||||
dedicated_gfx: GpuMode::NotSupported,
|
||||
panel_overdrive: Default::default(),
|
||||
@@ -346,7 +319,6 @@ impl Default for PageDataStates {
|
||||
egpu_enable: Default::default(),
|
||||
},
|
||||
aura: AuraState {
|
||||
was_notified: Default::default(),
|
||||
current_mode: AuraModeNum::Static,
|
||||
modes: Default::default(),
|
||||
enabled: AuraPowerDev {
|
||||
@@ -360,27 +332,35 @@ impl Default for PageDataStates {
|
||||
wave_blue: Default::default(),
|
||||
},
|
||||
anime: AnimeState {
|
||||
was_notified: Default::default(),
|
||||
bright: Default::default(),
|
||||
boot: Default::default(),
|
||||
awake: Default::default(),
|
||||
sleep: Default::default(),
|
||||
},
|
||||
profiles: ProfilesState {
|
||||
was_notified: Default::default(),
|
||||
list: Default::default(),
|
||||
current: Default::default(),
|
||||
},
|
||||
fan_curves: FanCurvesState {
|
||||
was_notified: Default::default(),
|
||||
show_curve: Default::default(),
|
||||
show_graph: Default::default(),
|
||||
enabled: Default::default(),
|
||||
curves: Default::default(),
|
||||
drag_delta: Default::default(),
|
||||
},
|
||||
charge_limit: Default::default(),
|
||||
gfx_state: GfxState {
|
||||
mode: GfxMode::None,
|
||||
power_status: GfxPower::Unknown,
|
||||
},
|
||||
power_state: PowerState {
|
||||
charge_limit: 99,
|
||||
ac_power: false,
|
||||
},
|
||||
error: Default::default(),
|
||||
tray_should_update: true,
|
||||
app_should_update: true,
|
||||
asus_dbus,
|
||||
gfx_dbus,
|
||||
}
|
||||
}
|
||||
}
|
||||
+265
-100
@@ -10,12 +10,18 @@ use std::{
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
use gtk::{gio::Icon, prelude::*, MenuItem};
|
||||
use gtk::{gio::Icon, prelude::*};
|
||||
use rog_dbus::zbus_platform::RogBiosProxyBlocking;
|
||||
use rog_platform::{platform::GpuMode, supported::SupportedFunctions};
|
||||
|
||||
use crate::{error::Result, get_ipc_file, SHOW_GUI};
|
||||
use crate::{error::Result, get_ipc_file, system_state::SystemState, SHOW_GUI};
|
||||
use libappindicator::{AppIndicator, AppIndicatorStatus};
|
||||
use supergfxctl::pci_device::{GfxMode, GfxPower};
|
||||
use supergfxctl::{
|
||||
pci_device::{GfxMode, GfxPower},
|
||||
zbus_proxy::DaemonProxyBlocking as GfxProxyBlocking,
|
||||
};
|
||||
|
||||
use log::{debug, error, info, trace};
|
||||
|
||||
const TRAY_APP_ICON: &str = "rog-control-center";
|
||||
const TRAY_LABEL: &str = "ROG Control Center";
|
||||
@@ -73,29 +79,36 @@ impl RadioGroup {
|
||||
pub struct ROGTray {
|
||||
tray: AppIndicator,
|
||||
menu: gtk::Menu,
|
||||
items: Vec<MenuItem>,
|
||||
icon: &'static str,
|
||||
bios_proxy: RogBiosProxyBlocking<'static>,
|
||||
gfx_proxy: GfxProxyBlocking<'static>,
|
||||
}
|
||||
|
||||
impl ROGTray {
|
||||
pub fn new() -> Result<Self> {
|
||||
let mut rog_tray = Self {
|
||||
let conn = zbus::blocking::Connection::system().map_err(|e| {
|
||||
error!("ROGTray: {e}");
|
||||
e
|
||||
})?;
|
||||
let rog_tray = Self {
|
||||
tray: AppIndicator::new(TRAY_LABEL, TRAY_APP_ICON),
|
||||
menu: gtk::Menu::new(),
|
||||
items: Vec::new(),
|
||||
icon: TRAY_APP_ICON,
|
||||
bios_proxy: RogBiosProxyBlocking::new(&conn).map_err(|e| {
|
||||
error!("ROGTray: {e}");
|
||||
e
|
||||
})?,
|
||||
gfx_proxy: GfxProxyBlocking::new(&conn).map_err(|e| {
|
||||
error!("ROGTray: {e}");
|
||||
e
|
||||
})?,
|
||||
};
|
||||
// rog_tray.set_icon(TRAY_APP_ICON);
|
||||
|
||||
rog_tray.add_icon_menu_item("Open app", "asus_notif_red", move || {
|
||||
get_ipc_file().unwrap().write_all(&[SHOW_GUI]).ok();
|
||||
});
|
||||
|
||||
rog_tray.add_inactive_label("----");
|
||||
|
||||
Ok(rog_tray)
|
||||
}
|
||||
|
||||
pub fn set_icon(&mut self, icon: &str) {
|
||||
self.tray.set_icon(icon);
|
||||
pub fn set_icon(&mut self, icon: &'static str) {
|
||||
self.icon = icon;
|
||||
self.tray.set_icon(self.icon);
|
||||
self.tray.set_status(AppIndicatorStatus::Active);
|
||||
}
|
||||
|
||||
@@ -105,7 +118,14 @@ impl ROGTray {
|
||||
item.set_sensitive(false);
|
||||
self.menu.append(&item);
|
||||
self.menu.show_all();
|
||||
self.tray.set_menu(&mut self.menu);
|
||||
}
|
||||
|
||||
/// Add a separator
|
||||
fn add_separator(&mut self) {
|
||||
let item = gtk::SeparatorMenuItem::new();
|
||||
item.set_sensitive(false);
|
||||
self.menu.append(&item);
|
||||
self.menu.show_all();
|
||||
}
|
||||
|
||||
fn add_radio_sub_menu(&mut self, header_label: &str, active_label: &str, sub_menu: RadioGroup) {
|
||||
@@ -115,7 +135,11 @@ impl ROGTray {
|
||||
|
||||
let menu = gtk::Menu::new();
|
||||
for item in sub_menu.0.iter() {
|
||||
item.set_active(item.label().unwrap() == active_label);
|
||||
if let Some(label) = item.label() {
|
||||
item.set_active(label == active_label);
|
||||
} else {
|
||||
item.set_active(false);
|
||||
}
|
||||
item.set_no_show_all(false);
|
||||
item.show_all();
|
||||
menu.add(item);
|
||||
@@ -124,19 +148,29 @@ impl ROGTray {
|
||||
header_item.set_submenu(Some(&menu));
|
||||
}
|
||||
|
||||
fn add_menu_item<F>(&mut self, label: &str, cb: F)
|
||||
fn _add_menu_item<F>(&mut self, label: &str, cb: F)
|
||||
where
|
||||
F: Fn() + Send + 'static,
|
||||
{
|
||||
let item = gtk::MenuItem::with_label(label);
|
||||
self.items.push(item);
|
||||
let item = self.items.last().unwrap();
|
||||
item.connect_activate(move |_| {
|
||||
cb();
|
||||
});
|
||||
self.menu.append(item);
|
||||
self.menu.append(&item);
|
||||
self.menu.show_all();
|
||||
}
|
||||
|
||||
fn add_check_menu_item<F>(&mut self, label: &str, is_active: bool, cb: F)
|
||||
where
|
||||
F: Fn(>k::CheckMenuItem) + Send + 'static,
|
||||
{
|
||||
let item = gtk::CheckMenuItem::with_label(label);
|
||||
item.set_active(is_active);
|
||||
item.connect_activate(move |this| {
|
||||
cb(this);
|
||||
});
|
||||
self.menu.append(&item);
|
||||
self.menu.show_all();
|
||||
self.tray.set_menu(&mut self.menu);
|
||||
}
|
||||
|
||||
/// Add a menu item with an icon to the right
|
||||
@@ -147,120 +181,251 @@ impl ROGTray {
|
||||
let g_box = gtk::Box::new(gtk::Orientation::Horizontal, 6);
|
||||
let icon = gtk::Image::from_gicon(&Icon::for_string(icon).unwrap(), gtk::IconSize::Menu);
|
||||
let label = gtk::Label::new(Some(label));
|
||||
let menu_item = gtk::MenuItem::new();
|
||||
let item = gtk::MenuItem::new();
|
||||
g_box.add(&icon);
|
||||
g_box.add(&label);
|
||||
|
||||
menu_item.add(&g_box);
|
||||
menu_item.show_all();
|
||||
item.add(&g_box);
|
||||
item.show_all();
|
||||
|
||||
self.items.push(menu_item);
|
||||
let item = self.items.last().unwrap();
|
||||
item.connect_activate(move |_| {
|
||||
cb();
|
||||
});
|
||||
self.menu.append(item);
|
||||
self.menu.append(&item);
|
||||
self.menu.show_all();
|
||||
self.tray.set_menu(&mut self.menu);
|
||||
}
|
||||
|
||||
fn set_status(&mut self, status: AppIndicatorStatus) {
|
||||
fn _set_status(&mut self, status: AppIndicatorStatus) {
|
||||
self.tray.set_status(status)
|
||||
}
|
||||
}
|
||||
|
||||
fn init_gpu_menu(supported: &SupportedFunctions, tray: &mut ROGTray) {
|
||||
let conn = zbus::blocking::Connection::system().unwrap();
|
||||
let gfx_dbus = supergfxctl::zbus_proxy::DaemonProxyBlocking::new(&conn).unwrap();
|
||||
|
||||
let mode = gfx_dbus.mode().unwrap();
|
||||
let mut gpu_menu = RadioGroup::new("Integrated", move |_| {
|
||||
let mode = gfx_dbus.mode().unwrap();
|
||||
if mode != GfxMode::Integrated {
|
||||
gfx_dbus.set_mode(&GfxMode::Integrated).unwrap();
|
||||
}
|
||||
});
|
||||
let gfx_dbus = supergfxctl::zbus_proxy::DaemonProxyBlocking::new(&conn).unwrap();
|
||||
gpu_menu.add("Hybrid", move |_| {
|
||||
let mode = gfx_dbus.mode().unwrap();
|
||||
if mode != GfxMode::Hybrid {
|
||||
gfx_dbus.set_mode(&GfxMode::Hybrid).unwrap();
|
||||
}
|
||||
});
|
||||
if supported.rog_bios_ctrl.gpu_mux {
|
||||
let gfx_dbus = rog_dbus::zbus_platform::RogBiosProxyBlocking::new(&conn).unwrap();
|
||||
gpu_menu.add("Ultimate (Reboot required)", move |_| {
|
||||
let mode = gfx_dbus.gpu_mux_mode().unwrap();
|
||||
if mode != GpuMode::Discrete {
|
||||
gfx_dbus.set_gpu_mux_mode(GpuMode::Discrete).unwrap();
|
||||
}
|
||||
});
|
||||
}
|
||||
if supported.rog_bios_ctrl.egpu_enable {
|
||||
let gfx_dbus = supergfxctl::zbus_proxy::DaemonProxyBlocking::new(&conn).unwrap();
|
||||
gpu_menu.add("eGPU", move |_| {
|
||||
let mode = gfx_dbus.mode().unwrap();
|
||||
if mode != GfxMode::Egpu {
|
||||
gfx_dbus.set_mode(&GfxMode::Egpu).unwrap();
|
||||
fn menu_add_base(&mut self) {
|
||||
self.add_icon_menu_item("Open app", "asus_notif_red", move || {
|
||||
if let Ok(mut ipc) = get_ipc_file().map_err(|e| {
|
||||
error!("ROGTray: get_ipc_file: {}", e);
|
||||
}) {
|
||||
ipc.write_all(&[SHOW_GUI]).ok();
|
||||
}
|
||||
});
|
||||
|
||||
self.add_separator();
|
||||
debug!("ROGTray: built base menu");
|
||||
}
|
||||
|
||||
let active = match mode {
|
||||
GfxMode::AsusMuxDiscreet => "Discreet".to_string(),
|
||||
_ => mode.to_string(),
|
||||
};
|
||||
tray.add_radio_sub_menu("GPU Mode", active.as_str(), gpu_menu);
|
||||
fn menu_add_charge_limit(&mut self, supported: &SupportedFunctions, limit: u8) {
|
||||
if supported.charge_ctrl.charge_level_set {
|
||||
self.add_inactive_label(&format!("Charge limit: {limit}"));
|
||||
debug!("ROGTray: appended charge limit menu");
|
||||
}
|
||||
}
|
||||
|
||||
fn menu_add_panel_od(&mut self, supported: &SupportedFunctions, panel_od: bool) {
|
||||
if supported.rog_bios_ctrl.panel_overdrive {
|
||||
let bios = self.bios_proxy.clone();
|
||||
self.add_check_menu_item("Panel Overdrive", panel_od, move |this| {
|
||||
bios.set_panel_od(this.is_active())
|
||||
.map_err(|e| {
|
||||
error!("ROGTray: set_panel_od: {e}");
|
||||
e
|
||||
})
|
||||
.ok();
|
||||
});
|
||||
debug!("ROGTray: appended panel overdrive menu");
|
||||
}
|
||||
}
|
||||
|
||||
fn menu_add_gpu(&mut self, supported: &SupportedFunctions, current_mode: GfxMode) {
|
||||
let gfx_dbus = self.gfx_proxy.clone();
|
||||
let mut gpu_menu = RadioGroup::new("Integrated", move |_| {
|
||||
let mode = gfx_dbus
|
||||
.mode()
|
||||
.map_err(|e| {
|
||||
error!("ROGTray: mode: {e}");
|
||||
e
|
||||
})
|
||||
.unwrap_or(GfxMode::None);
|
||||
if mode != GfxMode::Integrated {
|
||||
gfx_dbus
|
||||
.set_mode(&GfxMode::Integrated)
|
||||
.map_err(|e| {
|
||||
error!("ROGTray: srt_mode: {e}");
|
||||
e
|
||||
})
|
||||
.ok();
|
||||
}
|
||||
});
|
||||
|
||||
let gfx_dbus = self.gfx_proxy.clone();
|
||||
gpu_menu.add("Hybrid", move |_| {
|
||||
let mode = gfx_dbus
|
||||
.mode()
|
||||
.map_err(|e| {
|
||||
error!("ROGTray: mode: {e}");
|
||||
e
|
||||
})
|
||||
.unwrap_or(GfxMode::None);
|
||||
if mode != GfxMode::Hybrid {
|
||||
gfx_dbus
|
||||
.set_mode(&GfxMode::Hybrid)
|
||||
.map_err(|e| {
|
||||
error!("ROGTray: set_mode: {e}");
|
||||
e
|
||||
})
|
||||
.ok();
|
||||
}
|
||||
});
|
||||
if supported.rog_bios_ctrl.gpu_mux {
|
||||
let gfx_dbus = self.bios_proxy.clone();
|
||||
gpu_menu.add("Ultimate (Reboot required)", move |_| {
|
||||
let mode = gfx_dbus
|
||||
.gpu_mux_mode()
|
||||
.map_err(|e| {
|
||||
error!("ROGTray: mode: {e}");
|
||||
e
|
||||
})
|
||||
.unwrap_or(GpuMode::Error);
|
||||
if mode != GpuMode::Discrete {
|
||||
gfx_dbus
|
||||
.set_gpu_mux_mode(GpuMode::Discrete)
|
||||
.map_err(|e| {
|
||||
error!("ROGTray: set_mode: {e}");
|
||||
e
|
||||
})
|
||||
.ok();
|
||||
}
|
||||
});
|
||||
}
|
||||
if supported.rog_bios_ctrl.egpu_enable {
|
||||
let gfx_dbus = self.gfx_proxy.clone();
|
||||
gpu_menu.add("eGPU", move |_| {
|
||||
let mode = gfx_dbus
|
||||
.mode()
|
||||
.map_err(|e| {
|
||||
error!("ROGTray: mode: {e}");
|
||||
e
|
||||
})
|
||||
.unwrap_or(GfxMode::None);
|
||||
if mode != GfxMode::Egpu {
|
||||
gfx_dbus
|
||||
.set_mode(&GfxMode::Egpu)
|
||||
.map_err(|e| {
|
||||
error!("ROGTray: set_mode: {e}");
|
||||
e
|
||||
})
|
||||
.ok();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
let active = match current_mode {
|
||||
GfxMode::AsusMuxDiscreet => "Discreet".to_string(),
|
||||
_ => current_mode.to_string(),
|
||||
};
|
||||
self.add_radio_sub_menu(
|
||||
&format!("GPU Mode: {current_mode}"),
|
||||
active.as_str(),
|
||||
gpu_menu,
|
||||
);
|
||||
|
||||
debug!("ROGTray: appended gpu menu");
|
||||
}
|
||||
|
||||
fn menu_clear(&mut self) {
|
||||
self.menu = gtk::Menu::new();
|
||||
debug!("ROGTray: cleared self");
|
||||
}
|
||||
|
||||
/// Reset GTK menu to internal state, this can be called after clearing and rebuilding the menu too.
|
||||
fn menu_update(&mut self) {
|
||||
self.tray.set_menu(&mut self.menu);
|
||||
self.set_icon(self.icon);
|
||||
}
|
||||
|
||||
/// Do a flush, build, and update of the tray menu
|
||||
fn rebuild_and_update(
|
||||
&mut self,
|
||||
supported: &SupportedFunctions,
|
||||
current_gfx_mode: GfxMode,
|
||||
charge_limit: u8,
|
||||
panel_od: bool,
|
||||
) {
|
||||
self.menu_clear();
|
||||
self.menu_add_base();
|
||||
self.menu_add_charge_limit(supported, charge_limit);
|
||||
self.menu_add_panel_od(supported, panel_od);
|
||||
self.menu_add_gpu(supported, current_gfx_mode);
|
||||
self.menu_update();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn init_tray(
|
||||
supported: SupportedFunctions,
|
||||
recv_command: Receiver<AppToTray>,
|
||||
states: Arc<Mutex<SystemState>>,
|
||||
) -> Receiver<TrayToApp> {
|
||||
let (send, recv) = channel();
|
||||
let _send = Arc::new(Mutex::new(send));
|
||||
|
||||
std::thread::spawn(move || {
|
||||
gtk::init().unwrap(); // Make this the main thread for gtk
|
||||
if gtk::init()
|
||||
.map_err(|e| {
|
||||
error!("ROGTray: gtk init {e}");
|
||||
e
|
||||
})
|
||||
.is_err()
|
||||
{
|
||||
return;
|
||||
} // Make this the main thread for gtk
|
||||
debug!("init_tray gtk");
|
||||
|
||||
let mut tray = ROGTray::new().unwrap();
|
||||
|
||||
init_gpu_menu(&supported, &mut tray);
|
||||
// let s1 = send.clone();
|
||||
// tray.add_menu_item("Quit", move || {
|
||||
// let lock = s1.lock().unwrap();
|
||||
// lock.send(TrayToApp::Quit).ok();
|
||||
// })
|
||||
// .ok();
|
||||
|
||||
//***********************************
|
||||
// finally do
|
||||
tray.tray.set_menu(&mut tray.menu);
|
||||
//***********************************
|
||||
let mut tray = match ROGTray::new() {
|
||||
Ok(t) => {
|
||||
info!("init_tray: built menus");
|
||||
t
|
||||
}
|
||||
Err(e) => {
|
||||
error!("ROGTray: tray init {e}");
|
||||
if let Ok(mut states) = states.lock() {
|
||||
states.error = Some(format!("Could not start tray: {e}"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
};
|
||||
tray.rebuild_and_update(&supported, GfxMode::Hybrid, 100, false);
|
||||
tray.set_icon(TRAY_APP_ICON);
|
||||
info!("Started ROGTray");
|
||||
|
||||
loop {
|
||||
if let Ok(command) = recv_command.try_recv() {
|
||||
match command {
|
||||
AppToTray::DgpuStatus(s) => {
|
||||
match s {
|
||||
GfxPower::Active => tray.set_icon("asus_notif_red"),
|
||||
GfxPower::Suspended => tray.set_icon("asus_notif_blue"),
|
||||
GfxPower::Off => tray.set_icon("asus_notif_green"),
|
||||
GfxPower::AsusDisabled => tray.set_icon("asus_notif_white"),
|
||||
GfxPower::AsusMuxDiscreet => tray.set_icon("asus_notif_red"),
|
||||
GfxPower::Unknown => tray.set_icon("gpu-integrated"),
|
||||
};
|
||||
}
|
||||
if let Ok(mut lock) = states.lock() {
|
||||
if lock.tray_should_update {
|
||||
tray.rebuild_and_update(
|
||||
&supported,
|
||||
lock.gfx_state.mode,
|
||||
lock.power_state.charge_limit,
|
||||
lock.bios.panel_overdrive,
|
||||
);
|
||||
lock.tray_should_update = false;
|
||||
debug!("ROGTray: rebuilt menus due to state change");
|
||||
|
||||
match lock.gfx_state.power_status {
|
||||
GfxPower::Active => tray.set_icon("asus_notif_red"),
|
||||
GfxPower::Suspended => tray.set_icon("asus_notif_blue"),
|
||||
GfxPower::Off => tray.set_icon("asus_notif_green"),
|
||||
GfxPower::AsusDisabled => tray.set_icon("asus_notif_white"),
|
||||
GfxPower::AsusMuxDiscreet => tray.set_icon("asus_notif_red"),
|
||||
GfxPower::Unknown => tray.set_icon("gpu-integrated"),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if gtk::events_pending() {
|
||||
// This is blocking until any events are available
|
||||
gtk::main_iteration();
|
||||
} else {
|
||||
// Don't spool at max speed if no gtk events
|
||||
std::thread::sleep(Duration::from_millis(300));
|
||||
continue;
|
||||
}
|
||||
// Don't spool at max speed if no gtk events
|
||||
std::thread::sleep(Duration::from_millis(300));
|
||||
trace!("Tray loop ticked");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
use egui::{RichText, Ui};
|
||||
use rog_platform::supported::SupportedFunctions;
|
||||
|
||||
use crate::{page_states::PageDataStates, RogDbusClientBlocking};
|
||||
use crate::system_state::SystemState;
|
||||
|
||||
pub fn anime_power_group(
|
||||
_supported: &SupportedFunctions,
|
||||
states: &mut PageDataStates,
|
||||
dbus: &mut RogDbusClientBlocking,
|
||||
ui: &mut Ui,
|
||||
) {
|
||||
pub fn anime_power_group(_supported: &SupportedFunctions, states: &mut SystemState, ui: &mut Ui) {
|
||||
ui.heading("AniMe Matrix Settings");
|
||||
ui.label("Options are incomplete. Awake + Boot should work");
|
||||
|
||||
@@ -43,7 +38,9 @@ pub fn anime_power_group(
|
||||
});
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
if ui.checkbox(&mut states.anime.boot, "Enable").changed() {
|
||||
dbus.proxies()
|
||||
states
|
||||
.asus_dbus
|
||||
.proxies()
|
||||
.anime()
|
||||
.set_boot_on_off(states.anime.boot)
|
||||
.map_err(|err| {
|
||||
@@ -54,7 +51,9 @@ pub fn anime_power_group(
|
||||
});
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
if ui.checkbox(&mut states.anime.awake, "Enable").changed() {
|
||||
dbus.proxies()
|
||||
states
|
||||
.asus_dbus
|
||||
.proxies()
|
||||
.anime()
|
||||
.set_on_off(states.anime.awake)
|
||||
.map_err(|err| {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use egui::Ui;
|
||||
|
||||
use crate::{config::Config, page_states::PageDataStates};
|
||||
use crate::{config::Config, system_state::SystemState};
|
||||
|
||||
pub fn app_settings(config: &mut Config, states: &mut PageDataStates, ui: &mut Ui) {
|
||||
pub fn app_settings(config: &mut Config, states: &mut SystemState, ui: &mut Ui) {
|
||||
ui.heading("ROG GUI Settings");
|
||||
// ui.label("Options are incomplete. Awake + Boot should work");
|
||||
|
||||
|
||||
@@ -7,16 +7,12 @@ use egui::{RichText, Ui};
|
||||
use rog_aura::{AuraEffect, AuraModeNum, AuraZone, Colour, Speed};
|
||||
use rog_platform::supported::SupportedFunctions;
|
||||
|
||||
use crate::{
|
||||
page_states::{AuraState, PageDataStates},
|
||||
RogDbusClientBlocking,
|
||||
};
|
||||
use crate::system_state::{AuraState, SystemState};
|
||||
|
||||
pub fn aura_modes_group(
|
||||
supported: &SupportedFunctions,
|
||||
states: &mut PageDataStates,
|
||||
states: &mut SystemState,
|
||||
freq: &mut Arc<AtomicU8>,
|
||||
dbus: &mut RogDbusClientBlocking,
|
||||
ui: &mut Ui,
|
||||
) {
|
||||
let mut changed = false;
|
||||
@@ -172,8 +168,7 @@ pub fn aura_modes_group(
|
||||
ui.separator();
|
||||
ui.with_layout(egui::Layout::right_to_left(egui::Align::TOP), |ui| {
|
||||
if ui.add(egui::Button::new("Cancel")).clicked() {
|
||||
let notif = states.aura.was_notified.clone();
|
||||
match AuraState::new(notif, supported, dbus) {
|
||||
match AuraState::new(supported, &states.asus_dbus) {
|
||||
Ok(a) => states.aura.modes = a.modes,
|
||||
Err(e) => states.error = Some(e.to_string()),
|
||||
}
|
||||
@@ -202,7 +197,9 @@ pub fn aura_modes_group(
|
||||
if changed {
|
||||
states.aura.current_mode = selected;
|
||||
|
||||
dbus.proxies()
|
||||
states
|
||||
.asus_dbus
|
||||
.proxies()
|
||||
.led()
|
||||
.set_led_mode(states.aura.modes.get(&selected).unwrap())
|
||||
.map_err(|err| {
|
||||
|
||||
@@ -5,32 +5,22 @@ use rog_aura::{
|
||||
};
|
||||
use rog_platform::supported::SupportedFunctions;
|
||||
|
||||
use crate::{page_states::PageDataStates, RogDbusClientBlocking};
|
||||
use crate::system_state::SystemState;
|
||||
|
||||
pub fn aura_power_group(
|
||||
supported: &SupportedFunctions,
|
||||
states: &mut PageDataStates,
|
||||
dbus: &mut RogDbusClientBlocking,
|
||||
ui: &mut Ui,
|
||||
) {
|
||||
pub fn aura_power_group(supported: &SupportedFunctions, states: &mut SystemState, ui: &mut Ui) {
|
||||
ui.heading("LED settings");
|
||||
|
||||
match supported.keyboard_led.prod_id {
|
||||
AuraDevice::X1854 | AuraDevice::X1869 | AuraDevice::X1866 => {
|
||||
aura_power1(supported, states, dbus, ui)
|
||||
aura_power1(supported, states, ui)
|
||||
}
|
||||
AuraDevice::X19B6 => aura_power2(supported, states, dbus, ui),
|
||||
AuraDevice::Tuf => aura_power1(supported, states, dbus, ui),
|
||||
AuraDevice::X19B6 => aura_power2(supported, states, ui),
|
||||
AuraDevice::Tuf => aura_power1(supported, states, ui),
|
||||
AuraDevice::Unknown => {}
|
||||
}
|
||||
}
|
||||
|
||||
fn aura_power1(
|
||||
supported: &SupportedFunctions,
|
||||
states: &mut PageDataStates,
|
||||
dbus: &mut RogDbusClientBlocking,
|
||||
ui: &mut Ui,
|
||||
) {
|
||||
fn aura_power1(supported: &SupportedFunctions, states: &mut SystemState, ui: &mut Ui) {
|
||||
let enabled_states = &mut states.aura.enabled;
|
||||
let mut boot = enabled_states.x1866.contains(&AuraDev1866::Boot);
|
||||
let mut sleep = enabled_states.x1866.contains(&AuraDev1866::Sleep);
|
||||
@@ -144,7 +134,9 @@ fn aura_power1(
|
||||
x19b6: vec![],
|
||||
};
|
||||
// build data to send
|
||||
dbus.proxies()
|
||||
states
|
||||
.asus_dbus
|
||||
.proxies()
|
||||
.led()
|
||||
.set_leds_power(options, enable)
|
||||
.map_err(|err| {
|
||||
@@ -193,7 +185,9 @@ fn aura_power1(
|
||||
x19b6: vec![],
|
||||
};
|
||||
// build data to send
|
||||
dbus.proxies()
|
||||
states
|
||||
.asus_dbus
|
||||
.proxies()
|
||||
.led()
|
||||
.set_leds_power(options, enable)
|
||||
.map_err(|err| {
|
||||
@@ -207,12 +201,7 @@ fn aura_power1(
|
||||
}
|
||||
}
|
||||
|
||||
fn aura_power2(
|
||||
supported: &SupportedFunctions,
|
||||
states: &mut PageDataStates,
|
||||
dbus: &mut RogDbusClientBlocking,
|
||||
ui: &mut Ui,
|
||||
) {
|
||||
fn aura_power2(supported: &SupportedFunctions, states: &mut SystemState, ui: &mut Ui) {
|
||||
let enabled_states = &mut states.aura.enabled;
|
||||
let has_logo = supported
|
||||
.keyboard_led
|
||||
@@ -331,7 +320,9 @@ fn aura_power2(
|
||||
x19b6: data,
|
||||
};
|
||||
// build data to send
|
||||
dbus.proxies()
|
||||
states
|
||||
.asus_dbus
|
||||
.proxies()
|
||||
.led()
|
||||
.set_leds_power(options, enable)
|
||||
.map_err(|err| {
|
||||
|
||||
@@ -3,7 +3,7 @@ use rog_platform::supported::SupportedFunctions;
|
||||
use rog_profiles::{FanCurvePU, Profile};
|
||||
|
||||
use crate::{
|
||||
page_states::{FanCurvesState, ProfilesState},
|
||||
system_state::{FanCurvesState, ProfilesState},
|
||||
RogDbusClientBlocking,
|
||||
};
|
||||
|
||||
@@ -136,8 +136,7 @@ pub fn fan_graphs(
|
||||
})
|
||||
.ok();
|
||||
|
||||
let notif = curves.was_notified.clone();
|
||||
match FanCurvesState::new(notif, supported, dbus) {
|
||||
match FanCurvesState::new(supported, dbus) {
|
||||
Ok(f) => *curves = f,
|
||||
Err(e) => *do_error = Some(e.to_string()),
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use egui::{Align, Color32, Vec2};
|
||||
use rog_aura::{keys::KeyShape, layouts::KeyLayout, AuraModeNum};
|
||||
|
||||
use crate::page_states::AuraState;
|
||||
use crate::system_state::AuraState;
|
||||
|
||||
pub fn keyboard(
|
||||
ui: &mut egui::Ui,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use crate::{page_states::PageDataStates, RogDbusClientBlocking};
|
||||
use crate::system_state::SystemState;
|
||||
use egui::Ui;
|
||||
use rog_platform::{platform::GpuMode, supported::SupportedFunctions};
|
||||
use rog_profiles::Profile;
|
||||
|
||||
pub fn platform_profile(states: &mut PageDataStates, dbus: &RogDbusClientBlocking, ui: &mut Ui) {
|
||||
pub fn platform_profile(states: &mut SystemState, ui: &mut Ui) {
|
||||
ui.heading("Platform profile");
|
||||
|
||||
let mut changed = false;
|
||||
@@ -23,7 +23,9 @@ pub fn platform_profile(states: &mut PageDataStates, dbus: &RogDbusClientBlockin
|
||||
});
|
||||
|
||||
if changed {
|
||||
dbus.proxies()
|
||||
states
|
||||
.asus_dbus
|
||||
.proxies()
|
||||
.profile()
|
||||
.set_active_profile(states.profiles.current)
|
||||
.map_err(|err| {
|
||||
@@ -33,21 +35,18 @@ pub fn platform_profile(states: &mut PageDataStates, dbus: &RogDbusClientBlockin
|
||||
};
|
||||
}
|
||||
|
||||
pub fn rog_bios_group(
|
||||
supported: &SupportedFunctions,
|
||||
states: &mut PageDataStates,
|
||||
dbus: &mut RogDbusClientBlocking,
|
||||
ui: &mut Ui,
|
||||
) {
|
||||
pub fn rog_bios_group(supported: &SupportedFunctions, states: &mut SystemState, ui: &mut Ui) {
|
||||
ui.heading("Bios options");
|
||||
|
||||
let slider = egui::Slider::new(&mut states.charge_limit, 20..=100)
|
||||
let slider = egui::Slider::new(&mut states.power_state.charge_limit, 20..=100)
|
||||
.text("Charging limit")
|
||||
.step_by(1.0);
|
||||
if ui.add(slider).drag_released() {
|
||||
dbus.proxies()
|
||||
states
|
||||
.asus_dbus
|
||||
.proxies()
|
||||
.charge()
|
||||
.set_charge_control_end_threshold(states.charge_limit as u8)
|
||||
.set_charge_control_end_threshold(states.power_state.charge_limit as u8)
|
||||
.map_err(|err| {
|
||||
states.error = Some(err.to_string());
|
||||
})
|
||||
@@ -62,7 +61,9 @@ pub fn rog_bios_group(
|
||||
))
|
||||
.changed()
|
||||
{
|
||||
dbus.proxies()
|
||||
states
|
||||
.asus_dbus
|
||||
.proxies()
|
||||
.rog_bios()
|
||||
.set_post_boot_sound(states.bios.post_sound)
|
||||
.map_err(|err| {
|
||||
@@ -79,7 +80,9 @@ pub fn rog_bios_group(
|
||||
))
|
||||
.changed()
|
||||
{
|
||||
dbus.proxies()
|
||||
states
|
||||
.asus_dbus
|
||||
.proxies()
|
||||
.rog_bios()
|
||||
.set_panel_od(states.bios.panel_overdrive)
|
||||
.map_err(|err| {
|
||||
@@ -114,7 +117,9 @@ pub fn rog_bios_group(
|
||||
});
|
||||
|
||||
if changed {
|
||||
dbus.proxies()
|
||||
states
|
||||
.asus_dbus
|
||||
.proxies()
|
||||
.rog_bios()
|
||||
.set_gpu_mux_mode(states.bios.dedicated_gfx)
|
||||
.map_err(|err| {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::{Page, RogApp};
|
||||
|
||||
impl<'a> RogApp<'a> {
|
||||
impl RogApp {
|
||||
pub fn side_panel(&mut self, ctx: &egui::Context) {
|
||||
egui::SidePanel::left("side_panel")
|
||||
.resizable(false)
|
||||
|
||||
@@ -2,7 +2,7 @@ use egui::{vec2, Align2, FontId, Id, Sense};
|
||||
|
||||
use crate::{RogApp, VERSION};
|
||||
|
||||
impl<'a> RogApp<'a> {
|
||||
impl RogApp {
|
||||
pub fn top_bar(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) {
|
||||
egui::TopBottomPanel::top("top_panel").show(ctx, |ui| {
|
||||
// The top panel is often a good place for a menu bar:
|
||||
|
||||
@@ -15,5 +15,3 @@ rog_aura = { path = "../rog-aura" }
|
||||
rog_profiles = { path = "../rog-profiles" }
|
||||
rog_platform = { path = "../rog-platform" }
|
||||
zbus.workspace = true
|
||||
zbus_macros.workspace = true
|
||||
zvariant.workspace = true
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use rog_anime::{AnimeDataBuffer, AnimePowerStates};
|
||||
use zbus_macros::dbus_proxy;
|
||||
use zbus::dbus_proxy;
|
||||
|
||||
#[dbus_proxy(
|
||||
interface = "org.asuslinux.Daemon",
|
||||
@@ -7,33 +7,26 @@ use zbus_macros::dbus_proxy;
|
||||
)]
|
||||
trait Anime {
|
||||
/// Set whether the AniMe will show boot, suspend, or off animations
|
||||
#[inline]
|
||||
fn set_boot_on_off(&self, status: bool) -> zbus::Result<()>;
|
||||
|
||||
/// Set the global AniMe brightness
|
||||
#[inline]
|
||||
fn set_brightness(&self, bright: f32) -> zbus::Result<()>;
|
||||
|
||||
/// Set whether the AniMe is displaying images/data
|
||||
#[inline]
|
||||
fn set_on_off(&self, status: bool) -> zbus::Result<()>;
|
||||
|
||||
/// Writes a data stream of length. Will force system thread to exit until it is restarted
|
||||
#[inline]
|
||||
fn write(&self, input: AnimeDataBuffer) -> zbus::Result<()>;
|
||||
|
||||
/// Get status of if the AniMe LEDs are on
|
||||
#[inline]
|
||||
#[dbus_proxy(property)]
|
||||
fn awake_enabled(&self) -> zbus::Result<bool>;
|
||||
|
||||
/// Get the status of if factory system-status animations are enabled
|
||||
#[inline]
|
||||
#[dbus_proxy(property)]
|
||||
fn boot_enabled(&self) -> zbus::Result<bool>;
|
||||
|
||||
/// Notify listeners of the status of AniMe LED power and factory system-status animations
|
||||
#[inline]
|
||||
#[dbus_proxy(signal)]
|
||||
fn power_states(&self, data: AnimePowerStates) -> zbus::Result<()>;
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use zbus::dbus_proxy;
|
||||
use zbus::{blocking::Connection, Result};
|
||||
use zbus_macros::dbus_proxy;
|
||||
|
||||
use rog_aura::{usb::AuraPowerDev, AuraEffect, AuraModeNum, LedBrightness, PerKeyRaw};
|
||||
|
||||
@@ -34,60 +34,46 @@ const BLOCKING_TIME: u64 = 40; // 100ms = 10 FPS, max 50ms = 20 FPS, 40ms = 25 F
|
||||
)]
|
||||
trait Led {
|
||||
/// NextLedMode method
|
||||
#[inline]
|
||||
fn next_led_mode(&self) -> zbus::Result<()>;
|
||||
|
||||
/// PrevLedMode method
|
||||
#[inline]
|
||||
fn prev_led_mode(&self) -> zbus::Result<()>;
|
||||
|
||||
/// Toggle to next led brightness
|
||||
#[inline]
|
||||
fn next_led_brightness(&self) -> zbus::Result<()>;
|
||||
|
||||
/// Toggle to previous led brightness
|
||||
#[inline]
|
||||
fn prev_led_brightness(&self) -> zbus::Result<()>;
|
||||
|
||||
/// SetBrightness method
|
||||
#[inline]
|
||||
fn set_brightness(&self, brightness: LedBrightness) -> zbus::Result<()>;
|
||||
|
||||
/// SetLedMode method
|
||||
#[inline]
|
||||
fn set_led_mode(&self, effect: &AuraEffect) -> zbus::Result<()>;
|
||||
|
||||
#[inline]
|
||||
fn set_leds_power(&self, options: AuraPowerDev, enabled: bool) -> zbus::Result<()>;
|
||||
|
||||
#[inline]
|
||||
fn per_key_raw(&self, data: PerKeyRaw) -> zbus::fdo::Result<()>;
|
||||
|
||||
/// NotifyLed signal
|
||||
#[inline]
|
||||
#[dbus_proxy(signal)]
|
||||
fn notify_led(&self, data: AuraEffect) -> zbus::Result<()>;
|
||||
|
||||
#[dbus_proxy(signal)]
|
||||
#[inline]
|
||||
fn notify_power_states(&self, data: AuraPowerDev) -> zbus::Result<()>;
|
||||
|
||||
/// LedBrightness property
|
||||
#[inline]
|
||||
#[dbus_proxy(property)]
|
||||
fn led_brightness(&self) -> zbus::Result<i16>;
|
||||
|
||||
/// LedMode property
|
||||
#[inline]
|
||||
fn led_mode(&self) -> zbus::Result<AuraModeNum>;
|
||||
|
||||
/// LedModes property
|
||||
#[inline]
|
||||
fn led_modes(&self) -> zbus::Result<BTreeMap<AuraModeNum, AuraEffect>>;
|
||||
|
||||
// As property doesn't work for AuraPowerDev (complexity of serialization?)
|
||||
// #[dbus_proxy(property)]
|
||||
#[inline]
|
||||
fn leds_enabled(&self) -> zbus::Result<AuraPowerDev>;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
//! …consequently `zbus-xmlgen` did not generate code for the above interfaces.
|
||||
|
||||
use rog_platform::platform::GpuMode;
|
||||
use zbus_macros::dbus_proxy;
|
||||
use zbus::dbus_proxy;
|
||||
|
||||
#[dbus_proxy(
|
||||
interface = "org.asuslinux.Daemon",
|
||||
@@ -28,62 +28,48 @@ use zbus_macros::dbus_proxy;
|
||||
)]
|
||||
trait RogBios {
|
||||
/// DgpuDisable method
|
||||
#[inline]
|
||||
fn dgpu_disable(&self) -> zbus::Result<bool>;
|
||||
|
||||
/// EgpuEnable method
|
||||
#[inline]
|
||||
fn egpu_enable(&self) -> zbus::Result<bool>;
|
||||
|
||||
/// GpuMuxMode method
|
||||
#[inline]
|
||||
fn gpu_mux_mode(&self) -> zbus::Result<GpuMode>;
|
||||
|
||||
/// PanelOd method
|
||||
#[inline]
|
||||
fn panel_od(&self) -> zbus::Result<bool>;
|
||||
|
||||
/// PostBootSound method
|
||||
#[inline]
|
||||
fn post_boot_sound(&self) -> zbus::Result<i16>;
|
||||
|
||||
/// SetDgpuDisable method
|
||||
#[inline]
|
||||
fn set_dgpu_disable(&self, disable: bool) -> zbus::Result<()>;
|
||||
|
||||
/// SetEgpuEnable method
|
||||
#[inline]
|
||||
fn set_egpu_enable(&self, enable: bool) -> zbus::Result<()>;
|
||||
|
||||
/// SetGpuMuxMode method
|
||||
#[inline]
|
||||
fn set_gpu_mux_mode(&self, mode: GpuMode) -> zbus::Result<()>;
|
||||
|
||||
/// SetPanelOd method
|
||||
#[inline]
|
||||
fn set_panel_od(&self, overdrive: bool) -> zbus::Result<()>;
|
||||
|
||||
/// SetPostBootSound method
|
||||
#[inline]
|
||||
fn set_post_boot_sound(&self, on: bool) -> zbus::Result<()>;
|
||||
|
||||
/// NotifyDgpuDisable signal
|
||||
#[inline]
|
||||
#[dbus_proxy(signal)]
|
||||
fn notify_dgpu_disable(&self, disable: bool) -> zbus::Result<()>;
|
||||
|
||||
/// NotifyEgpuEnable signal
|
||||
#[inline]
|
||||
#[dbus_proxy(signal)]
|
||||
fn notify_egpu_enable(&self, enable: bool) -> zbus::Result<()>;
|
||||
|
||||
/// NotifyGpuMuxMode signal
|
||||
#[inline]
|
||||
#[dbus_proxy(signal)]
|
||||
fn notify_gpu_mux_mode(&self, mode: GpuMode) -> zbus::Result<()>;
|
||||
|
||||
/// NotifyPanelOd signal
|
||||
#[inline]
|
||||
#[dbus_proxy(signal)]
|
||||
fn notify_panel_od(&self, overdrive: bool) -> zbus::Result<()>;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
//!
|
||||
//! …consequently `zbus-xmlgen` did not generate code for the above interfaces.
|
||||
|
||||
use zbus_macros::dbus_proxy;
|
||||
use zbus::dbus_proxy;
|
||||
|
||||
#[dbus_proxy(
|
||||
interface = "org.asuslinux.Daemon",
|
||||
@@ -27,24 +27,19 @@ use zbus_macros::dbus_proxy;
|
||||
)]
|
||||
trait Power {
|
||||
/// charge_control_end_threshold method
|
||||
#[inline]
|
||||
fn charge_control_end_threshold(&self) -> zbus::Result<u8>;
|
||||
|
||||
/// MainsOnline method
|
||||
#[inline]
|
||||
fn mains_online(&self) -> zbus::Result<bool>;
|
||||
|
||||
/// set_charge_control_end_threshold method
|
||||
#[inline]
|
||||
fn set_charge_control_end_threshold(&self, limit: u8) -> zbus::Result<()>;
|
||||
|
||||
/// NotifyCharge signal
|
||||
#[inline]
|
||||
#[dbus_proxy(signal)]
|
||||
fn notify_charge_control_end_threshold(&self, limit: u8) -> zbus::Result<u8>;
|
||||
|
||||
/// NotifyMainsOnline signal
|
||||
#[inline]
|
||||
#[dbus_proxy(signal)]
|
||||
fn notify_mains_online(&self, on: bool) -> zbus::Result<()>;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ use rog_profiles::{
|
||||
fan_curve_set::{CurveData, FanCurveSet},
|
||||
Profile,
|
||||
};
|
||||
use zbus_macros::dbus_proxy;
|
||||
use zbus::dbus_proxy;
|
||||
|
||||
#[dbus_proxy(
|
||||
interface = "org.asuslinux.Daemon",
|
||||
@@ -31,55 +31,44 @@ use zbus_macros::dbus_proxy;
|
||||
)]
|
||||
trait Profile {
|
||||
/// Get the fan-curve data for the currently active Profile
|
||||
#[inline]
|
||||
fn fan_curve_data(&self, profile: Profile) -> zbus::Result<FanCurveSet>;
|
||||
|
||||
/// Fetch the active profile name
|
||||
#[inline]
|
||||
fn active_profile(&self) -> zbus::Result<Profile>;
|
||||
|
||||
/// Get a list of profiles that have fan-curves enabled.
|
||||
#[inline]
|
||||
fn enabled_fan_profiles(&self) -> zbus::Result<Vec<Profile>>;
|
||||
|
||||
/// Toggle to next platform_profile. Names provided by `Profiles`.
|
||||
/// If fan-curves are supported will also activate a fan curve for profile.
|
||||
#[inline]
|
||||
fn next_profile(&self) -> zbus::Result<()>;
|
||||
|
||||
/// Fetch profile names
|
||||
#[inline]
|
||||
fn profiles(&self) -> zbus::Result<Vec<Profile>>;
|
||||
|
||||
/// Set this platform_profile name as active
|
||||
#[inline]
|
||||
fn set_active_profile(&self, profile: Profile) -> zbus::Result<()>;
|
||||
|
||||
/// Set a profile fan curve enabled status. Will also activate a fan curve.
|
||||
#[inline]
|
||||
fn set_fan_curve_enabled(&self, profile: Profile, enabled: bool) -> zbus::Result<()>;
|
||||
|
||||
/// Set the fan curve for the specified profile, or the profile the user is
|
||||
/// currently in if profile == None. Will also activate the fan curve.
|
||||
#[inline]
|
||||
fn set_fan_curve(&self, profile: Profile, curve: CurveData) -> zbus::Result<()>;
|
||||
|
||||
/// Reset the stored (self) and device curve to the defaults of the platform.
|
||||
///
|
||||
/// Each platform_profile has a different default and the defualt can be read
|
||||
/// only for the currently active profile.
|
||||
#[inline]
|
||||
fn set_active_curve_to_defaults(&self) -> zbus::Result<()>;
|
||||
|
||||
/// Reset the stored (self) and device curve to the defaults of the platform.
|
||||
///
|
||||
/// Each platform_profile has a different default and the defualt can be read
|
||||
/// only for the currently active profile.
|
||||
#[inline]
|
||||
fn reset_profile_curves(&self, profile: Profile) -> zbus::fdo::Result<()>;
|
||||
|
||||
/// NotifyProfile signal
|
||||
#[inline]
|
||||
#[dbus_proxy(signal)]
|
||||
async fn notify_profile(&self, profile: Profile) -> zbus::Result<Profile>;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
//! …consequently `zbus-xmlgen` did not generate code for the above interfaces.
|
||||
|
||||
use rog_platform::supported::SupportedFunctions;
|
||||
use zbus_macros::dbus_proxy;
|
||||
use zbus::dbus_proxy;
|
||||
|
||||
#[dbus_proxy(
|
||||
interface = "org.asuslinux.Daemon",
|
||||
@@ -28,6 +28,5 @@ use zbus_macros::dbus_proxy;
|
||||
)]
|
||||
trait Supported {
|
||||
/// SupportedFunctions method
|
||||
#[inline]
|
||||
fn supported_functions(&self) -> zbus::Result<SupportedFunctions>;
|
||||
}
|
||||
|
||||
@@ -8,8 +8,7 @@ log.workspace = true
|
||||
rog_aura = { path = "../rog-aura" }
|
||||
serde.workspace = true
|
||||
serde_derive.workspace = true
|
||||
zvariant.workspace = true
|
||||
zvariant_derive.workspace = true
|
||||
zbus.workspace = true
|
||||
sysfs-class.workspace = true
|
||||
concat-idents.workspace = true
|
||||
udev.workspace = true
|
||||
|
||||
@@ -2,7 +2,7 @@ use std::{fmt::Display, path::PathBuf, str::FromStr};
|
||||
|
||||
use log::{info, warn};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use zvariant::Type;
|
||||
use zbus::zvariant::Type;
|
||||
|
||||
use crate::{
|
||||
attr_bool, attr_u8,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use rog_aura::{usb::AuraDevice, AuraModeNum, AuraZone};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
use zvariant_derive::Type;
|
||||
use zbus::zvariant::Type;
|
||||
|
||||
#[derive(Serialize, Deserialize, Type, Debug, Default, Clone)]
|
||||
pub struct SupportedFunctions {
|
||||
|
||||
@@ -6,12 +6,11 @@ edition = "2021"
|
||||
|
||||
[features]
|
||||
default = ["dbus"]
|
||||
dbus = ["zvariant", "zvariant_derive"]
|
||||
dbus = ["zbus"]
|
||||
|
||||
[dependencies]
|
||||
udev.workspace = true
|
||||
serde.workspace = true
|
||||
serde_derive.workspace = true
|
||||
|
||||
zvariant = { workspace = true, optional = true }
|
||||
zvariant_derive = { workspace = true, optional = true }
|
||||
zbus = { workspace = true, optional = true }
|
||||
@@ -2,7 +2,7 @@ use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
use udev::Device;
|
||||
#[cfg(feature = "dbus")]
|
||||
use zvariant_derive::Type;
|
||||
use zbus::zvariant::Type;
|
||||
|
||||
use crate::{error::ProfileError, FanCurvePU};
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
use udev::Device;
|
||||
#[cfg(feature = "dbus")]
|
||||
use zvariant_derive::Type;
|
||||
use zbus::zvariant::Type;
|
||||
|
||||
pub const PLATFORM_PROFILE: &str = "/sys/firmware/acpi/platform_profile";
|
||||
pub const PLATFORM_PROFILES: &str = "/sys/firmware/acpi/platform_profile_choices";
|
||||
@@ -52,7 +52,7 @@ impl Profile {
|
||||
}
|
||||
|
||||
pub fn get_active_profile() -> Result<Profile, ProfileError> {
|
||||
let mut file = OpenOptions::new().read(true).open(&PLATFORM_PROFILE)?;
|
||||
let mut file = OpenOptions::new().read(true).open(PLATFORM_PROFILE)?;
|
||||
|
||||
let mut buf = String::new();
|
||||
file.read_to_string(&mut buf)?;
|
||||
@@ -60,7 +60,7 @@ impl Profile {
|
||||
}
|
||||
|
||||
pub fn get_profile_names() -> Result<Vec<Profile>, ProfileError> {
|
||||
let mut file = OpenOptions::new().read(true).open(&PLATFORM_PROFILES)?;
|
||||
let mut file = OpenOptions::new().read(true).open(PLATFORM_PROFILES)?;
|
||||
|
||||
let mut buf = String::new();
|
||||
file.read_to_string(&mut buf)?;
|
||||
|
||||
Reference in New Issue
Block a user