hydrusnetwork / hydrusnetwork/hydrus

Tray icon goes blank after closing to tray

Open Beginner friendly
#2,091 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
3.2k
Forks
207
PR merge metrics
No merged PRs in 30d

Description

Hydrus version

v683

Qt major version

Qt 6

Operating system

Linux (specify distro and version in comments)

Install method

Third party (AUR, Docker, Chocolatey, etc. Specify in comments)

Install and OS comments

I'm running NixOS and have Hydrus installed through nixpkgs.

Bug description and reproduction

I have Hydrus set to close to tray, and in my system tray (polybar) the Hydrus icon goes blank once it's hidden. Showing Hydrus again makes the icon visible again. It only happens after a show and then a hide; if Hydrus boots straight into the tray there's no issue.

I managed to fix the issue with Claude, and it seems to be working without issue:

_SystemTrayHide hides every visible top level widget, and QSystemTrayIcon creates its own top level window, so the tray icon gets hidden along with the GUI. QSystemTrayIcon.isVisible() still returns True afterwards, so the show() in _UpdateSystemTrayIcon is a no-op and nothing brings the icon back. _SystemTrayShow re-shows everything it hid, including that window, which is why showing the client makes the icon reappear.

Skipping that window in the sweep is a one line fix:

visible_tlws = [ tlw for tlw in QW.QApplication.topLevelWidgets() if ( tlw.isVisible() or tlw.isMinimized() ) and tlw.metaObject().className() != 'QSystemTrayIconSys' ]

Matching on the class name is a bit gross; BypassWindowManagerHint is public API and is also set on that window, but it's broader.

Claude's fix is here on my fork. https://github.com/ElnuDev/hydrus/commit/8dcd4677

I've tested this on v683, but this should work in v687 as well.

Thank you!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating _SystemTrayHide, _SystemTrayShow, and _UpdateSystemTrayIcon, then reproduce a show-and-hide cycle on Linux with Qt 6. Check how top-level widgets are selected during hiding and how the tray icon is updated. Done means the icon remains visible after the application is hidden and reappears when the application is shown.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, python
Domain
desktop
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.