Well it uh, mostly works.

This commit is contained in:
Lucy 2022-02-15 17:41:01 -05:00
parent 29f0bbf0f6
commit 5af3abeb93
No known key found for this signature in database
GPG key ID: EBC517FAD666BBF1
5 changed files with 77 additions and 15 deletions

View file

@ -2,10 +2,11 @@
use crate::dbus::PowerDaemonProxy;
use zbus::Result;
#[derive(PartialEq, Eq)]
pub enum Graphics {
Integrated,
Hybrid,
External,
Nvidia,
Compute,
}
@ -14,7 +15,7 @@ pub async fn get_current_graphics(daemon: &PowerDaemonProxy<'_>) -> Result<Graph
match graphics.as_str() {
"integrated" => Ok(Graphics::Integrated),
"hybrid" => Ok(Graphics::Hybrid),
"external" => Ok(Graphics::External),
"nvidia" => Ok(Graphics::Nvidia),
"compute" => Ok(Graphics::Compute),
_ => panic!("Unknown graphics profile: {}", graphics),
}
@ -25,7 +26,7 @@ pub async fn get_default_graphics(daemon: &PowerDaemonProxy<'_>) -> Result<Graph
match graphics.as_str() {
"integrated" => Ok(Graphics::Integrated),
"hybrid" => Ok(Graphics::Hybrid),
"external" => Ok(Graphics::External),
"nvidia" => Ok(Graphics::Nvidia),
"compute" => Ok(Graphics::Compute),
_ => panic!("Unknown graphics profile: {}", graphics),
}
@ -35,7 +36,7 @@ pub async fn set_graphics(daemon: &PowerDaemonProxy<'_>, graphics: Graphics) ->
let graphics_str = match graphics {
Graphics::Integrated => "integrated",
Graphics::Hybrid => "hybrid",
Graphics::External => "external",
Graphics::Nvidia => "nvidia",
Graphics::Compute => "compute",
};
daemon.set_graphics(graphics_str).await