This commit is contained in:
jmb05
2026-10-28 01:13:43 +01:00
parent 1be6e51d02
commit 7ff311b441
3 changed files with 21 additions and 25 deletions

View File

@@ -180,7 +180,7 @@ impl BackendThread<BrightnessMessage, Sender<BrightnessMessage>> for BrightnessM
let mut last = manager
.display_cache
.get(&id)
.and_then(|d| Some(d.value))
.map(|d| d.value)
.unwrap_or(60);
let mut revert_flag = false;
for operation in operations {

View File

@@ -17,7 +17,6 @@ use wayland_protocols::ext::idle_notify::v1::client::ext_idle_notification_v1::{
Event, ExtIdleNotificationV1,
};
use wayland_protocols::ext::idle_notify::v1::client::ext_idle_notifier_v1::ExtIdleNotifierV1;
use zbus;
use zbus::conn::Builder;
use zbus::message::Header;
@@ -70,14 +69,11 @@ impl Dispatch<ExtIdleNotifierV1, (), WlState> for WlState {
fn event(
_: &mut WlState,
_: &ExtIdleNotifierV1,
event: <ExtIdleNotifierV1 as wayland_client::Proxy>::Event,
_: <ExtIdleNotifierV1 as wayland_client::Proxy>::Event,
_: &(),
_: &Connection,
_: &QueueHandle<WlState>,
) {
match event {
_ => {}
}
}
}
@@ -85,7 +81,7 @@ impl Dispatch<ExtIdleNotifierV1, (), WlState> for WlState {
struct Inhibitor {
owner: String,
application: String,
reason: String,
_reason: String,
}
#[derive(Clone, Copy, Debug)]
@@ -102,20 +98,6 @@ impl IdleStateInner {
}
}
impl Into<IdleState> for IdleStateInner {
fn into(self) -> IdleState {
if self.should_dim() {
IdleState::Dimmed
} else if self.caffeine {
IdleState::Caffeine
} else if self.dbus_inhibited {
IdleState::Inhibited
} else {
IdleState::Active
}
}
}
#[derive(Debug, Clone)]
pub enum IdleState {
Init(Sender<IdleMessage>),
@@ -125,6 +107,20 @@ pub enum IdleState {
Active,
}
impl From<IdleStateInner> for IdleState {
fn from(value: IdleStateInner) -> Self {
if value.should_dim() {
IdleState::Dimmed
} else if value.caffeine {
IdleState::Caffeine
} else if value.dbus_inhibited {
IdleState::Inhibited
} else {
IdleState::Active
}
}
}
#[derive(Debug, Clone)]
pub enum IdleMessage {
Inhibit,
@@ -404,7 +400,7 @@ impl ScreenSaver {
Inhibitor {
owner,
application: application_name,
reason: reason_for_inhibit,
_reason: reason_for_inhibit,
},
);

View File

@@ -27,7 +27,7 @@ pub enum State {
}
impl State {
fn try_from_value(value: i64) -> Option<State> {
fn _try_from_value(value: i64) -> Option<State> {
match value {
5 => Some(State::Connecting),
6 => Some(State::Connected),
@@ -37,7 +37,7 @@ impl State {
}
impl JsonSocketBackend {
async fn watch(instance: Arc<Mutex<Self>>) -> Result<(), Box<dyn Error + Send + Sync>> {
async fn _watch(instance: Arc<Mutex<Self>>) -> Result<(), Box<dyn Error + Send + Sync>> {
let socket_address = instance
.lock()
.expect("Couldn't get lock")
@@ -89,7 +89,7 @@ impl JsonSocketBackend {
if let Some(state) = notification.get("State")
&& !state.is_null()
{
let state = State::try_from_value(state.as_i64().unwrap_or(4))
let state = State::_try_from_value(state.as_i64().unwrap_or(4))
.unwrap_or(State::Disconnected);
instance.lock().expect("Couldn't get lock").publish(state);
}