Skip to content

Stop Focus Mode polling after restoring defaults #348

Description

@Shreya-nipunge

Description

Restoring default settings disables Focus Mode in the saved configuration but does not stop the active main-process Focus Mode polling interval.

The polling timer created by startFocusModePolling() continues running every second after Restore Defaults is used, even though the restored settings have Focus Mode disabled. This results in unnecessary background work and leaves the Focus Mode lifecycle out of sync with the current configuration.

Relevant Code Paths

  • settings.js invokes the restore-defaults IPC operation.
  • main.js calls resetAllSettings().
  • resetAllSettings() replaces the settings with defaults but does not call applyFocusModeState() or stopFocusModePolling().
  • The existing Focus Mode interval therefore remains active until the application exits.

Steps to Reproduce

  1. Launch Paraline.
  2. Open Settings and enable Focus Mode.
  3. Confirm that the Focus Mode polling callback is running (via debugger, logging, or inspection).
  4. Click Restore Defaults and confirm the action.
  5. Observe that Focus Mode is disabled in the restored settings, but the polling callback continues executing every second.

Expected Behavior

  • Restoring defaults should stop any active Focus Mode polling interval.
  • The visualizer should return to full opacity.
  • Runtime behavior should match the restored configuration.

Actual Behavior

  • Focus Mode is disabled in the restored settings.
  • The existing polling interval remains active and continues firing every second until the application exits.

Suggested Fix

After restoring default settings, reapply the Focus Mode lifecycle by calling applyFocusModeState() (or otherwise ensuring stopFocusModePolling() is invoked when Focus Mode is disabled).

Testing

  • Verify that restoring defaults clears the active Focus Mode polling interval.
  • Verify that visualizer opacity is restored to 1.0.
  • Verify that Focus Mode can still be re-enabled normally after restoring defaults.

Environment

  • Repo version / commit: 68edfe4

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions