xdg-toplevel-icon-v1.xml 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <protocol name="xdg_toplevel_icon_v1">
  3. <copyright>
  4. Copyright © 2023-2024 Matthias Klumpp
  5. Copyright © 2024 David Edmundson
  6. Permission is hereby granted, free of charge, to any person obtaining a
  7. copy of this software and associated documentation files (the "Software"),
  8. to deal in the Software without restriction, including without limitation
  9. the rights to use, copy, modify, merge, publish, distribute, sublicense,
  10. and/or sell copies of the Software, and to permit persons to whom the
  11. Software is furnished to do so, subject to the following conditions:
  12. The above copyright notice and this permission notice (including the next
  13. paragraph) shall be included in all copies or substantial portions of the
  14. Software.
  15. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  18. THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  20. FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  21. DEALINGS IN THE SOFTWARE.
  22. </copyright>
  23. <description summary="protocol to assign icons to toplevels">
  24. This protocol allows clients to set icons for their toplevel surfaces
  25. either via the XDG icon stock (using an icon name), or from pixel data.
  26. A toplevel icon represents the individual toplevel (unlike the application
  27. or launcher icon, which represents the application as a whole), and may be
  28. shown in window switchers, window overviews and taskbars that list
  29. individual windows.
  30. This document adheres to RFC 2119 when using words like "must",
  31. "should", "may", etc.
  32. Warning! The protocol described in this file is currently in the testing
  33. phase. Backward compatible changes may be added together with the
  34. corresponding interface version bump. Backward incompatible changes can
  35. only be done by creating a new major version of the extension.
  36. </description>
  37. <interface name="xdg_toplevel_icon_manager_v1" version="1">
  38. <description summary="interface to manage toplevel icons">
  39. This interface allows clients to create toplevel window icons and set
  40. them on toplevel windows to be displayed to the user.
  41. </description>
  42. <request name="destroy" type="destructor">
  43. <description summary="destroy the toplevel icon manager">
  44. Destroy the toplevel icon manager.
  45. This does not destroy objects created with the manager.
  46. </description>
  47. </request>
  48. <request name="create_icon">
  49. <description summary="create a new icon instance">
  50. Creates a new icon object. This icon can then be attached to a
  51. xdg_toplevel via the 'set_icon' request.
  52. </description>
  53. <arg name="id" type="new_id" interface="xdg_toplevel_icon_v1"/>
  54. </request>
  55. <request name="set_icon">
  56. <description summary="set an icon on a toplevel window">
  57. This request assigns the icon 'icon' to 'toplevel', or clears the
  58. toplevel icon if 'icon' was null.
  59. This state is double-buffered and is applied on the next
  60. wl_surface.commit of the toplevel.
  61. After making this call, the xdg_toplevel_icon_v1 provided as 'icon'
  62. can be destroyed by the client without 'toplevel' losing its icon.
  63. The xdg_toplevel_icon_v1 is immutable from this point, and any
  64. future attempts to change it must raise the
  65. 'xdg_toplevel_icon_v1.immutable' protocol error.
  66. The compositor must set the toplevel icon from either the pixel data
  67. the icon provides, or by loading a stock icon using the icon name.
  68. See the description of 'xdg_toplevel_icon_v1' for details.
  69. If 'icon' is set to null, the icon of the respective toplevel is reset
  70. to its default icon (usually the icon of the application, derived from
  71. its desktop-entry file, or a placeholder icon).
  72. If this request is passed an icon with no pixel buffers or icon name
  73. assigned, the icon must be reset just like if 'icon' was null.
  74. </description>
  75. <arg name="toplevel" type="object" interface="xdg_toplevel" summary="the toplevel to act on"/>
  76. <arg name="icon" type="object" interface="xdg_toplevel_icon_v1" allow-null="true"/>
  77. </request>
  78. <event name="icon_size">
  79. <description summary="describes a supported &amp; preferred icon size">
  80. This event indicates an icon size the compositor prefers to be
  81. available if the client has scalable icons and can render to any size.
  82. When the 'xdg_toplevel_icon_manager_v1' object is created, the
  83. compositor may send one or more 'icon_size' events to describe the list
  84. of preferred icon sizes. If the compositor has no size preference, it
  85. may not send any 'icon_size' event, and it is up to the client to
  86. decide a suitable icon size.
  87. A sequence of 'icon_size' events must be finished with a 'done' event.
  88. If the compositor has no size preferences, it must still send the
  89. 'done' event, without any preceding 'icon_size' events.
  90. </description>
  91. <arg name="size" type="int"
  92. summary="the edge size of the square icon in surface-local coordinates, e.g. 64"/>
  93. </event>
  94. <event name="done">
  95. <description summary="all information has been sent">
  96. This event is sent after all 'icon_size' events have been sent.
  97. </description>
  98. </event>
  99. </interface>
  100. <interface name="xdg_toplevel_icon_v1" version="1">
  101. <description summary="a toplevel window icon">
  102. This interface defines a toplevel icon.
  103. An icon can have a name, and multiple buffers.
  104. In order to be applied, the icon must have either a name, or at least
  105. one buffer assigned. Applying an empty icon (with no buffer or name) to
  106. a toplevel should reset its icon to the default icon.
  107. It is up to compositor policy whether to prefer using a buffer or loading
  108. an icon via its name. See 'set_name' and 'add_buffer' for details.
  109. </description>
  110. <enum name="error">
  111. <entry name="invalid_buffer"
  112. summary="the provided buffer does not satisfy requirements"
  113. value="1"/>
  114. <entry name="immutable"
  115. summary="the icon has already been assigned to a toplevel and must not be changed"
  116. value="2"/>
  117. <entry name="no_buffer"
  118. summary="the provided buffer has been destroyed before the toplevel icon"
  119. value="3"/>
  120. </enum>
  121. <request name="destroy" type="destructor">
  122. <description summary="destroy the icon object">
  123. Destroys the 'xdg_toplevel_icon_v1' object.
  124. The icon must still remain set on every toplevel it was assigned to,
  125. until the toplevel icon is reset explicitly.
  126. </description>
  127. </request>
  128. <request name="set_name">
  129. <description summary="set an icon name">
  130. This request assigns an icon name to this icon.
  131. Any previously set name is overridden.
  132. The compositor must resolve 'icon_name' according to the lookup rules
  133. described in the XDG icon theme specification[1] using the
  134. environment's current icon theme.
  135. If the compositor does not support icon names or cannot resolve
  136. 'icon_name' according to the XDG icon theme specification it must
  137. fall back to using pixel buffer data instead.
  138. If this request is made after the icon has been assigned to a toplevel
  139. via 'set_icon', a 'immutable' error must be raised.
  140. [1]: https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html
  141. </description>
  142. <arg name="icon_name" type="string"/>
  143. </request>
  144. <request name="add_buffer">
  145. <description summary="add icon data from a pixel buffer">
  146. This request adds pixel data supplied as wl_buffer to the icon.
  147. The client should add pixel data for all icon sizes and scales that
  148. it can provide, or which are explicitly requested by the compositor
  149. via 'icon_size' events on xdg_toplevel_icon_manager_v1.
  150. The wl_buffer supplying pixel data as 'buffer' must be backed by wl_shm
  151. and must be a square (width and height being equal).
  152. If any of these buffer requirements are not fulfilled, a 'invalid_buffer'
  153. error must be raised.
  154. If this icon instance already has a buffer of the same size and scale
  155. from a previous 'add_buffer' request, data from the last request
  156. overrides the preexisting pixel data.
  157. The wl_buffer must be kept alive for as long as the xdg_toplevel_icon
  158. it is associated with is not destroyed, otherwise a 'no_buffer' error
  159. is raised. The buffer contents must not be modified after it was
  160. assigned to the icon.
  161. If this request is made after the icon has been assigned to a toplevel
  162. via 'set_icon', a 'immutable' error must be raised.
  163. </description>
  164. <arg name="buffer" type="object" interface="wl_buffer"/>
  165. <arg name="scale" type="int"
  166. summary="the scaling factor of the icon, e.g. 1"/>
  167. </request>
  168. </interface>
  169. </protocol>