Struct logind_zbus::SessionInterface[][src]

pub struct SessionInterface<'a> { /* fields omitted */ }

Proxy wrapper for the logind Session dbus interface

All get_* methods are property getters

Example

use logind_zbus::ManagerInterface;
use logind_zbus::SessionInterface;
use zbus::Connection;

let connection = Connection::new_system().unwrap();
let manager = ManagerInterface::new(&connection).unwrap();
let sessions = manager.list_sessions().unwrap();
let session = SessionInterface::new(&connection, &sessions[0]).unwrap();

let time1 = session.get_timestamp().unwrap();
assert!(time1.as_secs() > 0);

let time2 = session.get_timestamp_monotonic().unwrap();
assert!(time2.as_secs() > 0);

Notes

All connect_* functions are signals and each of these functions names reflect the underlying generated Proxy call. If desired the wrapped function can be bypassed with:

<SessionInterface>.get_proxy().connect_<function name>()

Implementations

impl<'a> SessionInterface<'a>[src]

pub fn new(connection: &Connection, session: &'a SessionInfo) -> Result<Self>[src]

pub fn get_proxy(&self) -> &SessionProxy<'_>[src]

Borrow the underlying SessionProxy for use with zbus directly

pub fn activate(&self) -> Result<()>[src]

Bring session to foreground

pub fn kill(&self, who: UserInfo, signal: i32) -> Result<()>[src]

Send a signal to all processes of the user

pub fn lock(&self) -> Result<()>[src]

Ask session to activate its screen lock

pub fn pause_device_complete(&self, major: u32, minor: u32) -> Result<()>[src]

Allows a session controller to synchronously pause a device after receiving a PauseDevice(“pause”) signal

pub fn release_control(&self) -> Result<()>[src]

Drops control of a given session. Closing the D-Bus connection implicitly releases control as well. This method also releases all devices for which the controller requested

pub fn release_device(&self, major: u32, minor: u32) -> Result<()>[src]

Release a device (after TakeDevice). This is also implicitly done by release_control() or when closing the D-Bus connection.

pub fn set_brightness(
    &self,
    subsystem: &str,
    name: &str,
    brightness: u32
) -> Result<()>
[src]

Used to set the display brightness. This is intended to be used by the desktop environment and allows unprivileged programs to access hardware settings in a controlled way.

pub fn set_idle_hint(&self, idle: bool) -> Result<()>[src]

SetIdleHint() is called by the session object to update the idle state of the session whenever it changes

pub fn set_locked_hint(&self, locked: bool) -> Result<()>[src]

pub fn set_type(&self, type_: &str) -> Result<()>[src]

Allows the type of the session to be changed dynamically. It can only be called by session’s current controller. If take_control() has not been called, this method will fail. In addition, the session type will be reset to its original value once control is released, either by calling release_control() or closing the D-Bus connection.

pub fn take_control(&self, force: bool) -> Result<()>[src]

Allows a process to take exclusive managed device access-control for that session

pub fn take_device(&self, major: u32, minor: u32) -> Result<Device>[src]

Get a file descriptor for a specific device. Pass in the major and minor numbers of the character device and systemd-logind will return a file descriptor for the device.

pub fn terminate(&self) -> Result<()>[src]

Forcibly terminate this session

pub fn unlock(&self) -> Result<()>[src]

Ask this session to deactivate its lock screen

pub fn get_active(&self) -> Result<bool>[src]

Property: Is session is active, i.e. currently in the foreground. This field is semi-redundant due to State (get_state()).

pub fn get_audit(&self) -> Result<u32>[src]

Property: the Kernel Audit session ID of the session if auditing is available.

pub fn get_class(&self) -> Result<SessionClass>[src]

Property: The class of Session

pub fn get_desktop(&self) -> Result<String>[src]

Property: Describes the desktop environment running in the session (if known)

pub fn get_display(&self) -> Result<String>[src]

The X11 display name if this is a graphical login. If not, this is an empty string.

pub fn get_id(&self) -> Result<String>[src]

Property: Session ID

pub fn get_is_idle_hint(&self) -> Result<bool>[src]

pub fn get_is_idle_since_hint(&self) -> Result<u64>[src]

pub fn get_is_idle_since_hint_monotonic(&self) -> Result<u64>[src]

pub fn get_leader(&self) -> Result<u32>[src]

Property: PID of the process that registered the session

pub fn get_locked_hint(&self) -> Result<bool>[src]

Property: shows the locked hint state of this session

pub fn get_name(&self) -> Result<String>[src]

Property: The User name

pub fn get_is_remote(&self) -> Result<bool>[src]

Property: local or remote

pub fn get_remote_host(&self) -> Result<Option<String>>[src]

Property: None if not remote

pub fn get_remote_user(&self) -> Result<Option<String>>[src]

Property: None if not remote

pub fn get_scope(&self) -> Result<String>[src]

Property: systemd scope unit name of this session

pub fn get_seat(&self) -> Result<DbusPath>[src]

Property: seat this session belongs to if there is any

pub fn get_service(&self) -> Result<String>[src]

Property: PAM service name that registered the session

pub fn get_state(&self) -> Result<SessionState>[src]

Property: State of the session

pub fn get_tty(&self) -> Result<Option<String>>[src]

Property: kernel TTY path of the session if this is a text login. If not this None.

pub fn get_timestamp(&self) -> Result<Duration>[src]

Property: Get time since session was created (realtime)

pub fn get_timestamp_monotonic(&self) -> Result<Duration>[src]

Property: Get time since session was created (wal time)

pub fn get_type(&self) -> Result<SessionType>[src]

Property: Session type

pub fn get_user(&self) -> Result<UserSelf>[src]

Property: User the session belongs to

pub fn get_vtnr(&self) -> Result<u32>[src]

Property: Virtual terminal number of the session if there is any, 0 otherwise.

pub fn connect_lock<C>(&self, callback: C) -> Result<SignalHandlerId> where
    C: FnMut() -> Result<(), Error> + Send + 'static, 
[src]

pub fn connect_pause_device<C>(&self, callback: C) -> Result<SignalHandlerId> where
    C: FnMut(u32, u32, &str) -> Result<(), Error> + Send + 'static, 
[src]

pub fn connect_resume_device<C>(&self, callback: C) -> Result<SignalHandlerId> where
    C: FnMut(u32, u32, i32) -> Result<(), Error> + Send + 'static, 
[src]

pub fn connect_unlock<C>(&self, callback: C) -> Result<SignalHandlerId> where
    C: FnMut() -> Result<(), Error> + Send + 'static, 
[src]

Auto Trait Implementations

impl<'a> !RefUnwindSafe for SessionInterface<'a>

impl<'a> Send for SessionInterface<'a>

impl<'a> Sync for SessionInterface<'a>

impl<'a> Unpin for SessionInterface<'a>

impl<'a> !UnwindSafe for SessionInterface<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,