Update README

This commit is contained in:
Grégory Soutadé 2020-11-18 16:20:12 +01:00
parent 4c52c9fa8e
commit d756ef2c1e

View File

@ -23,18 +23,14 @@ All functions read JSON formatted parameters
notify(): notify():
{ {
"group": "groupname", "group": "groupname",
// item can have text and/or icon, other are optional
// click action can be : "signal" or "delete"
// box property can be : "left", "center" or "right"
"items": [ "items": [
{ {
"name" : "", "name" : "",
"text":"", "box" : "", // Optional : left, right or center
"style":"", "text" : <text_object>, // Optional
"icon-style":"", "icon" : <icon_object>, // Optional
"icon":"", "popup" : <popup_object>, // Optional
"on-click":"", <signals_description>, // Optional
"box":"",
}, ... }, ...
] ]
} }
@ -50,9 +46,75 @@ All functions read JSON formatted parameters
"groups": ["<groupName>", ...] "groups": ["<groupName>", ...]
} }
openPopup():
{
"item": "<itemName>@<groupName>"
}
When text/icon is clicked and on-click parameter is set to "signal", closePopup():
extension emit one of the following signals : {
"item": "<itemName>@<groupName>"
}
togglePopup():
{
"item": "<itemName>@<groupName>"
}
DBUS object
===========
<text_object> is defined as :
{
"text" : "Text to be displayed",
"style" : "CSS style to be applied", // Optional
}
<icon_object> is defined as :
{
"path" : "Icon path",
"style" : "CSS style to be applied", // Optional
}
<picture_object> is defined as :
{
"path" : "Icon path",
"width" : XXX, // Optional : Force width in pixels, can be -1 for defaut value
"height" : XXX, // Optional : Force height in pixels, can be -1 for defaut value
}
<popup_object is defuned as :
{
"items": [<text_objects> and/or <picture_objects>]
}
Signals description
===================
Signals can be :
"on-click" : ["signal"|"delete"|"open-popup"|"close-popup"|"toggle-popup"]
"on-dblclick" : ["signal"|"delete"|"open-popup"|"close-popup"|"toggle-popup"]
"on-rightclick" : ["signal"|"delete"|"open-popup"|"close-popup"|"toggle-popup"]
"on-rightdblclick" : ["signal"|"delete"|"open-popup"|"close-popup"|"toggle-popup"]
"on-enter" : ["signal"|"delete"|"open-popup"|"close-popup"|"toggle-popup"]
"on-leave" : ["signal"|"delete"|"open-popup"|"close-popup"|"toggle-popup"]
"on-scroll" : ["signal"|"delete"|"open-popup"|"close-popup"|"toggle-popup"]
<!!> WARNING <!!> : It seems that GNOME 3.38.0 had some troubles managing on-enter/on-leave signal
Targets :
* signal : emit a signal to desktop application
* delete : Delete item
* open-popup : Open the popup if there is one
* close-popup : Close the popup if there is one
* toggle-popup : Toggle (open/close) the popup if there is one
Signal names emit when action "signal" is specified :
* onClick * onClick
* onRightClick * onRightClick
@ -63,6 +125,8 @@ extension emit one of the following signals :
* onScrollUp * onScrollUp
* onScrollDown * onScrollDown
Each signal is sent with one parameter : "<itemName>@<groupName>"
Other signals are available when extension is activated/deactivated : Other signals are available when extension is activated/deactivated :
* onActivate * onActivate
@ -74,7 +138,7 @@ Example
You can test it with command line : You can test it with command line :
gdbus call --session --dest org.gnome.Shell --object-path /com/soutade/GenericMonitor --method com.soutade.GenericMonitor.notify '{"group":"new","items":[{"name":"first","on-enter":"open-popup","on-leave":"close-popup","text":"Hello","style":"color:green","popup":{"items":[{"picture":{"path":"/tmp/cat2.jpg"}}]}}]}' 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":"Hello","style":"color:green","popup":{"items":[{"picture":{"path":"/tmp/cat2.jpg"}}]}}]}'
gdbus call --session --dest org.gnome.Shell --object-path /com/soutade/GenericMonitor --method com.soutade.GenericMonitor.deleteGroups '{"groups":["new"]}' gdbus call --session --dest org.gnome.Shell --object-path /com/soutade/GenericMonitor --method com.soutade.GenericMonitor.deleteGroups '{"groups":["new"]}'