Update egui and supergfxctl deps

Requires running with supergfxctl v5.1.0-RC5 if installed
This commit is contained in:
Luke D. Jones
2023-04-19 10:12:14 +12:00
parent dd30c8092b
commit 6ea550b6ff
8 changed files with 332 additions and 264 deletions

View File

@@ -5,6 +5,8 @@ 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]
### Added
- Support for G733Z LED modes
### Changed
- Adjustments to Anime system events thread
- Add "sleep" animetion config options to anime config

515
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -300,6 +300,13 @@
basic_zones: [],
advanced_type: PerKey,
),
(
board_name: "G733Z",
layout_name: "g513i-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
),
(
board_name: "GA401Q",
layout_name: "ga401q",

View File

@@ -10,8 +10,8 @@ edition = "2021"
mocking = []
[dependencies]
egui = { git = "https://github.com/flukejones/egui", branch = "wayland_dark_theme" }
eframe = { git = "https://github.com/flukejones/egui", branch = "wayland_dark_theme" }
egui = { git = "https://github.com/emilk/egui", commit = "d486c76a9f146c12321b2a3fd0cedfe732e5783d"}
eframe = { git = "https://github.com/emilk/egui", commit = "d486c76a9f146c12321b2a3fd0cedfe732e5783d"}
libappindicator = "0.7" # Tray icon
gtk = "0.15.5"
@@ -42,5 +42,9 @@ png_pong.workspace = true
nix = "^0.26.1"
tempfile = "3.3.0"
# [patch.crates-io]
# egui = { git = "https://github.com/flukejones/egui" }
# eframe = { git = "https://github.com/flukejones/egui" }
[dev-dependencies]
cargo-husky.workspace = true

View File

@@ -11,6 +11,7 @@ pub enum Error {
XdgVars,
Zbus(zbus::Error),
Notification(notify_rust::error::Error),
Eframe(eframe::Error),
}
impl fmt::Display for Error {
@@ -24,6 +25,7 @@ impl fmt::Display for Error {
Error::XdgVars => write!(f, "XDG environment vars appear unset"),
Error::Zbus(err) => write!(f, "Error: {}", err),
Error::Notification(err) => write!(f, "Notification Error: {}", err),
Error::Eframe(err) => write!(f, "Eframe Error: {}", err),
}
}
}
@@ -53,3 +55,9 @@ impl From<notify_rust::error::Error> for Error {
Error::Notification(err)
}
}
impl From<eframe::Error> for Error {
fn from(err: eframe::Error) -> Self {
Error::Eframe(err)
}
}

View File

@@ -105,6 +105,6 @@ pub fn get_ipc_file() -> Result<File, crate::error::Error> {
Ok(OpenOptions::new()
.read(true)
.write(true)
.truncate(true)
// .truncate(true)
.open(&fifo_path)?)
}

View File

@@ -1,7 +1,10 @@
use std::env::args;
use std::io::{Read, Write};
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Mutex};
use std::thread;
use std::time::Duration;
use eframe::{IconData, NativeOptions};
use gumdrop::Options;
@@ -72,7 +75,9 @@ fn main() -> Result<()> {
"ROG Control Center",
native_options.clone(),
Box::new(move |_| Box::new(AppErrorShow::new(e.to_string()))),
);
)
.map_err(|e| error!("{e}"))
.ok();
})
.unwrap();
@@ -83,14 +88,16 @@ fn main() -> Result<()> {
"ROG Control Center",
native_options.clone(),
Box::new(move |_| Box::new(AppErrorShow::new(e.to_string()))),
);
)
.map_err(|e| error!("{e}"))
.ok();
SupportedFunctions::default()
}
};
// Startup
let mut config = Config::load()?;
let mut start_closed = config.startup_in_background;
let running_in_bg = Arc::new(AtomicBool::new(config.startup_in_background));
if config.startup_in_background {
config.run_in_background = true;
@@ -184,7 +191,8 @@ fn main() -> Result<()> {
init_tray(supported, states.clone());
loop {
if !start_closed {
if !running_in_bg.load(Ordering::Acquire) {
// blocks until window is closed
start_app(states.clone(), native_options.clone())?;
}
@@ -194,15 +202,21 @@ fn main() -> Result<()> {
break;
}
if config.run_in_background {
if config.run_in_background && !running_in_bg.load(Ordering::Acquire) {
running_in_bg.store(true, Ordering::SeqCst);
let running_in_bg = running_in_bg.clone();
thread::spawn(move || {
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()?.read(&mut buf).is_ok() && buf[0] == SHOW_GUI {
start_closed = false;
continue;
if get_ipc_file().unwrap().read(&mut buf).is_ok() && buf[0] == SHOW_GUI {
running_in_bg.store(false, Ordering::SeqCst);
}
});
}
// Prevent hogging CPU
thread::sleep(Duration::from_millis(500));
}
// loop {
@@ -240,7 +254,7 @@ fn start_app(states: Arc<Mutex<SystemState>>, native_options: NativeOptions) ->
"ROG Control Center",
native_options,
Box::new(move |cc| Box::new(RogApp::new(Config::load().unwrap(), states, cc).unwrap())),
);
)?;
Ok(())
}

View File

@@ -295,9 +295,9 @@ impl ROGTray {
e
})
.unwrap_or(GfxMode::None);
if mode != GfxMode::Egpu {
if mode != GfxMode::AsusEgpu {
gfx_dbus
.set_mode(&GfxMode::Egpu)
.set_mode(&GfxMode::AsusEgpu)
.map_err(|e| {
error!("ROGTray: set_mode: {e}");
e
@@ -344,7 +344,7 @@ impl ROGTray {
if let Ok(mode) = self.bios_proxy.gpu_mux_mode() {
// TODO: this is not taking in to account supergfxctl
let mode = match mode {
GpuMode::Discrete => GfxMode::AsusMuxDiscreet,
GpuMode::Discrete => GfxMode::AsusMuxDgpu,
_ => GfxMode::Hybrid,
};
reboot_required = mode != current_mode;
@@ -352,7 +352,7 @@ impl ROGTray {
}
let active = match current_mode {
GfxMode::AsusMuxDiscreet => "Discreet".to_owned(),
GfxMode::AsusMuxDgpu => "Discreet".to_owned(),
_ => current_mode.to_string(),
};
@@ -377,7 +377,7 @@ impl ROGTray {
let mut reboot_required = false;
if let Ok(mode) = gfx_dbus.gpu_mux_mode() {
let mode = match mode {
GpuMode::Discrete => GfxMode::AsusMuxDiscreet,
GpuMode::Discrete => GfxMode::AsusMuxDgpu,
_ => GfxMode::Hybrid,
};
reboot_required = mode != current_mode;
@@ -407,7 +407,7 @@ impl ROGTray {
});
let active = match current_mode {
GfxMode::AsusMuxDiscreet => "Ultimate".to_owned(),
GfxMode::AsusMuxDgpu => "Ultimate".to_owned(),
GfxMode::Hybrid => "Optimus".to_owned(),
_ => current_mode.to_string(),
};
@@ -508,7 +508,7 @@ pub fn init_tray(
lock.gfx_state.mode
} else {
match lock.bios.dedicated_gfx {
GpuMode::Discrete => GfxMode::AsusMuxDiscreet,
GpuMode::Discrete => GfxMode::AsusMuxDgpu,
_ => GfxMode::Hybrid,
}
};