mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Fix rogcc not closing when run-in-background
This commit is contained in:
@@ -4,7 +4,7 @@ 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/),
|
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).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [Unreleased - 4.5.0]
|
## [Unreleased - 4.5.0-RC5]
|
||||||
### Added
|
### Added
|
||||||
- intofy watches on:
|
- intofy watches on:
|
||||||
- `charge_control_end_threshold`
|
- `charge_control_end_threshold`
|
||||||
@@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Changed
|
### Changed
|
||||||
- Use loops to ensure that mutex is gained for LED changes.
|
- Use loops to ensure that mutex is gained for LED changes.
|
||||||
- asusctl now uses tokio for async runtime. This helps simplify some code.
|
- asusctl now uses tokio for async runtime. This helps simplify some code.
|
||||||
|
- Properly fix notifs used in rog-control-center
|
||||||
### Breaking
|
### Breaking
|
||||||
- DBUS: all charge control methods renamed to:
|
- DBUS: all charge control methods renamed to:
|
||||||
- `ChargeControlEndThreshold`
|
- `ChargeControlEndThreshold`
|
||||||
|
|||||||
69
Cargo.lock
generated
69
Cargo.lock
generated
@@ -47,9 +47,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "arboard"
|
name = "arboard"
|
||||||
version = "3.1.1"
|
version = "3.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6702f4a0b562d352aa3d0e22d4142ea9241c44faa27635bb9d87047a08837d4d"
|
checksum = "d6041616acea41d67c4a984709ddab1587fd0b10efe5cc563fee954d2f011854"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clipboard-win",
|
"clipboard-win",
|
||||||
"log",
|
"log",
|
||||||
@@ -77,7 +77,7 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "asusctl"
|
name = "asusctl"
|
||||||
version = "4.5.0-rc4"
|
version = "4.5.0-rc5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"daemon",
|
"daemon",
|
||||||
"gif",
|
"gif",
|
||||||
@@ -318,18 +318,18 @@ checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bytemuck"
|
name = "bytemuck"
|
||||||
version = "1.12.2"
|
version = "1.12.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5aec14f5d4e6e3f927cd0c81f72e5710d95ee9019fbeb4b3021193867491bfd8"
|
checksum = "aaa3a8d9a1ca92e282c96a32d6511b695d7d994d1d102ba85d279f9b2756947f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytemuck_derive",
|
"bytemuck_derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bytemuck_derive"
|
name = "bytemuck_derive"
|
||||||
version = "1.2.1"
|
version = "1.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1b9e1f5fa78f69496407a27ae9ed989e3c3b072310286f5ef385525e4cbc24a9"
|
checksum = "5fe233b960f12f8007e3db2d136e3cb1c291bfd7396e384ee76025fc1a3932b4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -592,7 +592,7 @@ checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "daemon"
|
name = "daemon"
|
||||||
version = "4.5.0-rc4"
|
version = "4.5.0-rc5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"concat-idents",
|
"concat-idents",
|
||||||
@@ -616,7 +616,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "daemon-user"
|
name = "daemon-user"
|
||||||
version = "4.5.0-rc4"
|
version = "4.5.0-rc5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dirs",
|
"dirs",
|
||||||
"rog_anime",
|
"rog_anime",
|
||||||
@@ -767,7 +767,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "eframe"
|
name = "eframe"
|
||||||
version = "0.19.0"
|
version = "0.19.0"
|
||||||
source = "git+https://github.com/emilk/egui#4d1e858a52ec5d4b4f243065774b3ad95413a5e2"
|
source = "git+https://github.com/flukejones/egui#f17fd2d2e47efc08b00fb2bda3529fed22e3a711"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
"egui",
|
"egui",
|
||||||
@@ -788,7 +788,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "egui"
|
name = "egui"
|
||||||
version = "0.19.0"
|
version = "0.19.0"
|
||||||
source = "git+https://github.com/emilk/egui#4d1e858a52ec5d4b4f243065774b3ad95413a5e2"
|
source = "git+https://github.com/flukejones/egui#f17fd2d2e47efc08b00fb2bda3529fed22e3a711"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ahash",
|
"ahash",
|
||||||
"epaint",
|
"epaint",
|
||||||
@@ -799,7 +799,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "egui-winit"
|
name = "egui-winit"
|
||||||
version = "0.19.0"
|
version = "0.19.0"
|
||||||
source = "git+https://github.com/emilk/egui#4d1e858a52ec5d4b4f243065774b3ad95413a5e2"
|
source = "git+https://github.com/flukejones/egui#f17fd2d2e47efc08b00fb2bda3529fed22e3a711"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arboard",
|
"arboard",
|
||||||
"egui",
|
"egui",
|
||||||
@@ -813,7 +813,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "egui_glow"
|
name = "egui_glow"
|
||||||
version = "0.19.0"
|
version = "0.19.0"
|
||||||
source = "git+https://github.com/emilk/egui#4d1e858a52ec5d4b4f243065774b3ad95413a5e2"
|
source = "git+https://github.com/flukejones/egui#f17fd2d2e47efc08b00fb2bda3529fed22e3a711"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
"egui",
|
"egui",
|
||||||
@@ -827,7 +827,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "emath"
|
name = "emath"
|
||||||
version = "0.19.0"
|
version = "0.19.0"
|
||||||
source = "git+https://github.com/emilk/egui#4d1e858a52ec5d4b4f243065774b3ad95413a5e2"
|
source = "git+https://github.com/flukejones/egui#f17fd2d2e47efc08b00fb2bda3529fed22e3a711"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
]
|
]
|
||||||
@@ -892,7 +892,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "epaint"
|
name = "epaint"
|
||||||
version = "0.19.0"
|
version = "0.19.0"
|
||||||
source = "git+https://github.com/emilk/egui#4d1e858a52ec5d4b4f243065774b3ad95413a5e2"
|
source = "git+https://github.com/flukejones/egui#f17fd2d2e47efc08b00fb2bda3529fed22e3a711"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ab_glyph",
|
"ab_glyph",
|
||||||
"ahash",
|
"ahash",
|
||||||
@@ -1732,15 +1732,6 @@ dependencies = [
|
|||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "num_threads"
|
|
||||||
version = "0.1.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44"
|
|
||||||
dependencies = [
|
|
||||||
"libc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "numtoa"
|
name = "numtoa"
|
||||||
version = "0.2.4"
|
version = "0.2.4"
|
||||||
@@ -1917,9 +1908,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ppv-lite86"
|
name = "ppv-lite86"
|
||||||
version = "0.2.16"
|
version = "0.2.17"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872"
|
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro-crate"
|
name = "proc-macro-crate"
|
||||||
@@ -2029,9 +2020,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex"
|
name = "regex"
|
||||||
version = "1.6.0"
|
version = "1.7.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b"
|
checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aho-corasick",
|
"aho-corasick",
|
||||||
"memchr",
|
"memchr",
|
||||||
@@ -2040,9 +2031,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex-syntax"
|
name = "regex-syntax"
|
||||||
version = "0.6.27"
|
version = "0.6.28"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244"
|
checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "remove_dir_all"
|
name = "remove_dir_all"
|
||||||
@@ -2055,7 +2046,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog-control-center"
|
name = "rog-control-center"
|
||||||
version = "4.5.0-rc4"
|
version = "4.5.0-rc5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"daemon",
|
"daemon",
|
||||||
"dirs",
|
"dirs",
|
||||||
@@ -2080,7 +2071,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_anime"
|
name = "rog_anime"
|
||||||
version = "4.5.0-rc4"
|
version = "4.5.0-rc5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gif",
|
"gif",
|
||||||
"glam",
|
"glam",
|
||||||
@@ -2096,7 +2087,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_aura"
|
name = "rog_aura"
|
||||||
version = "4.5.0-rc4"
|
version = "4.5.0-rc5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
@@ -2107,7 +2098,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_dbus"
|
name = "rog_dbus"
|
||||||
version = "4.5.0-rc4"
|
version = "4.5.0-rc5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rog_anime",
|
"rog_anime",
|
||||||
"rog_aura",
|
"rog_aura",
|
||||||
@@ -2120,7 +2111,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_platform"
|
name = "rog_platform"
|
||||||
version = "4.5.0-rc4"
|
version = "4.5.0-rc5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"concat-idents",
|
"concat-idents",
|
||||||
"inotify",
|
"inotify",
|
||||||
@@ -2137,7 +2128,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_profiles"
|
name = "rog_profiles"
|
||||||
version = "4.5.0-rc4"
|
version = "4.5.0-rc5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
@@ -2537,12 +2528,10 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "time"
|
name = "time"
|
||||||
version = "0.3.16"
|
version = "0.3.17"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0fab5c8b9980850e06d92ddbe3ab839c062c801f3927c0fb8abd6fc8e918fbca"
|
checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
|
||||||
"num_threads",
|
|
||||||
"serde",
|
"serde",
|
||||||
"time-core",
|
"time-core",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
members = ["asusctl", "daemon", "daemon-user", "rog-platform", "rog-dbus", "rog-anime", "rog-aura", "rog-profiles", "rog-control-center"]
|
members = ["asusctl", "daemon", "daemon-user", "rog-platform", "rog-dbus", "rog-anime", "rog-aura", "rog-profiles", "rog-control-center"]
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "4.5.0-rc4"
|
version = "4.5.0-rc5"
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
async-trait = "^0.1"
|
async-trait = "^0.1"
|
||||||
@@ -48,7 +48,7 @@ opt-level = 3
|
|||||||
panic = "abort"
|
panic = "abort"
|
||||||
|
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
debug = false
|
debug = true
|
||||||
opt-level = 1
|
opt-level = 1
|
||||||
|
|
||||||
[profile.bench]
|
[profile.bench]
|
||||||
|
|||||||
@@ -325,8 +325,8 @@ impl AuraEffect {
|
|||||||
&self.mode
|
&self.mode
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mode_name(&self) -> String {
|
pub fn mode_name(&self) -> &str {
|
||||||
(<&str>::from(&self.mode)).to_string()
|
<&str>::from(&self.mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mode_num(&self) -> u8 {
|
pub fn mode_num(&self) -> u8 {
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ edition = "2021"
|
|||||||
mocking = []
|
mocking = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
egui = { git = "https://github.com/emilk/egui" }
|
egui = { git = "https://github.com/flukejones/egui" }
|
||||||
eframe= { git = "https://github.com/emilk/egui" }
|
eframe= { git = "https://github.com/flukejones/egui" }
|
||||||
#eframe= { git = "https://github.com/emilk/egui", default-features = false, features = ["dark-light", "default_fonts", "wgpu"] }
|
#eframe= { git = "https://github.com/emilk/egui", default-features = false, features = ["dark-light", "default_fonts", "wgpu"] }
|
||||||
|
|
||||||
daemon = { path = "../daemon" }
|
daemon = { path = "../daemon" }
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ impl<'a> RogApp<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> eframe::App for RogApp<'a> {
|
impl<'a> eframe::App for RogApp<'a> {
|
||||||
/// Called each time the UI needs repainting, which may be many times per second.
|
/// 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`.
|
/// Put your widgets into a `SidePanel`, `TopPanel`, `CentralPanel`, `Window` or `Area`.
|
||||||
fn update(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) {
|
fn update(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) {
|
||||||
let Self {
|
let Self {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ pub enum Error {
|
|||||||
ConfigLockFail,
|
ConfigLockFail,
|
||||||
XdgVars,
|
XdgVars,
|
||||||
Zbus(zbus::Error),
|
Zbus(zbus::Error),
|
||||||
|
Notification(notify_rust::error::Error)
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for Error {
|
impl fmt::Display for Error {
|
||||||
@@ -22,6 +23,7 @@ impl fmt::Display for Error {
|
|||||||
Error::ConfigLockFail => write!(f, "Failed to lock user config"),
|
Error::ConfigLockFail => write!(f, "Failed to lock user config"),
|
||||||
Error::XdgVars => write!(f, "XDG environment vars appear unset"),
|
Error::XdgVars => write!(f, "XDG environment vars appear unset"),
|
||||||
Error::Zbus(err) => write!(f, "Error: {}", err),
|
Error::Zbus(err) => write!(f, "Error: {}", err),
|
||||||
|
Error::Notification(err) => write!(f, "Notification Error: {}", err),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -45,3 +47,9 @@ impl From<zbus::Error> for Error {
|
|||||||
Error::Zbus(err)
|
Error::Zbus(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<notify_rust::error::Error> for Error {
|
||||||
|
fn from(err: notify_rust::error::Error) -> Self {
|
||||||
|
Error::Notification(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ pub fn on_tmp_dir_exists() -> Result<TempDir, std::io::Error> {
|
|||||||
// If the app is running this ends up stacked on top of SHOWING_GUI
|
// If the app is running this ends up stacked on top of SHOWING_GUI
|
||||||
ipc_file.write_all(&[SHOW_GUI])?;
|
ipc_file.write_all(&[SHOW_GUI])?;
|
||||||
// tiny sleep to give the app a chance to respond
|
// tiny sleep to give the app a chance to respond
|
||||||
sleep(Duration::from_millis(10));
|
sleep(Duration::from_millis(100));
|
||||||
ipc_file.read(&mut buf).ok();
|
ipc_file.read(&mut buf).ok();
|
||||||
|
|
||||||
// First entry is the actual state
|
// First entry is the actual state
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
|
use eframe::NativeOptions;
|
||||||
use rog_aura::layouts::KeyLayout;
|
use rog_aura::layouts::KeyLayout;
|
||||||
use rog_control_center::{
|
use rog_control_center::{
|
||||||
|
error::Result,
|
||||||
config::Config, get_ipc_file, notify::start_notifications, on_tmp_dir_exists,
|
config::Config, get_ipc_file, notify::start_notifications, on_tmp_dir_exists,
|
||||||
page_states::PageDataStates, print_versions, startup_error::AppErrorShow, RogApp,
|
page_states::PageDataStates, print_versions, startup_error::AppErrorShow, RogApp,
|
||||||
RogDbusClientBlocking, SHOWING_GUI, SHOW_GUI,
|
RogDbusClientBlocking, SHOWING_GUI, SHOW_GUI,
|
||||||
};
|
};
|
||||||
|
use rog_platform::supported::SupportedFunctions;
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
fs::OpenOptions,
|
fs::OpenOptions,
|
||||||
@@ -18,12 +21,12 @@ const DATA_DIR: &str = "/usr/share/rog-gui/";
|
|||||||
const DATA_DIR: &str = env!("CARGO_MANIFEST_DIR");
|
const DATA_DIR: &str = env!("CARGO_MANIFEST_DIR");
|
||||||
const BOARD_NAME: &str = "/sys/class/dmi/id/board_name";
|
const BOARD_NAME: &str = "/sys/class/dmi/id/board_name";
|
||||||
|
|
||||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
fn main() -> Result<()> {
|
||||||
print_versions();
|
print_versions();
|
||||||
|
|
||||||
let native_options = eframe::NativeOptions {
|
let native_options = eframe::NativeOptions {
|
||||||
vsync: false,
|
vsync: true,
|
||||||
decorated: false,
|
decorated: true,
|
||||||
transparent: false,
|
transparent: false,
|
||||||
min_window_size: Some(egui::vec2(840.0, 600.0)),
|
min_window_size: Some(egui::vec2(840.0, 600.0)),
|
||||||
max_window_size: Some(egui::vec2(840.0, 600.0)),
|
max_window_size: Some(egui::vec2(840.0, 600.0)),
|
||||||
@@ -75,6 +78,51 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
})
|
})
|
||||||
.unwrap_or_else(|_| KeyLayout::ga401_layout());
|
.unwrap_or_else(|_| KeyLayout::ga401_layout());
|
||||||
|
|
||||||
|
// tmp-dir must live to the end of program life
|
||||||
|
let _tmp_dir = match tempfile::Builder::new()
|
||||||
|
.prefix("rog-gui")
|
||||||
|
.rand_bytes(0)
|
||||||
|
.tempdir()
|
||||||
|
{
|
||||||
|
Ok(tmp) => tmp,
|
||||||
|
Err(_) => on_tmp_dir_exists().unwrap(),
|
||||||
|
};
|
||||||
|
|
||||||
|
let states = setup_page_state_and_notifs(layout.clone(), &config, native_options.clone(), &dbus).unwrap();
|
||||||
|
|
||||||
|
loop {
|
||||||
|
dbg!();
|
||||||
|
if !start_closed {
|
||||||
|
start_app(states.clone(), native_options.clone())?;
|
||||||
|
}
|
||||||
|
dbg!();
|
||||||
|
|
||||||
|
let config = Config::load().unwrap();
|
||||||
|
if !config.run_in_background {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if config.run_in_background {
|
||||||
|
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 {
|
||||||
|
start_closed = false;
|
||||||
|
dbg!();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dbg!();
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
// Cheap method to alert to notifications rather than spinning a thread for each
|
||||||
// This is quite different when done in a retained mode app
|
// This is quite different when done in a retained mode app
|
||||||
let charge_notified = Arc::new(AtomicBool::new(false));
|
let charge_notified = Arc::new(AtomicBool::new(false));
|
||||||
@@ -95,68 +143,42 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
notifs_enabled.clone(),
|
notifs_enabled.clone(),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
// tmp-dir must live to the end of program life
|
let supported = match dbus.proxies().supported().supported_functions() {
|
||||||
let _tmp_dir = match tempfile::Builder::new()
|
Ok(s) => s,
|
||||||
.prefix("rog-gui")
|
Err(e) => {
|
||||||
.rand_bytes(0)
|
|
||||||
.tempdir()
|
|
||||||
{
|
|
||||||
Ok(tmp) => tmp,
|
|
||||||
Err(_) => on_tmp_dir_exists().unwrap(),
|
|
||||||
};
|
|
||||||
|
|
||||||
loop {
|
|
||||||
let states = {
|
|
||||||
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()))),
|
|
||||||
);
|
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
PageDataStates::new(
|
|
||||||
layout.clone(),
|
|
||||||
notifs_enabled.clone(),
|
|
||||||
charge_notified.clone(),
|
|
||||||
bios_notified.clone(),
|
|
||||||
aura_notified.clone(),
|
|
||||||
anime_notified.clone(),
|
|
||||||
profiles_notified.clone(),
|
|
||||||
fans_notified.clone(),
|
|
||||||
&supported,
|
|
||||||
&dbus,
|
|
||||||
)?
|
|
||||||
};
|
|
||||||
|
|
||||||
if !start_closed {
|
|
||||||
let mut ipc_file = get_ipc_file().unwrap();
|
|
||||||
ipc_file.write_all(&[SHOWING_GUI]).unwrap();
|
|
||||||
eframe::run_native(
|
eframe::run_native(
|
||||||
"ROG Control Center",
|
"ROG Control Center",
|
||||||
native_options.clone(),
|
native_options,
|
||||||
Box::new(move |cc| {
|
Box::new(move |_| Box::new(AppErrorShow::new(e.to_string()))),
|
||||||
Box::new(RogApp::new(Config::load().unwrap(), states, cc).unwrap())
|
|
||||||
}),
|
|
||||||
);
|
);
|
||||||
|
SupportedFunctions::default()
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
let config = Config::load().unwrap();
|
PageDataStates::new(
|
||||||
if !config.run_in_background {
|
keyboard_layout,
|
||||||
break;
|
notifs_enabled.clone(),
|
||||||
}
|
charge_notified.clone(),
|
||||||
|
bios_notified.clone(),
|
||||||
|
aura_notified.clone(),
|
||||||
|
anime_notified.clone(),
|
||||||
|
profiles_notified.clone(),
|
||||||
|
fans_notified.clone(),
|
||||||
|
&supported,
|
||||||
|
&dbus,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
let mut buf = [0u8; 4];
|
fn start_app(
|
||||||
// blocks until it is read, typically the read will happen after a second
|
states: PageDataStates,
|
||||||
// process writes to the IPC (so there is data to actually read)
|
native_options: NativeOptions,
|
||||||
if get_ipc_file().unwrap().read(&mut buf).is_ok() && buf[0] == SHOW_GUI {
|
) -> Result<()> {
|
||||||
start_closed = false;
|
let mut ipc_file = get_ipc_file().unwrap();
|
||||||
continue;
|
ipc_file.write_all(&[SHOWING_GUI]).unwrap();
|
||||||
}
|
eframe::run_native(
|
||||||
}
|
"ROG Control Center",
|
||||||
|
native_options,
|
||||||
|
Box::new(move |cc| Box::new(RogApp::new(Config::load().unwrap(), states, cc).unwrap())),
|
||||||
|
);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ use std::{
|
|||||||
};
|
};
|
||||||
use supergfxctl::pci_device::GfxPower;
|
use supergfxctl::pci_device::GfxPower;
|
||||||
use zbus::export::futures_util::StreamExt;
|
use zbus::export::futures_util::StreamExt;
|
||||||
|
use crate::error::Result;
|
||||||
|
|
||||||
const NOTIF_HEADER: &str = "ROG Control";
|
const NOTIF_HEADER: &str = "ROG Control";
|
||||||
|
|
||||||
@@ -76,7 +77,7 @@ pub fn start_notifications(
|
|||||||
profiles_notified: Arc<AtomicBool>,
|
profiles_notified: Arc<AtomicBool>,
|
||||||
_fans_notified: Arc<AtomicBool>,
|
_fans_notified: Arc<AtomicBool>,
|
||||||
notifs_enabled: Arc<AtomicBool>,
|
notifs_enabled: Arc<AtomicBool>,
|
||||||
) -> Result<(), Box<dyn std::error::Error>> {
|
) -> Result<()> {
|
||||||
let last_notification: SharedHandle = Arc::new(Mutex::new(None));
|
let last_notification: SharedHandle = Arc::new(Mutex::new(None));
|
||||||
|
|
||||||
let executor = Executor::new();
|
let executor = Executor::new();
|
||||||
@@ -101,7 +102,7 @@ pub fn start_notifications(
|
|||||||
last_notification,
|
last_notification,
|
||||||
notifs_enabled,
|
notifs_enabled,
|
||||||
[overdrive],
|
[overdrive],
|
||||||
"BIOS Panel Overdrive",
|
"Panel Overdrive enabled:",
|
||||||
do_notification
|
do_notification
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -154,6 +155,18 @@ pub fn start_notifications(
|
|||||||
do_notification
|
do_notification
|
||||||
);
|
);
|
||||||
|
|
||||||
|
recv_notif!(
|
||||||
|
executor,
|
||||||
|
PowerProxy,
|
||||||
|
receive_notify_mains_online,
|
||||||
|
bios_notified,
|
||||||
|
last_notification,
|
||||||
|
notifs_enabled,
|
||||||
|
[on],
|
||||||
|
"AC Power power is",
|
||||||
|
ac_power_notification
|
||||||
|
);
|
||||||
|
|
||||||
// Profile notif
|
// Profile notif
|
||||||
recv_notif!(
|
recv_notif!(
|
||||||
executor,
|
executor,
|
||||||
@@ -261,7 +274,7 @@ where
|
|||||||
.summary(NOTIF_HEADER)
|
.summary(NOTIF_HEADER)
|
||||||
.body(&format!("{message} {data}"))
|
.body(&format!("{message} {data}"))
|
||||||
.timeout(2000)
|
.timeout(2000)
|
||||||
.hint(Hint::Resident(true))
|
//.hint(Hint::Resident(true))
|
||||||
.hint(Hint::Category("device".into()));
|
.hint(Hint::Category("device".into()));
|
||||||
|
|
||||||
notif
|
notif
|
||||||
@@ -270,17 +283,25 @@ where
|
|||||||
fn do_notification<T>(
|
fn do_notification<T>(
|
||||||
message: &str,
|
message: &str,
|
||||||
data: &T,
|
data: &T,
|
||||||
) -> Result<NotificationHandle, notify_rust::error::Error>
|
) -> Result<NotificationHandle>
|
||||||
where
|
where
|
||||||
T: Display,
|
T: Display,
|
||||||
{
|
{
|
||||||
base_notification(message, data).show()
|
Ok(base_notification(message, data).show()?)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn ac_power_notification(
|
||||||
|
message: &str,
|
||||||
|
on: &bool,
|
||||||
|
) -> Result<NotificationHandle> {
|
||||||
|
let data = if *on { "plugged".to_string() } else { "unplugged".to_string() };
|
||||||
|
Ok(base_notification(message, &data).show()?)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn do_thermal_notif(
|
fn do_thermal_notif(
|
||||||
message: &str,
|
message: &str,
|
||||||
profile: &Profile,
|
profile: &Profile,
|
||||||
) -> Result<NotificationHandle, notify_rust::error::Error> {
|
) -> Result<NotificationHandle> {
|
||||||
let icon = match profile {
|
let icon = match profile {
|
||||||
Profile::Balanced => "asus_notif_yellow",
|
Profile::Balanced => "asus_notif_yellow",
|
||||||
Profile::Performance => "asus_notif_red",
|
Profile::Performance => "asus_notif_red",
|
||||||
@@ -288,5 +309,5 @@ fn do_thermal_notif(
|
|||||||
};
|
};
|
||||||
let profile: &str = (*profile).into();
|
let profile: &str = (*profile).into();
|
||||||
let mut notif = base_notification(message, &profile.to_uppercase());
|
let mut notif = base_notification(message, &profile.to_uppercase());
|
||||||
notif.icon(icon).show()
|
Ok(notif.icon(icon).show()?)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -246,7 +246,7 @@ impl AnimeState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct PageDataStates {
|
pub struct PageDataStates {
|
||||||
pub keyboard_layout: KeyLayout,
|
pub keyboard_layout: KeyLayout,
|
||||||
pub notifs_enabled: Arc<AtomicBool>,
|
pub notifs_enabled: Arc<AtomicBool>,
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ impl<'a> RogApp<'a> {
|
|||||||
} = self;
|
} = self;
|
||||||
|
|
||||||
egui::CentralPanel::default().show(ctx, |ui| {
|
egui::CentralPanel::default().show(ctx, |ui| {
|
||||||
ui.heading("Experimental application for asusd");
|
ui.heading("Base settings");
|
||||||
|
|
||||||
egui::ScrollArea::vertical().show(ui, |ui| {
|
egui::ScrollArea::vertical().show(ui, |ui| {
|
||||||
ui.spacing_mut().item_spacing = egui::vec2(8.0, 10.0);
|
ui.spacing_mut().item_spacing = egui::vec2(8.0, 10.0);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use egui::{vec2, Align2, Button, FontId, Id, Rect, RichText, Sense, Vec2};
|
use egui::{vec2, Align2, FontId, Id, Sense};
|
||||||
|
|
||||||
use crate::{RogApp, VERSION};
|
use crate::{RogApp, VERSION};
|
||||||
|
|
||||||
@@ -27,20 +27,20 @@ impl<'a> RogApp<'a> {
|
|||||||
let height = titlebar_rect.height();
|
let height = titlebar_rect.height();
|
||||||
// Paint the title:
|
// Paint the title:
|
||||||
ui.painter().text(
|
ui.painter().text(
|
||||||
titlebar_rect.center_top() + vec2(0.0, height / 2.0),
|
titlebar_rect.right_top() + vec2(0.0, height / 2.0),
|
||||||
Align2::CENTER_CENTER,
|
Align2::RIGHT_CENTER,
|
||||||
format!("ROG Control Center v{}", VERSION),
|
format!("v{}", VERSION),
|
||||||
FontId::proportional(height - 2.0),
|
FontId::proportional(height - 2.0),
|
||||||
text_color,
|
text_color,
|
||||||
);
|
);
|
||||||
// Add the close button:
|
// // Add the close button:
|
||||||
let close_response = ui.put(
|
// let close_response = ui.put(
|
||||||
Rect::from_min_size(titlebar_rect.right_top(), Vec2::splat(height)),
|
// Rect::from_min_size(titlebar_rect.right_top(), Vec2::splat(height)),
|
||||||
Button::new(RichText::new("❌").size(height - 4.0)).frame(false),
|
// Button::new(RichText::new("❌").size(height - 4.0)).frame(false),
|
||||||
);
|
// );
|
||||||
if close_response.clicked() {
|
// if close_response.clicked() {
|
||||||
frame.close();
|
// frame.close();
|
||||||
}
|
// }
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user