linuxmint / cinnamon

A Linux desktop featuring a traditional layout, built from modern technology and introducing brand new innovative features.
GNU General Public License v2.0
4.57k stars 745 forks source link

System tray applet disappears from the panel on monitor wakeup (dual monitors) #11347

Open MaxMotovilov opened 1 year ago

MaxMotovilov commented 1 year ago
 * Cinnamon version 5.4.12
 * Distribution - Mint 21
 * Graphics hardware:
   * NVIDIA GeForce GTX 1660 Ti
   * Driver Version: 525.60.11
   * 2 x Samsung U28E510 (DP-0, DP-2)
 * 64 bit
 * .xsession-errors snippet
======================
(cinnamon:7537): St-CRITICAL **: 10:20:14.563: cr_parser_new_from_buf: assertion 'a_buf && a_len' failed

(cinnamon:7537): St-CRITICAL **: 10:20:14.563: cr_declaration_parse_list_from_buf: assertion 'parser' failed

** (csd-color:7344): WARNING **: 10:20:14.814: no xrandr-Samsung Electric Company-U28E510-HTPH503516 device found: Failed to find output xrandr-Samsung Electric Company-U28E510-HTPH50
3516

(cinnamon:7537): Gjs-WARNING **: 10:20:15.224: JS ERROR: Exception in callback for signal: monitors-changed: TypeError: this.findMonitorForActor(...) is undefined
_updateVisibility@/usr/share/cinnamon/js/ui/layout.js:593:27
_relayout@/usr/share/cinnamon/js/ui/layout.js:616:14
_emit@resource:///org/gnome/gjs/modules/core/_signals.js:114:47
_monitorsChanged@/usr/share/cinnamon/js/ui/layout.js:157:14

Gjs-Message: 10:20:15.260: JS LOG: [LookingGlass/info] Adding systray: shutter (32x32px)
Gjs-Message: 10:20:15.263: JS LOG: [LookingGlass/info] Adding systray: shutter (32x32px)
Gjs-Message: 10:20:15.265: JS LOG: [LookingGlass/info] Adding systray: shutter (32x32px)
Gjs-Message: 10:20:15.272: JS LOG: [LookingGlass/info] Adding systray: shutter (32x32px)
Gjs-Message: 10:20:15.274: JS LOG: [LookingGlass/info] [weather@mockturtl#17]: Removing applet instance...

(cinnamon:7537): Gjs-WARNING **: 10:20:15.298: JS ERROR: Exception in callback for signal: monitors-changed: TypeError: this.findMonitorForActor(...) is undefined
_updateVisibility@/usr/share/cinnamon/js/ui/layout.js:593:27
_relayout@/usr/share/cinnamon/js/ui/layout.js:616:14
_emit@resource:///org/gnome/gjs/modules/core/_signals.js:114:47
_monitorsChanged@/usr/share/cinnamon/js/ui/layout.js:157:14

(cinnamon:7537): Gjs-WARNING **: 10:20:15.300: JS ERROR: Exception in callback for signal: monitors-changed: TypeError: this.findMonitorForActor(...) is undefined
_updateVisibility@/usr/share/cinnamon/js/ui/layout.js:593:27
_relayout@/usr/share/cinnamon/js/ui/layout.js:616:14
_emit@resource:///org/gnome/gjs/modules/core/_signals.js:114:47
_monitorsChanged@/usr/share/cinnamon/js/ui/layout.js:157:14

(cinnamon:7537): Gjs-CRITICAL **: 10:20:15.308: JS ERROR: TypeError: monitor is undefined
show@/usr/share/cinnamon/js/ui/tooltips.js:359:17
_onShowTimerComplete@/usr/share/cinnamon/js/ui/tooltips.js:134:18

** (csd-color:7344): WARNING **: 10:20:15.663: failed to reset xrandr-Samsung Electric Company-U28E510-HTPH503422 gamma tables: gamma size is zero

** (csd-color:7344): WARNING **: 10:20:15.664: failed to reset xrandr-Samsung Electric Company-U28E510-HTPH503516 gamma tables: gamma size is zero

** (csd-color:7344): WARNING **: 10:20:15.664: failed to reset xrandr-Samsung Electric Company-U28E510-HTPH503422 gamma tables: gamma size is zero

** (csd-color:7344): WARNING **: 10:20:15.664: failed to reset xrandr-Samsung Electric Company-U28E510-HTPH503516 gamma tables: gamma size is zero

** (csd-color:7344): WARNING **: 10:20:15.664: failed to reset xrandr-Samsung Electric Company-U28E510-HTPH503422 gamma tables: gamma size is zero

** (csd-color:7344): WARNING **: 10:20:15.664: failed to reset xrandr-Samsung Electric Company-U28E510-HTPH503516 gamma tables: gamma size is zero
Gjs-Message: 10:20:16.329: JS LOG: [LookingGlass/warning] Failed to add launcher from path: firefox.desktop
Gjs-Message: 10:20:16.588: JS LOG: [LookingGlass/info] [weather@mockturtl#17]: Internet access now available, resuming operations.

** (cinnamon:7537): CRITICAL **: 10:20:16.646: na_tray_manager_manage_screen: assertion 'manager->screen == NULL' failed

(cinnamon:7537): St-CRITICAL **: 10:20:16.693: cr_parser_new_from_buf: assertion 'a_buf && a_len' failed

(cinnamon:7537): St-CRITICAL **: 10:20:16.694: cr_declaration_parse_list_from_buf: assertion 'parser' failed

(cinnamon:7537): St-CRITICAL **: 10:20:16.694: cr_parser_new_from_buf: assertion 'a_buf && a_len' failed

(cinnamon:7537): St-CRITICAL **: 10:20:16.694: cr_declaration_parse_list_from_buf: assertion 'parser' failed
Gjs-Message: 10:20:16.918: JS LOG: calendar@cinnamon.org: Calendar events supported.

** (csd-power:7360): CRITICAL **: 10:20:16.934: abs_to_percentage: assertion 'max > min' failed
Gjs-Message: 10:20:16.962: JS LOG: Unknown network device type, is 14
Gjs-Message: 10:20:16.974: JS LOG: [LookingGlass/info] Adding XAppStatusIcon: mintUpdate.py (:1.925/org/x/StatusIcon/Icon)
Gjs-Message: 10:20:16.983: JS LOG: [LookingGlass/info] Adding XAppStatusIcon: birdtray (:1.1001/org/x/StatusIcon/Icon_2)
Gjs-Message: 10:20:16.990: JS LOG: [LookingGlass/info] Adding XAppStatusIcon: skype1 (:1.1001/org/x/StatusIcon/Icon)
Gjs-Message: 10:20:16.996: JS LOG: [LookingGlass/info] Adding XAppStatusIcon: slack1 (:1.1001/org/x/StatusIcon/Icon_1)
Gjs-Message: 10:20:17.003: JS LOG: [LookingGlass/info] Adding XAppStatusIcon: mintreport (:1.105/org/x/StatusIcon/Icon)
Gjs-Message: 10:20:17.049: JS LOG: [LookingGlass/info] Adding XAppStatusIcon: process-monitor (:1.105/org/x/StatusIcon/Icon_1)
Gjs-Message: 10:20:17.078: JS LOG: [LookingGlass/info] Hiding XAppStatusIcon (we have an applet): nm-applet
Gjs-Message: 10:20:17.798: JS LOG: [LookingGlass/info] [weather@mockturtl#17]: Weather Information refreshed

(cinnamon:7537): St-CRITICAL **: 10:20:17.881: cr_parser_new_from_buf: assertion 'a_buf && a_len' failed

(cinnamon:7537): St-CRITICAL **: 10:20:17.881: cr_declaration_parse_list_from_buf: assertion 'parser' failed
Window manager warning: Buggy client sent a _NET_ACTIVE_WINDOW message with a timestamp of 0 for 0x760003a
cinnamon-session[7203]: WARNING: t+340516.94077s: Detected that screensaver has left the bus
Window manager warning: META_CURRENT_TIME used to choose focus window; focus window may not be correct.
========

Issue

System tray applet (systray@cinnamon.org) containing a single app icon (shutter) disappears or collapses when the monitors wake up from powersave. Restarting Cinnamon brings it back.

Steps to reproduce

  1. xset dpms force off
  2. Wake up the monitors.
  3. Observe the absence of the icon.

Other information

The monitor configuration is as follows: DP0=primary, DP2=secondary. The system tray applet is located in the top panel of the secondary monitor.

The exception stack from .xsession-errors points to a place in the code that looks suspicious to me:

Exception in callback for signal: monitors-changed: TypeError: this.findMonitorForActor(...) is undefined
_updateVisibility@/usr/share/cinnamon/js/ui/layout.js:593:27
_relayout@/usr/share/cinnamon/js/ui/layout.js:616:14
_emit@resource:///org/gnome/gjs/modules/core/_signals.js:114:47
_monitorsChanged@/usr/share/cinnamon/js/ui/layout.js:157:14
            else if (!actorData.visibleInFullscreen &&
                     this.findMonitorForActor(actorData.actor).inFullscreen)
                visible = false;

From investigating other visual issues I am quite positive the two monitors do not wake up simultaneously and there have to be [at least] two monitors-changed events. During the first of them, one of the monitors (likely secondary) is absent from xrandr list and it would not be surprising for findMonitorForActor() to return undefined. Perhaps a small defensive programming measure is all that's required. Will try and see.

MaxMotovilov commented 1 year ago

Will try and see.

Did not solve the issue. With /usr/share/cinnamon/js/ui/layout.js modified as follows:

$ diff /usr/share/cinnamon/js/ui/layout.js /usr/share/cinnamon/js/ui/layout.js.backup
576c576,577
<       let monitor = this.findMonitorForActor(actorData.actor);
---
>             else if (global.stage_input_mode == Cinnamon.StageInputMode.FULLSCREEN) {
>                 let monitor = this.findMonitorForActor(actorData.actor);
578d578
<             if (global.stage_input_mode == Cinnamon.StageInputMode.FULLSCREEN) {
592c592,593
<             else if (!actorData.visibleInFullscreen && monitor && monitor.inFullScreen)
---
>             else if (!actorData.visibleInFullscreen &&
>                      this.findMonitorForActor(actorData.actor).inFullscreen)

the issue persists, although the exception trace is no longer present in .xsession-errors. Attaching the full set of messages added to the latter during monitor wakeup sequence. xsession-errors.incremental.txt

LarsCarlin commented 1 year ago

Have similar problem after upgrading to Mint 21.1 but ONLY with dual 4K monitors, DP0=primary, DP2=secondary, system trap displayed ONLY on main monitor. Bug does not appear on single monitors. System tray IS visible on monitor wakeup. (unlike MaxMotovilov) Error occurs If you toggle ON Panel Edit Mode. This causes the right side System Tray icons to drop BELOW the bar (Invisible) If you TOGGLE the Panel-Edit, the tray REAPPEARS for ONE SECOND before disappearing again. Toggling the Panel-Edit OFF, does NOT return the right side system tray. Left side is well-behaved. Moving the panel bar to the top position has no effect on the error - It still disappears. It worked perfectly in the previous version. Restarting Cinnamon returns the tray to its proper (visible) position.

mtwebster commented 1 year ago

@LarsCarlin Is this the systray@cinnamon.org applet or xapp-status@cinnamon.org?

Do you have multiple tray applets enabled?

The systray one only supports a single instance, while the xapp you can have as many as you want.

LarsCarlin commented 1 year ago

Both were active. Removed xapp-status@cinnamon.org leaving systray@cinnamon.org.

Toggling Panel Edit mode produces the same effect with the addition that the icons seem at least 4x larger as they disappear just below the bar. Restarting cinnamon resets them.

Yes, have other applets; like BT, printers, etc. Same as I had before 21.1. SysTray

I'm glad to run any tests or help ferret out the issue.

MaxMotovilov commented 1 year ago

The systray one only supports a single instance, while the xapp you can have as many as you want.

@mtwebster empirically, only the systray seems to be able to show Shutter's status icon. I wouldn't even use systray if it wasn't for that. Any particular reason you could think of (like, different APIs/versions in play)? I do know Shutter is written in Perl (ouch)...

mtwebster commented 1 year ago

I just fixed an issue that I think was the problem with edit mode.

I can't reproduce anything involving dpms - no errors, warnings, anything, though I am on Cinnamon 5.6 now.

Can you try reproducing the sleep/dpms issue on a new user account?

Tibladar commented 1 year ago

For the exception there's already PR #11348 pending

MaxMotovilov commented 1 year ago

Can you try reproducing the sleep/dpms issue on a new user account?

Reproduces. Steps as follows:

It is not inconceivable it would repro with simpler steps but I tried to roughly recreate my normal desktop...

MaxMotovilov commented 1 year ago

I can't reproduce anything involving dpms - no errors, warnings, anything, though I am on Cinnamon 5.6 now.

Does Vera (21.1) have 5.6? I'll try upgrading... was reluctant 'cause I had just spent a ton of time moving from 19.3 on mdraid to 21 on ZFS and felt like I've done enough sysadmin work to last me a quarter :grinning:

Tibladar commented 1 year ago

Does Vera (21.1) have 5.6?

Yes, currently 5.6.5

LarsCarlin commented 1 year ago

[FIXED] I made these changes by @mtwebster https://github.com/linuxmint/cinnamon/commit/fa4960a6e8070ac44643f56934b674091d2ab4c4 and it fixed the error where systray icons disappeared after toggling Panel Edit Mode. Tested new code with 4K single monitor AND 4K dual monitor

  1. Running Linux Mint 21.1 with Cinnamon 5.6.5
  2. Using dual monitors (4k) with menu and system tray on primary monitor only
  3. Turning Panel Edit Mode -> ON and OFF
  4. System tray icons on right side would drop below the screen and size was enlarged several times. This error was present even if tray was moved to top of screen.

Bug fix for Icons not resizing after toggled panel edit mode Seemed to occur ONLY with dual monitor 4k. Single 4k monitor worked fine.
Changes to applet.js /usr/share/cinnamon/applets/systray@cinnamon.org/applet.js

sections commented out are orig code new code immediately below 5 lines changed; from lines 102..121 Fri 23 Dec 2022 02:54:06 PM CST

//resizeIcons(size) { // this.icon_size = size global.ui_scale; resizeIcons() { this.icon_size = this.getPanelIconSize() global.ui_scale; Main.statusIconDispatcher.redisplay(); }

on_panel_icon_size_changed(size) {
    //this.resizeIcons(size);
    this.resizeIcons();
}

on_panel_edit_mode_changed() {
    //this.resizeIcons(this.icon_size);
    this.resizeIcons();
}

uiScaleChanged() {
    if (this._scaleUpdateId > 0) {
        Mainloop.source_remove(this._scaleUpdateId);
    }

    this._scaleUpdateId = Mainloop.timeout_add(1500, () => {
        //this.resizeIcons(this.getPanelIconSize());
        this.resizeIcons();

        this._scaleUpdateId = 0;
        return GLib.SOURCE_REMOVE;
    });
}
MaxMotovilov commented 1 year ago

I can't reproduce anything involving dpms - no errors, warnings, anything, though I am on Cinnamon 5.6 now.

Does Vera (21.1) have 5.6? I'll try upgrading... was reluctant 'cause I had just spent a ton of time moving from 19.3 on mdraid to 21 on ZFS and felt like I've done enough sysadmin work to last me a quarter grinning

Upgraded to Vera - no improvement.

MaxMotovilov commented 1 year ago

After recent upgrade to 5.6.6 the issue (disappearance of systray after monitor wakeup) still there and I see a new error in the log:

JS ERROR: Exception in callback for signal: status-icon-removed: TypeError: parent is null
_onTrayIconRemoved@/usr/share/cinnamon/applets/systray@cinnamon.org/applet.js:218:9
_emit@resource:///org/gnome/gjs/modules/core/_signals.js:114:47
_onTrayIconRemoved@/usr/share/cinnamon/js/ui/statusIconDispatcher.js:64:14

@mtwebster

mcopik commented 1 year ago

Same problem here - the problem started only after adding a second 4K display. I have to restart cinnamon every time monitors turn off, and after every wake-up from suspend.

Cinnamon 5.6.8.

romario74 commented 10 months ago

I still have the same issue with 6.0.2, two 4k displays. Sys: Manjarop testing $ cinnamon --version Cinnamon 6.0.2

LarsCarlin commented 10 months ago

Did you make the documented changes to applet.js? /usr/share/cinnamon/applets/systray@cinnamon.org/applet.js

vasya-kurochkin commented 1 month ago

I have the same issue on Cinnamon 6.0.4 with one non-4k monitor. Every time the monitor wakes up, systray disappears and the following errors appear in the log:

** (cinnamon:482956): CRITICAL **: 17:08:26.037: na_tray_manager_manage_screen: assertion 'manager->screen == NULL' failed

** (csd-power:3634): CRITICAL **: 17:08:26.071: abs_to_percentage: assertion 'max > min' failed

/usr/share/cinnamon/applets/systray@cinnamon.org/applet.js already has the changes proposed earlier.