Commit graph

72 commits

Author SHA1 Message Date
Kristijan Ribarić
187dece11c feat: Sync Workspaces to Services-Sync
This commit adds a new feature to synchronize workspaces to the Services-Sync framework.

- **ZenWorkspacesSync.mjs:** A new file that defines a custom engine for syncing workspaces.
- **ZenWorkspaces.mjs:** Modified to register the ZenWorkspacesEngine with the Service engine manager and to update its state using services-sync's notification system.

This feature enables users to sync their workspaces across devices and seamlessly switch between them using the services-sync mechanism.
2024-10-04 22:37:35 +02:00
mauro-balades
76d22a1f15
Made the code look cleaner 2024-10-04 18:21:39 +02:00
mauro-balades
1ed9227c01
Added workspaces migration system 2024-10-03 19:38:51 +02:00
Kristijan Ribarić
05acfdb27e Fix: Prevent potential crash when workspace doesn't exist
This commit addresses a potential crash that could occur when the active workspace no longer exists. The issue was that the code attempted to access the `uuid` property of the first workspace in the list even if the list was empty.

This commit fixes the issue by using optional chaining (`?.`) to safely access the `uuid` property, ensuring the code doesn't crash if the workspace list is empty.
2024-10-03 11:52:18 +02:00
Kristijan Ribarić
9bcb66c768 feat(workspaces): Use preferences to manage active workspace
This commit updates the workspaces system to use preferences to manage the active workspace, instead of storing the active state in each workspace object.

The following changes were made:

- **ZenWorkspaces.mjs:**
    - Removed the `used` property from workspace objects and replaced it with a preference (`zen.workspaces.active`) to store the active workspace ID.
    - Modified the `getActiveWorkspace` and `changeWorkspace` methods to use preferences instead of the `used` property.
    - Added a new `isWorkspaceActive` method to check if a workspace is active.
- **ZenWorkspacesStorage.mjs:**
    - Removed the `is_active` column from the `zen_workspaces` table.
    - Removed the `setActiveWorkspace` method as the active workspace is now managed by preferences.

This change simplifies the code and makes it easier to manage the active workspace across multiple browser windows and doesn't write to the database on every workspace change. Additionaly, it enables local active workspace selection when workspace sync is implemented.
2024-10-03 10:19:18 +02:00
Kristijan Ribarić
62be9d1fdd Refactor: Remove unused workspace storage logic 2024-10-02 14:44:48 +02:00
Kristijan Ribarić
de8a857549 feat(workspaces): Store workspaces in a database
This commit introduces a new `ZenWorkspacesStorage` class to handle the persistence of workspaces in a database. The previous implementation used JSON files, but this approach brings several advantages, including:

- Improved performance and scalability
- Easier data management and synchronization
- Enhanced security and data integrity

This change removes the reliance on JSON files and streamlines workspace management, leading to a more robust and reliable system.
2024-10-02 09:37:09 +02:00
mauro-balades
2ea7024eea
Synced workspaces across windows and also implemented MultiWindowFeatures 2024-10-01 23:21:38 +02:00
Sátvik Karanam
65a07ce1c7
use intl segmenter 2024-09-30 02:06:27 -04:00
mauro-balades
cc4f1a3eb2 Fixed workspace cycling with shortcuts 2024-09-29 19:03:26 +02:00
mauro-balades
50afebec5f Fixed workspace cycle using shortcuts 2024-09-29 19:01:54 +02:00
mauro-balades
7af14f1484 Refactor ZenWorkspaces to fix icon mapping issue 2024-09-27 18:56:37 +02:00
mauro-balades
cb24052969 Do not show default container context menu if disabled 2024-09-26 18:58:04 +02:00
mauro-balades
53b7f6eecc Refactor ZenWorkspaces shortcutSwitchTo method to handle out of bounds index gracefully 2024-09-24 16:47:42 +02:00
mauro-balades
58b7b402ac Refactor ZenKeyboardShortcuts to use async/await for initialization and handle potential error when retrieving active workspace from cache 2024-09-23 18:15:17 +02:00
mauro-balades
a97e7e65ed Refactor ZenWorkspaces to use async/await for shortcutSwitchTo method 2024-09-23 17:00:20 +02:00
mauro-balades
6097e99c99 Refactor ZenWorkspaces to use async/await for initialization 2024-09-22 18:30:03 +02:00
mauro-balades
fff6dac398 Refactor ZenWorkspaces to handle potential error when retrieving active workspace from cache 2024-09-22 18:27:56 +02:00
mauro-balades
9a1dcde549 Refactor ZenSidebarManager to handle drag enter event properly 2024-09-22 17:49:16 +02:00
mauro-balades
f56b8c0e59 Refactor ZenViewSplitter to reset tab state when removing a group 2024-09-22 13:36:09 +02:00
mauro-balades
ef5da75e5e Refactor ZenKeyboardShortcuts to add zenChangeWorkspaceBack shortcut 2024-09-21 17:25:09 +02:00
mauro-balades
e14fbd8e5c Refactor ZenCompactMode to add event listeners and flashSidebar enhancements 2024-09-21 16:58:20 +02:00
mauro-balades
3c66cbdc24 Refactor ZenWorkspaces to fix newWorkspacesButton height calculation 2024-09-20 13:33:01 +02:00
mauro-balades
20c2fc640f Refactor ZenWorkspaces to add attributes to newWorkspacesButton 2024-09-20 09:59:55 +02:00
mauro-balades
1d5e336462 Refactor ZenWorkspaces to improve workspace icon strip functionality 2024-09-19 21:05:33 +02:00
mauro-balades
f84a42cb7e Refactor ZenWorkspaces to add event listener for TabBrowserInserted 2024-09-19 07:50:28 +02:00
mauro-balades
72396b8f55 Refactor ZenSidebarManager to adjust parentRelativeHeight calculation 2024-09-18 22:05:31 +02:00
mauro-balades
0f775df5e6 Refactor ZenWorkspaces initialization and workspace check 2024-09-18 00:06:02 +02:00
mauro-balades
5f61c3b5af Merge branch 'main' of https://github.com/zen-browser/components 2024-09-16 22:53:49 +02:00
mauro-balades
437fdfecb5 Refactor ZenWorkspaces to add event listener for TabBrowserInserted 2024-09-16 22:53:45 +02:00
Kristijan Ribarić
f4c876c8de fix: Await workspace save in changeWorkspace
This change ensures that the `unsafeSaveWorkspaces` function is called asynchronously. This is necessary to prevent blocking the UI thread while saving the workspaces.
2024-09-16 21:10:34 +02:00
mauro-balades
95af4ba082 Merge branch 'main' of https://github.com/zen-browser/components 2024-09-16 07:51:37 +02:00
mauro-balades
fa248aecd9 Refactor ZenWorkspaces to initialize workspace icons and context menus 2024-09-16 07:51:34 +02:00
Mauro Baladés
b9c35455ad Refactor ZenWorkspaces to use getUserContextLabel instead of formatContextLabel 2024-09-15 20:00:14 -07:00
mauro-balades
329b197bda Fixed workspaces 2024-09-15 19:20:32 +02:00
mauro 🤙
7bfeaefb27
Merge branch 'main' into cycle-to-last-selected-workspace-tab 2024-09-14 12:04:54 +02:00
mauro-balades
62c056b4d0 Refactor ZenWorkspaces.mjs to discard unloaded tabs when hiding workspace 2024-09-14 11:34:26 +02:00
mauro-balades
d0f32a6ee8 Refactor ZenWorkspaces.mjs to preserve full icons instead of just the first character 2024-09-14 09:05:38 +02:00
mauro-balades
cc4601f0e1 Fixed display when choosing containers for each workspace 2024-09-13 23:01:22 +02:00
mauro-balades
5a9fb8d7be Allow pinned tabs to be workspace specific 2024-09-13 22:52:03 +02:00
mauro-balades
4cedd84ac8 Refactor ZenWorkspaces.mjs to add createContainerTabMenu method 2024-09-13 20:12:05 +02:00
Jivan Flores
569127a141 feat: Remember the last selected tab when cycling between workspaces 2024-09-13 09:49:39 -07:00
Jivan Flores
82814b4c9a chore: Reformat ZenWorkspaces.mjs 2024-09-12 21:48:05 -07:00
mauro-balades
89f28b307d Refactor ZenSidebarManager.mjs to remove console.log statement
Refactor ZenWorkspaces.mjs to remove console.log statements
2024-09-12 19:54:28 +02:00
mauro-balades
c9c5c94e8d Refactor ZenWorkspaces.mjs to return an array with contextId and a boolean flag 2024-09-11 23:44:44 +02:00
mauro-balades
b372ec2694 Refactor ZenWorkspaces.mjs to fix parsing of workspace icons and improve workspace creation
- Refactor ZenWorkspaces.mjs to fix parsing of workspace icons and ensure compatibility with icons that have more than one character.
- Improve workspace creation by displaying the first character of each icon and adding container information.
2024-09-11 22:54:17 +02:00
mauro-balades
014161404d Refactor ZenWorkspaces.mjs to fix parsing of workspace icons 2024-09-11 21:07:49 +02:00
mauro-balades
831801add3 Refactor tab navigation logic and add contextChangeContainerTab method 2024-09-11 20:59:02 +02:00
mauro-balades
26173f7cfb Refactor tab navigation logic in ZenWorkspaces.mjs 2024-09-09 20:27:52 +02:00
mauro-balades
bdcc6a8c97 Formatted the entire project 2024-09-09 19:36:06 +02:00