Skip to content

Make notifications for new tasks configurable #25

@ariyadey

Description

@ariyadey

Description:

Currently, a desktop notification is always shown when a new task is successfully added via the quick-add dialog. This provides useful feedback, but some users may find it intrusive. This issue proposes adding a configuration option to allow users to enable or disable these notifications.

Proposed Changes

  1. Add a Setting for Notifications:

    • Introduce a new persistent setting, showNotifications, to store the user's preference.
    • The setting should default to true (enabled).
  2. Add a UI Toggle in the Tray Menu:

    • Add a new checkable menu item, "Show notifications", to the system tray menu.
    • The checked state of this item should reflect the current value of the showNotifications setting.
    • Toggling the menu item should update the setting and persist the change.
  3. Conditionally Send Notifications:

    • The frontend logic in the QuickAddDialog should check the showNotifications setting before attempting to send a notification.
    • Notifications for both successful and failed task additions should respect this setting.

Implementation Plan

Backend (src-tauri)

  1. src-tauri/src/desktop/tray.rs:

    • Add a new ToggleNotifications variant to the MenuId enum.
    • In get_tray_menu, add a CheckMenuItem for "Show notifications". Its initial state should be loaded from the new setting.
    • In handle_menu_event, add a case for ToggleNotifications that updates the setting and the menu item's checked state.
  2. src-tauri/src/ipc/commands.rs:

    • Expose a new command get_show_notifications() -> bool that retrieves the current setting value.
    • Expose a new command set_show_notifications(enabled: bool) that updates the setting.
  3. src-tauri/src/shared/storage/general.rs:

    • Utilize the existing set and find functions in this module to manage the showNotifications setting.
    • A new StorageKey variant, ShowNotifications, will need to be added to src-tauri/src/shared/storage/key.rs.

Frontend (src/app)

  1. src/app/quick-add/quick-add-dialog.ts:
    • On initialization, fetch the showNotifications setting using the new get_show_notifications command.
    • In the onSubmit method, check the value of this setting before calling this.notification.send().

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions