diff --git a/Cargo.lock b/Cargo.lock index 5152989c..233af7a4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -506,18 +506,6 @@ dependencies = [ "cfg-if 1.0.0", ] -[[package]] -name = "logind-zbus" -version = "0.1.0" -dependencies = [ - "serde", - "serde_json", - "zbus", - "zbus_macros", - "zvariant", - "zvariant_derive", -] - [[package]] name = "mac-notification-sys" version = "0.3.0" diff --git a/Cargo.toml b/Cargo.toml index fd5f05aa..9462e627 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace] -members = ["asusctl", "asus-notify", "daemon", "rog-types", "rog-dbus", "logind-zbus"] +members = ["asusctl", "asus-notify", "daemon", "rog-types", "rog-dbus"] [profile.release] lto = true diff --git a/logind-zbus/Cargo.toml b/logind-zbus/Cargo.toml deleted file mode 100644 index cd42d75e..00000000 --- a/logind-zbus/Cargo.toml +++ /dev/null @@ -1,16 +0,0 @@ -[package] -name = "logind-zbus" -version = "0.1.0" -license = "MPL-2.0" -readme = "README.md" -authors = ["Luke D Jones "] -edition = "2018" -description = "A dbus client (using zbus) for logind" - -[dependencies] -serde = "^1.0" -serde_json = "^1.0" -zbus = "^1.8" -zbus_macros = "^1.8" -zvariant = "^2.5" -zvariant_derive = "^2.5" \ No newline at end of file diff --git a/logind-zbus/README.md b/logind-zbus/README.md deleted file mode 100644 index 6d3f6659..00000000 --- a/logind-zbus/README.md +++ /dev/null @@ -1 +0,0 @@ -WIP \ No newline at end of file diff --git a/logind-zbus/src/lib.rs b/logind-zbus/src/lib.rs deleted file mode 100644 index d4a62751..00000000 --- a/logind-zbus/src/lib.rs +++ /dev/null @@ -1,63 +0,0 @@ -//! Reference https://freedesktop.org/wiki/Software/systemd/logind/ -pub mod types; -pub mod proxy; - -use proxy::{logind, session}; -use zbus::{Connection, Result}; - -const DEFAULT_DEST: &str = "org.freedesktop.login1"; - -pub struct Logind<'a> { - connection: Connection, - logind_proxy: logind::ManagerProxy<'a>, -} - -impl<'a> Logind<'a> { - pub fn new() -> Result { - let connection = Connection::new_system()?; - let logind_proxy = logind::ManagerProxy::new(&connection)?; - Ok(Self { - connection, - logind_proxy, - }) - } - - pub fn logind(&self) -> &logind::ManagerProxy<'a> { - &self.logind_proxy - } - - pub fn session(&self, - path: &'a str) -> session::SessionProxy<'a> { - let session_proxy = session::SessionProxy::new_for(&self.connection, DEFAULT_DEST, path).unwrap(); - session_proxy - } -} - -#[cfg(test)] -mod tests { - use crate::Logind; - use crate::types::session::SessionType; - - #[test] - fn basic_test() { - let proxy = Logind::new().unwrap(); - - let sessions = proxy.logind().list_sessions().unwrap(); - dbg!(&sessions); - - let session_proxy = proxy.session(sessions[0].path()); - //let res = session_proxy.seat().unwrap(); - let res = session_proxy.name().unwrap(); - dbg!(res); - let res = session_proxy.class().unwrap(); - dbg!(res); - let res = session_proxy.type_().unwrap(); - let e:SessionType = res.as_str().into(); - dbg!(e); - dbg!(res); - let res = session_proxy.active().unwrap(); - dbg!(res); - - assert_eq!(2 + 2, 4); - } -} diff --git a/logind-zbus/src/proxy/logind.rs b/logind-zbus/src/proxy/logind.rs deleted file mode 100644 index f34bac0c..00000000 --- a/logind-zbus/src/proxy/logind.rs +++ /dev/null @@ -1,420 +0,0 @@ -//! # DBus interface proxy for: `org.freedesktop.login1.Manager` -//! -//! This code was generated by `zbus-xmlgen` `1.0.0` from DBus introspection data. -//! Source: `Interface '/org/freedesktop/login1' from service 'org.freedesktop.login1' on system bus`. -//! -//! You may prefer to adapt it, instead of using it verbatim. -//! -//! More information can be found in the -//! [Writing a client proxy](https://zeenix.pages.freedesktop.org/zbus/client.html) -//! section of the zbus documentation. -//! -//! This DBus object implements -//! [standard DBus interfaces](https://dbus.freedesktop.org/doc/dbus-specification.html), -//! (`org.freedesktop.DBus.*`) for which the following zbus proxies can be used: -//! -//! * [`zbus::fdo::PeerProxy`] -//! * [`zbus::fdo::IntrospectableProxy`] -//! * [`zbus::fdo::PropertiesProxy`] -//! -//! …consequently `zbus-xmlgen` did not generate code for the above interfaces. -//! -//! **NOTE!** -//! Commented out sections aren't required yet, and need work for deserialising - -use zbus::dbus_proxy; - -use crate::types::logind::{Seat, SessionInfo, User}; - -#[dbus_proxy(interface = "org.freedesktop.login1.Manager", - default_service = "org.freedesktop.login1", - default_path = "/org/freedesktop/login1")] -trait Manager { - /// ActivateSession method - fn activate_session(&self, session_id: &str) -> zbus::Result<()>; - - /// ActivateSessionOnSeat method - fn activate_session_on_seat(&self, session_id: &str, seat_id: &str) -> zbus::Result<()>; - - /// AttachDevice method - fn attach_device(&self, seat_id: &str, sysfs_path: &str, interactive: bool) - -> zbus::Result<()>; - - /// CanHalt method - fn can_halt(&self) -> zbus::Result; - - /// CanHibernate method - fn can_hibernate(&self) -> zbus::Result; - - /// CanHybridSleep method - fn can_hybrid_sleep(&self) -> zbus::Result; - - /// CanPowerOff method - fn can_power_off(&self) -> zbus::Result; - - /// CanReboot method - fn can_reboot(&self) -> zbus::Result; - - /// CanRebootParameter method - fn can_reboot_parameter(&self) -> zbus::Result; - - /// CanRebootToBootLoaderEntry method - fn can_reboot_to_boot_loader_entry(&self) -> zbus::Result; - - /// CanRebootToBootLoaderMenu method - fn can_reboot_to_boot_loader_menu(&self) -> zbus::Result; - - /// CanRebootToFirmwareSetup method - fn can_reboot_to_firmware_setup(&self) -> zbus::Result; - - /// CanSuspend method - fn can_suspend(&self) -> zbus::Result; - - /// CanSuspendThenHibernate method - fn can_suspend_then_hibernate(&self) -> zbus::Result; - - /// CancelScheduledShutdown method - fn cancel_scheduled_shutdown(&self) -> zbus::Result; - - // /// CreateSession method - // fn create_session( - // &self, - // uid: u32, - // pid: u32, - // service: &str, - // r#type: &str, - // class: &str, - // desktop: &str, - // seat_id: &str, - // vtnr: u32, - // tty: &str, - // display: &str, - // remote: bool, - // remote_user: &str, - // remote_host: &str, - // properties: &[(&str, zvariant::Value)], - // ) -> zbus::Result<( - // String, - // zvariant::OwnedObjectPath, - // String, - // std::os::unix::io::RawFd, - // u32, - // String, - // u32, - // bool, - // )>; - - /// FlushDevices method - fn flush_devices(&self, interactive: bool) -> zbus::Result<()>; - - /// GetSeat method - fn get_seat(&self, seat_id: &str) -> zbus::Result; - - /// GetSession method - fn get_session(&self, session_id: &str) -> zbus::Result; - - /// GetSessionByPID method - fn get_session_by_pid(&self, pid: u32) -> zbus::Result; - - /// GetUser method - fn get_user(&self, uid: u32) -> zbus::Result; - - /// GetUserByPID method - fn get_user_by_pid(&self, pid: u32) -> zbus::Result; - - /// Halt method - fn halt(&self, interactive: bool) -> zbus::Result<()>; - - /// Hibernate method - fn hibernate(&self, interactive: bool) -> zbus::Result<()>; - - /// HybridSleep method - fn hybrid_sleep(&self, interactive: bool) -> zbus::Result<()>; - - /// Inhibit method - fn inhibit( - &self, - what: &str, - who: &str, - why: &str, - mode: &str, - ) -> zbus::Result; - - /// KillSession method - fn kill_session(&self, session_id: &str, who: &str, signal_number: i32) -> zbus::Result<()>; - - /// KillUser method - fn kill_user(&self, uid: u32, signal_number: i32) -> zbus::Result<()>; - - /// ListInhibitors method - fn list_inhibitors(&self) -> zbus::Result>; - - /// ListSeats method - fn list_seats(&self) -> zbus::Result>; - - /// ListSessions method - fn list_sessions( - &self, - ) -> zbus::Result>; - - /// ListUsers method - fn list_users(&self) -> zbus::Result>; - - /// LockSession method - fn lock_session(&self, session_id: &str) -> zbus::Result<()>; - - /// LockSessions method - fn lock_sessions(&self) -> zbus::Result<()>; - - /// PowerOff method - fn power_off(&self, interactive: bool) -> zbus::Result<()>; - - /// Reboot method - fn reboot(&self, interactive: bool) -> zbus::Result<()>; - - /// ReleaseSession method - fn release_session(&self, session_id: &str) -> zbus::Result<()>; - - /// ScheduleShutdown method - fn schedule_shutdown(&self, r#type: &str, usec: u64) -> zbus::Result<()>; - - /// SetRebootParameter method - fn set_reboot_parameter(&self, parameter: &str) -> zbus::Result<()>; - - /// SetRebootToBootLoaderEntry method - fn set_reboot_to_boot_loader_entry(&self, boot_loader_entry: &str) -> zbus::Result<()>; - - /// SetRebootToBootLoaderMenu method - fn set_reboot_to_boot_loader_menu(&self, timeout: u64) -> zbus::Result<()>; - - /// SetRebootToFirmwareSetup method - fn set_reboot_to_firmware_setup(&self, enable: bool) -> zbus::Result<()>; - - /// SetUserLinger method - fn set_user_linger(&self, uid: u32, enable: bool, interactive: bool) -> zbus::Result<()>; - - /// SetWallMessage method - fn set_wall_message(&self, wall_message: &str, enable: bool) -> zbus::Result<()>; - - /// Suspend method - fn suspend(&self, interactive: bool) -> zbus::Result<()>; - - /// SuspendThenHibernate method - fn suspend_then_hibernate(&self, interactive: bool) -> zbus::Result<()>; - - /// TerminateSeat method - fn terminate_seat(&self, seat_id: &str) -> zbus::Result<()>; - - /// TerminateSession method - fn terminate_session(&self, session_id: &str) -> zbus::Result<()>; - - /// TerminateUser method - fn terminate_user(&self, uid: u32) -> zbus::Result<()>; - - /// UnlockSession method - fn unlock_session(&self, session_id: &str) -> zbus::Result<()>; - - /// UnlockSessions method - fn unlock_sessions(&self) -> zbus::Result<()>; - - /// PrepareForShutdown signal - #[dbus_proxy(signal)] - fn prepare_for_shutdown(&self, start: bool) -> zbus::Result<()>; - - /// PrepareForSleep signal - #[dbus_proxy(signal)] - fn prepare_for_sleep(&self, start: bool) -> zbus::Result<()>; - - // /// SeatNew signal - // #[dbus_proxy(signal)] - // fn seat_new(&self, seat_id: &str, object_path: &zvariant::ObjectPath) -> zbus::Result<()>; - - // /// SeatRemoved signal - // #[dbus_proxy(signal)] - // fn seat_removed(&self, seat_id: &str, object_path: &zvariant::ObjectPath) -> zbus::Result<()>; - - // /// SessionNew signal - // #[dbus_proxy(signal)] - // fn session_new(&self, session_id: &str, object_path: &zvariant::ObjectPath) - // -> zbus::Result<()>; - - // /// SessionRemoved signal - // #[dbus_proxy(signal)] - // fn session_removed( - // &self, - // session_id: &str, - // object_path: &zvariant::ObjectPath, - // ) -> zbus::Result<()>; - - // /// UserNew signal - // #[dbus_proxy(signal)] - // fn user_new(&self, uid: u32, object_path: &zvariant::ObjectPath) -> zbus::Result<()>; - - // /// UserRemoved signal - // #[dbus_proxy(signal)] - // fn user_removed(&self, uid: u32, object_path: &zvariant::ObjectPath) -> zbus::Result<()>; - - /// BlockInhibited property - #[dbus_proxy(property)] - fn block_inhibited(&self) -> zbus::Result; - - /// BootLoaderEntries property - #[dbus_proxy(property)] - fn boot_loader_entries(&self) -> zbus::Result>; - - /// DelayInhibited property - #[dbus_proxy(property)] - fn delay_inhibited(&self) -> zbus::Result; - - /// Docked property - #[dbus_proxy(property)] - fn docked(&self) -> zbus::Result; - - /// EnableWallMessages property - #[dbus_proxy(property)] - fn enable_wall_messages(&self) -> zbus::Result; - #[DBusProxy(property)] - fn set_enable_wall_messages(&self, value: bool) -> zbus::Result<()>; - - /// HandleHibernateKey property - #[dbus_proxy(property)] - fn handle_hibernate_key(&self) -> zbus::Result; - - /// HandleLidSwitch property - #[dbus_proxy(property)] - fn handle_lid_switch(&self) -> zbus::Result; - - /// HandleLidSwitchDocked property - #[dbus_proxy(property)] - fn handle_lid_switch_docked(&self) -> zbus::Result; - - /// HandleLidSwitchExternalPower property - #[dbus_proxy(property)] - fn handle_lid_switch_external_power(&self) -> zbus::Result; - - /// HandlePowerKey property - #[dbus_proxy(property)] - fn handle_power_key(&self) -> zbus::Result; - - /// HandleSuspendKey property - #[dbus_proxy(property)] - fn handle_suspend_key(&self) -> zbus::Result; - - /// HoldoffTimeoutUSec property - #[dbus_proxy(property)] - fn holdoff_timeout_usec(&self) -> zbus::Result; - - /// IdleAction property - #[dbus_proxy(property)] - fn idle_action(&self) -> zbus::Result; - - /// IdleActionUSec property - #[dbus_proxy(property)] - fn idle_action_usec(&self) -> zbus::Result; - - /// IdleHint property - #[dbus_proxy(property)] - fn idle_hint(&self) -> zbus::Result; - - /// IdleSinceHint property - #[dbus_proxy(property)] - fn idle_since_hint(&self) -> zbus::Result; - - /// IdleSinceHintMonotonic property - #[dbus_proxy(property)] - fn idle_since_hint_monotonic(&self) -> zbus::Result; - - /// InhibitDelayMaxUSec property - #[dbus_proxy(property)] - fn inhibit_delay_max_usec(&self) -> zbus::Result; - - /// InhibitorsMax property - #[dbus_proxy(property)] - fn inhibitors_max(&self) -> zbus::Result; - - /// KillExcludeUsers property - #[dbus_proxy(property)] - fn kill_exclude_users(&self) -> zbus::Result>; - - /// KillOnlyUsers property - #[dbus_proxy(property)] - fn kill_only_users(&self) -> zbus::Result>; - - /// KillUserProcesses property - #[dbus_proxy(property)] - fn kill_user_processes(&self) -> zbus::Result; - - /// LidClosed property - #[dbus_proxy(property)] - fn lid_closed(&self) -> zbus::Result; - - /// NAutoVTs property - #[dbus_proxy(property)] - fn nauto_vts(&self) -> zbus::Result; - - /// NCurrentInhibitors property - #[dbus_proxy(property)] - fn ncurrent_inhibitors(&self) -> zbus::Result; - - /// NCurrentSessions property - #[dbus_proxy(property)] - fn ncurrent_sessions(&self) -> zbus::Result; - - /// OnExternalPower property - #[dbus_proxy(property)] - fn on_external_power(&self) -> zbus::Result; - - /// PreparingForShutdown property - #[dbus_proxy(property)] - fn preparing_for_shutdown(&self) -> zbus::Result; - - /// PreparingForSleep property - #[dbus_proxy(property)] - fn preparing_for_sleep(&self) -> zbus::Result; - - /// RebootParameter property - #[dbus_proxy(property)] - fn reboot_parameter(&self) -> zbus::Result; - - /// RebootToBootLoaderEntry property - #[dbus_proxy(property)] - fn reboot_to_boot_loader_entry(&self) -> zbus::Result; - - /// RebootToBootLoaderMenu property - #[dbus_proxy(property)] - fn reboot_to_boot_loader_menu(&self) -> zbus::Result; - - /// RebootToFirmwareSetup property - #[dbus_proxy(property)] - fn reboot_to_firmware_setup(&self) -> zbus::Result; - - /// RemoveIPC property - #[dbus_proxy(property)] - fn remove_ipc(&self) -> zbus::Result; - - /// RuntimeDirectoryInodesMax property - #[dbus_proxy(property)] - fn runtime_directory_inodes_max(&self) -> zbus::Result; - - /// RuntimeDirectorySize property - #[dbus_proxy(property)] - fn runtime_directory_size(&self) -> zbus::Result; - - // /// ScheduledShutdown property - // #[dbus_proxy(property)] - // fn scheduled_shutdown(&self) -> zbus::Result<(String, u64)>; - - /// SessionsMax property - #[dbus_proxy(property)] - fn sessions_max(&self) -> zbus::Result; - - /// UserStopDelayUSec property - #[dbus_proxy(property)] - fn user_stop_delay_usec(&self) -> zbus::Result; - - /// WallMessage property - #[dbus_proxy(property)] - fn wall_message(&self) -> zbus::Result; - // #[DBusProxy(property)] - // fn set_wall_message(&self, value: &str) -> zbus::Result<()>; -} diff --git a/logind-zbus/src/proxy/mod.rs b/logind-zbus/src/proxy/mod.rs deleted file mode 100644 index fb1b4de3..00000000 --- a/logind-zbus/src/proxy/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod logind; -pub mod session; \ No newline at end of file diff --git a/logind-zbus/src/proxy/session.rs b/logind-zbus/src/proxy/session.rs deleted file mode 100644 index b01137cf..00000000 --- a/logind-zbus/src/proxy/session.rs +++ /dev/null @@ -1,190 +0,0 @@ -//! # DBus interface proxy for: `org.freedesktop.login1.Session` -//! -//! This code was generated by `zbus-xmlgen` `1.0.0` from DBus introspection data. -//! Source: `Interface '/org/freedesktop/login1/session/_36' from service 'org.freedesktop.login1' on system bus`. -//! -//! You may prefer to adapt it, instead of using it verbatim. -//! -//! More information can be found in the -//! [Writing a client proxy](https://dbus.pages.freedesktop.org/zbus/client.html) -//! section of the zbus documentation. -//! -//! This DBus object implements -//! [standard DBus interfaces](https://dbus.freedesktop.org/doc/dbus-specification.html), -//! (`org.freedesktop.DBus.*`) for which the following zbus proxies can be used: -//! -//! * [`zbus::fdo::PeerProxy`] -//! * [`zbus::fdo::IntrospectableProxy`] -//! * [`zbus::fdo::PropertiesProxy`] -//! -//! …consequently `zbus-xmlgen` did not generate code for the above interfaces. - -use zbus::dbus_proxy; - -#[dbus_proxy(interface = "org.freedesktop.login1.Session", - default_service = "org.freedesktop.login1",)] -trait Session { - /// Activate method - fn activate(&self) -> zbus::Result<()>; - - /// Kill method - fn kill(&self, who: &str, signal_number: i32) -> zbus::Result<()>; - - /// Lock method - fn lock(&self) -> zbus::Result<()>; - - /// PauseDeviceComplete method - fn pause_device_complete(&self, major: u32, minor: u32) -> zbus::Result<()>; - - /// ReleaseControl method - fn release_control(&self) -> zbus::Result<()>; - - /// ReleaseDevice method - fn release_device(&self, major: u32, minor: u32) -> zbus::Result<()>; - - /// SetBrightness method - fn set_brightness(&self, subsystem: &str, name: &str, brightness: u32) -> zbus::Result<()>; - - /// SetIdleHint method - fn set_idle_hint(&self, idle: bool) -> zbus::Result<()>; - - /// SetLockedHint method - fn set_locked_hint(&self, locked: bool) -> zbus::Result<()>; - - /// SetType method - fn set_type(&self, type_: &str) -> zbus::Result<()>; - - /// TakeControl method - fn take_control(&self, force: bool) -> zbus::Result<()>; - - /// TakeDevice method - fn take_device(&self, major: u32, minor: u32) - -> zbus::Result<(std::os::unix::io::RawFd, bool)>; - - /// Terminate method - fn terminate(&self) -> zbus::Result<()>; - - /// Unlock method - fn unlock(&self) -> zbus::Result<()>; - - /// Lock signal - #[dbus_proxy(signal)] - fn lock(&self) -> zbus::Result<()>; - - /// PauseDevice signal - #[dbus_proxy(signal)] - fn pause_device(&self, major: u32, minor: u32, type_: &str) -> zbus::Result<()>; - - /// ResumeDevice signal - #[dbus_proxy(signal)] - fn resume_device( - &self, - major: u32, - minor: u32, - fd: std::os::unix::io::RawFd, - ) -> zbus::Result<()>; - - /// Unlock signal - #[dbus_proxy(signal)] - fn unlock(&self) -> zbus::Result<()>; - - /// Active property - #[dbus_proxy(property)] - fn active(&self) -> zbus::Result; - - /// Audit property - #[dbus_proxy(property)] - fn audit(&self) -> zbus::Result; - - /// Class property - #[dbus_proxy(property)] - fn class(&self) -> zbus::Result; - - /// Desktop property - #[dbus_proxy(property)] - fn desktop(&self) -> zbus::Result; - - /// Display property - #[dbus_proxy(property)] - fn display(&self) -> zbus::Result; - - /// Id property - #[dbus_proxy(property)] - fn id(&self) -> zbus::Result; - - /// IdleHint property - #[dbus_proxy(property)] - fn idle_hint(&self) -> zbus::Result; - - /// IdleSinceHint property - #[dbus_proxy(property)] - fn idle_since_hint(&self) -> zbus::Result; - - /// IdleSinceHintMonotonic property - #[dbus_proxy(property)] - fn idle_since_hint_monotonic(&self) -> zbus::Result; - - /// Leader property - #[dbus_proxy(property)] - fn leader(&self) -> zbus::Result; - - /// LockedHint property - #[dbus_proxy(property)] - fn locked_hint(&self) -> zbus::Result; - - /// Name property - #[dbus_proxy(property)] - fn name(&self) -> zbus::Result; - - /// Remote property - #[dbus_proxy(property)] - fn remote(&self) -> zbus::Result; - - /// RemoteHost property - #[dbus_proxy(property)] - fn remote_host(&self) -> zbus::Result; - - /// RemoteUser property - #[dbus_proxy(property)] - fn remote_user(&self) -> zbus::Result; - - /// Scope property - #[dbus_proxy(property)] - fn scope(&self) -> zbus::Result; - - // /// Seat property - // #[dbus_proxy(property)] - // fn seat(&self) -> zbus::Result; - - /// Service property - #[dbus_proxy(property)] - fn service(&self) -> zbus::Result; - - /// State property - #[dbus_proxy(property)] - fn state(&self) -> zbus::Result; - - /// TTY property - #[dbus_proxy(property)] - fn tty(&self) -> zbus::Result; - - /// Timestamp property - #[dbus_proxy(property)] - fn timestamp(&self) -> zbus::Result; - - /// TimestampMonotonic property - #[dbus_proxy(property)] - fn timestamp_monotonic(&self) -> zbus::Result; - - /// Type property - #[dbus_proxy(property)] - fn type_(&self) -> zbus::Result; - - // /// User property - // #[dbus_proxy(property)] - // fn user(&self) -> zbus::Result<(u32, zvariant::OwnedObjectPath)>; - - /// VTNr property - #[dbus_proxy(property)] - fn vtnr(&self) -> zbus::Result; -} diff --git a/logind-zbus/src/types/logind.rs b/logind-zbus/src/types/logind.rs deleted file mode 100644 index 773df6fe..00000000 --- a/logind-zbus/src/types/logind.rs +++ /dev/null @@ -1,77 +0,0 @@ -use serde::{Deserialize, Serialize}; - -use zvariant_derive::Type; -use zvariant::OwnedObjectPath; - -#[derive(Debug, Type, Serialize, Deserialize)] -pub struct SessionInfo { - /// Session ID - sid: String, - /// User ID - uid: u32, - /// Name of session user - user: String, - seat: String, - path: OwnedObjectPath, -} - -impl SessionInfo { - pub fn sid(&self) -> &str { - &self.sid - } - - pub fn uid(&self) -> u32 { - self.uid - } - - pub fn user(&self) -> &str { - &self.user - } - - pub fn seat(&self) -> &str { - &self.seat - } - - pub fn path(&self) -> &OwnedObjectPath { - &self.path - } -} - -#[derive(Debug, Type, Serialize, Deserialize)] -pub struct Seat { - id: String, - /// Name of session user - path: OwnedObjectPath, -} - -impl Seat { - pub fn id(&self) -> &str { - &self.id - } - - pub fn path(&self) -> &OwnedObjectPath { - &self.path - } -} - -#[derive(Debug, Type, Serialize, Deserialize)] -pub struct User { - uid: u32, - name: String, - /// Name of session user - path: OwnedObjectPath, -} - -impl User { - pub fn uid(&self) -> u32 { - self.uid - } - - pub fn name(&self) -> &str { - &self.name - } - - pub fn path(&self) -> &OwnedObjectPath { - &self.path - } -} \ No newline at end of file diff --git a/logind-zbus/src/types/mod.rs b/logind-zbus/src/types/mod.rs deleted file mode 100644 index 064cd81a..00000000 --- a/logind-zbus/src/types/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod logind; -pub mod session; diff --git a/logind-zbus/src/types/session.rs b/logind-zbus/src/types/session.rs deleted file mode 100644 index 3a6f5876..00000000 --- a/logind-zbus/src/types/session.rs +++ /dev/null @@ -1,24 +0,0 @@ -#[derive(Debug, PartialEq)] -pub enum SessionType { - X11, - Wayland, - TTY, - Other(String), -} - -impl From for SessionType { - fn from(s: String) -> Self { - ::from(s.as_str()) - } -} - -impl From<&str> for SessionType { - fn from(s: &str) -> Self { - match s { - "wayland" => SessionType::Wayland, - "x11" => SessionType::X11, - "tty" => SessionType::TTY, - _ => SessionType::Other(s.to_owned()), - } - } -} \ No newline at end of file