3 个稳定版本

1.1.1 2021 年 1 月 22 日
1.1.0 2020 年 6 月 6 日
1.0.0 2020 年 5 月 25 日

#695 in Unix APIs


2 crates 中使用

MIT/Apache 许可协议

63KB
1.5K SLoC

桌面环境支持套件

Desk 是一套用于在轻量级窗口管理器中执行类似桌面环境操作的实用工具集。目前它有两个,一个是屏幕锁定助手,另一个是退出屏幕。

desk-locker

desk-locker 是一个与 xss-lock 类似的屏幕锁定工具。它监听 X 屏幕保护程序事件、系统休眠和会话锁定/解锁事件,并运行类似于 xsecurelocki3lock 的锁定程序。与 xss-lock 不同,它使用 XDG_SESSION_ID 环境变量来确定要锁定的会话,因此可以从 systemd 用户单元运行。

用法

# Basic usage: run xsecurelock whenever the screen should be locked
$ desk-locker xsecurelock

# Pass a logind inhibitor lock to xsecurelock. This prevents the system from sleeping until xsecurelock reports that
# it's ready. `--pass-inhibitor-lock` should work with any screen locker that supports xss-lock's `--transfer-sleep-lock` flag.
$ desk-locker --pass-inhibitor-lock xsecurelock

# Additionally, update the session's idle hint. Logind can be configured to do something (ex. put the system to sleep)
# after all sessions have been idle for a certain amount of time. If you don't already have something that updates the
# idle hint, setting it whenever the screen locker is active is a reasonable default.
$ desk-locker --set-idle-hint --pass-inhibitor-lock xsecurelock

desk-exit-screen

desk-exit-screen 显示退出窗口管理器的 GUI(关闭、重启、注销等)。

它支持使用 ~/.config/desk/exit-screen.toml 配置文件中的自定义操作。

# Add an action for quitting / logging out, by running the given shell command
# For example, i3-msg exit
quit_command = "<window-manager-specific quit command>"

# Customize the order actions are shown in. This must be set to display any custom actions.
# By default, the order is
# [ "lock", "quit", "suspend", "hibernate", "reboot", "shutdown" ]
order = ["act1", "act2", "..."]

# Use more [actions.<action name>] sections to define additional actions
[actions.mycustomaction]
key = "u" # Keyboard shortcut for this action
icon = "system-upgrade" # GTK+ icon name to use for the button
description = "Upgrade the system" # Text description of the action
command = "yay" # Command to run

desk-logind

这是一个用于使用 logind D-Bus API 的 Rust 库。


lib.rs:

systemd-logind 客户端库

依赖关系

~7.5MB
~167K SLoC