2 | 2 |
//
|
3 | 3 |
// Scraped from various tarballs or aquired using debugging tools
|
4 | 4 |
|
5 | |
const StatusNotifierItem = <interface name="org.kde.StatusNotifierItem">
|
6 | |
<property name="Category" type="s" access="read"/>
|
7 | |
<property name="Id" type="s" access="read"/>
|
8 | |
<property name="Title" type="s" access="read"/>
|
9 | |
<property name="Status" type="s" access="read"/>
|
10 | |
<property name="WindowId" type="i" access="read"/>
|
11 | |
<property name="Menu" type="o" access="read" />
|
|
5 |
const StatusNotifierItem = loadInterfaceXml("StatusNotifierItem.xml")
|
|
6 |
const Properties = loadInterfaceXml("Properties.xml")
|
|
7 |
const DBusMenu = loadInterfaceXml("DBusMenu.xml")
|
|
8 |
const StatusNotifierWatcher = loadInterfaceXml("StatusNotifierWatcher.xml")
|
12 | 9 |
|
13 | |
<!-- main icon -->
|
14 | |
<!-- names are preferred over pixmaps -->
|
15 | |
<property name="IconName" type="s" access="read" />
|
16 | |
<property name="IconThemePath" type="s" access="read" />
|
|
10 |
// loads a xml file into an in-memory string
|
|
11 |
function loadInterfaceXml(filename) {
|
|
12 |
let extension = imports.misc.extensionUtils.getCurrentExtension()
|
17 | 13 |
|
18 | |
<!-- struct containing width, height and image data-->
|
19 | |
<!-- implementation has been dropped as of now -->
|
20 | |
<property name="IconPixmap" type="a(iiay)" access="read" />
|
|
14 |
let interfaces_dir = extension.dir.get_child("interfaces-xml")
|
21 | 15 |
|
22 | |
<!-- not used in ayatana code, no test case so far -->
|
23 | |
<property name="OverlayIconName" type="s" access="read"/>
|
24 | |
<property name="OverlayIconPixmap" type="a(iiay)" access="read" />
|
|
16 |
let file = interfaces_dir.get_child(filename)
|
25 | 17 |
|
26 | |
<!-- Requesting attention icon -->
|
27 | |
<property name="AttentionIconName" type="s" access="read"/>
|
|
18 |
let [ result, contents ] = imports.gi.GLib.file_get_contents(file.get_path())
|
28 | 19 |
|
29 | |
<!--same definition as image-->
|
30 | |
<property name="AttentionIconPixmap" type="a(iiay)" access="read" />
|
31 | |
|
32 | |
<!-- tooltip data -->
|
33 | |
<!-- unimplemented as of now -->
|
34 | |
<!--(iiay) is an image-->
|
35 | |
<property name="ToolTip" type="(sa(iiay)ss)" access="read" />
|
36 | |
|
37 | |
|
38 | |
<!-- interaction: actually, we do not use them. -->
|
39 | |
<method name="Activate">
|
40 | |
<arg name="x" type="i" direction="in"/>
|
41 | |
<arg name="y" type="i" direction="in"/>
|
42 | |
</method>
|
43 | |
|
44 | |
<!-- Signals: the client wants to change something in the status-->
|
45 | |
<signal name="NewTitle"></signal>
|
46 | |
<signal name="NewIcon"></signal>
|
47 | |
<signal name="NewIconThemePath">
|
48 | |
<arg type="s" name="icon_theme_path" direction="out" />
|
49 | |
</signal>
|
50 | |
<signal name="NewAttentionIcon"></signal>
|
51 | |
<signal name="NewOverlayIcon"></signal>
|
52 | |
<signal name="NewToolTip"></signal>
|
53 | |
<signal name="NewStatus">
|
54 | |
<arg name="status" type="s" />
|
55 | |
</signal>
|
56 | |
|
57 | |
<!-- ayatana labels -->
|
58 | |
<signal name="XAyatanaNewLabel">
|
59 | |
<arg type="s" name="label" direction="out" />
|
60 | |
<arg type="s" name="guide" direction="out" />
|
61 | |
</signal>
|
62 | |
<property name="XAyatanaLabel" type="s" access="read" />
|
63 | |
<property name="XAyatanaLabelGuide" type="s" access="read" /> <!-- unimplemented -->
|
64 | |
|
65 | |
|
66 | |
</interface>;
|
67 | |
|
68 | |
const Properties = <interface name="org.freedesktop.DBus.Properties">
|
69 | |
<method name="Get">
|
70 | |
<arg type="s" direction="in" />
|
71 | |
<arg type="s" direction="in" />
|
72 | |
<arg type="v" direction="out" />
|
73 | |
</method>
|
74 | |
<method name="GetAll">
|
75 | |
<arg type="s" direction="in" />
|
76 | |
<arg type="a{sv}" direction="out" />
|
77 | |
</method>
|
78 | |
<signal name="PropertiesChanged">
|
79 | |
<arg type="s" direction="out" />
|
80 | |
<arg type="a{sv}" direction="out" />
|
81 | |
<arg type="as" direction="out" />
|
82 | |
</signal>
|
83 | |
</interface>;
|
84 | |
|
85 | |
//copied from libdbusmenu
|
86 | |
const DBusMenu = <interface name="com.canonical.dbusmenu">
|
87 | |
<!-- Properties -->
|
88 | |
<property name="Version" type="u" access="read">
|
89 | |
</property>
|
90 | |
<property name="TextDirection" type="s" access="read">
|
91 | |
</property>
|
92 | |
<property name="Status" type="s" access="read">
|
93 | |
</property>
|
94 | |
<property name="IconThemePath" type="as" access="read">
|
95 | |
</property>
|
96 | |
<!-- Functions -->
|
97 | |
<method name="GetLayout">
|
98 | |
<arg type="i" name="parentId" direction="in" />
|
99 | |
<arg type="i" name="recursionDepth" direction="in" />
|
100 | |
<arg type="as" name="propertyNames" direction="in" />
|
101 | |
<arg type="u(ia{sv}av)" name="layout" direction="out" />
|
102 | |
</method>
|
103 | |
<method name="GetGroupProperties">
|
104 | |
<arg type="ai" name="ids" direction="in" >
|
105 | |
</arg>
|
106 | |
<arg type="as" name="propertyNames" direction="in" >
|
107 | |
</arg>
|
108 | |
<arg type="a(ia{sv})" name="properties" direction="out" >
|
109 | |
</arg>
|
110 | |
</method>
|
111 | |
<method name="GetProperty">
|
112 | |
<arg type="i" name="id" direction="in">
|
113 | |
</arg>
|
114 | |
<arg type="s" name="name" direction="in">
|
115 | |
</arg>
|
116 | |
<arg type="v" name="value" direction="out">
|
117 | |
</arg>
|
118 | |
</method>
|
119 | |
<method name="Event">
|
120 | |
<arg type="i" name="id" direction="in" >
|
121 | |
</arg>
|
122 | |
<arg type="s" name="eventId" direction="in" >
|
123 | |
</arg>
|
124 | |
<arg type="v" name="data" direction="in" >
|
125 | |
</arg>
|
126 | |
<arg type="u" name="timestamp" direction="in" >
|
127 | |
</arg>
|
128 | |
</method>
|
129 | |
<method name="EventGroup">
|
130 | |
<arg type="a(isvu)" name="events" direction="in">
|
131 | |
</arg>
|
132 | |
<arg type="ai" name="idErrors" direction="out">
|
133 | |
</arg>
|
134 | |
</method>
|
135 | |
<method name="AboutToShow">
|
136 | |
<arg type="i" name="id" direction="in">
|
137 | |
</arg>
|
138 | |
<arg type="b" name="needUpdate" direction="out">
|
139 | |
</arg>
|
140 | |
</method>
|
141 | |
<method name="AboutToShowGroup">
|
142 | |
<arg type="ai" name="ids" direction="in">
|
143 | |
</arg>
|
144 | |
<arg type="ai" name="updatesNeeded" direction="out">
|
145 | |
</arg>
|
146 | |
<arg type="ai" name="idErrors" direction="out">
|
147 | |
</arg>
|
148 | |
</method>
|
149 | |
<!-- Signals -->
|
150 | |
<signal name="ItemsPropertiesUpdated">
|
151 | |
<arg type="a(ia{sv})" name="updatedProps" direction="out" />
|
152 | |
<arg type="a(ias)" name="removedProps" direction="out" />
|
153 | |
</signal>
|
154 | |
<signal name="LayoutUpdated">
|
155 | |
<arg type="u" name="revision" direction="out" />
|
156 | |
<arg type="i" name="parent" direction="out" />
|
157 | |
</signal>
|
158 | |
<signal name="ItemActivationRequested">
|
159 | |
<arg type="i" name="id" direction="out" >
|
160 | |
</arg>
|
161 | |
<arg type="u" name="timestamp" direction="out" >
|
162 | |
</arg>
|
163 | |
</signal>
|
164 | |
<!-- End of interesting stuff -->
|
165 | |
</interface>
|
166 | |
|
167 | |
const StatusNotifierWatcher = <interface name="org.kde.StatusNotifierWatcher">
|
168 | |
<method name="RegisterStatusNotifierItem">
|
169 | |
<arg type="s" direction="in" />
|
170 | |
</method>
|
171 | |
<method name="RegisterNotificationHost">
|
172 | |
<arg type="s" direction="in" />
|
173 | |
</method>
|
174 | |
<property name="RegisteredStatusNotifierItems" type="as" access="read" />
|
175 | |
<method name="ProtocolVersion">
|
176 | |
<arg type="s" direction="out" />
|
177 | |
</method>
|
178 | |
<method name="IsNotificationHostRegistered">
|
179 | |
<arg type="b" direction="out" />
|
180 | |
</method>
|
181 | |
<signal name="ServiceRegistered">
|
182 | |
<arg type="s" direction="out" />
|
183 | |
</signal>
|
184 | |
<signal name="ServiceUnregistered">
|
185 | |
<arg type="s" direction="out" />
|
186 | |
</signal>
|
187 | |
<property name="IsStatusNotifierHostRegistered" type="b" access="read" />
|
188 | |
</interface>;
|
189 | |
|
190 | |
|
|
20 |
if (result) {
|
|
21 |
//HACK: The "" + trick is important as hell because file_get_contents returns
|
|
22 |
// an object (WTF?) but Gio.makeProxyWrapper requires `typeof() == "string"`
|
|
23 |
// Otherwise, it will try to check `instanceof XML` and fail miserably because there
|
|
24 |
// is no `XML` on very recent SpiderMonkey releases (or, if SpiderMonkey is old enough,
|
|
25 |
// will spit out a TypeError soon).
|
|
26 |
return "<node>" + contents + "</node>"
|
|
27 |
} else {
|
|
28 |
throw new Error("AppIndicatorSupport: Could not load file: "+filename)
|
|
29 |
}
|
|
30 |
}
|