idle: add a grace period
This commit is contained in:
parent
1ad3d11616
commit
e8be15a26c
29 changed files with 405 additions and 79 deletions
|
|
@ -893,6 +893,10 @@ impl Client {
|
|||
self.send(&ClientMessage::SetIdle { timeout })
|
||||
}
|
||||
|
||||
pub fn set_idle_grace_period(&self, period: Duration) {
|
||||
self.send(&ClientMessage::SetIdleGracePeriod { period })
|
||||
}
|
||||
|
||||
pub fn set_explicit_sync_enabled(&self, enabled: bool) {
|
||||
self.send(&ClientMessage::SetExplicitSyncEnabled { enabled })
|
||||
}
|
||||
|
|
|
|||
|
|
@ -527,6 +527,9 @@ pub enum ClientMessage<'a> {
|
|||
SetXScalingMode {
|
||||
mode: XScalingMode,
|
||||
},
|
||||
SetIdleGracePeriod {
|
||||
period: Duration,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
|
|
|
|||
|
|
@ -224,10 +224,24 @@ pub fn workspaces() -> Vec<Workspace> {
|
|||
/// Configures the idle timeout.
|
||||
///
|
||||
/// `None` disables the timeout.
|
||||
///
|
||||
/// The default is 10 minutes.
|
||||
pub fn set_idle(timeout: Option<Duration>) {
|
||||
get!().set_idle(timeout.unwrap_or_default())
|
||||
}
|
||||
|
||||
/// Configures the idle grace period.
|
||||
///
|
||||
/// The grace period starts after the idle timeout expires. During the grace period, the
|
||||
/// screen goes black but the displays are not yet disabled and the idle callback (set
|
||||
/// with [`on_idle`]) is not yet called. This is a purely visual effect to inform the user
|
||||
/// that the machine will soon go idle.
|
||||
///
|
||||
/// The default is 5 seconds.
|
||||
pub fn set_idle_grace_period(timeout: Duration) {
|
||||
get!().set_idle_grace_period(timeout)
|
||||
}
|
||||
|
||||
/// Enables or disables explicit sync.
|
||||
///
|
||||
/// Calling this after the compositor has started has no effect.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue