创建 shell 窗口和辅助工具

此接口由基于 KF5 的 Wayland shell 用于与合成器通信,只能绑定一次。

警告!此文件中描述的协议是桌面环境的实现细节。普通客户端不得使用此协议。可能会在不增加扩展主版本号的情况下进行不兼容的更改。

get_surface(id: new_id<org_kde_plasma_surface>, surface: object<wl_surface>)
参数
类型
描述
idnew_id<org_kde_plasma_surface>
surfaceobject<wl_surface>
从 surface 创建 shell surface

为已有的 surface 创建一个 shell surface。 一个 surface 只能关联一个 shell surface。


元数据接口

此接口可由 wl_surface 实现,用于提供 shell 用户界面。

它提供了设置 surface 角色、分配输出或在输出坐标中设置位置的请求。

在服务端,当关联的 wl_surface 被销毁时,该对象会自动销毁。在客户端,必须在销毁 wl_surface 对象之前调用 org_kde_plasma_surface.destroy()。

destroy()
移除 org_kde_plasma_surface 接口

The org_kde_plasma_surface interface is removed from the wl_surface object that was turned into a shell surface with the org_kde_plasma_shell.get_surface request. The shell surface role is lost and wl_surface is unmapped.

set_output(output: object<wl_output>)
参数
类型
描述
outputobject<wl_output>
为此 shell surface 分配输出

将输出分配给此 shell surface。合成器将在调用 org_kde_plasma_surface.set_position 请求时使用此信息来设置位置。

set_position(x: int, y: int)
参数
类型
描述
xint
x coordinate in global space
yint
y coordinate in global space
更改 shell surface 的位置

将 surface 移动到新坐标。

坐标是全局的,例如对于 1920,0+1920x1080 输出,50,50 在全局坐标空间中为 1970,50。

使用 org_kde_plasma_surface.set_output 为此 surface 分配输出。

set_role(role: uint)
参数
类型
描述
roleuint
为此 surface 分配角色

为 shell surface 分配角色。

合成器根据 surface 的角色对其进行处理。参见下面的说明。

如果 surface 已有角色,此请求将失败,这意味着 surface 角色只能分配一次。

== 带有 splash 角色的 surface ==

Splash surface 在 shell 启动阶段放置在所有其他 surface 之上。

这些 surface 根据输出坐标放置。不会对这些 surface 施加大小限制,shell 需要根据输出大小调整它们的尺寸。

这些 surface 用于在启动阶段隐藏桌面,使用户始终看到准备就绪的桌面。

如果合成器以其他方式显示桌面(例如使用淡入效果),则 shell 可能不会创建 splash surface。

这取决于桌面通常需要多少时间准备工作区或特定的设计决策。本规范不强制任何特定设计。

当启动阶段完成后,shell 将向合成器发送 org_kde_plasma.desktop_ready 请求。

== 带有 desktop 角色的 surface ==

Desktop surface 放置在所有其他 surface 之下,用于显示带有图标、搜索结果或用户交互控件的实际桌面视图。显示内容取决于 shell 实现。

这些 surface 根据输出坐标放置。不会对这些 surface 施加大小限制,shell 需要根据输出大小调整它们的尺寸。

每个输出只能有一个 surface 具有 desktop 角色。

== 带有 dashboard 角色的 surface ==

Dashboard surface 放置在 desktop surface 之上,用于显示额外的小部件和控件。

这些 surface 根据输出坐标放置。不会对这些 surface 施加大小限制,shell 需要根据输出大小调整它们的尺寸。

每个输出只能有一个 surface 具有 dashboard 角色。

== 带有 config 角色的 surface ==

配置 surface 用于桌面配置。

set_panel_behavior(flag: uint)
参数
类型
描述
flaguint
panel_behavior enum value
设置或取消设置面板

按 flag enum 中描述的设置标志位掩码。传入 0 以取消设置任何标志,surface 将恢复默认行为。

在 Plasma 6 中已弃用。设置此标志将不起作用。应用应在适当时使用 layer shell。

set_skip_taskbar(skip: uint)
参数
类型
描述
skipuint
Boolean value that sets whether to skip the taskbar
使窗口跳过任务栏

将此位设置到窗口上,将使其表示倾向于不在任务栏中列出。任务栏实现可能会也可能不会遵循此提示。

panel_auto_hide_hide()
隐藏自动隐藏面板

带有 panel_behavior auto_hide 的面板 surface 可以执行此请求,在不取消映射的情况下隐藏屏幕边缘的面板。合成器通过 auto_hidden_panel_hidden 事件通知客户端面板已被隐藏。

当指针触及面板边界的屏幕边缘时,合成器将恢复 surface 的可见性状态。一旦合成器恢复可见性,将发送 auto_hidden_panel_shown 事件。如果合成器无法隐藏面板,也会发送此事件。

客户端也可以使用 panel_auto_hide_show 请求再次显示面板。

panel_auto_hide_show()
显示自动隐藏面板

带有 panel_behavior auto_hide 的面板 surface 可以执行此请求,再次显示通过 panel_auto_hide_hide 隐藏的面板。

set_panel_takes_focus(takes_focus: uint)
参数
类型
描述
takes_focusuint
Boolean value that sets whether the panel takes focus
面板是否获取焦点

默认情况下,各种 org_kde_plasma_surface 角色不会获取焦点且无法激活。通过此请求,可以指示合成器将焦点也传递给此 org_kde_plasma_surface。

set_skip_switcher(skip: uint)
参数
类型
描述
skipuint
Boolean value that sets whether to skip the window switcher.
使窗口不出现在切换器中

设置此位将指示窗口倾向于不在切换器中列出。

open_under_cursor()
在光标下打开

请求此 surface 的初始位置在当前光标位置下方。必须在向此 surface 附加任何缓冲区之前调用。

auto_hidden_panel_hidden()
自动隐藏面板已被隐藏

自动隐藏面板已被合成器隐藏。

auto_hidden_panel_shown()
自动隐藏面板已被显示

自动隐藏面板已被合成器显示。

参数
描述
always_visible1
正常面板可见性
面板在其他 surface 之上,窗口不能覆盖(全屏窗口除外)。

The panel is on top of other surfaces, windows cannot cover (full screen windows excluded).

auto_hide2
自动隐藏
面板自动隐藏,鼠标悬停时恢复。

The panel is hidden automatically and restored when the mouse is over.

windows_can_cover3
窗口可以覆盖
窗口可以覆盖面板。

Windows can cover the panel.

windows_go_below4
窗口在下方
最大化窗口占据整个屏幕空间,但面板在窗口之上。

Maximized windows take the whole screen space but the panel is above the windows.

面板 surface 的行为
参数
描述
panel_not_auto_hide0
对非自动隐藏面板执行了 panel_auto_hide 请求。

合成器支持

Cage
Cage
0.2.0
COSMIC
COSMIC
1.0.0~beta.8
GameScope
GameScope
3.15.14
Hyprland
Hyprland
0.52.1
Jay
1.12.0
KWin
KWin
6.6
Labwc
Labwc
0.9.2
Louvre
Louvre
2.14.1
Mir
Mir
2.26
Muffin
Muffin
6.6.0
Mutter
Mutter
49.2
niri
niri
25.11
phoc
phoc
0.52
river
river
0.3.13
Sway
Sway
1.11
Treeland
Treeland
0.8.0
Wayfire
Wayfire
0.9.0
Weston
Weston
14.0.2
org_kde_plasma_shell
x
x
x
x
x
8
x
x
x
x
x
x
x
x
x
x
x
x

SPDX-FileCopyrightText: 2013-2014 Pier Luigi Fiorini

SPDX-License-Identifier: LGPL-2.1-or-later

Footer

© 2026 Wayland Explorer

本网站与 Wayland 官方项目无任何关联。网站所有内容均根据 Wayland 协议 XML 文件自动生成。

本网站使用的 Visual Studio Code - Codicons 遵循 CC BY 4.0 许可。