Skip to content

Commit 9cf08d4

Browse files
committed
dbusMenu: Provide XDG Activation token on menu items activation
Applications may want to perform actions on menu activations, so let's provide them a token proactively.
1 parent 220139e commit 9cf08d4

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

Diff for: dbusMenu.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -577,8 +577,12 @@ const MenuItemFactory = {
577577
},
578578

579579
_onActivate(_item, event) {
580+
const timestamp = event.get_time();
581+
if (timestamp && this._dbusClient.indicator)
582+
this._dbusClient.indicator.provideActivationToken(timestamp);
583+
580584
this._dbusItem.handleEvent('clicked', GLib.Variant.new('i', 0),
581-
event.get_time());
585+
timestamp);
582586
},
583587

584588
_onPropertyChanged(dbusItem, prop, _value) {
@@ -728,12 +732,13 @@ const MenuUtils = {
728732
*/
729733
var Client = class AppIndicatorsClient {
730734

731-
constructor(busName, path) {
735+
constructor(busName, path, indicator) {
732736
this._busName = busName;
733737
this._busPath = path;
734738
this._client = new DBusClient(busName, path);
735739
this._rootMenu = null; // the shell menu
736740
this._rootItem = null; // the DbusMenuItem for the root
741+
this.indicator = indicator;
737742
}
738743

739744
get isReady() {
@@ -825,6 +830,7 @@ var Client = class AppIndicatorsClient {
825830
this._client = null;
826831
this._rootItem = null;
827832
this._rootMenu = null;
833+
this.indicator = null;
828834
}
829835
};
830836
Signals.addSignalMethods(Client.prototype);

Diff for: indicatorStatusIcon.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ class AppIndicatorsIndicatorStatusIcon extends BaseStatusIcon {
265265

266266
if (this._indicator.menuPath) {
267267
this._menuClient = new DBusMenu.Client(this._indicator.busName,
268-
this._indicator.menuPath);
268+
this._indicator.menuPath, this._indicator);
269269
this._menuClient.attachToMenu(this.menu);
270270
}
271271
}

0 commit comments

Comments
 (0)