1
0
Fork 0
forked from wry/wry

config: add various new functions

This commit is contained in:
Julian Orth 2024-03-13 19:29:33 +01:00
parent f1a3705699
commit e24a61bc62
12 changed files with 435 additions and 28 deletions

View file

@ -42,7 +42,10 @@
use {
crate::keyboard::ModifiedKeySym,
serde::{Deserialize, Serialize},
std::fmt::{Debug, Display, Formatter},
std::{
fmt::{Debug, Display, Formatter},
time::Duration,
},
};
#[macro_use]
@ -195,3 +198,20 @@ pub fn on_idle<F: FnMut() + 'static>(f: F) {
pub fn on_devices_enumerated<F: FnOnce() + 'static>(f: F) {
get!().on_devices_enumerated(f)
}
/// Returns the Jay config directory.
pub fn config_dir() -> String {
get!().config_dir()
}
/// Returns all visible workspaces.
pub fn workspaces() -> Vec<Workspace> {
get!().workspaces()
}
/// Configures the idle timeout.
///
/// `None` disables the timeout.
pub fn set_idle(timeout: Option<Duration>) {
get!().set_idle(timeout.unwrap_or_default())
}