mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
@@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
+ Support 8bit RGB, RGBA, 16bit Greyscalw, RGB, RGBA
|
||||
+ add `AsusImage` type for slanted-template pixel-perfect images
|
||||
+ `BREAKING:` plain `Image` with time period is changed and old anime configs break as a result (sorry)
|
||||
- LED:
|
||||
+ By popular request LED prev/next cycle is added
|
||||
### BREAKING CHANGES
|
||||
- Graphics control:
|
||||
+ graphics control is pulled out of asusd and moved to new package; https://gitlab.com/asus-linux/supergfxctl
|
||||
|
||||
@@ -31,6 +31,10 @@ struct CliStart {
|
||||
show_supported: bool,
|
||||
#[options(meta = "", help = "<off, low, med, high>")]
|
||||
kbd_bright: Option<LedBrightness>,
|
||||
#[options(help = "Toggle to next keyboard brightness")]
|
||||
next_kbd_bright: bool,
|
||||
#[options(help = "Toggle to previous keyboard brightness")]
|
||||
prev_kbd_bright: bool,
|
||||
#[options(meta = "", help = "<20-100>")]
|
||||
chg_limit: Option<u8>,
|
||||
#[options(command)]
|
||||
@@ -158,8 +162,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
Some(CliCommand::Anime(cmd)) => handle_anime(&dbus, &supported.anime_ctrl, &cmd)?,
|
||||
Some(CliCommand::Bios(cmd)) => handle_bios_option(&dbus, &supported.rog_bios_ctrl, &cmd)?,
|
||||
None => {
|
||||
if (!parsed.show_supported && parsed.kbd_bright.is_none() && parsed.chg_limit.is_none())
|
||||
|| parsed.help
|
||||
if (!parsed.show_supported && parsed.kbd_bright.is_none() && parsed.chg_limit.is_none()
|
||||
&& !parsed.next_kbd_bright && !parsed.prev_kbd_bright) || parsed.help
|
||||
{
|
||||
println!("{}", CliStart::usage());
|
||||
println!();
|
||||
@@ -181,6 +185,14 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
}
|
||||
}
|
||||
|
||||
if parsed.next_kbd_bright {
|
||||
dbus.proxies().led().next_led_brightness()?;
|
||||
}
|
||||
|
||||
if parsed.prev_kbd_bright {
|
||||
dbus.proxies().led().prev_led_brightness()?;
|
||||
}
|
||||
|
||||
if parsed.show_supported {
|
||||
println!("Supported laptop functions:\n\n{}", supported);
|
||||
}
|
||||
|
||||
@@ -239,6 +239,28 @@ impl CtrlKbdLed {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn next_brightness(&mut self) -> Result<(), RogError> {
|
||||
let mut bright = (self.config.brightness as u32) + 1;
|
||||
if bright > 3 {
|
||||
bright = 0;
|
||||
}
|
||||
self.config.brightness = <LedBrightness>::from(bright);
|
||||
self.config.write();
|
||||
self.set_brightness(self.config.brightness)
|
||||
}
|
||||
|
||||
pub fn prev_brightness(&mut self) -> Result<(), RogError> {
|
||||
let mut bright = self.config.brightness as u32;
|
||||
if bright == 0 {
|
||||
bright = 3;
|
||||
} else {
|
||||
bright -= 1;
|
||||
}
|
||||
self.config.brightness = <LedBrightness>::from(bright);
|
||||
self.config.write();
|
||||
self.set_brightness(self.config.brightness)
|
||||
}
|
||||
|
||||
/// Set if awake/on LED active, and/or sleep animation active
|
||||
pub(super) fn set_states_enabled(&self, awake: bool, sleep: bool) -> Result<(), RogError> {
|
||||
let bytes = if awake && sleep {
|
||||
|
||||
@@ -105,6 +105,20 @@ impl CtrlKbdLedZbus {
|
||||
}
|
||||
}
|
||||
|
||||
fn next_led_brightness(&self) {
|
||||
if let Ok(mut ctrl) = self.0.try_lock() {
|
||||
ctrl.next_brightness()
|
||||
.unwrap_or_else(|err| warn!("{}", err));
|
||||
}
|
||||
}
|
||||
|
||||
fn prev_led_brightness(&self) {
|
||||
if let Ok(mut ctrl) = self.0.try_lock() {
|
||||
ctrl.prev_brightness()
|
||||
.unwrap_or_else(|err| warn!("{}", err));
|
||||
}
|
||||
}
|
||||
|
||||
#[dbus_interface(property)]
|
||||
fn awake_enabled(&self) -> bool {
|
||||
if let Ok(ctrl) = self.0.try_lock() {
|
||||
|
||||
@@ -38,6 +38,12 @@ trait Daemon {
|
||||
/// PrevLedMode method
|
||||
fn prev_led_mode(&self) -> zbus::Result<()>;
|
||||
|
||||
/// Toggle to next led brightness
|
||||
fn next_led_brightness(&self) -> zbus::Result<()>;
|
||||
|
||||
/// Toggle to previous led brightness
|
||||
fn prev_led_brightness(&self) -> zbus::Result<()>;
|
||||
|
||||
/// SetBrightness method
|
||||
fn set_brightness(&self, brightness: LedBrightness) -> zbus::Result<()>;
|
||||
|
||||
@@ -124,6 +130,16 @@ impl<'a> LedProxy<'a> {
|
||||
self.0.prev_led_mode()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn next_led_brightness(&self) -> Result<()> {
|
||||
self.0.next_led_brightness()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn prev_led_brightness(&self) -> Result<()> {
|
||||
self.0.prev_led_brightness()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn set_led_mode(&self, mode: &AuraEffect) -> Result<()> {
|
||||
self.0.set_led_mode(mode)
|
||||
|
||||
Reference in New Issue
Block a user