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.
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.