mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 93d472fe74 | |||
| 5469c73f11 | |||
| ad95765954 | |||
| e42a5bc3e9 |
+7
-2
@@ -17,7 +17,7 @@ cache:
|
|||||||
- target/release/.cargo-lock
|
- target/release/.cargo-lock
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- apt-get update -qq && apt-get install -y -qq libudev-dev libgtk-3-dev
|
- apt-get update -qq && apt-get install -y -qq libudev-dev libgtk-3-dev grep
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- format
|
- format
|
||||||
@@ -26,13 +26,16 @@ stages:
|
|||||||
- release
|
- release
|
||||||
|
|
||||||
format:
|
format:
|
||||||
image: rust:latest
|
except:
|
||||||
|
- tags
|
||||||
script:
|
script:
|
||||||
- echo "nightly" > rust-toolchain
|
- echo "nightly" > rust-toolchain
|
||||||
- rustup component add rustfmt
|
- rustup component add rustfmt
|
||||||
- cargo fmt --check
|
- cargo fmt --check
|
||||||
|
|
||||||
check:
|
check:
|
||||||
|
except:
|
||||||
|
- tags
|
||||||
script:
|
script:
|
||||||
- rustup component add clippy
|
- rustup component add clippy
|
||||||
- cargo check
|
- cargo check
|
||||||
@@ -41,6 +44,8 @@ check:
|
|||||||
- cargo install cargo-cranky && cargo cranky
|
- cargo install cargo-cranky && cargo cranky
|
||||||
|
|
||||||
test:
|
test:
|
||||||
|
except:
|
||||||
|
- tags
|
||||||
script:
|
script:
|
||||||
- cargo test
|
- cargo test
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,12 @@ 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]
|
## [Unreleased]
|
||||||
|
## [v4.5.4]
|
||||||
|
### Changed
|
||||||
|
- ROGCC:: Allow ROGCC to run without supergfxd
|
||||||
|
- ROGCC: Tray/notifs now reads dGPU status directly via supergfx crate (supergfxd not required)
|
||||||
|
- Add rust-toolchain to force minimum rust version
|
||||||
|
|
||||||
## [v4.5.3]
|
## [v4.5.3]
|
||||||
### Changed
|
### Changed
|
||||||
- Adjust how fan graph in ROGCC works, deny incorrect graphs
|
- Adjust how fan graph in ROGCC works, deny incorrect graphs
|
||||||
|
|||||||
Generated
+9
-9
@@ -149,7 +149,7 @@ checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "asusctl"
|
name = "asusctl"
|
||||||
version = "4.5.3"
|
version = "4.5.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"daemon",
|
"daemon",
|
||||||
"gif",
|
"gif",
|
||||||
@@ -727,7 +727,7 @@ checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "daemon"
|
name = "daemon"
|
||||||
version = "4.5.3"
|
version = "4.5.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"concat-idents",
|
"concat-idents",
|
||||||
@@ -750,7 +750,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "daemon-user"
|
name = "daemon-user"
|
||||||
version = "4.5.3"
|
version = "4.5.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dirs",
|
"dirs",
|
||||||
"rog_anime",
|
"rog_anime",
|
||||||
@@ -2593,7 +2593,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog-control-center"
|
name = "rog-control-center"
|
||||||
version = "4.5.3"
|
version = "4.5.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"daemon",
|
"daemon",
|
||||||
"dirs",
|
"dirs",
|
||||||
@@ -2624,7 +2624,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_anime"
|
name = "rog_anime"
|
||||||
version = "4.5.3"
|
version = "4.5.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gif",
|
"gif",
|
||||||
"glam",
|
"glam",
|
||||||
@@ -2639,7 +2639,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_aura"
|
name = "rog_aura"
|
||||||
version = "4.5.3"
|
version = "4.5.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
@@ -2650,7 +2650,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_dbus"
|
name = "rog_dbus"
|
||||||
version = "4.5.3"
|
version = "4.5.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rog_anime",
|
"rog_anime",
|
||||||
"rog_aura",
|
"rog_aura",
|
||||||
@@ -2661,7 +2661,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_platform"
|
name = "rog_platform"
|
||||||
version = "4.5.3"
|
version = "4.5.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"concat-idents",
|
"concat-idents",
|
||||||
"inotify",
|
"inotify",
|
||||||
@@ -2677,7 +2677,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_profiles"
|
name = "rog_profiles"
|
||||||
version = "4.5.3"
|
version = "4.5.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
|
|||||||
+1
-1
@@ -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.3"
|
version = "4.5.4"
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
async-trait = "^0.1"
|
async-trait = "^0.1"
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ mocking = []
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
egui = { git = "https://github.com/flukejones/egui", branch = "wayland_dark_theme" }
|
egui = { git = "https://github.com/flukejones/egui", branch = "wayland_dark_theme" }
|
||||||
eframe= { git = "https://github.com/flukejones/egui", branch = "wayland_dark_theme" }
|
eframe= { git = "https://github.com/flukejones/egui", branch = "wayland_dark_theme" }
|
||||||
#eframe= { git = "https://github.com/emilk/egui", default-features = false, features = ["dark-light", "default_fonts", "wgpu"] }
|
|
||||||
|
|
||||||
libappindicator = "0.7" # Tray icon
|
libappindicator = "0.7" # Tray icon
|
||||||
gtk = "0.15.5"
|
gtk = "0.15.5"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use std::{
|
|||||||
};
|
};
|
||||||
//use log::{error, info, warn};
|
//use log::{error, info, warn};
|
||||||
|
|
||||||
use crate::{error::Error, notify::EnabledNotifications};
|
use crate::{error::Error, update_and_notify::EnabledNotifications};
|
||||||
|
|
||||||
const CFG_DIR: &str = "rog";
|
const CFG_DIR: &str = "rog";
|
||||||
const CFG_FILE_NAME: &str = "rog-control-center.cfg";
|
const CFG_FILE_NAME: &str = "rog-control-center.cfg";
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ pub mod config;
|
|||||||
pub mod error;
|
pub mod error;
|
||||||
#[cfg(feature = "mocking")]
|
#[cfg(feature = "mocking")]
|
||||||
pub mod mocking;
|
pub mod mocking;
|
||||||
pub mod notify;
|
|
||||||
pub mod pages;
|
pub mod pages;
|
||||||
pub mod startup_error;
|
pub mod startup_error;
|
||||||
pub mod system_state;
|
pub mod system_state;
|
||||||
pub mod tray;
|
pub mod tray;
|
||||||
|
pub mod update_and_notify;
|
||||||
pub mod widgets;
|
pub mod widgets;
|
||||||
|
|
||||||
#[cfg(feature = "mocking")]
|
#[cfg(feature = "mocking")]
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
use eframe::{IconData, NativeOptions};
|
use eframe::{IconData, NativeOptions};
|
||||||
use log::{error, info, LevelFilter};
|
use log::{error, info, LevelFilter};
|
||||||
use rog_aura::layouts::KeyLayout;
|
use rog_aura::layouts::KeyLayout;
|
||||||
use rog_control_center::notify::EnabledNotifications;
|
|
||||||
use rog_control_center::tray::init_tray;
|
use rog_control_center::tray::init_tray;
|
||||||
|
use rog_control_center::update_and_notify::EnabledNotifications;
|
||||||
use rog_control_center::{
|
use rog_control_center::{
|
||||||
config::Config, error::Result, get_ipc_file, notify::start_notifications, on_tmp_dir_exists,
|
config::Config, error::Result, get_ipc_file, on_tmp_dir_exists, print_versions,
|
||||||
print_versions, startup_error::AppErrorShow, system_state::SystemState, RogApp,
|
startup_error::AppErrorShow, system_state::SystemState, update_and_notify::start_notifications,
|
||||||
RogDbusClientBlocking, SHOWING_GUI, SHOW_GUI,
|
RogApp, RogDbusClientBlocking, SHOWING_GUI, SHOW_GUI,
|
||||||
};
|
};
|
||||||
use rog_platform::supported::SupportedFunctions;
|
use rog_platform::supported::SupportedFunctions;
|
||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use supergfxctl::{
|
|||||||
zbus_proxy::DaemonProxyBlocking as GfxProxyBlocking,
|
zbus_proxy::DaemonProxyBlocking as GfxProxyBlocking,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{error::Result, notify::EnabledNotifications, RogDbusClientBlocking};
|
use crate::{error::Result, update_and_notify::EnabledNotifications, RogDbusClientBlocking};
|
||||||
use log::error;
|
use log::error;
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default)]
|
#[derive(Clone, Debug, Default)]
|
||||||
@@ -219,6 +219,7 @@ impl AnimeState {
|
|||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct GfxState {
|
pub struct GfxState {
|
||||||
|
pub has_supergfx: bool,
|
||||||
pub mode: GfxMode,
|
pub mode: GfxMode,
|
||||||
pub power_status: GfxPower,
|
pub power_status: GfxPower,
|
||||||
}
|
}
|
||||||
@@ -226,8 +227,9 @@ pub struct GfxState {
|
|||||||
impl GfxState {
|
impl GfxState {
|
||||||
pub fn new(_supported: &SupportedFunctions, dbus: &GfxProxyBlocking<'_>) -> Result<Self> {
|
pub fn new(_supported: &SupportedFunctions, dbus: &GfxProxyBlocking<'_>) -> Result<Self> {
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
mode: dbus.mode()?,
|
has_supergfx: dbus.mode().is_ok(),
|
||||||
power_status: dbus.power()?,
|
mode: dbus.mode().unwrap_or(GfxMode::None),
|
||||||
|
power_status: dbus.power().unwrap_or(GfxPower::Unknown),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -235,6 +237,7 @@ impl GfxState {
|
|||||||
impl Default for GfxState {
|
impl Default for GfxState {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
has_supergfx: false,
|
||||||
mode: GfxMode::None,
|
mode: GfxMode::None,
|
||||||
power_status: GfxPower::Unknown,
|
power_status: GfxPower::Unknown,
|
||||||
}
|
}
|
||||||
@@ -401,6 +404,7 @@ impl Default for SystemState {
|
|||||||
drag_delta: Default::default(),
|
drag_delta: Default::default(),
|
||||||
},
|
},
|
||||||
gfx_state: GfxState {
|
gfx_state: GfxState {
|
||||||
|
has_supergfx: false,
|
||||||
mode: GfxMode::None,
|
mode: GfxMode::None,
|
||||||
power_status: GfxPower::Unknown,
|
power_status: GfxPower::Unknown,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -351,6 +351,7 @@ impl ROGTray {
|
|||||||
fn rebuild_and_update(
|
fn rebuild_and_update(
|
||||||
&mut self,
|
&mut self,
|
||||||
supported: &SupportedFunctions,
|
supported: &SupportedFunctions,
|
||||||
|
has_supergfx: bool,
|
||||||
current_gfx_mode: GfxMode,
|
current_gfx_mode: GfxMode,
|
||||||
charge_limit: u8,
|
charge_limit: u8,
|
||||||
panel_od: bool,
|
panel_od: bool,
|
||||||
@@ -359,7 +360,9 @@ impl ROGTray {
|
|||||||
self.menu_add_base();
|
self.menu_add_base();
|
||||||
self.menu_add_charge_limit(supported, charge_limit);
|
self.menu_add_charge_limit(supported, charge_limit);
|
||||||
self.menu_add_panel_od(supported, panel_od);
|
self.menu_add_panel_od(supported, panel_od);
|
||||||
self.menu_add_gpu(supported, current_gfx_mode);
|
if has_supergfx {
|
||||||
|
self.menu_add_gpu(supported, current_gfx_mode);
|
||||||
|
}
|
||||||
self.menu_update();
|
self.menu_update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -371,6 +374,12 @@ pub fn init_tray(
|
|||||||
let (send, recv) = channel();
|
let (send, recv) = channel();
|
||||||
let _send = Arc::new(Mutex::new(send));
|
let _send = Arc::new(Mutex::new(send));
|
||||||
|
|
||||||
|
let has_supergfx = if let Ok(lock) = states.try_lock() {
|
||||||
|
lock.gfx_state.has_supergfx
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
};
|
||||||
|
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
if gtk::init()
|
if gtk::init()
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
@@ -396,7 +405,7 @@ pub fn init_tray(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
tray.rebuild_and_update(&supported, GfxMode::Hybrid, 100, false);
|
tray.rebuild_and_update(&supported, has_supergfx, GfxMode::Hybrid, 100, false);
|
||||||
tray.set_icon(TRAY_APP_ICON);
|
tray.set_icon(TRAY_APP_ICON);
|
||||||
info!("Started ROGTray");
|
info!("Started ROGTray");
|
||||||
|
|
||||||
@@ -405,6 +414,7 @@ pub fn init_tray(
|
|||||||
if lock.tray_should_update {
|
if lock.tray_should_update {
|
||||||
tray.rebuild_and_update(
|
tray.rebuild_and_update(
|
||||||
&supported,
|
&supported,
|
||||||
|
has_supergfx,
|
||||||
lock.gfx_state.mode,
|
lock.gfx_state.mode,
|
||||||
lock.power_state.charge_limit,
|
lock.power_state.charge_limit,
|
||||||
lock.bios.panel_overdrive,
|
lock.bios.panel_overdrive,
|
||||||
@@ -419,7 +429,13 @@ pub fn init_tray(
|
|||||||
GfxPower::AsusMuxDiscreet | GfxPower::Active => {
|
GfxPower::AsusMuxDiscreet | GfxPower::Active => {
|
||||||
tray.set_icon("asus_notif_red");
|
tray.set_icon("asus_notif_red");
|
||||||
}
|
}
|
||||||
GfxPower::Unknown => tray.set_icon("gpu-integrated"),
|
GfxPower::Unknown => {
|
||||||
|
if has_supergfx {
|
||||||
|
tray.set_icon("gpu-integrated");
|
||||||
|
} else {
|
||||||
|
tray.set_icon("asus_notif_red");
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
|
//! `update_and_notify` is responsible for both notifications *and* updating stored statuses
|
||||||
|
//! about the system state. This is done through either direct, intoify, zbus notifications
|
||||||
|
//! or similar methods.
|
||||||
|
|
||||||
use crate::{config::Config, error::Result, system_state::SystemState};
|
use crate::{config::Config, error::Result, system_state::SystemState};
|
||||||
use log::{error, info, trace};
|
use log::{error, info, trace, warn};
|
||||||
use notify_rust::{Hint, Notification, NotificationHandle, Urgency};
|
use notify_rust::{Hint, Notification, NotificationHandle, Urgency};
|
||||||
use rog_dbus::{
|
use rog_dbus::{
|
||||||
zbus_anime::AnimeProxy, zbus_led::LedProxy, zbus_platform::RogBiosProxy,
|
zbus_anime::AnimeProxy, zbus_led::LedProxy, zbus_platform::RogBiosProxy,
|
||||||
@@ -12,8 +16,10 @@ use std::{
|
|||||||
fmt::Display,
|
fmt::Display,
|
||||||
process::Command,
|
process::Command,
|
||||||
sync::{Arc, Mutex},
|
sync::{Arc, Mutex},
|
||||||
|
time::Duration,
|
||||||
};
|
};
|
||||||
use supergfxctl::{pci_device::GfxPower, zbus_proxy::DaemonProxy as SuperProxy};
|
use supergfxctl::{pci_device::GfxPower, zbus_proxy::DaemonProxy as SuperProxy};
|
||||||
|
use tokio::time::sleep;
|
||||||
use zbus::export::futures_util::{future, StreamExt};
|
use zbus::export::futures_util::{future, StreamExt};
|
||||||
|
|
||||||
const NOTIF_HEADER: &str = "ROG Control";
|
const NOTIF_HEADER: &str = "ROG Control";
|
||||||
@@ -271,103 +277,101 @@ pub fn start_notifications(
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
recv_notif!(
|
if let Ok(lock) = page_states.try_lock() {
|
||||||
SuperProxy,
|
use supergfxctl::pci_device::Device;
|
||||||
receive_notify_gfx,
|
let dev = Device::find().unwrap();
|
||||||
last_notification,
|
let mut found_dgpu = false; // just for logging
|
||||||
enabled_notifications,
|
for dev in dev {
|
||||||
page_states,
|
if dev.is_dgpu() {
|
||||||
(gfx_state.mode),
|
let notifs_enabled1 = enabled_notifications.clone();
|
||||||
(mode),
|
let last_notif = last_notification.clone();
|
||||||
"Gfx mode changed to",
|
let page_states1 = page_states.clone();
|
||||||
do_notification
|
// Plain old thread is perfectly fine since most of this is potentially blocking
|
||||||
);
|
tokio::spawn(async move {
|
||||||
|
let mut last_status = GfxPower::Unknown;
|
||||||
// recv_notif!(
|
loop {
|
||||||
// SuperProxy,
|
if let Ok(status) = dev.get_runtime_status() {
|
||||||
// receive_notify_action,
|
if status != GfxPower::Unknown && status != last_status {
|
||||||
// bios_notified,
|
if let Ok(config) = notifs_enabled1.lock() {
|
||||||
// last_gfx_action_notif,
|
if config.all_enabled && config.receive_notify_gfx_status {
|
||||||
// enabled_notifications,
|
// Required check because status cycles through active/unknown/suspended
|
||||||
// [action],
|
if let Ok(ref mut lock) = last_notif.lock() {
|
||||||
// "Gfx mode change requires",
|
notify!(
|
||||||
// do_gfx_action_notif
|
do_gpu_status_notif(
|
||||||
// );
|
"dGPU status changed:",
|
||||||
|
&status
|
||||||
tokio::spawn(async move {
|
),
|
||||||
let conn = zbus::Connection::system()
|
lock
|
||||||
.await
|
);
|
||||||
.map_err(|e| {
|
}
|
||||||
error!("zbus signal: receive_notify_action: {e}");
|
}
|
||||||
e
|
|
||||||
})
|
|
||||||
.unwrap();
|
|
||||||
let proxy = SuperProxy::new(&conn)
|
|
||||||
.await
|
|
||||||
.map_err(|e| {
|
|
||||||
error!("zbus signal: receive_notify_action: {e}");
|
|
||||||
e
|
|
||||||
})
|
|
||||||
.unwrap();
|
|
||||||
if let Ok(mut p) = proxy.receive_notify_action().await {
|
|
||||||
info!("Started zbus signal thread: receive_notify_action");
|
|
||||||
while let Some(e) = p.next().await {
|
|
||||||
if let Ok(out) = e.args() {
|
|
||||||
let action = out.action();
|
|
||||||
do_gfx_action_notif("Gfx mode change requires", &format!("{action:?}",))
|
|
||||||
.map_err(|e| {
|
|
||||||
error!("zbus signal: do_gfx_action_notif: {e}");
|
|
||||||
e
|
|
||||||
})
|
|
||||||
.unwrap();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
let notifs_enabled1 = enabled_notifications;
|
|
||||||
let last_notif = last_notification;
|
|
||||||
tokio::spawn(async move {
|
|
||||||
let conn = zbus::Connection::system()
|
|
||||||
.await
|
|
||||||
.map_err(|e| {
|
|
||||||
error!("zbus signal: receive_notify_gfx_status: {e}");
|
|
||||||
e
|
|
||||||
})
|
|
||||||
.unwrap();
|
|
||||||
let proxy = SuperProxy::new(&conn)
|
|
||||||
.await
|
|
||||||
.map_err(|e| {
|
|
||||||
error!("zbus signal: receive_notify_gfx_status: {e}");
|
|
||||||
e
|
|
||||||
})
|
|
||||||
.unwrap();
|
|
||||||
if let Ok(mut p) = proxy.receive_notify_gfx_status().await {
|
|
||||||
info!("Started zbus signal thread: receive_notify_gfx_status");
|
|
||||||
while let Some(e) = p.next().await {
|
|
||||||
if let Ok(out) = e.args() {
|
|
||||||
let status = out.status;
|
|
||||||
if status != GfxPower::Unknown {
|
|
||||||
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.lock() {
|
|
||||||
notify!(
|
|
||||||
do_gpu_status_notif("dGPU status changed:", &status),
|
|
||||||
lock
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
if let Ok(mut lock) = page_states1.lock() {
|
||||||
|
lock.gfx_state.power_status = status;
|
||||||
|
lock.set_notified();
|
||||||
|
}
|
||||||
|
last_status = status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Ok(mut lock) = page_states.lock() {
|
sleep(Duration::from_millis(500)).await;
|
||||||
lock.gfx_state.power_status = status;
|
}
|
||||||
lock.set_notified();
|
});
|
||||||
|
found_dgpu = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !found_dgpu {
|
||||||
|
warn!("Did not find a dGPU on this system, dGPU status won't be avilable");
|
||||||
|
}
|
||||||
|
|
||||||
|
if lock.gfx_state.has_supergfx {
|
||||||
|
recv_notif!(
|
||||||
|
SuperProxy,
|
||||||
|
receive_notify_gfx,
|
||||||
|
last_notification,
|
||||||
|
enabled_notifications,
|
||||||
|
page_states,
|
||||||
|
(gfx_state.mode),
|
||||||
|
(mode),
|
||||||
|
"Gfx mode changed to",
|
||||||
|
do_notification
|
||||||
|
);
|
||||||
|
|
||||||
|
tokio::spawn(async move {
|
||||||
|
let conn = zbus::Connection::system()
|
||||||
|
.await
|
||||||
|
.map_err(|e| {
|
||||||
|
error!("zbus signal: receive_notify_action: {e}");
|
||||||
|
e
|
||||||
|
})
|
||||||
|
.unwrap();
|
||||||
|
let proxy = SuperProxy::new(&conn)
|
||||||
|
.await
|
||||||
|
.map_err(|e| {
|
||||||
|
error!("zbus signal: receive_notify_action: {e}");
|
||||||
|
e
|
||||||
|
})
|
||||||
|
.unwrap();
|
||||||
|
if let Ok(mut p) = proxy.receive_notify_action().await {
|
||||||
|
info!("Started zbus signal thread: receive_notify_action");
|
||||||
|
while let Some(e) = p.next().await {
|
||||||
|
if let Ok(out) = e.args() {
|
||||||
|
let action = out.action();
|
||||||
|
do_gfx_action_notif(
|
||||||
|
"Gfx mode change requires",
|
||||||
|
&format!("{action:?}",),
|
||||||
|
)
|
||||||
|
.map_err(|e| {
|
||||||
|
error!("zbus signal: do_gfx_action_notif: {e}");
|
||||||
|
e
|
||||||
|
})
|
||||||
|
.unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
});
|
||||||
};
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# If you see this, run "rustup self update" to get rustup 1.23 or newer.
|
||||||
|
|
||||||
|
# NOTE: above comment is for older `rustup` (before TOML support was added),
|
||||||
|
# which will treat the first line as the toolchain name, and therefore show it
|
||||||
|
# to the user in the error, instead of "error: invalid channel name '[toolchain]'".
|
||||||
|
|
||||||
|
[toolchain]
|
||||||
|
channel = "1.65.0"
|
||||||
|
components = [ "rustfmt", "clippy" ]
|
||||||
Reference in New Issue
Block a user