mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Fix up colour sliders
- Fixup colour sliders for UI - Correctly drop tokio runtime
This commit is contained in:
11
CHANGELOG.md
11
CHANGELOG.md
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [v6.0.3]
|
||||||
|
|
||||||
|
### NOTE
|
||||||
|
|
||||||
|
- Xorg is not supported any longer. All major desktops and distros are Wayland.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Add a check to prevent non-TUF laptops with screwed up method return from TUF acpi methods from trying to add a TUF aura device without actually being a TUF laptop.
|
||||||
|
- Make the G834JZ entry in aura db generic for all G834J
|
||||||
|
|
||||||
## [v6.0.2]
|
## [v6.0.2]
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|||||||
30
Cargo.lock
generated
30
Cargo.lock
generated
@@ -117,7 +117,7 @@ checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "asusctl"
|
name = "asusctl"
|
||||||
version = "6.0.2"
|
version = "6.0.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"asusd",
|
"asusd",
|
||||||
"cargo-husky",
|
"cargo-husky",
|
||||||
@@ -135,14 +135,14 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "asusd"
|
name = "asusd"
|
||||||
version = "6.0.2"
|
version = "6.0.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cargo-husky",
|
"cargo-husky",
|
||||||
"concat-idents",
|
"concat-idents",
|
||||||
"config-traits",
|
"config-traits",
|
||||||
"dmi_id",
|
"dmi_id",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
"futures-lite 2.3.0",
|
"futures-lite 1.13.0",
|
||||||
"inotify",
|
"inotify",
|
||||||
"log",
|
"log",
|
||||||
"logind-zbus",
|
"logind-zbus",
|
||||||
@@ -161,7 +161,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "asusd-user"
|
name = "asusd-user"
|
||||||
version = "6.0.2"
|
version = "6.0.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cargo-husky",
|
"cargo-husky",
|
||||||
"config-traits",
|
"config-traits",
|
||||||
@@ -828,7 +828,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "config-traits"
|
name = "config-traits"
|
||||||
version = "6.0.2"
|
version = "6.0.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cargo-husky",
|
"cargo-husky",
|
||||||
"log",
|
"log",
|
||||||
@@ -934,7 +934,7 @@ checksum = "7704b5fdd17b18ae31c4c1da5a2e0305a2bf17b5249300a9ee9ed7b72114c636"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cpuctl"
|
name = "cpuctl"
|
||||||
version = "6.0.2"
|
version = "6.0.3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cpufeatures"
|
name = "cpufeatures"
|
||||||
@@ -1134,7 +1134,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dmi_id"
|
name = "dmi_id"
|
||||||
version = "6.0.2"
|
version = "6.0.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"log",
|
"log",
|
||||||
"udev 0.8.0",
|
"udev 0.8.0",
|
||||||
@@ -3309,7 +3309,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog-control-center"
|
name = "rog-control-center"
|
||||||
version = "6.0.2"
|
version = "6.0.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"asusd",
|
"asusd",
|
||||||
"betrayer",
|
"betrayer",
|
||||||
@@ -3341,7 +3341,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_anime"
|
name = "rog_anime"
|
||||||
version = "6.0.2"
|
version = "6.0.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cargo-husky",
|
"cargo-husky",
|
||||||
"dmi_id",
|
"dmi_id",
|
||||||
@@ -3358,7 +3358,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_aura"
|
name = "rog_aura"
|
||||||
version = "6.0.2"
|
version = "6.0.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cargo-husky",
|
"cargo-husky",
|
||||||
"dmi_id",
|
"dmi_id",
|
||||||
@@ -3372,7 +3372,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_dbus"
|
name = "rog_dbus"
|
||||||
version = "6.0.2"
|
version = "6.0.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"asusd",
|
"asusd",
|
||||||
"cargo-husky",
|
"cargo-husky",
|
||||||
@@ -3386,7 +3386,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_platform"
|
name = "rog_platform"
|
||||||
version = "6.0.2"
|
version = "6.0.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cargo-husky",
|
"cargo-husky",
|
||||||
"concat-idents",
|
"concat-idents",
|
||||||
@@ -3401,7 +3401,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_profiles"
|
name = "rog_profiles"
|
||||||
version = "6.0.2"
|
version = "6.0.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cargo-husky",
|
"cargo-husky",
|
||||||
"log",
|
"log",
|
||||||
@@ -3415,7 +3415,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_simulators"
|
name = "rog_simulators"
|
||||||
version = "6.0.2"
|
version = "6.0.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"log",
|
"log",
|
||||||
"rog_anime",
|
"rog_anime",
|
||||||
@@ -3425,7 +3425,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_slash"
|
name = "rog_slash"
|
||||||
version = "6.0.2"
|
version = "6.0.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cargo-husky",
|
"cargo-husky",
|
||||||
"dmi_id",
|
"dmi_id",
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ default-members = [
|
|||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "6.0.2"
|
version = "6.0.3"
|
||||||
rust-version = "1.77"
|
rust-version = "1.77"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
use std::collections::{BTreeMap, HashSet};
|
use std::collections::{BTreeMap, HashSet};
|
||||||
|
|
||||||
use config_traits::{StdConfig, StdConfigLoad};
|
use config_traits::{StdConfig, StdConfigLoad};
|
||||||
|
use dmi_id::DMIID;
|
||||||
use inotify::Inotify;
|
use inotify::Inotify;
|
||||||
use log::{debug, info, warn};
|
use log::{debug, info, warn};
|
||||||
use rog_aura::aura_detection::LedSupportData;
|
use rog_aura::aura_detection::LedSupportData;
|
||||||
@@ -123,16 +124,24 @@ impl CtrlKbdLed {
|
|||||||
// Check for a TUF laptop LED. Assume there is only ever one.
|
// Check for a TUF laptop LED. Assume there is only ever one.
|
||||||
if let Ok(kbd_backlight) = KeyboardLed::new() {
|
if let Ok(kbd_backlight) = KeyboardLed::new() {
|
||||||
if kbd_backlight.has_kbd_rgb_mode() {
|
if kbd_backlight.has_kbd_rgb_mode() {
|
||||||
info!("AuraControl found a TUF laptop keyboard");
|
// Extra sure double-check that this isn't a laptop with crap
|
||||||
let ctrl = CtrlKbdLed {
|
// ACPI with borked return on the TUF rgb methods
|
||||||
led_type: AuraDeviceType::LaptopTuf,
|
let dmi = DMIID::new().unwrap_or_default();
|
||||||
led_node: LEDNode::KbdLed(kbd_backlight),
|
info!("Found a TUF with product family: {}", dmi.product_family);
|
||||||
supported_data: LedSupportData::get_data("tuf"),
|
info!("and board name: {}", dmi.board_name);
|
||||||
per_key_mode_active: false,
|
|
||||||
config: Self::init_config("tuf"),
|
if dmi.product_family.contains("TUF") {
|
||||||
dbus_path: dbus_path_for_tuf(),
|
info!("AuraControl found a TUF laptop keyboard");
|
||||||
};
|
let ctrl = CtrlKbdLed {
|
||||||
devices.push(ctrl);
|
led_type: AuraDeviceType::LaptopTuf,
|
||||||
|
led_node: LEDNode::KbdLed(kbd_backlight),
|
||||||
|
supported_data: LedSupportData::get_data("tuf"),
|
||||||
|
per_key_mode_active: false,
|
||||||
|
config: Self::init_config("tuf"),
|
||||||
|
dbus_path: dbus_path_for_tuf(),
|
||||||
|
};
|
||||||
|
devices.push(ctrl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
power_zones: [Keyboard],
|
power_zones: [Keyboard],
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
device_name: "FX505D",
|
device_name: "FX505",
|
||||||
product_id: "",
|
product_id: "",
|
||||||
layout_name: "fx505d",
|
layout_name: "fx505d",
|
||||||
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
|
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
|
||||||
@@ -36,25 +36,7 @@
|
|||||||
power_zones: [Keyboard],
|
power_zones: [Keyboard],
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
device_name: "FX505G",
|
device_name: "FX506",
|
||||||
product_id: "",
|
|
||||||
layout_name: "fx505d",
|
|
||||||
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
|
|
||||||
basic_zones: [],
|
|
||||||
advanced_type: None,
|
|
||||||
power_zones: [Keyboard],
|
|
||||||
),
|
|
||||||
(
|
|
||||||
device_name: "FX506H",
|
|
||||||
product_id: "",
|
|
||||||
layout_name: "fa506i",
|
|
||||||
basic_modes: [Static, Breathe, Strobe, Pulse],
|
|
||||||
basic_zones: [],
|
|
||||||
advanced_type: None,
|
|
||||||
power_zones: [Keyboard],
|
|
||||||
),
|
|
||||||
(
|
|
||||||
device_name: "FX506L",
|
|
||||||
product_id: "",
|
product_id: "",
|
||||||
layout_name: "fa506i",
|
layout_name: "fa506i",
|
||||||
basic_modes: [Static, Breathe, Strobe, Pulse],
|
basic_modes: [Static, Breathe, Strobe, Pulse],
|
||||||
@@ -98,15 +80,6 @@
|
|||||||
advanced_type: None,
|
advanced_type: None,
|
||||||
power_zones: [Keyboard],
|
power_zones: [Keyboard],
|
||||||
),
|
),
|
||||||
(
|
|
||||||
device_name: "G512LV",
|
|
||||||
product_id: "",
|
|
||||||
layout_name: "ga401q",
|
|
||||||
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
|
|
||||||
basic_zones: [Key1, Key2, Key3, Key4],
|
|
||||||
advanced_type: None,
|
|
||||||
power_zones: [Keyboard],
|
|
||||||
),
|
|
||||||
(
|
(
|
||||||
device_name: "G513I",
|
device_name: "G513I",
|
||||||
product_id: "",
|
product_id: "",
|
||||||
@@ -126,16 +99,7 @@
|
|||||||
power_zones: [Keyboard],
|
power_zones: [Keyboard],
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
device_name: "G513QM",
|
device_name: "G513Q",
|
||||||
product_id: "",
|
|
||||||
layout_name: "g513i",
|
|
||||||
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
|
|
||||||
basic_zones: [],
|
|
||||||
advanced_type: PerKey,
|
|
||||||
power_zones: [Keyboard],
|
|
||||||
),
|
|
||||||
(
|
|
||||||
device_name: "G513QR",
|
|
||||||
product_id: "",
|
product_id: "",
|
||||||
layout_name: "g513i-per-key",
|
layout_name: "g513i-per-key",
|
||||||
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
|
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
|
||||||
@@ -153,16 +117,7 @@
|
|||||||
power_zones: [Keyboard],
|
power_zones: [Keyboard],
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
device_name: "G513RC",
|
device_name: "G513R",
|
||||||
product_id: "",
|
|
||||||
layout_name: "g513i",
|
|
||||||
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
|
|
||||||
basic_zones: [],
|
|
||||||
advanced_type: Zoned([ZonedKbLeft, ZonedKbLeftMid, ZonedKbRightMid, ZonedKbRight, LightbarRight, LightbarRightCorner, LightbarRightBottom, LightbarLeftBottom, LightbarLeftCorner, LightbarLeft]),
|
|
||||||
power_zones: [Keyboard, Lightbar],
|
|
||||||
),
|
|
||||||
(
|
|
||||||
device_name: "G513RM",
|
|
||||||
product_id: "",
|
product_id: "",
|
||||||
layout_name: "g513i",
|
layout_name: "g513i",
|
||||||
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
|
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
|
||||||
@@ -188,15 +143,6 @@
|
|||||||
advanced_type: PerKey,
|
advanced_type: PerKey,
|
||||||
power_zones: [Keyboard],
|
power_zones: [Keyboard],
|
||||||
),
|
),
|
||||||
(
|
|
||||||
device_name: "G531",
|
|
||||||
product_id: "",
|
|
||||||
layout_name: "g513i-per-key",
|
|
||||||
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
|
|
||||||
basic_zones: [Key1, Key2, Key3, Key4],
|
|
||||||
advanced_type: PerKey,
|
|
||||||
power_zones: [Keyboard],
|
|
||||||
),
|
|
||||||
(
|
(
|
||||||
device_name: "G531GD",
|
device_name: "G531GD",
|
||||||
product_id: "",
|
product_id: "",
|
||||||
@@ -468,7 +414,7 @@
|
|||||||
power_zones: [Keyboard],
|
power_zones: [Keyboard],
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
device_name: "G814JI",
|
device_name: "G814J",
|
||||||
product_id: "",
|
product_id: "",
|
||||||
layout_name: "g814ji-per-key",
|
layout_name: "g814ji-per-key",
|
||||||
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
|
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
|
||||||
@@ -477,16 +423,7 @@
|
|||||||
power_zones: [Keyboard, Lightbar],
|
power_zones: [Keyboard, Lightbar],
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
device_name: "G814JZ",
|
device_name: "G834J",
|
||||||
product_id: "",
|
|
||||||
layout_name: "g814ji-per-key",
|
|
||||||
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
|
|
||||||
basic_zones: [],
|
|
||||||
advanced_type: PerKey,
|
|
||||||
power_zones: [Keyboard, Lightbar],
|
|
||||||
),
|
|
||||||
(
|
|
||||||
device_name: "G834JZ",
|
|
||||||
product_id: "",
|
product_id: "",
|
||||||
layout_name: "g814ji-per-key",
|
layout_name: "g814ji-per-key",
|
||||||
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
|
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
|
||||||
@@ -540,7 +477,7 @@
|
|||||||
power_zones: [Keyboard],
|
power_zones: [Keyboard],
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
device_name: "GA403UI",
|
device_name: "GA403U",
|
||||||
product_id: "",
|
product_id: "",
|
||||||
layout_name: "ga401q",
|
layout_name: "ga401q",
|
||||||
basic_modes: [Static, Breathe, Pulse],
|
basic_modes: [Static, Breathe, Pulse],
|
||||||
@@ -647,15 +584,6 @@
|
|||||||
advanced_type: PerKey,
|
advanced_type: PerKey,
|
||||||
power_zones: [Keyboard],
|
power_zones: [Keyboard],
|
||||||
),
|
),
|
||||||
(
|
|
||||||
device_name: "GU502G",
|
|
||||||
product_id: "",
|
|
||||||
layout_name: "gx502",
|
|
||||||
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
|
|
||||||
basic_zones: [],
|
|
||||||
advanced_type: PerKey,
|
|
||||||
power_zones: [Keyboard],
|
|
||||||
),
|
|
||||||
(
|
(
|
||||||
device_name: "GU502L",
|
device_name: "GU502L",
|
||||||
product_id: "",
|
product_id: "",
|
||||||
@@ -684,7 +612,7 @@
|
|||||||
power_zones: [Keyboard],
|
power_zones: [Keyboard],
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
device_name: "GU603VV",
|
device_name: "GU603V",
|
||||||
product_id: "",
|
product_id: "",
|
||||||
layout_name: "ga401q",
|
layout_name: "ga401q",
|
||||||
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
|
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
|
||||||
|
|||||||
@@ -22,8 +22,6 @@ use rog_control_center::{
|
|||||||
get_ipc_file, on_tmp_dir_exists, print_versions, MainWindow, QUIT_APP, SHOWING_GUI, SHOW_GUI,
|
get_ipc_file, on_tmp_dir_exists, print_versions, MainWindow, QUIT_APP, SHOWING_GUI, SHOW_GUI,
|
||||||
};
|
};
|
||||||
use tokio::runtime::Runtime;
|
use tokio::runtime::Runtime;
|
||||||
// use winit::monitor::VideoMode;
|
|
||||||
// use winit::window::{Fullscreen, WindowLevel};
|
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<()> {
|
async fn main() -> Result<()> {
|
||||||
@@ -73,11 +71,6 @@ async fn main() -> Result<()> {
|
|||||||
.format_timestamp(None)
|
.format_timestamp(None)
|
||||||
.init();
|
.init();
|
||||||
|
|
||||||
// start tokio
|
|
||||||
let rt = Runtime::new().expect("Unable to create Runtime");
|
|
||||||
// Enter the runtime so that `tokio::spawn` is available immediately.
|
|
||||||
let _enter = rt.enter();
|
|
||||||
|
|
||||||
let supported_properties = match proxy.supported_properties() {
|
let supported_properties = match proxy.supported_properties() {
|
||||||
Ok(s) => s,
|
Ok(s) => s,
|
||||||
Err(_e) => {
|
Err(_e) => {
|
||||||
@@ -117,7 +110,13 @@ async fn main() -> Result<()> {
|
|||||||
let enable_tray_icon = config.enable_tray_icon;
|
let enable_tray_icon = config.enable_tray_icon;
|
||||||
let startup_in_background = config.startup_in_background;
|
let startup_in_background = config.startup_in_background;
|
||||||
let config = Arc::new(Mutex::new(config));
|
let config = Arc::new(Mutex::new(config));
|
||||||
start_notifications(config.clone())?;
|
|
||||||
|
// start tokio
|
||||||
|
let rt = Runtime::new().expect("Unable to create Runtime");
|
||||||
|
// Enter the runtime so that `tokio::spawn` is available immediately.
|
||||||
|
let _enter = rt.enter();
|
||||||
|
start_notifications(config.clone(), &rt)?;
|
||||||
|
|
||||||
if enable_tray_icon {
|
if enable_tray_icon {
|
||||||
init_tray(supported_properties, config.clone());
|
init_tray(supported_properties, config.clone());
|
||||||
}
|
}
|
||||||
@@ -208,6 +207,7 @@ async fn main() -> Result<()> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
slint::run_event_loop_until_quit().unwrap();
|
slint::run_event_loop_until_quit().unwrap();
|
||||||
|
rt.shutdown_background();
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ use serde::{Deserialize, Serialize};
|
|||||||
use supergfxctl::actions::UserActionRequired as GfxUserAction;
|
use supergfxctl::actions::UserActionRequired as GfxUserAction;
|
||||||
use supergfxctl::pci_device::{GfxMode, GfxPower};
|
use supergfxctl::pci_device::{GfxMode, GfxPower};
|
||||||
use supergfxctl::zbus_proxy::DaemonProxy as SuperProxy;
|
use supergfxctl::zbus_proxy::DaemonProxy as SuperProxy;
|
||||||
|
use tokio::runtime::Runtime;
|
||||||
|
use tokio::task::JoinHandle;
|
||||||
use tokio::time::sleep;
|
use tokio::time::sleep;
|
||||||
use zbus::export::futures_util::StreamExt;
|
use zbus::export::futures_util::StreamExt;
|
||||||
|
|
||||||
@@ -44,10 +46,13 @@ impl Default for EnabledNotifications {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn start_notifications(config: Arc<Mutex<Config>>) -> Result<()> {
|
pub fn start_notifications(
|
||||||
|
config: Arc<Mutex<Config>>,
|
||||||
|
rt: &Runtime,
|
||||||
|
) -> Result<Vec<JoinHandle<()>>> {
|
||||||
// Setup the AC/BAT commands that will run on power status change
|
// Setup the AC/BAT commands that will run on power status change
|
||||||
let config_copy = config.clone();
|
let config_copy = config.clone();
|
||||||
tokio::task::spawn_blocking(move || {
|
let blocking = rt.spawn_blocking(move || {
|
||||||
let power = AsusPower::new()
|
let power = AsusPower::new()
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
error!("AsusPower: {e}");
|
error!("AsusPower: {e}");
|
||||||
@@ -217,7 +222,7 @@ pub fn start_notifications(config: Arc<Mutex<Config>>) -> Result<()> {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
Ok(())
|
Ok(vec![blocking])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn convert_gfx_mode(gfx: GfxMode) -> GpuMode {
|
fn convert_gfx_mode(gfx: GfxMode) -> GpuMode {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"POT-Creation-Date: 2024-05-08 04:26+0000\n"
|
"POT-Creation-Date: 2024-05-08 10:28+0000\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ export component ColourSlider inherits VerticalLayout {
|
|||||||
property <string> hex: "#FF0000";
|
property <string> hex: "#FF0000";
|
||||||
in-out property <float> c1value <=> c1.value;
|
in-out property <float> c1value <=> c1.value;
|
||||||
in-out property <float> c2value <=> c2.value;
|
in-out property <float> c2value <=> c2.value;
|
||||||
|
in-out property <float> c3value <=> c3.value;
|
||||||
property <color> base_colour: Colors.red;
|
property <color> base_colour: Colors.red;
|
||||||
in-out property <color> final_colour: Colors.red;
|
in-out property <color> final_colour: Colors.red;
|
||||||
in-out property <brush> colourbox: final_colour;
|
in-out property <brush> colourbox: final_colour;
|
||||||
@@ -53,39 +54,52 @@ export component ColourSlider inherits VerticalLayout {
|
|||||||
hsv(350, 1, 1),
|
hsv(350, 1, 1),
|
||||||
hsv(360, 1, 1),
|
hsv(360, 1, 1),
|
||||||
];
|
];
|
||||||
property <[color]> base_shade: [
|
property <[color]> base_saturation: [
|
||||||
blend_lightness(base_colour, 1.0),
|
hsv(base_colour.to-hsv().hue, 1, 1),
|
||||||
blend_lightness(base_colour, 0.9),
|
hsv(base_colour.to-hsv().hue, 0.9, 1),
|
||||||
blend_lightness(base_colour, 0.8),
|
hsv(base_colour.to-hsv().hue, 0.8, 1),
|
||||||
blend_lightness(base_colour, 0.7),
|
hsv(base_colour.to-hsv().hue, 0.7, 1),
|
||||||
blend_lightness(base_colour, 0.6),
|
hsv(base_colour.to-hsv().hue, 0.6, 1),
|
||||||
blend_lightness(base_colour, 0.5),
|
hsv(base_colour.to-hsv().hue, 0.5, 1),
|
||||||
blend_lightness(base_colour, 0.4),
|
hsv(base_colour.to-hsv().hue, 0.4, 1),
|
||||||
blend_lightness(base_colour, 0.3),
|
hsv(base_colour.to-hsv().hue, 0.3, 1),
|
||||||
blend_lightness(base_colour, 0.2),
|
hsv(base_colour.to-hsv().hue, 0.2, 1),
|
||||||
blend_lightness(base_colour, 0.1),
|
hsv(base_colour.to-hsv().hue, 0.1, 1),
|
||||||
blend_lightness(base_colour, 0.0)
|
hsv(base_colour.to-hsv().hue, 0, 1),
|
||||||
];
|
];
|
||||||
function blend_lightness(c1: color,f: float) -> color {
|
property <[color]> base_value: [
|
||||||
rgb(c1.red * f, c1.green * f, c1.blue * f)
|
hsv(base_colour.to-hsv().hue, 1, 1),
|
||||||
}
|
hsv(base_colour.to-hsv().hue, 1, 0.9),
|
||||||
//
|
hsv(base_colour.to-hsv().hue, 1, 0.8),
|
||||||
|
hsv(base_colour.to-hsv().hue, 1, 0.7),
|
||||||
|
hsv(base_colour.to-hsv().hue, 1, 0.6),
|
||||||
|
hsv(base_colour.to-hsv().hue, 1, 0.5),
|
||||||
|
hsv(base_colour.to-hsv().hue, 1, 0.4),
|
||||||
|
hsv(base_colour.to-hsv().hue, 1, 0.3),
|
||||||
|
hsv(base_colour.to-hsv().hue, 1, 0.2),
|
||||||
|
hsv(base_colour.to-hsv().hue, 1, 0.1),
|
||||||
|
hsv(base_colour.to-hsv().hue, 1, 0),
|
||||||
|
];
|
||||||
|
|
||||||
function set_base_colour(){
|
function set_base_colour(){
|
||||||
root.base_colour = base_colours[c1.value].mix(base_colours[c1.value + 1], c1.value - Math.floor(c1.value));
|
root.base_colour = hsv(c1.value / base_colours.length * 360, 1, 1);
|
||||||
root.final_colour = blend_lightness(base_colour, ((base_shade.length - c2.value) / base_shade.length));
|
root.final_colour = hsv(base_colour.to-hsv().hue, ((base_saturation.length - c2.value) / base_saturation.length), ((base_value.length - c3.value) / base_value.length));
|
||||||
root.colourbox = root.final_colour;
|
root.colourbox = root.final_colour;
|
||||||
}
|
}
|
||||||
//
|
|
||||||
callback external_colour_change();
|
callback external_colour_change();
|
||||||
|
|
||||||
external_colour_change => {
|
external_colour_change => {
|
||||||
if (root.final_colour.to-hsv().hue < 0) {
|
if (root.final_colour.to-hsv().hue < 0) {
|
||||||
c1.value = (root.base_colours.length - 1) * ((root.final_colour.to-hsv().hue + 360) / 360);
|
c1.value = root.base_colours.length * (root.final_colour.to-hsv().hue + 360) / 360;
|
||||||
} else {
|
} else {
|
||||||
c1.value = (root.base_colours.length - 1) * (root.final_colour.to-hsv().hue / 360);
|
c1.value = root.base_colours.length * root.final_colour.to-hsv().hue / 360;
|
||||||
}
|
}
|
||||||
c2.value = root.base_shade.length - (root.base_shade.length * root.final_colour.to-hsv().value);
|
// c1.value = root.base_colours.length * 360 / root.final_colour.to-hsv().hue;
|
||||||
|
c2.value = root.base_saturation.length - root.base_saturation.length * root.final_colour.to-hsv().saturation;
|
||||||
|
c3.value = root.base_value.length - root.base_value.length * root.final_colour.to-hsv().value;
|
||||||
root.set_base_colour();
|
root.set_base_colour();
|
||||||
|
hex = set_hex_from_colour(final_colour);
|
||||||
}
|
}
|
||||||
Rectangle {
|
Rectangle {
|
||||||
height: 32px;
|
height: 32px;
|
||||||
@@ -100,7 +114,7 @@ export component ColourSlider inherits VerticalLayout {
|
|||||||
width: parent.width;
|
width: parent.width;
|
||||||
height: parent.height;
|
height: parent.height;
|
||||||
minimum: 0;
|
minimum: 0;
|
||||||
maximum: root.base_colours.length - 1;
|
maximum: root.base_colours.length;
|
||||||
// One less than the array length
|
// One less than the array length
|
||||||
changed => {
|
changed => {
|
||||||
set_base_colour();
|
set_base_colour();
|
||||||
@@ -118,14 +132,38 @@ export component ColourSlider inherits VerticalLayout {
|
|||||||
border-radius: 7px;
|
border-radius: 7px;
|
||||||
border-color: Palette.border;
|
border-color: Palette.border;
|
||||||
// 11 colours
|
// 11 colours
|
||||||
background: !root.enabled ? Palette.alternate-background : @linear-gradient(90deg, base_shade[0], base_shade[1], base_shade[2], base_shade[3], base_shade[4], base_shade[5], base_shade[6], base_shade[7], base_shade[8], base_shade[9], base_shade[10]);
|
background: !root.enabled ? Palette.alternate-background : @linear-gradient(90deg, base_saturation[0], base_saturation[1], base_saturation[2], base_saturation[3], base_saturation[4], base_saturation[5], base_saturation[6], base_saturation[7], base_saturation[8], base_saturation[9], base_saturation[10]);
|
||||||
clip: true;
|
clip: true;
|
||||||
c2 := Slider {
|
c2 := Slider {
|
||||||
enabled <=> root.enabled;
|
enabled <=> root.enabled;
|
||||||
width: parent.width;
|
width: parent.width;
|
||||||
height: parent.height;
|
height: parent.height;
|
||||||
minimum: 0;
|
minimum: 0;
|
||||||
maximum: 11;
|
maximum: root.base_saturation.length;
|
||||||
|
changed => {
|
||||||
|
set_base_colour();
|
||||||
|
hex = set_hex_from_colour(final_colour);
|
||||||
|
}
|
||||||
|
released => {
|
||||||
|
root.released();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
height: 32px;
|
||||||
|
border-width: 2px;
|
||||||
|
border-radius: 7px;
|
||||||
|
border-color: Palette.border;
|
||||||
|
// 11 colours
|
||||||
|
background: !root.enabled ? Palette.alternate-background : @linear-gradient(90deg, base_value[0], base_value[1], base_value[2], base_value[3], base_value[4], base_value[5], base_value[6], base_value[7], base_value[8], base_value[9], base_value[10]);
|
||||||
|
clip: true;
|
||||||
|
c3 := Slider {
|
||||||
|
enabled <=> root.enabled;
|
||||||
|
width: parent.width;
|
||||||
|
height: parent.height;
|
||||||
|
minimum: 0;
|
||||||
|
maximum: root.base_value.length;
|
||||||
changed => {
|
changed => {
|
||||||
set_base_colour();
|
set_base_colour();
|
||||||
hex = set_hex_from_colour(final_colour);
|
hex = set_hex_from_colour(final_colour);
|
||||||
|
|||||||
Reference in New Issue
Block a user