Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trayicons can't be clicked #5

Open
starrymohannad opened this issue Jun 26, 2023 · 2 comments
Open

Trayicons can't be clicked #5

starrymohannad opened this issue Jun 26, 2023 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@starrymohannad
Copy link

No description provided.

@MadcowOG
Copy link
Owner

MadcowOG commented Jun 28, 2023

The systray patch doesn't implement dbusmenu which some applications require to show menus. I currently don't have plans to implement it.
If someone would like to work on it, this pull request on swaybar appears to be relevant and a good starting point.
I'm going to leave this issue open.

@MadcowOG MadcowOG added the help wanted Extra attention is needed label Jun 28, 2023
@starrymohannad starrymohannad reopened this Aug 3, 2023
@0mark
Copy link

0mark commented Nov 5, 2023

As a short term solution i use a modified version of dbusmenu.py and call it in systray instead of sd_bus_call_method_async (if item has a menu_path and not is_menu).

Patch for dbusmenu.py:

65c65
< def show_menu(session_bus, bus, path):
---
> def show_menu(session_bus, bus, path, num):
69c69
<       _, item = iface.GetLayout(0, -1, [])
---
>       _, item = iface.GetLayout(int(num), -1, [])
97,98c97,98
<       if len(sys.argv) == 3:
<               show_menu(session_bus, sys.argv[1], sys.argv[2])
---
>       if len(sys.argv) == 4:
>               show_menu(session_bus, sys.argv[1], sys.argv[2], sys.argv[3])

Call in systray in user.c (instead of sd_bus_call_method_async(item->tray->bus, NULL, item->service, item->path, item->interface, method, NULL, NULL, "ii", click->x, click->y); ):

if(item->menu_path!=NULL && item->is_menu!=0) {
	cmd[1] = item->service;
	cmd[2] = item->menu_path;

	if (STRING_EQUAL(method, "Activate")) {
		cmd[3] = "0";
	} else if (STRING_EQUAL(method, "SecondaryActivate")) {
		cmd[3] = "1";
	} else if (STRING_EQUAL(method, "ContextMenu")) {
		cmd[3] = "2";
	} else {
		printf("Unknown method \"%s\", using \"Activate\"\n", method);
		cmd[3] = "0";
	}
	arg2.v = cmd;
	spawn(monitor, -1, NULL, &arg2);
} else {
	sd_bus_call_method_async(item->tray->bus, NULL, item->service, item->path, item->interface, method, NULL, NULL, "ii", click->x, click->y);
}

This seems to work so far, although it does look kinda ugly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants