This commit introduces a unified behavior for the pinned tab close shortcut, controlled by a single preference `zen.pinned-tab-manager.close-shortcut-behavior`.
The previous implementation relied on multiple separate preferences:
- `zen.pinned-tab-manager.reset-pinned-tab-on-close-shortcut`
- `zen.pinned-tab-manager.unload-pinned-tab-on-close-shortcut`
- `zen.pinned-tab-manager.change-pinned-tab-on-close-shortcut`
- `zen.pinned-tab-manager.close-pinned-tab-on-close-shortcut`
This new unified approach simplifies the configuration and offers more granular control over the desired behavior.
The new preference `zen.pinned-tab-manager.close-shortcut-behavior` accepts the following values:
- `close`: Closes the selected pinned tab.
- `reset`: Resets the selected pinned tab to its stored state.
- `unload`: Unloads the selected pinned tab.
- `switch`: Switches to the next unpinned tab.
- `reset-unload-switch`: Resets, unloads, and switches the selected pinned tab.
- `unload-switch`: Unloads and switches the selected pinned tab.
- `reset-switch`: Resets and switches the selected pinned tab.
This unified approach provides greater flexibility and simplifies the user experience.
This commit adds a new keyboard shortcut to reset pinned tabs in the zen sidebar.
The new shortcut is grouped under "Other Zen Features" in the keybinding manager.
This commit introduces several improvements to the pinned tab manager:
- **Adds icon support for pinned tabs**: Pinned tabs now store and restore their icon in addition to URL and title.
- **Adds "Replace with Current" context menu option**: A new option in the tab context menu allows replacing the URL of a pinned tab with the current page.
- **Refactors code for better readability**: Renames methods and variables for clarity, and improves code structure.
- **Fixes issues with resetting pinned tabs**: Ensures that pinned tabs are correctly reset when closed using the Ctrl+W shortcut or by using the "Reset Pinned Tab" context menu option.
- **Adds missing menu item**: Adds the missing menu item for resetting the pinned tab in the tab context menu.
These changes enhance the functionality and user experience of the pinned tab manager, making it more robust and user-friendly.
This commit introduces a new feature: a pinned tab manager.
- Adds `ZenPinnedTabsObserver` to listen for pinned/unpinned tab events.
- Implements `ZenPinnedTabManager` to handle the logic of managing pinned tabs:
- Stores pinned tab URLs and titles.
- Resets the pinned tab to its saved state when closed.
- Adds a new context menu option to manually reset a pinned tab.
- Implements a shortcut to close a pinned tab and optionally reset its state.
This feature enhances pinned tab functionality by providing a better user experience for managing and resetting them.
This commit improves the notification and handling of workspace changes by:
- **Introducing a dedicated observer notification system:** The `ZenWorkspacesStorage` now uses a private helper method (`_notifyWorkspacesChanged`) to notify observers with a list of changed workspace UUIDs. This provides a more efficient and flexible notification system.
- **Updating `ZenWorkspacesTracker` to parse UUIDs:** The `ZenWorkspacesTracker` now correctly parses the JSON stringified array of UUIDs received from the observer, allowing it to handle multiple workspace changes in a single notification.
- **Refactoring `saveWorkspace`, `removeWorkspace`, `setDefaultWorkspace`, and `updateWorkspaceOrder`:** These methods now consistently collect and notify observers about changed UUIDs.
- **Removing unnecessary code:** The previous approach of notifying observers individually for each change has been removed, leading to code simplification and reduced complexity.
This commit ensures that workspace changes are more reliably and efficiently tracked, leading to a smoother and more responsive workspace management experience.
This commit removes the `used` field from the Workspaces database table and Zen Workspace objects.
The `used` field was originally intended to track whether a workspace was currently being used, but it turned out to be unnecessary. This change simplifies the data model and removes redundant information.
This commit prevents multiple registrations of the `ZenWorkspacesEngine`.
Previously, the `ZenWorkspacesEngine` was registered unconditionally every time `ZenWorkspaces` was initialized. This could lead to issues if the engine was already registered.
This commit adds a check to ensure that the engine is only registered if it is not already present. This prevents multiple registrations and ensures that the engine is only initialized once.
This commit introduces workspace ordering and a new mechanism for tracking changes to workspaces.
**Changes:**
- **Workspace Ordering:** Workspaces can now be ordered using a `position` field. This allows for user-defined ordering of workspaces, improving usability.
- **Changes Tracking:** A new `zen_workspaces_changes` table is added to track changes to workspaces. This allows for more efficient sync operations and improved error handling.
**Benefits:**
- **Improved Workspace Management:** Users can now customize the order of their workspaces.
- **More Efficient Sync:** Changes tracking enables faster and more accurate synchronization of workspaces across devices.
- **Enhanced Error Handling:** Changes tracking helps to identify and resolve conflicts during sync.
**Notes:**
- This change requires deleting the zen_workspaces table in places db
This commit removes a call to `this.closeWorkspacesSubView()` after saving a workspace.
The previous behavior caused an error to be thrown because main view was already closed.
This commit ensures that only one workspace can be marked as default. Previously, multiple workspaces could be marked as default, leading to unexpected behavior.
The commit introduces a transaction to update all workspaces, setting `is_default` to `0` for all workspaces except the one being saved as default. This prevents multiple workspaces from being marked as default.
The previous implementation of the workspace update notification was using `workspaceData.uuid`, which is incorrect. This commit fixes the issue by using `workspace.uuid` instead, ensuring the correct workspace identifier is sent to observers.