This commit refactors the ZenSidebarManager and ZenWorkspaces classes. In ZenSidebarManager, the _createWebPanelBrowser method now includes the userContextId when creating a new browser. Additionally, a new method createContainerTabMenu is added to handle the creation of a context menu for container tabs. The contextChangeContainerTab method is also added to handle changing the userContextId for a container tab.
In ZenWorkspaces, the ownerWindow property is now set to the window object. The _contextMenuId property is now bound to the ZenWorkspaces instance. The onclick event handler is modified to use the ownerWindow property and the changeWorkspace method is now called on the ZenWorkspaces instance.
These changes improve the functionality and maintainability of the ZenSidebarManager and ZenWorkspaces classes.
This commit introduces a new preference, `zen.workspaces.force-container-workspace`, which allows users to automatically switch to the workspace associated with a specific tab's container.
This commit modifies the `getContextIdIfNeeded` method to automatically use the active workspace context ID for external calls.
Previously, external calls would use the provided `userContextId` if it was different from the active workspace context ID. Now, if `fromExternal` is true and there's an active workspace, the method will return the active workspace context ID, ensuring consistency with the active workspace.
This commit updates the pinned tab entries to include the triggering principal.
Previously, the pinned tab entries only included the URL and title of the tab. This caused issues when restoring pinned tabs, as the triggering principal was not being saved.
This commit adds the triggering principal to the pinned tab entries, ensuring that they can be restored correctly.
This fixes the issue where pinned tabs were not being restored correctly.
This commit updates the pinned tab manager to store all relevant data (URL, title, triggering principal, and icon) in a single JSON string attribute (`zen-pinned-entry`).
This simplifies the code by eliminating the need for multiple individual attributes and provides a more robust and organized approach to storing the pinned tab's state.
The following changes were made:
- Removed redundant attributes (`zen-pinned-url`, `zen-pinned-title`, `zen-pinned-triggering-principal`)
- Updated the pinned tab data structure to store all information in a single `zen-pinned-entry` attribute
- Adjusted the `resetPinnedTabData` function to handle the new data structure
- Modified the pinned tab context menu to reflect the changes in the attribute handling
This change provides a more efficient and streamlined way to manage pinned tab data, enhancing the overall maintainability and clarity of the codebase.
This commit adds the ability to store the triggering principal for pinned tabs in the session store. This allows us to correctly restore pinned tabs when a user has multiple profiles open, as the triggering principal will be used to determine which profile the pinned tab belongs to.
The following changes were made:
- Added a new attribute, "zen-pinned-triggering-principal", to pinned tabs to store the triggering principal.
- Updated the session store to store and restore the triggering principal for pinned tabs.
- Updated the `ZenPinnedTabManager` to set and get the triggering principal for pinned tabs.
This change is necessary to ensure that pinned tabs are correctly restored when reset to pinned URL.
This commit fixes an issue where weird stuff would happen if pinned tab didn't have a base url to reset to. If there is no base url, reset tab functionality won't work and it won't be visible in context menu until you click replace pinned url with current or unpin and repin the tab.
This commit changes the `position` column in the `workspaces` table to be an `INTEGER` instead of a `REAL` data type. This change is made to ensure that workspace positions are always whole numbers, which prevents issues with floating-point precision and ensures consistent ordering of workspaces.
Additionally, it updates the logic for calculating new workspace positions to use `Math.floor` to round down to the nearest integer, ensuring that positions are always integers.
This change also adjusts the `minGap` constant used in the `shouldReorderWorkspaces` function to `1`, which reflects the minimum allowed gap between workspace positions now that they are integers.
This commit introduces improvements to workspace ordering and change tracking in the Zen Workspaces system:
- **Workspace Ordering:**
- Uses `REAL` data type for `position` in `zen_workspaces` table, allowing for more precise and efficient ordering.
- Introduces a new `updateWorkspaceOrder` method to update workspace positions.
- Reorders workspaces with large increments to avoid frequent reordering, ensuring consistent ordering after changes.
- Implements a mechanism to check for necessary reordering after position updates and reorder all workspaces if required.
- **Changes Tracking:**
- Tracks changes to workspaces by inserting a record in `zen_workspaces_changes` for each modified workspace.
- Adds an index on `uuid` column in `zen_workspaces_changes` table for faster querying.
- Updates `getLastChangeTimestamp` method to return the last change timestamp from the changes tracking table, providing accurate timestamp for changes.
These changes optimize workspace management, improve accuracy of ordering, and enhance the performance of change tracking.