Commit graph

14 commits

Author SHA1 Message Date
Kristijan Ribarić
915c9858fe feat: Introduce pinned tab persistence and global/workspace based pinned tabs
This commit introduces pinned tab persistence across sessions and integrates it with workspaces.

- **Pinned Tab Storage:**
    - Implements a database-based storage system for pinned tabs using PlacesUtils.
    - Provides methods for saving, retrieving, deleting, and managing pinned tabs.
    - Tracks changes to pinned tabs for efficient updates.
- **Workspace Integration:**
    - Allows pinned tabs to be associated with specific workspaces.
    - Synchronizes pinned tabs with the active workspace.
    - Ensures that pinned tabs are not inadvertently moved between workspaces.
2024-10-31 19:17:14 +01:00
Kristijan Ribarić
410264c9c6 Fix: Create new tab when closing last unpinned tab. 2024-10-18 20:45:16 +02:00
Kristijan Ribarić
5e4ea9889c Fix: Update pinned tab entries to include triggering principal
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.
2024-10-12 21:52:07 +02:00
Kristijan Ribarić
7d8dde9269 Store all pinned tab data in single attribute
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.
2024-10-12 20:43:26 +02:00
Kristijan Ribarić
0183de5382 feat: Store triggering principal for pinned tabs
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.
2024-10-12 18:18:58 +02:00
Kristijan Ribarić
d51cb4f1e3 Fix: Add middle click to handle close pinned tab and handle tab switch
This commit fixes an issue where middle clicking a pinned tab would not follow the behavior of pinned tab close shortcut.
2024-10-12 18:18:58 +02:00
Kristijan Ribarić
7f430568a8 Fix: Update pinned tab context menu visibility logic
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.
2024-10-11 10:35:32 +02:00
mauro-balades
327380907e
Refactor ZenCommonUtils and ZenPinnedTabManager classes 2024-10-08 22:30:23 +02:00
Kristijan Ribarić
4217882981 feat: Unified pinned tab close shortcut behavior
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.
2024-10-08 21:07:57 +02:00
Kristijan Ribarić
e28f8e131e feat(pinned-tab-manager): Add shortcut options for closing, unloading, changing, and resetting pinned tabs 2024-10-08 17:46:35 +02:00
Kristijan Ribarić
2e37d6ce0b Updated zen pinned tab manager to use lazy prefs getter, added methods for setting Pinned Tab State and updating pinned tab for session restore 2024-10-08 14:14:43 +02:00
Kristijan Ribarić
dab9e1edcc fix(pinned-tabs): Always update pinned tab data with latest information
This commit ensures that pinned tab data is always updated with the latest information, and previous tab entries are cleaned up.
2024-10-07 22:56:37 +02:00
Kristijan Ribarić
89f6a07353 feat: Improve pinned tab management
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.
2024-10-07 21:02:01 +02:00
Kristijan Ribarić
1963de08e9 feat: Implement pinned tab manager
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.
2024-10-07 21:02:01 +02:00