Is it possible to add to or edit the Session Indicator menu items?
Is there an easy way to do this, or would it involve recompiling a custom build?
I cannot find much relating to this online.
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.
Sign up to join this communitysome refs:
- jimi312 / Titlebar Menu / source — Bitbucket:
- Programming with DBus using PyQt
- Unity/QA/StateIntrospection - Ubuntu Wiki: especially example code
At the moment passive querying can extract information such as shown in this post:
How does one find out which application is associated with an indicator icon? .
I am also exploring the answer to this question as it relates to DBus, to use as high a level interface as possible to avoid low level programming. The ultimate objective is to create a utility that minimally identifies the host applications of the indicators and the sub-apps of their component menus. Maximally it would allow modifications to the menus such as the session-indicator
menu including the top level menu, ie. the icon indicator of the unity-panel itself.
It would be good to know which, (if any!) modifier methods exist in the DBus environment to modify the DBus, so the indicator panel
and it's components, such as Session Indicator
, could be modified as you require.
The following commands reveal the interface methods to manipulate the session indicator
bus information but unfortunately the parameters used in these methods are not described here - the reference above supplies links to the documents describing the general indicator interfacing - but specifics for the session indicator
are still needed.
The output from
qdbus --session com.canonical.indicator.session
implicates the existence of menu interfaces as the items below:
/
/org
/org/ayatana
/org/ayatana/indicator
/org/ayatana/indicator/service
/com
/com/canonical
/com/canonical/indicator
/com/canonical/indicator/users
/com/canonical/indicator/users/menu
/com/canonical/indicator/session
/com/canonical/indicator/session/service
/com/canonical/indicator/session/menu
The interfaces can be examined with:
gdbus introspect --session --dest com.canonical.indicator.session \
--object-path /com/canonical/indicator/users/menu --recurse
and
gdbus introspect --session --dest com.canonical.indicator.session \
--object-path /com/canonical/indicator/session/menu --recurse
Note the internal reference to interface com.canonical.dbusmenu
.
For a real comprehensive dump use:
gdbus introspect --session --dest com.canonical.indicator.session --object-path / --recurse
Several sub-apps are bound to the session indicator
drop down menu but what is not clear is whether these interface methods just transfer data to the associated sub-menu apps or whether in fact there is a communication channel to the session indicator app itself so its menu can be "methodized".
Also,
qdbus --literal --session com.canonical.AppMenu.Registrar \
/com/canonical/AppMenu/Registrar \
com.canonical.AppMenu.Registrar.GetMenus \
| sed -e 's/], \[/],\n[/g' | sort -k 4 -V
provides a list of interface menu associations (there are menus
for the windows and also for the indicators like the session indicator
, which is which in the list below still needs determination)
[Argument: (uso) 25167301, ":1.22", [ObjectPath: /com/canonical/menu/18005C5]],
[Argument: (uso) 25165828, ":1.22", [ObjectPath: /com/canonical/menu/1800004]],
[Argument: (uso) 48234500, ":1.81", [ObjectPath: /com/canonical/menu/2E00004]],
[Argument: (uso) 55244411, ":1.114", [ObjectPath: /com/canonical/menu/34AF67B]],
[Argument: (uso) 55370996, ":1.114", [ObjectPath: /com/canonical/menu/34CE4F4]],
...
[Argument: (uso) 65083174, ":1.275", [ObjectPath: /com/canonical/menu/3E11726]],
[Argument: (uso) 65085474, ":1.275", [ObjectPath: /com/canonical/menu/3E12022]],
Examining
qdbus --session com.canonical.AppMenu.Registrar /com/canonical/AppMenu/Registrar
it may be these methods are useful:
method void org.freedesktop.DBus.Properties.Set(QString interface_name, QString property_name, QDBusVariant value
method void com.canonical.AppMenu.Registrar.RegisterWindow(uint windowId, QDBusObjectPath menuObjectPath)
method void com.canonical.AppMenu.Registrar.UnregisterWindow(uint windowId)
Note the parameter identified as menuObjectPath
. These method names are qualified
with {un}RegisterWindow
, so the methods perhaps are irrelevant to indicator menues.
Once the correct methods with their parameters are identified it is easier to use qdbus
(cannot use QVariant parameters however) or D-Feet
than gdbus
to invoke the methods.
Basically qdbus
and gdbus
are functionally the same and use identical parameters except:
qdbus
does not identify the separate components with --dest, --object-path, --method, ...
but instead requires the corresponding attributes be given in exact order gdbus
method calls handle more parameter typesqdbus
is not as exhaustive asgdbus
especially w/ --recurse
qdbus
can expediently extract its command parameter sequence via double or triple click from its output w/ a middle click to concatenate it to the end of the commandThe answer
How does one find out which application is associated with an indicator icon?
in the post mentioned above describes how to use qdbus
as an expedient technique to compose the scripts.
The manpage man gdbus
(or gdbus:
) has a better exposition than man qdbus
but consider D-Feet
.