Skip to content

feat(tray): add IPC action to open tray menus - #2701

Merged
bbedward merged 2 commits into
duxlabs-dev:masterfrom
lankong0522:feat/tray-menu-ipc
Aug 5, 2026
Merged

bbedward merged 2 commits into
duxlabs-dev:masterfrom
lankong0522:feat/tray-menu-ipc

Conversation

@lankong0522

@lankong0522 lankong0522 commented Jun 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This adds a new tray IPC action:

dms ipc call tray menu <id>

The new action opens the menu for a system tray item using the same item lookup behavior as the existing tray IPC actions.

Implementation

  • Adds an openTrayMenuRequested signal to TrayMenuManager.
  • Adds a menu(itemId) function to the tray IPC handler.
  • Handles the actual menu opening in SystemTrayBar by reusing the existing showForTrayItem() path.

The IPC layer only requests the menu to be opened. It does not attempt to render or display tray menus directly.

Motivation

This makes it possible to open tray item menus from compositor keybindings, for example from niri shortcuts, without manually clicking the tray item in the bar.

Tested

Built and launched the current source tree with:

make run

Verified the tray IPC actions using the locally built binary:

./core/bin/dms ipc call tray list
./core/bin/dms ipc call tray status "Fcitx"
./core/bin/dms ipc call tray activate "Fcitx"
./core/bin/dms ipc call tray menu "Fcitx"
./core/bin/dms ipc call tray menu "nm-applet"
./core/bin/dms ipc call tray menu "definitely-not-existing"

Confirmed that valid tray menus open correctly, existing tray IPC actions continue to work, and missing tray items return the expected error.

@Spoch-dev

This comment was marked as spam.

Comment thread quickshell/Common/TrayMenuManager.qml Outdated

signal openTrayMenuRequested(string itemId)

function requestOpenTrayMenu(itemId) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove this function, its useless

target: TrayMenuManager

function onOpenTrayMenuRequested(itemId) {
const item = root.allTrayItems.find(trayItem => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move findTrayItem to TrayMenuManager instead of duplicating the logic

if (!item || !item.hasMenu)
return;

TrayMenuManager.closeAllMenus();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed, already handled by showForTrayItem

@purian23

purian23 commented Aug 1, 2026

Copy link
Copy Markdown
Member

@lankong0522 following up here to see if we should close this out as stale or if you plan on the follow up on requested changes.

@lankong0522

Copy link
Copy Markdown
Contributor Author

@lankong0522 请关注此处,查看我们是否应将此事删除为过时,或是否计划后续修改请求。

Thanks for following up. I plan to continue working on this PR and address the requested changes. I will rebase the branch onto the latest master, apply the review feedback, retest the feature, and update this PR.

@lankong0522

Copy link
Copy Markdown
Contributor Author

Updated and rebased onto the latest master.

Addressed all requested review changes:

  • Removed the unnecessary requestOpenTrayMenu wrapper.
  • Moved findTrayItem into TrayMenuManager and reused it from both the tray IPC handler and SystemTrayBar.
  • Removed the redundant closeAllMenus() call before showForTrayItem().

I tested the updated implementation locally using the current source tree. The existing tray list, tray status, and tray activate actions still work, and tray menu correctly handles valid menu requests and missing tray items.

@bbedward
bbedward merged commit 2baf048 into duxlabs-dev:master Aug 5, 2026
1 check passed
marcusramberg pushed a commit to marcusramberg/DankMaterialShell that referenced this pull request Sep 2, 2026
* feat(tray): add IPC action to open tray menus

* tray: open IPC-requested menus on the focused screen only

---------

Co-authored-by: bbedward <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants