Skip to content

calendar@cinnamon.org: Custom format settings field freezes UI due to live validation on every keystroke #13636

@Drako101

Description

@Drako101

Distribution

Mint 22.3

Package version

6.6.7

Graphics hardware in use

Intel Corporation Core Processor Integrated Graphics Controller hp630

Frequency

Always

Bug description

Related to #13635
When editing the custom date or tooltip format string in the calendar applet
settings, the UI becomes unresponsive/frozen while typing. This is caused by
the format field applying and validating the format string live on every
keystroke, flooding the error loop when the string is temporarily invalid
mid-edit.

Steps to reproduce

  1. Right-click the calendar/clock applet → Configure

  2. Enable "Use a custom date format"

  3. Click into either the "Date format" or "Date format for tooltip" field

  4. Type slowly, character by character

  5. Observe the settings window becoming sluggish or frozen

  6. Observe the following error repeated rapidly in ~/.xsession-errors:

    [LookingGlass/error] Calendar applet: bad time format string - check your string.

Expected behavior

The format string should only be applied and validated after the user has
finished typing — not on every single keystroke. A debounce delay of
~500ms after the last keystroke would prevent the error flood and keep
the UI responsive.
Actual behavior:
Every keystroke immediately triggers _updateClockAndDate(), which calls
get_clock_for_format() on the partially-typed (and therefore invalid)
string. This floods the GLib main loop with errors on every keypress,
making the settings UI unresponsive.

Additional information

Suggested fix:
Debounce the format string input field so validation and application only
triggers after the user stops typing for ~500ms:

if (this._format_debounce_id) {
    Mainloop.source_remove(this._format_debounce_id);
}
this._format_debounce_id = Mainloop.timeout_add(500, () => {
    this._updateFormatString();
    this._updateClockAndDate();
    this._format_debounce_id = 0;
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions