1 | Introduction␊ |
2 | ------------␊ |
3 | ␊ |
4 | This GNOME Shell Extension aims to display information to center box. Using DBUS protocol, any application can add or remove text and icons in the upper bar, right after date & clock.␊ |
5 | ␊ |
6 | ␊ |
7 | Installation␊ |
8 | ------------␊ |
9 | ␊ |
10 | Install it from https://extensions.gnome.org/extension/2826/generic-monitor/␊ |
11 | ␊ |
12 | OR␊ |
13 | ␊ |
14 | Create a symbolic link from your _.local_ directory and enable extension␊ |
15 | ␊ |
16 | ln -s $PWD/generic-monitor@gnome-shell-extensions/ ~/.local/share/gnome-shell/extensions/␊ |
17 | gnome-extensions enable generic-monitor@gnome-shell-extensions␊ |
18 | ␊ |
19 | Restart GNOME␊ |
20 | ␊ |
21 | ␊ |
22 | DBUS protocol␊ |
23 | -------------␊ |
24 | ␊ |
25 | All functions read JSON formatted parameters␊ |
26 | ␊ |
27 | notify():␊ |
28 | {␊ |
29 | "group": "groupname",␊ |
30 | "items": [␊ |
31 | {␊ |
32 | ␉ "name" : "",␊ |
33 | ␉ "box" : ["left"|"center"|"right"], // Optional : center by default␊ |
34 | ␉ "text" : <text_object>, // Optional␊ |
35 | ␉ "icon" : <icon_object>, // Optional␊ |
36 | ␉ "popup" : <popup_object>, // Optional␊ |
37 | ␉ <signals_description>, // Optional␊ |
38 | }, ...␊ |
39 | ]␊ |
40 | }␊ |
41 | }␊ |
42 | ␊ |
43 | deleteItems():␊ |
44 | {␊ |
45 | "items": ["<itemName>@<groupName>", ...]␊ |
46 | }␊ |
47 | ␊ |
48 | deleteGroups():␊ |
49 | {␊ |
50 | "groups": ["<groupName>", ...]␊ |
51 | }␊ |
52 | ␊ |
53 | openPopup():␊ |
54 | {␊ |
55 | "item": "<itemName>@<groupName>"␊ |
56 | }␊ |
57 | ␊ |
58 | closePopup():␊ |
59 | {␊ |
60 | "item": "<itemName>@<groupName>"␊ |
61 | }␊ |
62 | ␊ |
63 | togglePopup():␊ |
64 | {␊ |
65 | "item": "<itemName>@<groupName>"␊ |
66 | }␊ |
67 | ␊ |
68 | ␊ |
69 | DBUS object␊ |
70 | ===========␊ |
71 | ␊ |
72 | <text_object> is defined as :␊ |
73 | "text" : {␊ |
74 | "name" : "" // Optional, used with popup nested element␊ |
75 | <signals_description>, // Optional, used with popup nested element␊ |
76 | "text" : "Text to be displayed",␊ |
77 | "style" : "CSS style to be applied", // Optional␊ |
78 | }␊ |
79 | ␊ |
80 | <icon_object> is defined as :␊ |
81 | "icon" : {␊ |
82 | "path" : "Icon path",␊ |
83 | "style" : "CSS style to be applied", // Optional␊ |
84 | }␊ |
85 | ␊ |
86 | <picture_object> is defined as :␊ |
87 | "picture" : {␊ |
88 | "name" : "" // Optional, used with popup nested element␊ |
89 | <signals_description>, // Optional, used with popup nested element␊ |
90 | "path" : "Icon path",␊ |
91 | "width" : XXX, // Optional : Force width in pixels, can be -1 for defaut value␊ |
92 | "height" : XXX, // Optional : Force height in pixels, can be -1 for defaut value␊ |
93 | }␊ |
94 | ␊ |
95 | <popup_object is defuned as :␊ |
96 | "popup" : {␊ |
97 | "items": [<text_objects> and/or <picture_objects>]␊ |
98 | }␊ |
99 | ␊ |
100 | ␊ |
101 | Signals description␊ |
102 | ===================␊ |
103 | ␊ |
104 | Signals can be :␊ |
105 | ␊ |
106 | "on-click" : ["signal"|"delete"|"open-popup"|"close-popup"|"toggle-popup"]␊ |
107 | "on-dblclick" : ["signal"|"delete"|"open-popup"|"close-popup"|"toggle-popup"]␊ |
108 | "on-rightclick" : ["signal"|"delete"|"open-popup"|"close-popup"|"toggle-popup"]␊ |
109 | "on-rightdblclick" : ["signal"|"delete"|"open-popup"|"close-popup"|"toggle-popup"]␊ |
110 | "on-enter" : ["signal"|"delete"|"open-popup"|"close-popup"|"toggle-popup"]␊ |
111 | "on-leave" : ["signal"|"delete"|"open-popup"|"close-popup"|"toggle-popup"]␊ |
112 | "on-scroll" : ["signal"|"delete"|"open-popup"|"close-popup"|"toggle-popup"]␊ |
113 | ␊ |
114 | Targets :␊ |
115 | ␊ |
116 | * signal : Emit a signal to desktop application␊ |
117 | * delete : Delete item␊ |
118 | * open-popup : Open the popup if there is one␊ |
119 | * close-popup : Close the popup if there is one␊ |
120 | * toggle-popup : Toggle (open/close) the popup if there is one␊ |
121 | ␊ |
122 | ␊ |
123 | Signal names emit when action "signal" is specified :␊ |
124 | ␊ |
125 | * onClick␊ |
126 | * onDblClick␊ |
127 | * onRightClick␊ |
128 | * onRightDblClick␊ |
129 | * onEnter␊ |
130 | * onLeave␊ |
131 | * onScrollUp␊ |
132 | * onScrollDown␊ |
133 | ␊ |
134 | Each signal is sent with one parameter : "<itemName>@<groupName>"␊ |
135 | For popup nested elements, parameter is "<nestedName>@<itemName>@<groupName>"␊ |
136 | where nestedName can be empty if not defined by user␊ |
137 | ␊ |
138 | Other signals are available when extension is activated/deactivated :␊ |
139 | ␊ |
140 | * onActivate␊ |
141 | * onDeactivate␊ |
142 | ␊ |
143 | ␊ |
144 | Example␊ |
145 | -------␊ |
146 | ␊ |
147 | You can test it with command line :␊ |
148 | ␊ |
149 | gdbus call --session --dest org.gnome.Shell --object-path /com/soutade/GenericMonitor --method com.soutade.GenericMonitor.notify '{"group":"new","items":[{"name":"first","on-click":"toggle-popup","text":{"text":"Hello","style":"color:green"},"popup":{"items":[{"picture":{"path":"/tmp/cat.jpg"}}]}}]}'␊ |
150 | ␊ |
151 | gdbus call --session --dest org.gnome.Shell --object-path /com/soutade/GenericMonitor --method com.soutade.GenericMonitor.deleteGroups '{"groups":["new"]}'␊ |
152 | ␊ |
153 | Python examples are available @ https://indefero.soutade.fr/p/genericmonitor/source/tree/master/examples␊ |
154 | ␊ |
155 | ␊ |
156 | Development␊ |
157 | -----------␊ |
158 | ␊ |
159 | After doing code update, you can test it within a nested window. In other cases you have to restart GNOME.␊ |
160 | ␊ |
161 | dbus-run-session -- gnome-shell --nested [--wayland]␊ |
162 | ␊ |
163 | To see log & errors :␊ |
164 | ␊ |
165 | journalctl /usr/bin/gnome-shell␊ |
166 | ␊ |
167 | ␊ |
168 | Licence␊ |
169 | -------␊ |
170 | ␊ |
171 | GNU GPL 3 |