Skip to content

Commit

Permalink
Add left click event for libappindicator
Browse files Browse the repository at this point in the history
  • Loading branch information
Ximi1970 committed Jan 13, 2019
1 parent 8a1630c commit 5b42769
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
-- 0.6.4 - 13 Jan 2019

- Added left click action for libindicator icon (Thank you for the tip @PlagueCZ)

This "activate" event needs a specially patched version of libappindicator.
For openSuSE, you can find it here:

https://build.opensuse.org/project/show/home:Ximi1970:branches:X11:Unity

Repositories:
https://download.opensuse.org/repositories/home:/Ximi1970:/branches:/X11:/Unity/

The patch used for libappindicator can be found here:

The original patch can be found here (for an old version?);
https://github.com/yuyichao/arch-pkg/blob/facba16172ef6caa7fddd1babb21a9d2d5137f32/pkg/all/libappindicator/activate.patch

My modfied version here:
https://build.opensuse.org/package/view_file/home:Ximi1970:branches:X11:Unity/libappindicator/libappindicator-activate-support.patch?expand=1

-- 0.6.3 - 13 Jan 2019

- Update Russian translation (@vantu5z)
Expand Down
3 changes: 3 additions & 0 deletions src/modules/ctypes/linux/gtk2/appindicator.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ function appindicator_defines(lib) {

this.OnScrollCb_t = ctypes.FunctionType(
ctypes.default_abi, ctypes.void_t, [this.AppIndicator.ptr, gobject.gint, gobject.guint, gobject.gpointer]).ptr;

this.OnActivateCb_t = ctypes.FunctionType(
ctypes.default_abi, ctypes.void_t, [this.AppIndicator.ptr, gobject.gint, gobject.gint, gobject.gpointer]).ptr;
};

var appind = new ctypes_library(APPINDICATOR_LIBNAME, APPINDICATOR_ABIS, appindicator_defines, this);
3 changes: 3 additions & 0 deletions src/modules/ctypes/linux/gtk3/appindicator.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ function appindicator_defines(lib) {

this.OnScrollCb_t = ctypes.FunctionType(
ctypes.default_abi, ctypes.void_t, [this.AppIndicator.ptr, gobject.gint, gobject.guint, gobject.gpointer]).ptr;

this.OnActivateCb_t = ctypes.FunctionType(
ctypes.default_abi, ctypes.void_t, [this.AppIndicator.ptr, gobject.gint, gobject.gint, gobject.gpointer]).ptr;
};

var appind = new ctypes_library(APPINDICATOR_LIBNAME, APPINDICATOR_ABIS, appindicator_defines, this);
10 changes: 10 additions & 0 deletions src/modules/linux/FiretrayAppIndicator.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ firetray.AppIndicator = {
firetray.AppIndicator.onScroll); // void return, no sentinel
gobject.g_signal_connect(this.indicator, "scroll-event",
firetray.AppIndicator.callbacks.onScroll, null);

this.callbacks.onActivate = appind.OnActivateCb_t(
firetray.AppIndicator.onActivate); // void return, no sentinel
gobject.g_signal_connect(this.indicator, "activate-event",
firetray.AppIndicator.callbacks.onActivate, null);
},

attachMiddleClickCallback: function() {
Expand Down Expand Up @@ -112,6 +117,11 @@ firetray.AppIndicator = {
firetray.StatusIcon.onScroll(direction);
},

onActivate: function(indicator, directoin_x, direction_y, data) {
log.debug("AppIndicator activate: x="+directoin_x+" y="+direction_y);
firetray.Handler.showHideAllWindows();
},

}; // AppIndicator

firetray.StatusIcon.initImpl =
Expand Down

0 comments on commit 5b42769

Please sign in to comment.