此接口允许客户端监控用户的空闲状态。
绑定到此全局对象后,客户端可以创建 ext_idle_notification_v1 对象,以便在用户空闲指定时间后获得通知。
get_idle_notification(id: new_id<ext_idle_notification_v1>, timeout: uint, seat: object<wl_seat>)
参数 | 类型 | 描述 |
|---|---|---|
| id | new_id<ext_idle_notification_v1> | |
| timeout | uint | minimum idle timeout in msec |
| seat | object<wl_seat> |
创建一个新的空闲通知对象。
该通知对象具有最小超时时间,并绑定到一个 seat。如果 seat 处于非活动状态的时间至少达到 提供的超时时间,将通知客户端。有关更多详细信息,请参阅 ext_idle_notification_v1。
零超时是有效的,意味着客户端希望在 seat 处于非活动状态时尽快收到通知。
get_input_idle_notification(id: new_id<ext_idle_notification_v1>, timeout: uint, seat: object<wl_seat>)
参数 | 类型 | 描述 |
|---|---|---|
| id | new_id<ext_idle_notification_v1> | |
| timeout | uint | minimum idle timeout in msec |
| seat | object<wl_seat> |
创建一个新的空闲通知对象,以跟踪 用户的输入,例如键盘和鼠标移动。因为此对象 仅用于跟踪用户输入,所以它会忽略空闲抑制器(idle inhibitors)。
该通知对象具有最小超时时间,并绑定到一个 seat。如果 seat 处于非活动状态的时间至少达到 提供的超时时间,将通知客户端。有关更多详细信息,请参阅 ext_idle_notification_v1。
零超时是有效的,意味着客户端希望在 seat 处于非活动状态时尽快收到通知。
此接口由 compositor 使用,用于向客户端发送空闲通知事件。
最初,通知对象不处于空闲状态。从创建通知对象开始算起,当至少在超时持续时间内未发生任何用户活动时, 通知对象将变为空闲状态。用户 活动可以包括输入事件或存在传感器,但具体取决于 compositor。
此通知对空闲抑制器(idle inhibitors)的响应方式取决于 它的构建方式。如果通过 get_idle_notification 请求构建,那么如果存在活动的空闲抑制器 (例如,另一个客户端在可见的 surface 上创建了 zwp_idle_inhibitor_v1), compositor 绝不能使该 通知对象进入空闲状态。但是,如果通过 get_input_idle_notification 请求构建,则会忽略空闲抑制器, 并且只有来自用户的输入(例如来自键盘或 鼠标)才算作活动。
当通知对象变为空闲时,会发送 idled 事件。当 用户活动重新开始时,通知对象停止空闲, 会发送 resumed 事件并重新启动超时。
idled()
当通知对象变为空闲状态时发送此事件。
如果在没有 resumed 事件介入的情况下发送此事件两次,则属于 compositor 协议错误。
resumed()
当通知对象停止空闲时发送此事件。
如果在没有 idled 事件介入的情况下发送此事件两次,则属于 compositor 协议错误。在任何 idled 事件之前发送此 事件也属于 compositor 协议错误。
合成器支持
Cage | COSMIC | GameScope | Hyprland | Jay | KWin | Labwc | Louvre | Mir | Muffin | Mutter | niri | phoc | river | Sway | Treeland | Wayfire | Weston | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ext_idle_notifier_v1 | 1 | 2 | x | 2 | 2 | 2 | 2 | 1 | x | x | x | 2 | 2 | 2 | 2 | 2 | 1 | x |
Copyright
Copyright © 2015 Martin Gräßlin Copyright © 2022 Simon Ser
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.