Light Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

serverstatus@maksmokriev: fix BoxBgColor setting, fix multiple mainloop callbacks#1740

Open
KopfdesDaemons wants to merge 2 commits intolinuxmint:masterfrom
KopfdesDaemons:serverstatus
Open

serverstatus@maksmokriev: fix BoxBgColor setting, fix multiple mainloop callbacks#1740
KopfdesDaemons wants to merge 2 commits intolinuxmint:masterfrom
KopfdesDaemons:serverstatus

Conversation

Copy link
Contributor

KopfdesDaemons commented Feb 7, 2026 *
edited
Loading

@maksmokriev closes #1736

The wrong callback is being used for the BoxBgColor setting. onSettingsBgChanged should be onSettingsChanged. onSettingsBgChanged only updates the container, not the box itself.

There is also a critical bug with the main loop. Every time a setting is changed, another callback is added to the main loop. Changing settings multiple times can overload the entire system.

KopfdesDaemons changed the title serverstatus@maksmokriev: fix BoxBgColor setting, fix multiple mainloop callbacks closes #1736 serverstatus@maksmokriev: fix BoxBgColor setting, fix multiple mainloop callbacks Feb 15, 2026
mtwebster requested a review from Copilot February 19, 2026 13:40
Copilot started reviewing on behalf of mtwebster February 19, 2026 13:40 View session
Copilot AI reviewed Feb 19, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request fixes a critical bug in the serverstatus desklet where settings changes would create multiple mainloop callbacks, overloading the system. It also corrects the BoxBgColor and FontSize setting callbacks to properly update the UI elements. The changes improve stability and fix a user-reported issue where the element background color setting was being ignored.

Changes:

  • Fixed BoxBgColor and FontSize settings to use the correct callback handler
  • Added logic to prevent duplicate mainloop callbacks when settings change
  • Bumped version from 1.2.0 to 1.2.1

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
metadata.json Version bump to 1.2.1 to reflect the bug fixes
desklet.js Fixed BoxBgColor/FontSize callbacks and added mainloop deduplication logic

Comment on lines +93 to 104
Mainloop.timeout_add_seconds(5, () => {
this.updateStatus();
return true;
if (this.mainloop) {
Mainloop.source_remove(this.mainloop);
}
//After the first call, we start a periodic update
this.mainloop = Mainloop.timeout_add_seconds(this.TimeRepeat, () => {
this.updateStatus();
return true;
});
return false; //Return false so that this timer only runs once
});
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

The initial 5-second timeout is not tracked, which means if settings are changed during this initial 5-second delay, a new timeout will be created but the old one will continue to execute. This could result in updateStatus() being called and creating a new mainloop even though the settings have changed. Consider storing the initial timeout ID and removing it in the condition check, similar to how the mainloop is handled.

Copilot uses AI. Check for mistakes.
//After the first call, we start a periodic update
this.mainloop = Mainloop.timeout_add_seconds(this.TimeRepeat, () => {

if (!this.mainloop || this.oldTimeRepeat != this.TimeRepeat) {
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

The variable oldTimeRepeat is never initialized in the constructor, which means the first time this condition is evaluated, it will compare undefined != this.TimeRepeat, which will always be true. While this works for the first initialization, it would be clearer to explicitly initialize this.oldTimeRepeat = null in the _init method to make the intent explicit.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot Copilot left review comments

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Desklet Bug - Colors in config being overriden

2 participants