Module smithay::backend::session::direct [−][src]
Expand description
Implementation of the Session
trait through the legacy vt kernel interface.
This requires write permissions for the given tty device and any devices opened through this interface. This means it will almost certainly require root permissions and not allow to run the compositor as an unprivileged user. Use this session type only as a fallback or for testing, if anything better is available.
How to use it
Initialization
To initialize the session you may pass the path to any tty device, that shall be used. If no path is given the tty used to start this compositor (if any) will be used unless the SMITHAY_DIRECT_TTY_ENV environment variable is set. A new session and its notifier will be returned.
extern crate smithay; use smithay::backend::session::direct::DirectSession; let (session, mut notifier) = DirectSession::new(None, None).unwrap();
Usage of the session
The session may be used to open devices manually through the Session
interface
or be passed to other objects that need it to open devices themselves.
Examples for those are e.g. the LibinputInputBackend
(its context might be initialized through a Session
via the LibinputSessionInterface
).
In case you want to pass the same Session
to multiple objects, Session
is implement for
every Rc<RefCell<Session>>
or Arc<Mutex<Session>>
.
Usage of the session notifier
The notifier might be used to pause device access, when the session gets paused (e.g. by
switching the tty via DirectSession::change_vt
)
and to automatically enable it again, when the session becomes active again.
It is crucial to avoid errors during that state. Examples for object that might be registered
for notifications are the Libinput
context or the DrmDevice
.
The DirectSessionNotifier
is to be inserted into
a calloop event source to have its events processed.
Structs
Session
via the virtual terminal direct kernel interface
Notifier of the virtual terminal direct kernel interface
Ids of registered observers of the DirectSessionNotifier
Enums
Errors related to direct/tty sessions
Constants
This environment variable can be used to specify a tty path that will be used in DirectSession::new in case no explicit tty path has been provided.