mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
ROGCC: Attempt to add LED brightness
This commit is contained in:
@@ -169,11 +169,26 @@ pub fn start_notifications(
|
|||||||
})
|
})
|
||||||
.detach();
|
.detach();
|
||||||
|
|
||||||
|
let aura_notif = aura_notified.clone();
|
||||||
executor
|
executor
|
||||||
.spawn(async move {
|
.spawn(async move {
|
||||||
let conn = zbus::Connection::system().await.unwrap();
|
let conn = zbus::Connection::system().await.unwrap();
|
||||||
let proxy = LedProxy::new(&conn).await.unwrap();
|
let proxy = LedProxy::new(&conn).await.unwrap();
|
||||||
if let Ok(p) = proxy.receive_notify_power_states().await {
|
if let Ok(p) = proxy.receive_notify_led().await {
|
||||||
|
p.for_each(|_| {
|
||||||
|
aura_notif.store(true, Ordering::SeqCst);
|
||||||
|
future::ready(())
|
||||||
|
})
|
||||||
|
.await;
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.detach();
|
||||||
|
|
||||||
|
executor
|
||||||
|
.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(|_| {
|
p.for_each(|_| {
|
||||||
aura_notified.store(true, Ordering::SeqCst);
|
aura_notified.store(true, Ordering::SeqCst);
|
||||||
future::ready(())
|
future::ready(())
|
||||||
|
|||||||
@@ -156,6 +156,8 @@ pub struct AuraState {
|
|||||||
pub current_mode: AuraModeNum,
|
pub current_mode: AuraModeNum,
|
||||||
pub modes: BTreeMap<AuraModeNum, AuraEffect>,
|
pub modes: BTreeMap<AuraModeNum, AuraEffect>,
|
||||||
pub enabled: AuraPowerDev,
|
pub enabled: AuraPowerDev,
|
||||||
|
/// Brightness from 0-3
|
||||||
|
pub bright: i16,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AuraState {
|
impl AuraState {
|
||||||
@@ -178,6 +180,11 @@ impl AuraState {
|
|||||||
BTreeMap::new()
|
BTreeMap::new()
|
||||||
},
|
},
|
||||||
enabled: dbus.proxies().led().leds_enabled().unwrap(),
|
enabled: dbus.proxies().led().leds_enabled().unwrap(),
|
||||||
|
bright: if !supported.keyboard_led.brightness_set {
|
||||||
|
dbus.proxies().led().led_brightness().unwrap()
|
||||||
|
} else {
|
||||||
|
2
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use egui::{RichText, Ui};
|
use egui::{RichText, Ui};
|
||||||
use rog_aura::{
|
use rog_aura::{
|
||||||
usb::{AuraDev1866, AuraDev19b6, AuraDevice, AuraPowerDev},
|
usb::{AuraDev1866, AuraDev19b6, AuraDevice, AuraPowerDev},
|
||||||
AuraModeNum, AuraZone, Colour, Speed,
|
AuraModeNum, AuraZone, Colour, LedBrightness, Speed,
|
||||||
};
|
};
|
||||||
use rog_dbus::RogDbusClientBlocking;
|
use rog_dbus::RogDbusClientBlocking;
|
||||||
use rog_supported::SupportedFunctions;
|
use rog_supported::SupportedFunctions;
|
||||||
@@ -72,6 +72,11 @@ impl<'a> RogApp<'a> {
|
|||||||
ui.horizontal_wrapped(|ui| {
|
ui.horizontal_wrapped(|ui| {
|
||||||
ui.label(RichText::new("Sleep").size(h));
|
ui.label(RichText::new("Sleep").size(h));
|
||||||
});
|
});
|
||||||
|
// if supported.keyboard_led.brightness_set {
|
||||||
|
// ui.horizontal_wrapped(|ui| {
|
||||||
|
// ui.label(RichText::new("Brightness").size(h));
|
||||||
|
// });
|
||||||
|
// }
|
||||||
});
|
});
|
||||||
ui.vertical(|ui| {
|
ui.vertical(|ui| {
|
||||||
ui.set_row_height(22.0);
|
ui.set_row_height(22.0);
|
||||||
@@ -95,6 +100,26 @@ impl<'a> RogApp<'a> {
|
|||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// We currently don't have a watch for system changes here
|
||||||
|
// if supported.keyboard_led.brightness_set {
|
||||||
|
// if ui
|
||||||
|
// .add(egui::Slider::new(
|
||||||
|
// &mut states.aura.bright,
|
||||||
|
// 0..=3,
|
||||||
|
// ))
|
||||||
|
// .changed()
|
||||||
|
// {
|
||||||
|
// let bright = LedBrightness::from(states.aura.bright as u32);
|
||||||
|
// dbus.proxies()
|
||||||
|
// .led()
|
||||||
|
// .set_brightness(bright)
|
||||||
|
// .map_err(|err| {
|
||||||
|
// states.error = Some(err.to_string());
|
||||||
|
// })
|
||||||
|
// .ok();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user