Compare commits

...

19 Commits

Author SHA1 Message Date
Luke D. Jones
73b1a7050a ROGCC: Make zbus notifications fully manage pagestates 2022-11-15 22:26:17 +13:00
Luke D. Jones
762bfea102 ROGCC: share PageState so tray can use it. zbus notifs update this 2022-11-15 11:12:41 +13:00
Luke D. Jones
b41fdf5cfe ROGCC: add status for dgpu, charge ctl, panel-od to systray 2022-11-14 11:05:52 +13:00
Luke D. Jones
bf13ebebd3 Set tray icon after init 2022-11-13 21:00:33 +13:00
Luke D. Jones
3a73e3a526 Try to prevent tray loop stalling 2022-11-13 12:52:52 +13:00
Luke D. Jones
1211400d7b 4.5.1-RC1 2022-11-11 20:13:00 +13:00
Luke D. Jones
ff9edb9876 Enable system tray status for dGPU and actions 2022-11-11 20:09:43 +13:00
Luke D. Jones
20f8251dd3 Adjust FA506IE led mode match to FA506I 2022-11-10 09:14:17 +13:00
Luke Jones
902dfed67c Merge branch 'add-asus-tuf-gaming-a15-led-modes' into 'main'
Add led_data for 2022 ASUS TUF Gaming A15 FA506IE

See merge request asus-linux/asusctl!137
2022-11-09 20:12:04 +00:00
Luke D. Jones
5e08b4416d Bump version 2022-11-10 09:11:52 +13:00
Herohtar
44c3ab7294 Add led_data for 2022 ASUS TUF Gaming A15 FA506IE 2022-11-09 12:03:23 -06:00
Luke D. Jones
be40474f79 Update app icons 2022-11-09 21:47:41 +13:00
Luke Jones
3654da2ff8 Merge branch 'tuxfanou/building_opensuse' into 'main'
Add openSUSE requirements to build asusctl

See merge request asus-linux/asusctl!136
2022-11-08 20:20:46 +00:00
Luke Jones
60bbad4ab6 Merge branch 'feat-add-vivobook-family' into 'main'
Add Vivobook to asusd rules

See merge request asus-linux/asusctl!135
2022-11-08 20:19:00 +00:00
Sarang S
0a59d5c041 Add Vivobook to asusd rules 2022-11-08 20:19:00 +00:00
Stéphane Burdin
1506fc44d3 Add openSUSE requirements to build asusctl 2022-11-08 16:14:53 +01:00
Luke D. Jones
aad31610f2 Add missing file 2022-11-08 22:03:42 +13:00
Luke D. Jones
a6fe7645e9 Tray icons 2022-11-08 21:55:09 +13:00
Luke D. Jones
4f8745ae19 Prep release 4.5.0 2022-11-07 21:36:28 +13:00
40 changed files with 1469 additions and 485 deletions

View File

@@ -4,7 +4,20 @@ All notable changes to this project will be documented in this file.
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 - 4.5.0-RC5]
## [Unreleased]
## [v4.5.1- RC2]
- Share pagestates with tray process in ROGCC
## [v4.5.1- RC1]
### 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 pagestates with tray process in ROGCC
## [v4.5.0]
### Added
- intofy watches on:
- `charge_control_end_threshold`

542
Cargo.lock generated
View File

@@ -45,6 +45,12 @@ dependencies = [
"memchr",
]
[[package]]
name = "anyhow"
version = "1.0.66"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6"
[[package]]
name = "arboard"
version = "3.2.0"
@@ -77,7 +83,7 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
[[package]]
name = "asusctl"
version = "4.5.0-rc5"
version = "4.5.1-RC2"
dependencies = [
"daemon",
"gif",
@@ -110,22 +116,22 @@ version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e14485364214912d3b19cc3435dde4df66065127f05fa0d75c712f36f12c2f28"
dependencies = [
"concurrent-queue",
"concurrent-queue 1.2.4",
"event-listener",
"futures-core",
]
[[package]]
name = "async-executor"
version = "1.4.1"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "871f9bb5e0a22eeb7e8cf16641feb87c9dc67032ccf8ff49e772eb9941d3a965"
checksum = "17adb73da160dfb475c183343c8cccd80721ea5a605d3eb57125f0a7b7a92d0b"
dependencies = [
"async-lock",
"async-task",
"concurrent-queue",
"concurrent-queue 2.0.0",
"fastrand",
"futures-lite",
"once_cell",
"slab",
]
@@ -149,7 +155,7 @@ checksum = "e8121296a9f05be7f34aa4196b1747243b3b62e048bb7906f644f3fbfc490cf7"
dependencies = [
"async-lock",
"autocfg",
"concurrent-queue",
"concurrent-queue 1.2.4",
"futures-lite",
"libc",
"log",
@@ -229,6 +235,30 @@ dependencies = [
"syn",
]
[[package]]
name = "atk"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c3d816ce6f0e2909a96830d6911c2aff044370b1ef92d7f267b43bae5addedd"
dependencies = [
"atk-sys",
"bitflags",
"glib",
"libc",
]
[[package]]
name = "atk-sys"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58aeb089fb698e06db8089971c7ee317ab9644bade33383f63631437b03aafb6"
dependencies = [
"glib-sys",
"gobject-sys",
"libc",
"system-deps",
]
[[package]]
name = "atomic-waker"
version = "1.0.0"
@@ -266,9 +296,9 @@ checksum = "7b7e4c2464d97fe331d41de9d5db0def0a96f4d823b8b32a2efd503578988973"
[[package]]
name = "bitflags"
version = "1.2.1"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "block"
@@ -344,10 +374,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c"
[[package]]
name = "calloop"
version = "0.10.1"
name = "cairo-rs"
version = "0.15.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a22a6a8f622f797120d452c630b0ab12e1331a1a753e2039ce7868d4ac77b4ee"
checksum = "c76ee391b03d35510d9fa917357c7f1855bd9a6659c95a1b392e33f49b3369bc"
dependencies = [
"bitflags",
"cairo-sys-rs",
"glib",
"libc",
"thiserror",
]
[[package]]
name = "cairo-sys-rs"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c55d429bef56ac9172d25fecb85dc8068307d17acd74b377866b7a1ef25d3c8"
dependencies = [
"glib-sys",
"libc",
"system-deps",
]
[[package]]
name = "calloop"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "595eb0438b3c6d262395fe30e6de9a61beb57ea56290b00a07f227fe6e20cbf2"
dependencies = [
"log",
"nix 0.24.2",
@@ -358,9 +412,9 @@ dependencies = [
[[package]]
name = "cc"
version = "1.0.74"
version = "1.0.76"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "581f5dba903aac52ea3feb5ec4810848460ee833876f1f9b0fdeab1f19091574"
checksum = "76a284da2e6fe2092f2353e51713435363112dfd60030e22add80be333fb928f"
[[package]]
name = "cesu8"
@@ -368,6 +422,15 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c"
[[package]]
name = "cfg-expr"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0357a6402b295ca3a86bc148e84df46c02e41f41fef186bda662557ef6328aa"
dependencies = [
"smallvec",
]
[[package]]
name = "cfg-if"
version = "1.0.0"
@@ -469,6 +532,15 @@ dependencies = [
"cache-padded",
]
[[package]]
name = "concurrent-queue"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd7bef69dc86e3c610e4e7aed41035e2a7ed12e72dd7530f61327a6579a4390b"
dependencies = [
"crossbeam-utils",
]
[[package]]
name = "core-foundation"
version = "0.9.3"
@@ -540,6 +612,15 @@ dependencies = [
"cfg-if",
]
[[package]]
name = "crossbeam-utils"
version = "0.8.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac"
dependencies = [
"cfg-if",
]
[[package]]
name = "crossfont"
version = "0.5.1"
@@ -581,7 +662,7 @@ checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35"
[[package]]
name = "daemon"
version = "4.5.0-rc5"
version = "4.5.1-RC2"
dependencies = [
"async-trait",
"concat-idents",
@@ -605,7 +686,7 @@ dependencies = [
[[package]]
name = "daemon-user"
version = "4.5.0-rc5"
version = "4.5.1-RC2"
dependencies = [
"dirs",
"rog_anime",
@@ -867,9 +948,9 @@ dependencies = [
[[package]]
name = "env_logger"
version = "0.9.1"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c90bf5f19754d10198ccb95b70664fc925bd1fc090a0fd9a6ebc54acc8cd6272"
checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7"
dependencies = [
"atty",
"humantime",
@@ -927,6 +1008,16 @@ dependencies = [
"instant",
]
[[package]]
name = "field-offset"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e1c54951450cbd39f3dbcf1005ac413b49487dabf18a720ad2383eccfeffb92"
dependencies = [
"memoffset",
"rustc_version",
]
[[package]]
name = "flate2"
version = "1.0.24"
@@ -1025,12 +1116,32 @@ dependencies = [
"pkg-config",
]
[[package]]
name = "futures-channel"
version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed"
dependencies = [
"futures-core",
]
[[package]]
name = "futures-core"
version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac"
[[package]]
name = "futures-executor"
version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2"
dependencies = [
"futures-core",
"futures-task",
"futures-util",
]
[[package]]
name = "futures-io"
version = "0.3.25"
@@ -1078,6 +1189,65 @@ dependencies = [
"slab",
]
[[package]]
name = "gdk"
version = "0.15.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6e05c1f572ab0e1f15be94217f0dc29088c248b14f792a5ff0af0d84bcda9e8"
dependencies = [
"bitflags",
"cairo-rs",
"gdk-pixbuf",
"gdk-sys",
"gio",
"glib",
"libc",
"pango",
]
[[package]]
name = "gdk-pixbuf"
version = "0.15.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad38dd9cc8b099cceecdf41375bb6d481b1b5a7cd5cd603e10a69a9383f8619a"
dependencies = [
"bitflags",
"gdk-pixbuf-sys",
"gio",
"glib",
"libc",
]
[[package]]
name = "gdk-pixbuf-sys"
version = "0.15.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "140b2f5378256527150350a8346dbdb08fadc13453a7a2d73aecd5fab3c402a7"
dependencies = [
"gio-sys",
"glib-sys",
"gobject-sys",
"libc",
"system-deps",
]
[[package]]
name = "gdk-sys"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32e7a08c1e8f06f4177fb7e51a777b8c1689f743a7bc11ea91d44d2226073a88"
dependencies = [
"cairo-sys-rs",
"gdk-pixbuf-sys",
"gio-sys",
"glib-sys",
"gobject-sys",
"libc",
"pango-sys",
"pkg-config",
"system-deps",
]
[[package]]
name = "generic-array"
version = "0.14.6"
@@ -1121,6 +1291,36 @@ dependencies = [
"weezl",
]
[[package]]
name = "gio"
version = "0.15.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68fdbc90312d462781a395f7a16d96a2b379bb6ef8cd6310a2df272771c4283b"
dependencies = [
"bitflags",
"futures-channel",
"futures-core",
"futures-io",
"gio-sys",
"glib",
"libc",
"once_cell",
"thiserror",
]
[[package]]
name = "gio-sys"
version = "0.15.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32157a475271e2c4a023382e9cab31c4584ee30a97da41d3c4e9fdd605abcf8d"
dependencies = [
"glib-sys",
"gobject-sys",
"libc",
"system-deps",
"winapi",
]
[[package]]
name = "gl_generator"
version = "0.14.0"
@@ -1141,6 +1341,51 @@ dependencies = [
"serde",
]
[[package]]
name = "glib"
version = "0.15.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "edb0306fbad0ab5428b0ca674a23893db909a98582969c9b537be4ced78c505d"
dependencies = [
"bitflags",
"futures-channel",
"futures-core",
"futures-executor",
"futures-task",
"glib-macros",
"glib-sys",
"gobject-sys",
"libc",
"once_cell",
"smallvec",
"thiserror",
]
[[package]]
name = "glib-macros"
version = "0.15.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25a68131a662b04931e71891fb14aaf65ee4b44d08e8abc10f49e77418c86c64"
dependencies = [
"anyhow",
"heck 0.4.0",
"proc-macro-crate",
"proc-macro-error",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "glib-sys"
version = "0.15.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef4b192f8e65e9cf76cbf4ea71fa8e3be4a0e18ffe3d68b8da6836974cc5bad4"
dependencies = [
"libc",
"system-deps",
]
[[package]]
name = "glow"
version = "0.11.2"
@@ -1218,6 +1463,72 @@ dependencies = [
"gl_generator",
]
[[package]]
name = "gobject-sys"
version = "0.15.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d57ce44246becd17153bd035ab4d32cfee096a657fc01f2231c9278378d1e0a"
dependencies = [
"glib-sys",
"libc",
"system-deps",
]
[[package]]
name = "gtk"
version = "0.15.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92e3004a2d5d6d8b5057d2b57b3712c9529b62e82c77f25c1fecde1fd5c23bd0"
dependencies = [
"atk",
"bitflags",
"cairo-rs",
"field-offset",
"futures-channel",
"gdk",
"gdk-pixbuf",
"gio",
"glib",
"gtk-sys",
"gtk3-macros",
"libc",
"once_cell",
"pango",
"pkg-config",
]
[[package]]
name = "gtk-sys"
version = "0.15.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5bc2f0587cba247f60246a0ca11fe25fb733eabc3de12d1965fc07efab87c84"
dependencies = [
"atk-sys",
"cairo-sys-rs",
"gdk-pixbuf-sys",
"gdk-sys",
"gio-sys",
"glib-sys",
"gobject-sys",
"libc",
"pango-sys",
"system-deps",
]
[[package]]
name = "gtk3-macros"
version = "0.15.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24f518afe90c23fba585b2d7697856f9e6a7bbc62f65588035e66f6afb01a2e9"
dependencies = [
"anyhow",
"proc-macro-crate",
"proc-macro-error",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "gumdrop"
version = "0.8.1"
@@ -1247,6 +1558,12 @@ dependencies = [
"unicode-segmentation",
]
[[package]]
name = "heck"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
[[package]]
name = "hermit-abi"
version = "0.1.19"
@@ -1365,6 +1682,30 @@ version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libappindicator"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db2d3cb96d092b4824cb306c9e544c856a4cb6210c1081945187f7f1924b47e8"
dependencies = [
"glib",
"gtk",
"gtk-sys",
"libappindicator-sys",
"log",
]
[[package]]
name = "libappindicator-sys"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1b3b6681973cea8cc3bce7391e6d7d5502720b80a581c9a95c9cbaf592826aa"
dependencies = [
"gtk-sys",
"libloading",
"once_cell",
]
[[package]]
name = "libc"
version = "0.2.137"
@@ -1373,9 +1714,9 @@ checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89"
[[package]]
name = "libloading"
version = "0.7.3"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd"
checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f"
dependencies = [
"cfg-if",
"winapi",
@@ -1463,9 +1804,9 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]]
name = "memmap2"
version = "0.5.7"
version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95af15f345b17af2efc8ead6080fb8bc376f8cec1b35277b935637595fe77498"
checksum = "4b182332558b18d807c4ce1ca8ca983b34c3ee32765e47b3f0f69b90355cc1dc"
dependencies = [
"libc",
]
@@ -1589,19 +1930,6 @@ dependencies = [
"jni-sys",
]
[[package]]
name = "nix"
version = "0.20.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f5e06129fb611568ef4e868c14b326274959aa70ff7776e9d55323531c374945"
dependencies = [
"bitflags",
"cc",
"cfg-if",
"libc",
"memoffset",
]
[[package]]
name = "nix"
version = "0.24.2"
@@ -1776,6 +2104,31 @@ dependencies = [
"ttf-parser",
]
[[package]]
name = "pango"
version = "0.15.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22e4045548659aee5313bde6c582b0d83a627b7904dd20dc2d9ef0895d414e4f"
dependencies = [
"bitflags",
"glib",
"libc",
"once_cell",
"pango-sys",
]
[[package]]
name = "pango-sys"
version = "0.15.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2a00081cde4661982ed91d80ef437c20eacaf6aa1a5962c0279ae194662c3aa"
dependencies = [
"glib-sys",
"gobject-sys",
"libc",
"system-deps",
]
[[package]]
name = "parking"
version = "2.0.0"
@@ -1811,6 +2164,16 @@ version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"
[[package]]
name = "pest"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a528564cc62c19a7acac4d81e01f39e53e25e17b934878f4c6d25cc2836e62f8"
dependencies = [
"thiserror",
"ucd-trie",
]
[[package]]
name = "pin-project-lite"
version = "0.2.9"
@@ -1888,6 +2251,30 @@ dependencies = [
"toml",
]
[[package]]
name = "proc-macro-error"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
dependencies = [
"proc-macro-error-attr",
"proc-macro2",
"quote",
"syn",
"version_check",
]
[[package]]
name = "proc-macro-error-attr"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
dependencies = [
"proc-macro2",
"quote",
"version_check",
]
[[package]]
name = "proc-macro2"
version = "1.0.47"
@@ -2011,14 +2398,19 @@ dependencies = [
[[package]]
name = "rog-control-center"
version = "4.5.0-rc5"
version = "4.5.1-RC2"
dependencies = [
"daemon",
"dirs",
"eframe",
"egui",
"nix 0.20.2",
"env_logger",
"gtk",
"libappindicator",
"log",
"nix 0.25.0",
"notify-rust",
"png_pong",
"rog_anime",
"rog_aura",
"rog_dbus",
@@ -2036,7 +2428,7 @@ dependencies = [
[[package]]
name = "rog_anime"
version = "4.5.0-rc5"
version = "4.5.1-RC2"
dependencies = [
"gif",
"glam",
@@ -2052,7 +2444,7 @@ dependencies = [
[[package]]
name = "rog_aura"
version = "4.5.0-rc5"
version = "4.5.1-RC2"
dependencies = [
"serde",
"serde_derive",
@@ -2063,7 +2455,7 @@ dependencies = [
[[package]]
name = "rog_dbus"
version = "4.5.0-rc5"
version = "4.5.1-RC2"
dependencies = [
"rog_anime",
"rog_aura",
@@ -2076,7 +2468,7 @@ dependencies = [
[[package]]
name = "rog_platform"
version = "4.5.0-rc5"
version = "4.5.1-RC2"
dependencies = [
"concat-idents",
"inotify",
@@ -2093,7 +2485,7 @@ dependencies = [
[[package]]
name = "rog_profiles"
version = "4.5.0-rc5"
version = "4.5.1-RC2"
dependencies = [
"serde",
"serde_derive",
@@ -2112,6 +2504,15 @@ dependencies = [
"libusb1-sys",
]
[[package]]
name = "rustc_version"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee"
dependencies = [
"semver",
]
[[package]]
name = "ryu"
version = "1.0.11"
@@ -2160,6 +2561,24 @@ dependencies = [
"tiny-skia",
]
[[package]]
name = "semver"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6"
dependencies = [
"semver-parser",
]
[[package]]
name = "semver-parser"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7"
dependencies = [
"pest",
]
[[package]]
name = "serde"
version = "1.0.147"
@@ -2377,7 +2796,7 @@ version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "339f799d8b549e3744c7ac7feb216383e4005d94bdb22561b3ab8f3b808ae9fb"
dependencies = [
"heck",
"heck 0.3.3",
"proc-macro2",
"quote",
"syn",
@@ -2386,10 +2805,8 @@ dependencies = [
[[package]]
name = "supergfxctl"
version = "5.0.2"
source = "git+https://gitlab.com/asus-linux/supergfxctl.git#e551271c53231d650123246cab43ccd42ffe926a"
source = "git+https://gitlab.com/asus-linux/supergfxctl.git#fa022efb54b752a3672a64c640bd7aebeb842e05"
dependencies = [
"env_logger",
"gumdrop",
"log",
"logind-zbus",
"serde",
@@ -2422,6 +2839,19 @@ dependencies = [
"numtoa",
]
[[package]]
name = "system-deps"
version = "6.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2955b1fe31e1fa2fbd1976b71cc69a606d7d4da16f6de3333d0c92d51419aeff"
dependencies = [
"cfg-expr",
"heck 0.4.0",
"pkg-config",
"toml",
"version-compare",
]
[[package]]
name = "tauri-winrt-notification"
version = "0.1.0"
@@ -2549,9 +2979,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9e03c497dc955702ba729190dc4aac6f2a0ce97f913e5b1b5912fc5039d9099"
dependencies = [
"autocfg",
"bytes",
"libc",
"memchr",
"mio",
"num_cpus",
"pin-project-lite",
@@ -2624,6 +3052,12 @@ version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987"
[[package]]
name = "ucd-trie"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81"
[[package]]
name = "udev"
version = "0.6.3"
@@ -2695,6 +3129,12 @@ version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
[[package]]
name = "version-compare"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "579a42fc0b8e0c63b76519a339be31bed574929511fa53c1a3acae26eb258f29"
[[package]]
name = "version_check"
version = "0.9.4"
@@ -2885,9 +3325,9 @@ dependencies = [
[[package]]
name = "webbrowser"
version = "0.8.1"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f7aa8c655ad0b020787afb0b8f0656b2cfbef3452d619ea930e6b1aa1c5c1e9"
checksum = "2a0cc7962b5aaa0dfcebaeef0161eec6edf5f4606c12e6777fd7d392f52033a5"
dependencies = [
"jni",
"ndk-context",
@@ -3216,7 +3656,6 @@ dependencies = [
"futures-sink",
"futures-util",
"hex",
"lazy_static",
"nix 0.25.0",
"once_cell",
"ordered-stream",
@@ -3225,7 +3664,6 @@ dependencies = [
"serde_repr",
"sha1",
"static_assertions",
"tokio",
"tracing",
"uds_windows",
"winapi",

View File

@@ -2,11 +2,11 @@
members = ["asusctl", "daemon", "daemon-user", "rog-platform", "rog-dbus", "rog-anime", "rog-aura", "rog-profiles", "rog-control-center"]
[workspace.package]
version = "4.5.0-rc5"
version = "4.5.1-RC2"
[workspace.dependencies]
async-trait = "^0.1"
tokio = { version = "^1.21.2", features = ["macros", "rt-multi-thread", "time"]}
tokio = { version = "^1.21.2", features = ["macros", "rt-multi-thread", "time", "sync"]}
concat-idents = "^1.1"
dirs = "^4.0"
smol = "^1.2"
@@ -23,7 +23,7 @@ serde_json = "^1.0"
toml = "^0.5.9"
log = "^0.4"
env_logger = "^0.9"
env_logger = "^0.9.3"
glam = { version = "^0.22", features = ["serde"] }
gumdrop = "^0.8"

View File

@@ -57,7 +57,10 @@ install:
$(INSTALL_DATA) "./data/icons/asus_notif_yellow.png" "$(DESTDIR)$(datarootdir)/icons/hicolor/512x512/apps/asus_notif_yellow.png"
$(INSTALL_DATA) "./data/icons/asus_notif_green.png" "$(DESTDIR)$(datarootdir)/icons/hicolor/512x512/apps/asus_notif_green.png"
$(INSTALL_DATA) "./data/icons/asus_notif_blue.png" "$(DESTDIR)$(datarootdir)/icons/hicolor/512x512/apps/asus_notif_blue.png"
$(INSTALL_DATA) "./data/icons/asus_notif_red.png" "$(DESTDIR)$(datarootdir)/icons/hicolor/512x512/apps/asus_notif_red.png"
$(INSTALL_DATA) "./data/icons/asus_notif_orange.png" "$(DESTDIR)$(datarootdir)/icons/hicolor/512x512/apps/asus_notif_orange.png"
$(INSTALL_DATA) "./data/icons/asus_notif_white.png" "$(DESTDIR)$(datarootdir)/icons/hicolor/512x512/apps/asus_notif_white.png"
$(INSTALL_DATA) "./data/icons/scalable/gpu-compute.svg" "$(DESTDIR)$(datarootdir)/icons/hicolor/scalable/status/gpu-compute.svg"
$(INSTALL_DATA) "./data/icons/scalable/gpu-hybrid.svg" "$(DESTDIR)$(datarootdir)/icons/hicolor/scalable/status/gpu-hybrid.svg"

View File

@@ -81,7 +81,16 @@ Requirements are rust >= 1.57 installed from rustup.io if the distro provided ve
**fedora:**
dnf install clang-devel systemd-devel cargo
dnf install cmake clang-devel systemd-devel gtk3-devel
make
sudo make install
**openSUSE:**
Works with KDE Plasma (without GTK packages)
zypper in -t pattern devel_basis
zypper in rustup cmake clang-devel systemd-devel glib2-devel cairo-devel atkmm-devel pangomm-devel gdk-pixbuf-devel gtk3-devel
make
sudo make install

View File

@@ -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 {

View File

@@ -61,7 +61,7 @@ impl Config {
pub fn read(&mut self) {
let mut file = OpenOptions::new()
.read(true)
.open(&CONFIG_PATH)
.open(CONFIG_PATH)
.unwrap_or_else(|err| panic!("Error reading {}: {}", CONFIG_PATH, err));
let mut buf = String::new();
if let Ok(l) = file.read_to_string(&mut buf) {

View File

@@ -90,7 +90,7 @@ impl LedSupportFile {
let mut loaded = false;
let mut data = LedSupportFile::default();
// Load user configs first so they are first to be checked
if let Ok(mut file) = OpenOptions::new().read(true).open(&ASUS_LED_MODE_USER_CONF) {
if let Ok(mut file) = OpenOptions::new().read(true).open(ASUS_LED_MODE_USER_CONF) {
let mut buf = String::new();
if let Ok(l) = file.read_to_string(&mut buf) {
if l == 0 {
@@ -107,7 +107,7 @@ impl LedSupportFile {
}
}
// Load and append the default LED support data
if let Ok(mut file) = OpenOptions::new().read(true).open(&ASUS_LED_MODE_CONF) {
if let Ok(mut file) = OpenOptions::new().read(true).open(ASUS_LED_MODE_CONF) {
let mut buf = String::new();
if let Ok(l) = file.read_to_string(&mut buf) {
if l == 0 {

View File

@@ -64,7 +64,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();
});

View File

@@ -12,6 +12,13 @@ standard = ["Static", "Breathe", "Strobe", "Rainbow", "Pulse"]
multizone = []
per_key = false
[[led_data]]
prod_family = "ASUS TUF Gaming A15"
board_names = ["FA506I"]
standard = ["Static", "Breathe", "Strobe", "Pulse"]
multizone = []
per_key = false
[[led_data]]
prod_family = "Zephyrus S"
board_names = ["GX502", "GX701", "G531", "GL531", "G532"]

View File

@@ -9,6 +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"
# No match so
GOTO="asusd_end"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 185 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 203 KiB

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 208 KiB

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 197 KiB

After

Width:  |  Height:  |  Size: 74 KiB

View File

@@ -5,7 +5,7 @@ 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;
@@ -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 {

View File

@@ -12,14 +12,20 @@ egui = { git = "https://github.com/flukejones/egui" }
eframe= { git = "https://github.com/flukejones/egui" }
#eframe= { git = "https://github.com/emilk/egui", default-features = false, features = ["dark-light", "default_fonts", "wgpu"] }
libappindicator = "0.7" # Tray icon
gtk = "0.15"
daemon = { path = "../daemon" }
rog_anime = { path = "../rog-anime" }
rog_dbus = { path = "../rog-dbus" }
rog_aura = { path = "../rog-aura" }
rog_profiles = { path = "../rog-profiles" }
rog_platform = { path = "../rog-platform" }
supergfxctl = { git = "https://gitlab.com/asus-linux/supergfxctl.git" }
#supergfxctl = { path = "../../supergfxctl" }
supergfxctl = { git = "https://gitlab.com/asus-linux/supergfxctl.git", default-features = false }
#supergfxctl = { path = "../../supergfxctl", default-features = false }
log.workspace = true
env_logger.workspace = true
tokio.workspace = true
serde.workspace = true
@@ -30,5 +36,7 @@ zbus.workspace = true
dirs.workspace = true
notify-rust.workspace = true
nix = "^0.20.0"
png_pong.workspace = true
nix = "^0.25"
tempfile = "3.2.0"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 70 KiB

View File

@@ -2,7 +2,7 @@ use std::{
f64::consts::PI,
sync::{
atomic::{AtomicBool, AtomicU8, Ordering},
Arc,
Arc, Mutex,
},
time::{Duration, Instant},
};
@@ -14,13 +14,12 @@ use crate::{
config::Config, error::Result, page_states::PageDataStates, Page, RogDbusClientBlocking,
};
pub struct RogApp<'a> {
pub struct RogApp {
pub page: Page,
pub states: PageDataStates,
pub states: Arc<Mutex<PageDataStates>>,
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>,
@@ -31,11 +30,11 @@ pub struct RogApp<'a> {
pub oscillator_toggle: Arc<AtomicBool>,
}
impl<'a> RogApp<'a> {
impl RogApp {
/// Called once before the first frame.
pub fn new(
config: Config,
states: PageDataStates,
states: Arc<Mutex<PageDataStates>>,
_cc: &eframe::CreationContext<'_>,
) -> Result<Self> {
let (dbus, _) = RogDbusClientBlocking::new()?;
@@ -55,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;
@@ -83,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));
}
});
@@ -92,7 +93,6 @@ impl<'a> RogApp<'a> {
states,
page: Page::System,
config,
asus_dbus: dbus,
oscillator1,
oscillator2,
oscillator3,
@@ -102,32 +102,29 @@ impl<'a> RogApp<'a> {
}
}
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) {
let Self {
supported,
asus_dbus: dbus,
states,
..
} = self;
states
.refresh_if_notfied(supported, dbus)
.map(|repaint| {
if repaint {
let states = self.states.clone();
if let Ok(mut states) = states.try_lock() {
if states.app_should_update {
states.app_should_update = false;
ctx.request_repaint();
}
})
.map_err(|e| self.states.error = Some(e.to_string()))
.ok();
}
let page = self.page;
self.top_bar(ctx, frame);
self.side_panel(ctx);
if let Some(err) = self.states.error.clone() {
let mut was_error = false;
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));
@@ -143,19 +140,25 @@ impl<'a> eframe::App for RogApp<'a> {
.add(Button::new(RichText::new("Okay").size(20.0)))
.clicked()
{
self.states.error = None;
states.error = None;
}
});
});
} else if page == Page::System {
self.system_page(ctx);
}
}
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(ctx);
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(ctx);
self.fan_curve_page(&mut states, ctx);
}
}
}
}
}

View File

@@ -6,17 +6,18 @@ use std::{
use serde_derive::{Deserialize, Serialize};
//use log::{error, info, warn};
use crate::error::Error;
use crate::{error::Error, notify::EnabledNotifications};
const CFG_DIR: &str = "rog";
const CFG_FILE_NAME: &str = "rog-control-center.cfg";
#[derive(Debug, Deserialize, Serialize)]
#[derive(Debug, Clone, Deserialize, Serialize)]
#[serde(default)]
pub struct Config {
pub run_in_background: bool,
pub startup_in_background: bool,
pub enable_notifications: bool,
pub enabled_notifications: EnabledNotifications,
}
impl Default for Config {
@@ -25,6 +26,7 @@ impl Default for Config {
run_in_background: true,
startup_in_background: false,
enable_notifications: true,
enabled_notifications: EnabledNotifications::default(),
}
}
}
@@ -65,7 +67,7 @@ impl Config {
Err(Error::ConfigLoadFail)
}
pub fn save(&self) -> Result<(), Error> {
pub fn save(&mut self, enabled_notifications: &EnabledNotifications) -> Result<(), Error> {
let mut path = if let Some(dir) = dirs::config_dir() {
dir
} else {
@@ -85,6 +87,7 @@ impl Config {
.truncate(true)
.open(&path)?;
self.enabled_notifications = enabled_notifications.clone();
let t = toml::to_string_pretty(&self).unwrap();
file.write_all(t.as_bytes())?;
Ok(())

View File

@@ -17,6 +17,7 @@ pub mod notify;
pub mod page_states;
pub mod pages;
pub mod startup_error;
pub mod tray;
pub mod widgets;
#[cfg(feature = "mocking")]
@@ -96,7 +97,7 @@ pub fn get_ipc_file() -> Result<File, crate::error::Error> {
let tmp_dir = std::env::temp_dir().join("rog-gui");
let fifo_path = tmp_dir.join("ipc.pipe");
if let Err(e) = unistd::mkfifo(&fifo_path, stat::Mode::S_IRWXU) {
if !matches!(e, nix::Error::Sys(nix::errno::Errno::EEXIST)) {
if !matches!(e, nix::errno::Errno::EEXIST) {
return Err(e)?;
}
}

View File

@@ -1,28 +1,38 @@
use eframe::NativeOptions;
use eframe::{IconData, NativeOptions};
use log::{error, LevelFilter};
use rog_aura::layouts::KeyLayout;
use rog_control_center::notify::EnabledNotifications;
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, RogApp,
RogDbusClientBlocking, SHOWING_GUI, SHOW_GUI,
};
use rog_platform::supported::SupportedFunctions;
use tokio::runtime::Runtime;
use std::sync::Mutex;
use std::{
fs::OpenOptions,
io::{Read, Write},
path::PathBuf,
sync::{atomic::AtomicBool, Arc},
sync::Arc,
};
use tokio::runtime::Runtime;
#[cfg(not(feature = "mocking"))]
const DATA_DIR: &str = "/usr/share/rog-gui/";
#[cfg(feature = "mocking")]
const DATA_DIR: &str = env!("CARGO_MANIFEST_DIR");
const BOARD_NAME: &str = "/sys/class/dmi/id/board_name";
const APP_ICON_PATH: &str = "/usr/share/icons/hicolor/512x512/apps/rog-control-center.png";
fn main() -> Result<()> {
print_versions();
let mut logger = env_logger::Builder::new();
logger
.target(env_logger::Target::Stdout)
.format(|buf, record| writeln!(buf, "{}: {}", record.level(), record.args()))
.filter(None, LevelFilter::Info)
.init();
// start tokio
let rt = Runtime::new().expect("Unable to create Runtime");
@@ -36,6 +46,7 @@ fn main() -> Result<()> {
min_window_size: Some(egui::vec2(840.0, 600.0)),
max_window_size: Some(egui::vec2(840.0, 600.0)),
run_and_return: true,
icon_data: Some(load_icon()),
..Default::default()
};
@@ -49,14 +60,28 @@ fn main() -> Result<()> {
})
.unwrap();
let supported = match dbus.proxies().supported().supported_functions() {
Ok(s) => s,
Err(e) => {
eframe::run_native(
"ROG Control Center",
native_options.clone(),
Box::new(move |_| Box::new(AppErrorShow::new(e.to_string()))),
);
SupportedFunctions::default()
}
};
// Startup
let mut config = Config::load()?;
let mut start_closed = config.startup_in_background;
if config.startup_in_background {
config.run_in_background = true;
config.save()?;
let tmp = config.enabled_notifications.clone(); // ends up being a double clone, oh well.
config.save(&tmp)?;
}
let enabled_notifications = EnabledNotifications::tokio_mutex(&config);
// Find and load a matching layout for laptop
let mut file = OpenOptions::new()
@@ -93,9 +118,9 @@ fn main() -> Result<()> {
Err(_) => on_tmp_dir_exists().unwrap(),
};
let states =
setup_page_state_and_notifs(layout.clone(), &config, native_options.clone(), &dbus)
.unwrap();
let states = setup_page_state_and_notifs(layout, enabled_notifications, &supported).unwrap();
init_tray(supported, states.clone());
loop {
if !start_closed {
@@ -127,57 +152,21 @@ fn main() -> Result<()> {
fn setup_page_state_and_notifs(
keyboard_layout: KeyLayout,
config: &Config,
native_options: NativeOptions,
dbus: &RogDbusClientBlocking,
) -> 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));
let notifs_enabled = Arc::new(AtomicBool::new(config.enable_notifications));
start_notifications(
charge_notified.clone(),
bios_notified.clone(),
aura_notified.clone(),
anime_notified.clone(),
profiles_notified.clone(),
fans_notified.clone(),
notifs_enabled.clone(),
)?;
let supported = match dbus.proxies().supported().supported_functions() {
Ok(s) => s,
Err(e) => {
eframe::run_native(
"ROG Control Center",
native_options,
Box::new(move |_| Box::new(AppErrorShow::new(e.to_string()))),
);
SupportedFunctions::default()
}
};
PageDataStates::new(
enabled_notifications: Arc<Mutex<EnabledNotifications>>,
supported: &SupportedFunctions,
) -> Result<Arc<Mutex<PageDataStates>>> {
let page_states = Arc::new(Mutex::new(PageDataStates::new(
keyboard_layout,
notifs_enabled.clone(),
charge_notified.clone(),
bios_notified.clone(),
aura_notified.clone(),
anime_notified.clone(),
profiles_notified.clone(),
fans_notified.clone(),
&supported,
&dbus,
)
enabled_notifications.clone(),
supported,
)?));
start_notifications(page_states.clone(), enabled_notifications)?;
Ok(page_states)
}
fn start_app(states: PageDataStates, native_options: NativeOptions) -> Result<()> {
fn start_app(states: Arc<Mutex<PageDataStates>>, native_options: NativeOptions) -> Result<()> {
let mut ipc_file = get_ipc_file().unwrap();
ipc_file.write_all(&[SHOWING_GUI]).unwrap();
eframe::run_native(
@@ -187,3 +176,41 @@ fn start_app(states: PageDataStates, native_options: NativeOptions) -> Result<()
);
Ok(())
}
/// Bah.. the icon dosn't work on wayland anyway, but we'll leave it in for now.
fn load_icon() -> IconData {
let path = PathBuf::from(APP_ICON_PATH);
let mut buf = Vec::new();
let mut rgba = Vec::new();
let mut height = 512;
let mut width = 512;
if path.exists() {
if let Ok(mut file) = OpenOptions::new()
.read(true)
.open(path)
.map_err(|e| error!("Error opening app icon: {e:?}"))
{
file.read_to_end(&mut buf)
.map_err(|e| error!("Error reading app icon: {e:?}"))
.ok();
let data = std::io::Cursor::new(buf);
let decoder = png_pong::Decoder::new(data).unwrap().into_steps();
let png_pong::Step { raster, delay: _ } = decoder.last().unwrap().unwrap();
if let png_pong::PngRaster::Rgba8(ras) = raster {
rgba = ras.as_u8_slice().to_vec();
width = ras.width();
height = ras.height();
}
}
} else {
error!("Missing {APP_ICON_PATH}")
}
IconData {
height,
width,
rgba,
}
}

View File

@@ -1,23 +1,67 @@
use crate::error::Result;
use notify_rust::{Hint, Notification, NotificationHandle};
use crate::{config::Config, error::Result, page_states::PageDataStates};
use notify_rust::{Hint, Notification, NotificationHandle, Urgency};
use rog_dbus::{
zbus_anime::AnimeProxy, zbus_led::LedProxy, zbus_platform::RogBiosProxy,
zbus_power::PowerProxy, zbus_profile::ProfileProxy,
};
use rog_platform::platform::GpuMode;
use rog_profiles::Profile;
use serde::{Deserialize, Serialize};
use std::{
fmt::Display,
sync::{
atomic::{AtomicBool, Ordering},
Arc, Mutex,
},
process::Command,
sync::{Arc, Mutex},
};
use supergfxctl::pci_device::GfxPower;
use supergfxctl::{pci_device::GfxPower, zbus_proxy::DaemonProxy as SuperProxy};
use zbus::export::futures_util::{future, StreamExt};
const NOTIF_HEADER: &str = "ROG Control";
#[derive(Debug, Clone, Deserialize, Serialize)]
#[serde(default)]
pub struct EnabledNotifications {
pub receive_notify_post_boot_sound: bool,
pub receive_notify_panel_od: bool,
pub receive_notify_dgpu_disable: bool,
pub receive_notify_egpu_enable: bool,
pub receive_notify_gpu_mux_mode: bool,
pub receive_notify_charge_control_end_threshold: bool,
pub receive_notify_mains_online: bool,
pub receive_notify_profile: bool,
pub receive_notify_led: bool,
/// Anime
pub receive_power_states: bool,
pub receive_notify_gfx: bool,
pub receive_notify_gfx_status: bool,
pub all_enabled: bool,
}
impl Default for EnabledNotifications {
fn default() -> Self {
Self {
receive_notify_post_boot_sound: false,
receive_notify_panel_od: true,
receive_notify_dgpu_disable: true,
receive_notify_egpu_enable: true,
receive_notify_gpu_mux_mode: true,
receive_notify_charge_control_end_threshold: true,
receive_notify_mains_online: false,
receive_notify_profile: true,
receive_notify_led: false,
receive_power_states: false,
receive_notify_gfx: false,
receive_notify_gfx_status: false,
all_enabled: false,
}
}
}
impl EnabledNotifications {
pub fn tokio_mutex(config: &Config) -> Arc<Mutex<Self>> {
Arc::new(Mutex::new(config.enabled_notifications.clone()))
}
}
macro_rules! notify {
($notifier:expr, $last_notif:ident) => {
if let Some(notif) = $last_notif.take() {
@@ -29,35 +73,41 @@ 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();
if let Ok(p) = proxy.$signal().await {
p.for_each(|e| {
if let Ok(mut p) = proxy.$signal().await {
while let Some(e) = p.next().await {
if let Ok(out) = e.args() {
if notifs_enabled1.load(Ordering::SeqCst) {
if let Ok(ref mut lock) = last_notif.try_lock() {
notify!($notifier($msg, &out$(.$out_arg)+()), lock);
if let Ok(config) = notifs_enabled1.lock() {
if config.all_enabled && config.$signal {
if let Ok(ref mut lock) = last_notif.lock() {
notify!($notifier($msg, &out.$($out_arg)+()), lock);
}
}
}
if let Ok(mut lock) = page_states1.lock() {
lock.$($args)+ = *out.$($out_arg)+();
lock.set_notified();
}
}
notified.store(true, Ordering::SeqCst);
}
future::ready(())
})
.await;
};
});
};
@@ -66,13 +116,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>,
notifs_enabled: Arc<AtomicBool>,
page_states: Arc<Mutex<PageDataStates>>,
enabled_notifications: Arc<Mutex<EnabledNotifications>>,
) -> Result<()> {
let last_notification: SharedHandle = Arc::new(Mutex::new(None));
@@ -80,10 +125,11 @@ pub fn start_notifications(
recv_notif!(
RogBiosProxy,
receive_notify_post_boot_sound,
bios_notified,
last_notification,
notifs_enabled,
[on],
enabled_notifications,
page_states,
(bios.post_sound),
(on),
"BIOS Post sound",
do_notification
);
@@ -91,10 +137,11 @@ pub fn start_notifications(
recv_notif!(
RogBiosProxy,
receive_notify_panel_od,
bios_notified,
last_notification,
notifs_enabled,
[overdrive],
enabled_notifications,
page_states,
(bios.panel_overdrive),
(overdrive),
"Panel Overdrive enabled:",
do_notification
);
@@ -102,10 +149,11 @@ pub fn start_notifications(
recv_notif!(
RogBiosProxy,
receive_notify_dgpu_disable,
bios_notified,
last_notification,
notifs_enabled,
[disable],
enabled_notifications,
page_states,
(bios.dgpu_disable),
(disable),
"BIOS dGPU disabled",
do_notification
);
@@ -113,10 +161,11 @@ pub fn start_notifications(
recv_notif!(
RogBiosProxy,
receive_notify_egpu_enable,
bios_notified,
last_notification,
notifs_enabled,
[enable],
enabled_notifications,
page_states,
(bios.egpu_enable),
(enable),
"BIOS eGPU enabled",
do_notification
);
@@ -124,22 +173,24 @@ pub fn start_notifications(
recv_notif!(
RogBiosProxy,
receive_notify_gpu_mux_mode,
bios_notified,
last_notification,
notifs_enabled,
[mode],
"BIOS GPU MUX mode (reboot required)",
mux_notification
enabled_notifications,
page_states,
(bios.dedicated_gfx),
(mode),
"Reboot required. BIOS GPU MUX mode set to",
do_mux_notification
);
// Charge notif
recv_notif!(
PowerProxy,
receive_notify_charge_control_end_threshold,
charge_notified,
last_notification,
notifs_enabled,
[limit],
enabled_notifications,
page_states,
(power_state.charge_limit),
(limit),
"Battery charge limit changed to",
do_notification
);
@@ -147,10 +198,11 @@ pub fn start_notifications(
recv_notif!(
PowerProxy,
receive_notify_mains_online,
bios_notified,
last_notification,
notifs_enabled,
[on],
enabled_notifications,
page_states,
(power_state.ac_power),
(on),
"AC Power power is",
ac_power_notification
);
@@ -159,10 +211,11 @@ pub fn start_notifications(
recv_notif!(
ProfileProxy,
receive_notify_profile,
profiles_notified,
last_notification,
notifs_enabled,
[profile],
enabled_notifications,
page_states,
(profiles.current),
(profile),
"Profile changed to",
do_thermal_notif
);
@@ -172,69 +225,95 @@ pub fn start_notifications(
recv_notif!(
LedProxy,
receive_notify_led,
aura_notified,
last_notification,
notifs_enabled,
[data mode_name],
enabled_notifications,
page_states,
(aura.current_mode),
(data.mode),
"Keyboard LED mode changed to",
do_notification
);
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(())
})
.await;
};
});
let page_states1 = page_states.clone();
tokio::spawn(async move {
let conn = zbus::Connection::system().await.unwrap();
let proxy = AnimeProxy::new(&conn).await.unwrap();
if let Ok(p) = proxy.receive_power_states().await {
p.for_each(|_| {
anime_notified.store(true, Ordering::SeqCst);
if let Ok(_lock) = page_states1.lock() {
// TODO: lock.anime.
}
future::ready(())
})
.await;
};
});
let notifs_enabled1 = notifs_enabled.clone();
let last_notif = last_notification.clone();
let bios_notified1 = bios_notified.clone();
recv_notif!(
SuperProxy,
receive_notify_gfx,
last_notification,
enabled_notifications,
page_states,
(gfx_state.mode),
(mode),
"Gfx mode changed to",
do_notification
);
// recv_notif!(
// SuperProxy,
// receive_notify_action,
// bios_notified,
// last_gfx_action_notif,
// enabled_notifications,
// [action],
// "Gfx mode change requires",
// do_gfx_action_notif
// );
tokio::spawn(async move {
let conn = zbus::Connection::system().await.unwrap();
let proxy = supergfxctl::zbus_proxy::DaemonProxy::new(&conn)
.await
.unwrap();
if let Ok(p) = proxy.receive_notify_gfx_status().await {
p.for_each(|e| {
let proxy = SuperProxy::new(&conn).await.unwrap();
if let Ok(mut p) = proxy.receive_notify_action().await {
while let Some(e) = p.next().await {
if let Ok(out) = e.args() {
if notifs_enabled1.load(Ordering::SeqCst) {
let status = out.status();
if *status != GfxPower::Unknown {
let action = out.action();
do_gfx_action_notif("Gfx mode change requires", &format!("{action:?}",))
.unwrap();
}
}
};
});
let notifs_enabled1 = enabled_notifications;
let last_notif = last_notification;
tokio::spawn(async move {
let conn = zbus::Connection::system().await.unwrap();
let proxy = SuperProxy::new(&conn).await.unwrap();
if let Ok(mut p) = proxy.receive_notify_gfx_status().await {
while let Some(e) = p.next().await {
if let Ok(out) = e.args() {
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_notification(
"dGPU status changed:",
&format!("{status:?}",)
),
do_gpu_status_notif("dGPU status changed:", &status),
lock
);
}
}
}
if let Ok(mut lock) = page_states.lock() {
lock.gfx_state.power_status = status;
lock.set_notified();
}
}
}
}
bios_notified1.store(true, Ordering::SeqCst);
future::ready(())
})
.await;
};
});
@@ -273,11 +352,6 @@ fn ac_power_notification(message: &str, on: &bool) -> Result<NotificationHandle>
Ok(base_notification(message, &data).show()?)
}
/// Actual GpuMode unused as data is never correct until switched by reboot
fn mux_notification(message: &str, _: &GpuMode) -> Result<NotificationHandle> {
Ok(base_notification(message, &"").show()?)
}
fn do_thermal_notif(message: &str, profile: &Profile) -> Result<NotificationHandle> {
let icon = match profile {
Profile::Balanced => "asus_notif_yellow",
@@ -288,3 +362,49 @@ fn do_thermal_notif(message: &str, profile: &Profile) -> Result<NotificationHand
let mut notif = base_notification(message, &profile.to_uppercase());
Ok(notif.icon(icon).show()?)
}
fn do_gpu_status_notif(message: &str, data: &GfxPower) -> Result<NotificationHandle> {
// eww
let mut notif = base_notification(message, &<&str>::from(data).to_string());
let icon = match data {
GfxPower::Active => "asus_notif_red",
GfxPower::Suspended => "asus_notif_blue",
GfxPower::Off => "asus_notif_green",
GfxPower::AsusDisabled => "asus_notif_white",
GfxPower::AsusMuxDiscreet => "asus_notif_red",
GfxPower::Unknown => "gpu-integrated",
};
notif.icon(icon);
Ok(Notification::show(&notif)?)
}
fn do_gfx_action_notif<T>(message: &str, data: &T) -> Result<()>
where
T: Display,
{
let mut notif = base_notification(message, data);
notif.action("gnome-session-quit", "Logout");
notif.urgency(Urgency::Critical);
notif.timeout(3000);
notif.icon("dialog-warning");
notif.hint(Hint::Transient(true));
let handle = notif.show()?;
handle.wait_for_action(|id| {
if id == "gnome-session-quit" {
let mut cmd = Command::new("gnome-session-quit");
cmd.spawn().ok();
} else if id == "__closed" {
// TODO: cancel the switching
}
});
Ok(())
}
/// Actual GpuMode unused as data is never correct until switched by reboot
fn do_mux_notification(message: &str, _: &GpuMode) -> Result<NotificationHandle> {
let mut notif = base_notification(message, &"");
notif.urgency(Urgency::Critical);
notif.icon("system-reboot-symbolic");
notif.hint(Hint::Transient(true));
Ok(notif.show()?)
}

View File

@@ -1,24 +1,24 @@
use std::{
collections::{BTreeMap, HashSet},
sync::{
atomic::{AtomicBool, Ordering},
Arc,
},
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, RogDbusClientBlocking};
use crate::{error::Result, notify::EnabledNotifications, RogDbusClientBlocking};
#[derive(Clone, Debug)]
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,39 @@ impl AnimeState {
}
}
#[derive(Debug, Clone)]
#[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()?,
})
}
}
pub struct PageDataStates {
pub keyboard_layout: KeyLayout,
pub notifs_enabled: Arc<AtomicBool>,
pub was_notified: Arc<AtomicBool>,
pub enabled_notifications: Arc<Mutex<EnabledNotifications>>,
/// Because much of the app state here is the same as `RogBiosSupportedFunctions`
/// we can re-use that structure.
pub bios: BiosState,
@@ -258,87 +257,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 {
/// Creates self, including the relevant dbus connections and proixies for internal use
pub fn new(
keyboard_layout: KeyLayout,
notifs_enabled: Arc<AtomicBool>,
charge_notified: Arc<AtomicBool>,
bios_notified: Arc<AtomicBool>,
aura_notified: Arc<AtomicBool>,
anime_notified: Arc<AtomicBool>,
profiles_notified: Arc<AtomicBool>,
fans_notified: Arc<AtomicBool>,
enabled_notifications: Arc<Mutex<EnabledNotifications>>,
supported: &SupportedFunctions,
dbus: &RogDbusClientBlocking,
) -> Result<Self> {
let (asus_dbus, conn) = RogDbusClientBlocking::new().unwrap();
let gfx_dbus = GfxProxyBlocking::new(&conn).unwrap();
Ok(Self {
keyboard_layout,
notifs_enabled,
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)?,
enabled_notifications,
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 {
fn default() -> Self {
let (asus_dbus, conn) = RogDbusClientBlocking::new().unwrap();
let gfx_dbus = GfxProxyBlocking::new(&conn).unwrap();
Self {
keyboard_layout: KeyLayout::ga401_layout(),
notifs_enabled: Default::default(),
was_notified: Default::default(),
enabled_notifications: Default::default(),
bios: BiosState {
was_notified: Default::default(),
post_sound: Default::default(),
dedicated_gfx: GpuMode::NotSupported,
panel_overdrive: Default::default(),
@@ -346,7 +317,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 +330,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,
}
}
}

View File

@@ -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");

View File

@@ -4,16 +4,15 @@ use egui::Color32;
use rog_aura::{AuraEffect, AuraModeNum};
use crate::{
page_states::PageDataStates,
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 PageDataStates, 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);
});

View File

@@ -1,5 +1,5 @@
use crate::{
page_states::{FanCurvesState, ProfilesState},
page_states::{FanCurvesState, PageDataStates, ProfilesState},
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 PageDataStates, 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()),
}

View File

@@ -1,18 +1,15 @@
use crate::{
page_states::PageDataStates,
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 PageDataStates, ctx: &egui::Context) {
let Self {
config,
supported,
states,
asus_dbus: dbus,
..
config, supported, ..
} = self;
egui::CentralPanel::default().show(ctx, |ui| {
@@ -27,26 +24,24 @@ impl<'a> RogApp<'a> {
/******************************************************/
ui.vertical(|ui| {
ui.separator();
app_settings(config, states, ui);
if supported.platform_profile.platform_profile {
platform_profile(states, ui);
}
});
ui.vertical(|ui| {
ui.separator();
if supported.platform_profile.platform_profile {
platform_profile(states, dbus, ui);
}
aura_power_group(supported, states, ui);
});
ui.end_row();
/******************************************************/
ui.vertical(|ui| {
ui.separator();
aura_power_group(supported, states, dbus, ui);
app_settings(config, states, ui);
});
ui.vertical(|ui| {
ui.separator();
rog_bios_group(supported, states, dbus, ui);
rog_bios_group(supported, states, ui);
});
ui.end_row();
@@ -54,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| {

View File

@@ -0,0 +1,330 @@
//! A seld-contained tray icon with menus. The control of app<->tray is done via
//! commands over an MPSC channel.
use std::{
io::Write,
sync::{
mpsc::{channel, Receiver},
Arc, Mutex,
},
time::Duration,
};
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, page_states::PageDataStates, SHOW_GUI};
use libappindicator::{AppIndicator, AppIndicatorStatus};
use supergfxctl::{
pci_device::{GfxMode, GfxPower},
zbus_proxy::DaemonProxyBlocking as GfxProxyBlocking,
};
use log::trace;
const TRAY_APP_ICON: &str = "rog-control-center";
const TRAY_LABEL: &str = "ROG Control Center";
pub enum AppToTray {
DgpuStatus(GfxPower),
}
pub enum TrayToApp {
Open,
Quit,
}
pub struct RadioGroup(Vec<gtk::RadioMenuItem>);
impl RadioGroup {
/// Add new radio menu item. `set_no_show_all()` is true until added to menu
/// to prevent teh callback from running
pub fn new<F>(first_label: &str, cb: F) -> Self
where
F: Fn(&gtk::RadioMenuItem) + Send + 'static,
{
let item = gtk::RadioMenuItem::with_label(first_label);
item.set_active(false);
item.set_no_show_all(true);
item.connect_activate(move |this| {
if this.is_active() && !this.is_no_show_all() {
cb(this);
}
});
Self(vec![item])
}
/// Add new radio menu item. `set_no_show_all()` is true until added to menu
/// to prevent teh callback from running
pub fn add<F>(&mut self, label: &str, cb: F)
where
F: Fn(&gtk::RadioMenuItem) + Send + 'static,
{
debug_assert!(!self.0.is_empty());
let group = self.0[0].group();
let item = gtk::RadioMenuItem::with_label_from_widget(&group[0], Some(label));
item.set_active(false);
item.set_no_show_all(true);
item.connect_activate(move |this| {
if this.is_active() && !this.is_no_show_all() {
cb(this);
}
});
self.0.push(item);
}
}
pub struct ROGTray {
tray: AppIndicator,
menu: gtk::Menu,
icon: &'static str,
bios_proxy: RogBiosProxyBlocking<'static>,
gfx_proxy: GfxProxyBlocking<'static>,
}
impl ROGTray {
pub fn new() -> Result<Self> {
let conn = zbus::blocking::Connection::system().unwrap();
let rog_tray = Self {
tray: AppIndicator::new(TRAY_LABEL, TRAY_APP_ICON),
menu: gtk::Menu::new(),
icon: TRAY_APP_ICON,
bios_proxy: RogBiosProxyBlocking::new(&conn).unwrap(),
gfx_proxy: GfxProxyBlocking::new(&conn).unwrap(),
};
Ok(rog_tray)
}
pub fn set_icon(&mut self, icon: &'static str) {
self.icon = icon;
self.tray.set_icon(self.icon);
self.tray.set_status(AppIndicatorStatus::Active);
}
/// Add a non-interactive label
fn add_inactive_label(&mut self, label: &str) {
let item = gtk::MenuItem::with_label(label);
item.set_sensitive(false);
self.menu.append(&item);
self.menu.show_all();
}
/// 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) {
let header_item = gtk::MenuItem::with_label(header_label);
header_item.show_all();
self.menu.add(&header_item);
let menu = gtk::Menu::new();
for item in sub_menu.0.iter() {
item.set_active(item.label().unwrap() == active_label);
item.set_no_show_all(false);
item.show_all();
menu.add(item);
}
menu.show_all();
header_item.set_submenu(Some(&menu));
}
fn add_menu_item<F>(&mut self, label: &str, cb: F)
where
F: Fn() + Send + 'static,
{
let item = gtk::MenuItem::with_label(label);
item.connect_activate(move |_| {
cb();
});
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(&gtk::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();
}
/// Add a menu item with an icon to the right
fn add_icon_menu_item<F>(&mut self, label: &str, icon: &str, cb: F)
where
F: Fn() + Send + 'static,
{
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 item = gtk::MenuItem::new();
g_box.add(&icon);
g_box.add(&label);
item.add(&g_box);
item.show_all();
item.connect_activate(move |_| {
cb();
});
self.menu.append(&item);
self.menu.show_all();
self.tray.set_menu(&mut self.menu);
}
fn set_status(&mut self, status: AppIndicatorStatus) {
self.tray.set_status(status)
}
fn menu_add_base(&mut self) {
self.add_icon_menu_item("Open app", "asus_notif_red", move || {
get_ipc_file().unwrap().write_all(&[SHOW_GUI]).ok();
});
self.add_separator();
}
fn menu_add_charge_limit(&mut self, limit: u8) {
self.add_inactive_label(&format!("Charge limit: {limit}"));
}
fn menu_add_panel_od(&mut self, panel_od: bool) {
let bios = self.bios_proxy.clone();
self.add_check_menu_item("Panel Overdrive", panel_od, move |this| {
bios.set_panel_od(this.is_active()).unwrap();
});
}
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().unwrap();
if mode != GfxMode::Integrated {
gfx_dbus.set_mode(&GfxMode::Integrated).unwrap();
}
});
let gfx_dbus = self.gfx_proxy.clone();
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 = self.bios_proxy.clone();
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 = self.gfx_proxy.clone();
gpu_menu.add("eGPU", move |_| {
let mode = gfx_dbus.mode().unwrap();
if mode != GfxMode::Egpu {
gfx_dbus.set_mode(&GfxMode::Egpu).unwrap();
}
});
}
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,
);
}
fn menu_clear(&mut self) {
self.menu = gtk::Menu::new();
}
/// 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(charge_limit);
self.menu_add_panel_od(panel_od);
self.menu_add_gpu(supported, current_gfx_mode);
self.menu_update();
}
}
pub fn init_tray(
supported: SupportedFunctions,
states: Arc<Mutex<PageDataStates>>,
) -> 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
let mut tray = ROGTray::new().unwrap();
tray.rebuild_and_update(&supported, GfxMode::Hybrid, 100, false);
tray.set_icon(TRAY_APP_ICON);
loop {
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;
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();
continue;
}
// Don't spool at max speed if no gtk events
std::thread::sleep(Duration::from_millis(300));
trace!("Tray loop ticked");
}
});
recv
}

View File

@@ -1,12 +1,11 @@
use egui::{RichText, Ui};
use rog_platform::supported::SupportedFunctions;
use crate::{page_states::PageDataStates, RogDbusClientBlocking};
use crate::page_states::PageDataStates;
pub fn anime_power_group(
_supported: &SupportedFunctions,
states: &mut PageDataStates,
dbus: &mut RogDbusClientBlocking,
ui: &mut Ui,
) {
ui.heading("AniMe Matrix Settings");
@@ -43,7 +42,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 +55,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| {

View File

@@ -1,5 +1,3 @@
use std::sync::atomic::Ordering;
use egui::Ui;
use crate::{config::Config, page_states::PageDataStates};
@@ -8,6 +6,12 @@ pub fn app_settings(config: &mut Config, states: &mut PageDataStates, ui: &mut U
ui.heading("ROG GUI Settings");
// ui.label("Options are incomplete. Awake + Boot should work");
let mut enabled_notifications = if let Ok(lock) = states.enabled_notifications.lock() {
lock.clone()
} else {
Default::default()
};
if ui
.checkbox(&mut config.run_in_background, "Run in Background")
.clicked()
@@ -15,17 +19,70 @@ pub fn app_settings(config: &mut Config, states: &mut PageDataStates, ui: &mut U
.checkbox(&mut config.startup_in_background, "Startup Hidden")
.clicked()
|| ui
.checkbox(&mut config.enable_notifications, "Enable Notifications")
.checkbox(
&mut enabled_notifications.all_enabled,
"Enable Notifications",
)
.clicked()
|| ui
.checkbox(
&mut enabled_notifications.receive_notify_gfx_status,
"Enable dGPU status notification",
)
.clicked()
|| ui
.checkbox(
&mut enabled_notifications.receive_notify_dgpu_disable,
"Enable dGPU disablement notification",
)
.clicked()
|| ui
.checkbox(
&mut enabled_notifications.receive_notify_egpu_enable,
"Enable eGPU enablement notification",
)
.clicked()
|| ui
.checkbox(
&mut enabled_notifications.receive_notify_mains_online,
"Enable mains (AC) power notification",
)
.clicked()
|| ui
.checkbox(
&mut enabled_notifications.receive_notify_charge_control_end_threshold,
"Enable charge threshold notification",
)
.clicked()
|| ui
.checkbox(
&mut enabled_notifications.receive_notify_profile,
"Enable profile change notification",
)
.clicked()
|| ui
.checkbox(
&mut enabled_notifications.receive_notify_panel_od,
"Enable panel overdrive notification",
)
.clicked()
|| ui
.checkbox(
&mut enabled_notifications.receive_notify_post_boot_sound,
"Enable BIOS post sound notification",
)
.clicked()
{
states
.notifs_enabled
.store(config.enable_notifications, Ordering::SeqCst);
if let Ok(mut lock) = states.enabled_notifications.lock() {
// Replace inner content before save
*lock = enabled_notifications;
config
.save()
.save(&lock)
.map_err(|err| {
states.error = Some(err.to_string());
})
.ok();
}
}
}

View File

@@ -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::page_states::{AuraState, PageDataStates};
pub fn aura_modes_group(
supported: &SupportedFunctions,
states: &mut PageDataStates,
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| {

View File

@@ -5,32 +5,22 @@ use rog_aura::{
};
use rog_platform::supported::SupportedFunctions;
use crate::{page_states::PageDataStates, RogDbusClientBlocking};
use crate::page_states::PageDataStates;
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 PageDataStates, 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 PageDataStates, 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 PageDataStates, 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| {

View File

@@ -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()),
}

View File

@@ -1,9 +1,9 @@
use crate::{page_states::PageDataStates, RogDbusClientBlocking};
use crate::page_states::PageDataStates;
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 PageDataStates, 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 PageDataStates, 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| {

View File

@@ -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)

View File

@@ -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:

View File

@@ -78,7 +78,7 @@ pub fn write_attr_u8_array(device: &mut Device, attr: &str, values: &[u8]) -> Re
let tmp: String = values.iter().map(|v| format!("{} ", v)).collect();
let tmp = tmp.trim();
device
.set_attribute_value(attr, &tmp)
.set_attribute_value(attr, tmp)
.map_err(|e| PlatformError::IoPath(attr.into(), e))
}