saddle 0.1.2

Async seat managment made easy
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
//! # D-Bus interface proxy for: `org.freedesktop.login1.Manager`
use zbus::proxy;
#[proxy(
    interface = "org.freedesktop.login1.Manager",
    gen_blocking = false,
    default_service = "org.freedesktop.login1",
    default_path = "/org/freedesktop/login1"
)]
pub 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<String>;

    /// CanHibernate method
    fn can_hibernate(&self) -> zbus::Result<String>;

    /// CanHybridSleep method
    fn can_hybrid_sleep(&self) -> zbus::Result<String>;

    /// CanPowerOff method
    fn can_power_off(&self) -> zbus::Result<String>;

    /// CanReboot method
    fn can_reboot(&self) -> zbus::Result<String>;

    /// CanRebootParameter method
    fn can_reboot_parameter(&self) -> zbus::Result<String>;

    /// CanRebootToBootLoaderEntry method
    fn can_reboot_to_boot_loader_entry(&self) -> zbus::Result<String>;

    /// CanRebootToBootLoaderMenu method
    fn can_reboot_to_boot_loader_menu(&self) -> zbus::Result<String>;

    /// CanRebootToFirmwareSetup method
    fn can_reboot_to_firmware_setup(&self) -> zbus::Result<String>;

    /// CanSleep method
    fn can_sleep(&self) -> zbus::Result<String>;

    /// CanSuspend method
    fn can_suspend(&self) -> zbus::Result<String>;

    /// CanSuspendThenHibernate method
    fn can_suspend_then_hibernate(&self) -> zbus::Result<String>;

    /// CancelScheduledShutdown method
    fn cancel_scheduled_shutdown(&self) -> zbus::Result<bool>;

    /// CreateSession method
    #[allow(clippy::too_many_arguments)]
    fn create_session(
        &self,
        uid: u32,
        pid: u32,
        service: &str,
        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, &zbus::zvariant::Value<'_>)],
    ) -> zbus::Result<(
        String,
        zbus::zvariant::OwnedObjectPath,
        String,
        zbus::zvariant::OwnedFd,
        u32,
        String,
        u32,
        bool,
    )>;

    /// CreateSessionWithPIDFD method
    #[zbus(name = "CreateSessionWithPIDFD")]
    #[allow(clippy::too_many_arguments)]
    fn create_session_with_pidfd(
        &self,
        uid: u32,
        pidfd: zbus::zvariant::Fd<'_>,
        service: &str,
        type_: &str,
        class: &str,
        desktop: &str,
        seat_id: &str,
        vtnr: u32,
        tty: &str,
        display: &str,
        remote: bool,
        remote_user: &str,
        remote_host: &str,
        flags: u64,
        properties: &[&(&str, &zbus::zvariant::Value<'_>)],
    ) -> zbus::Result<(
        String,
        zbus::zvariant::OwnedObjectPath,
        String,
        zbus::zvariant::OwnedFd,
        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<zbus::zvariant::OwnedObjectPath>;

    /// GetSession method
    fn get_session(&self, session_id: &str) -> zbus::Result<zbus::zvariant::OwnedObjectPath>;

    /// GetSessionByPID method
    #[zbus(name = "GetSessionByPID")]
    fn get_session_by_pid(&self, pid: u32) -> zbus::Result<zbus::zvariant::OwnedObjectPath>;

    /// GetUser method
    fn get_user(&self, uid: u32) -> zbus::Result<zbus::zvariant::OwnedObjectPath>;

    /// GetUserByPID method
    #[zbus(name = "GetUserByPID")]
    fn get_user_by_pid(&self, pid: u32) -> zbus::Result<zbus::zvariant::OwnedObjectPath>;

    /// Halt method
    fn halt(&self, interactive: bool) -> zbus::Result<()>;

    /// HaltWithFlags method
    fn halt_with_flags(&self, flags: u64) -> zbus::Result<()>;

    /// Hibernate method
    fn hibernate(&self, interactive: bool) -> zbus::Result<()>;

    /// HibernateWithFlags method
    fn hibernate_with_flags(&self, flags: u64) -> zbus::Result<()>;

    /// HybridSleep method
    fn hybrid_sleep(&self, interactive: bool) -> zbus::Result<()>;

    /// HybridSleepWithFlags method
    fn hybrid_sleep_with_flags(&self, flags: u64) -> zbus::Result<()>;

    /// Inhibit method
    fn inhibit(
        &self,
        what: &str,
        who: &str,
        why: &str,
        mode: &str,
    ) -> zbus::Result<zbus::zvariant::OwnedFd>;

    /// KillSession method
    fn kill_session(&self, session_id: &str, whom: &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<Vec<(String, String, String, String, u32, u32)>>;

    /// ListSeats method
    fn list_seats(&self) -> zbus::Result<Vec<(String, zbus::zvariant::OwnedObjectPath)>>;

    /// ListSessions method
    fn list_sessions(
        &self,
    ) -> zbus::Result<Vec<(String, u32, String, String, zbus::zvariant::OwnedObjectPath)>>;

    /// ListSessionsEx method
    fn list_sessions_ex(
        &self,
    ) -> zbus::Result<
        Vec<(
            String,
            u32,
            String,
            String,
            u32,
            String,
            String,
            bool,
            u64,
            zbus::zvariant::OwnedObjectPath,
        )>,
    >;

    /// ListUsers method
    fn list_users(&self) -> zbus::Result<Vec<(u32, String, zbus::zvariant::OwnedObjectPath)>>;

    /// 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<()>;

    /// PowerOffWithFlags method
    fn power_off_with_flags(&self, flags: u64) -> zbus::Result<()>;

    /// Reboot method
    fn reboot(&self, interactive: bool) -> zbus::Result<()>;

    /// RebootWithFlags method
    fn reboot_with_flags(&self, flags: u64) -> zbus::Result<()>;

    /// ReleaseSession method
    fn release_session(&self, session_id: &str) -> zbus::Result<()>;

    /// ScheduleShutdown method
    fn schedule_shutdown(&self, 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<()>;

    /// Sleep method
    fn sleep(&self, flags: u64) -> zbus::Result<()>;

    /// Suspend method
    fn suspend(&self, interactive: bool) -> zbus::Result<()>;

    /// SuspendThenHibernate method
    fn suspend_then_hibernate(&self, interactive: bool) -> zbus::Result<()>;

    /// SuspendThenHibernateWithFlags method
    fn suspend_then_hibernate_with_flags(&self, flags: u64) -> zbus::Result<()>;

    /// SuspendWithFlags method
    fn suspend_with_flags(&self, flags: u64) -> 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
    #[zbus(signal)]
    fn prepare_for_shutdown(&self, start: bool) -> zbus::Result<()>;

    /// PrepareForShutdownWithMetadata signal
    #[zbus(signal)]
    fn prepare_for_shutdown_with_metadata(
        &self,
        start: bool,
        metadata: std::collections::HashMap<&str, zbus::zvariant::Value<'_>>,
    ) -> zbus::Result<()>;

    /// PrepareForSleep signal
    #[zbus(signal)]
    fn prepare_for_sleep(&self, start: bool) -> zbus::Result<()>;

    /// SeatNew signal
    #[zbus(signal)]
    fn seat_new(
        &self,
        seat_id: &str,
        object_path: zbus::zvariant::ObjectPath<'_>,
    ) -> zbus::Result<()>;

    /// SeatRemoved signal
    #[zbus(signal)]
    fn seat_removed(
        &self,
        seat_id: &str,
        object_path: zbus::zvariant::ObjectPath<'_>,
    ) -> zbus::Result<()>;

    /// SecureAttentionKey signal
    #[zbus(signal)]
    fn secure_attention_key(
        &self,
        seat_id: &str,
        object_path: zbus::zvariant::ObjectPath<'_>,
    ) -> zbus::Result<()>;

    /// SessionNew signal
    #[zbus(signal)]
    fn session_new(
        &self,
        session_id: &str,
        object_path: zbus::zvariant::ObjectPath<'_>,
    ) -> zbus::Result<()>;

    /// SessionRemoved signal
    #[zbus(signal)]
    fn session_removed(
        &self,
        session_id: &str,
        object_path: zbus::zvariant::ObjectPath<'_>,
    ) -> zbus::Result<()>;

    /// UserNew signal
    #[zbus(signal)]
    fn user_new(&self, uid: u32, object_path: zbus::zvariant::ObjectPath<'_>) -> zbus::Result<()>;

    /// UserRemoved signal
    #[zbus(signal)]
    fn user_removed(
        &self,
        uid: u32,
        object_path: zbus::zvariant::ObjectPath<'_>,
    ) -> zbus::Result<()>;

    /// BlockInhibited property
    #[zbus(property)]
    fn block_inhibited(&self) -> zbus::Result<String>;

    /// BlockWeakInhibited property
    #[zbus(property)]
    fn block_weak_inhibited(&self) -> zbus::Result<String>;

    /// BootLoaderEntries property
    #[zbus(property)]
    fn boot_loader_entries(&self) -> zbus::Result<Vec<String>>;

    /// DelayInhibited property
    #[zbus(property)]
    fn delay_inhibited(&self) -> zbus::Result<String>;

    /// DesignatedMaintenanceTime property
    #[zbus(property)]
    fn designated_maintenance_time(&self) -> zbus::Result<String>;

    /// Docked property
    #[zbus(property)]
    fn docked(&self) -> zbus::Result<bool>;

    /// EnableWallMessages property
    #[zbus(property)]
    fn enable_wall_messages(&self) -> zbus::Result<bool>;
    #[zbus(property)]
    fn set_enable_wall_messages(&self, value: bool) -> zbus::Result<()>;

    /// HandleHibernateKey property
    #[zbus(property)]
    fn handle_hibernate_key(&self) -> zbus::Result<String>;

    /// HandleHibernateKeyLongPress property
    #[zbus(property)]
    fn handle_hibernate_key_long_press(&self) -> zbus::Result<String>;

    /// HandleLidSwitch property
    #[zbus(property)]
    fn handle_lid_switch(&self) -> zbus::Result<String>;

    /// HandleLidSwitchDocked property
    #[zbus(property)]
    fn handle_lid_switch_docked(&self) -> zbus::Result<String>;

    /// HandleLidSwitchExternalPower property
    #[zbus(property)]
    fn handle_lid_switch_external_power(&self) -> zbus::Result<String>;

    /// HandlePowerKey property
    #[zbus(property)]
    fn handle_power_key(&self) -> zbus::Result<String>;

    /// HandlePowerKeyLongPress property
    #[zbus(property)]
    fn handle_power_key_long_press(&self) -> zbus::Result<String>;

    /// HandleRebootKey property
    #[zbus(property)]
    fn handle_reboot_key(&self) -> zbus::Result<String>;

    /// HandleRebootKeyLongPress property
    #[zbus(property)]
    fn handle_reboot_key_long_press(&self) -> zbus::Result<String>;

    /// HandleSecureAttentionKey property
    #[zbus(property)]
    fn handle_secure_attention_key(&self) -> zbus::Result<String>;

    /// HandleSuspendKey property
    #[zbus(property)]
    fn handle_suspend_key(&self) -> zbus::Result<String>;

    /// HandleSuspendKeyLongPress property
    #[zbus(property)]
    fn handle_suspend_key_long_press(&self) -> zbus::Result<String>;

    /// HoldoffTimeoutUSec property
    #[zbus(property, name = "HoldoffTimeoutUSec")]
    fn holdoff_timeout_usec(&self) -> zbus::Result<u64>;

    /// IdleAction property
    #[zbus(property)]
    fn idle_action(&self) -> zbus::Result<String>;

    /// IdleActionUSec property
    #[zbus(property, name = "IdleActionUSec")]
    fn idle_action_usec(&self) -> zbus::Result<u64>;

    /// IdleHint property
    #[zbus(property)]
    fn idle_hint(&self) -> zbus::Result<bool>;

    /// IdleSinceHint property
    #[zbus(property)]
    fn idle_since_hint(&self) -> zbus::Result<u64>;

    /// IdleSinceHintMonotonic property
    #[zbus(property)]
    fn idle_since_hint_monotonic(&self) -> zbus::Result<u64>;

    /// InhibitDelayMaxUSec property
    #[zbus(property, name = "InhibitDelayMaxUSec")]
    fn inhibit_delay_max_usec(&self) -> zbus::Result<u64>;

    /// InhibitorsMax property
    #[zbus(property)]
    fn inhibitors_max(&self) -> zbus::Result<u64>;

    /// KillExcludeUsers property
    #[zbus(property)]
    fn kill_exclude_users(&self) -> zbus::Result<Vec<String>>;

    /// KillOnlyUsers property
    #[zbus(property)]
    fn kill_only_users(&self) -> zbus::Result<Vec<String>>;

    /// KillUserProcesses property
    #[zbus(property)]
    fn kill_user_processes(&self) -> zbus::Result<bool>;

    /// LidClosed property
    #[zbus(property)]
    fn lid_closed(&self) -> zbus::Result<bool>;

    /// NAutoVTs property
    #[zbus(property, name = "NAutoVTs")]
    fn nauto_vts(&self) -> zbus::Result<u32>;

    /// NCurrentInhibitors property
    #[zbus(property, name = "NCurrentInhibitors")]
    fn ncurrent_inhibitors(&self) -> zbus::Result<u64>;

    /// NCurrentSessions property
    #[zbus(property, name = "NCurrentSessions")]
    fn ncurrent_sessions(&self) -> zbus::Result<u64>;

    /// OnExternalPower property
    #[zbus(property)]
    fn on_external_power(&self) -> zbus::Result<bool>;

    /// PreparingForShutdown property
    #[zbus(property)]
    fn preparing_for_shutdown(&self) -> zbus::Result<bool>;

    /// PreparingForShutdownWithMetadata property
    #[zbus(property)]
    fn preparing_for_shutdown_with_metadata(
        &self,
    ) -> zbus::Result<std::collections::HashMap<String, zbus::zvariant::OwnedValue>>;

    /// PreparingForSleep property
    #[zbus(property)]
    fn preparing_for_sleep(&self) -> zbus::Result<bool>;

    /// RebootParameter property
    #[zbus(property)]
    fn reboot_parameter(&self) -> zbus::Result<String>;

    /// RebootToBootLoaderEntry property
    #[zbus(property)]
    fn reboot_to_boot_loader_entry(&self) -> zbus::Result<String>;

    /// RebootToBootLoaderMenu property
    #[zbus(property)]
    fn reboot_to_boot_loader_menu(&self) -> zbus::Result<u64>;

    /// RebootToFirmwareSetup property
    #[zbus(property)]
    fn reboot_to_firmware_setup(&self) -> zbus::Result<bool>;

    /// RemoveIPC property
    #[zbus(property, name = "RemoveIPC")]
    fn remove_ipc(&self) -> zbus::Result<bool>;

    /// RuntimeDirectoryInodesMax property
    #[zbus(property)]
    fn runtime_directory_inodes_max(&self) -> zbus::Result<u64>;

    /// RuntimeDirectorySize property
    #[zbus(property)]
    fn runtime_directory_size(&self) -> zbus::Result<u64>;

    /// ScheduledShutdown property
    #[zbus(property)]
    fn scheduled_shutdown(&self) -> zbus::Result<(String, u64)>;

    /// SessionsMax property
    #[zbus(property)]
    fn sessions_max(&self) -> zbus::Result<u64>;

    /// SleepOperation property
    #[zbus(property)]
    fn sleep_operation(&self) -> zbus::Result<Vec<String>>;

    /// StopIdleSessionUSec property
    #[zbus(property, name = "StopIdleSessionUSec")]
    fn stop_idle_session_usec(&self) -> zbus::Result<u64>;

    /// UserStopDelayUSec property
    #[zbus(property, name = "UserStopDelayUSec")]
    fn user_stop_delay_usec(&self) -> zbus::Result<u64>;

    /// WallMessage property
    #[zbus(property)]
    fn wall_message(&self) -> zbus::Result<String>;
    // FIXME: this causes a name collision without the _ suffix
    #[zbus(property)]
    fn set_wall_message_(&self, value: &str) -> zbus::Result<()>;
}