refactor: preference keys to right order

This commit is contained in:
lin onetwo 2025-10-19 23:34:03 +08:00
parent b376a06b21
commit 260c9eacde
19 changed files with 106 additions and 105 deletions

View file

@ -26,7 +26,7 @@ Given('I configure tidgi mini window with shortcut', async function() {
const updatedPreferences = { const updatedPreferences = {
...existing.preferences, ...existing.preferences,
attachToTidgiMiniWindow: true, tidgiMiniWindow: true,
keyboardShortcuts: { keyboardShortcuts: {
...(existing.preferences?.keyboardShortcuts || {}), ...(existing.preferences?.keyboardShortcuts || {}),
'Window.toggleTidgiMiniWindow': shortcut, 'Window.toggleTidgiMiniWindow': shortcut,
@ -42,12 +42,12 @@ function clearTidgiMiniWindowSettings() {
const parsed = fs.readJsonSync(settingsPath) as ISettingFile; const parsed = fs.readJsonSync(settingsPath) as ISettingFile;
// Remove tidgi mini window-related preferences to avoid affecting other tests // Remove tidgi mini window-related preferences to avoid affecting other tests
const cleanedPreferences = omit(parsed.preferences || {}, [ const cleanedPreferences = omit(parsed.preferences || {}, [
'attachToTidgiMiniWindow', 'tidgiMiniWindow',
'tidgiMiniWindowSyncWorkspaceWithMainWindow', 'tidgiMiniWindowSyncWorkspaceWithMainWindow',
'tidgiMiniWindowFixedWorkspaceId', 'tidgiMiniWindowFixedWorkspaceId',
'tidgiMiniWindowAlwaysOnTop', 'tidgiMiniWindowAlwaysOnTop',
'sidebarOnTidgiMiniWindow', 'tidgiMiniWindowShowSidebar',
'showTidgiMiniWindowTitleBar', 'tidgiMiniWindowShowTitleBar',
]); ]);
// Also clean up the tidgi mini window shortcut from keyboardShortcuts // Also clean up the tidgi mini window shortcut from keyboardShortcuts
if (cleanedPreferences.keyboardShortcuts) { if (cleanedPreferences.keyboardShortcuts) {

View file

@ -5,7 +5,8 @@ Feature: TidGi Mini Window
So that I can quickly access TidGi from the system tray So that I can quickly access TidGi from the system tray
Scenario: Enable tidgi mini window and test keyboard shortcut Scenario: Enable tidgi mini window and test keyboard shortcut
Given I launch the TidGi application Given I cleanup test wiki
And I launch the TidGi application
And I wait for the page to load completely And I wait for the page to load completely
And I click on an "open preferences button" element with selector "#open-preferences-button" And I click on an "open preferences button" element with selector "#open-preferences-button"
And I switch to "preferences" window And I switch to "preferences" window

View file

@ -324,10 +324,10 @@
"AlwaysOnTopDetail": "Keep TidGis main window always on top of other windows, and will not be covered by other windows", "AlwaysOnTopDetail": "Keep TidGis main window always on top of other windows, and will not be covered by other windows",
"AntiAntiLeech": "Some website has Anti-Leech, will prevent some images from being displayed on your wiki, we simulate a request header that looks like visiting that website to bypass this protection.", "AntiAntiLeech": "Some website has Anti-Leech, will prevent some images from being displayed on your wiki, we simulate a request header that looks like visiting that website to bypass this protection.",
"AskDownloadLocation": "Ask where to save each file before downloading", "AskDownloadLocation": "Ask where to save each file before downloading",
"AttachToTidgiMiniWindow": "Attach to TidGi mini window", "TidgiMiniWindow": "Attach to TidGi mini window",
"AttachToTidgiMiniWindowShowSidebar": "Attach To TidGi Mini Window Show Sidebar", "TidgiMiniWindowShowSidebar": "Attach To TidGi Mini Window Show Sidebar",
"AttachToTidgiMiniWindowShowSidebarTip": "Generally, TidGi mini window is only used to quickly view the current workspace, so the default synchronization with the main window workspace, do not need a sidebar, the default hidden sidebar.", "TidgiMiniWindowShowSidebarTip": "Generally, TidGi mini window is only used to quickly view the current workspace, so the default synchronization with the main window workspace, do not need a sidebar, the default hidden sidebar.",
"AttachToTidgiMiniWindowTip": "Make a small TidGi popup window that pop when you click system tray mini icon. Tip: Right-click on mini app icon to access context menu.", "TidgiMiniWindowTip": "Make a small TidGi popup window that pop when you click system tray mini icon. Tip: Right-click on mini app icon to access context menu.",
"AttachToTaskbar": "Attach to taskbar", "AttachToTaskbar": "Attach to taskbar",
"AttachToTaskbarShowSidebar": "Attach To Taskbar Show Sidebar", "AttachToTaskbarShowSidebar": "Attach To Taskbar Show Sidebar",
"ChooseLanguage": "Choose Language 选择语言", "ChooseLanguage": "Choose Language 选择语言",
@ -370,8 +370,8 @@
"TidgiMiniWindowShortcutKeyPlaceholder": "e.g.: Ctrl+Shift+D", "TidgiMiniWindowShortcutKeyPlaceholder": "e.g.: Ctrl+Shift+D",
"TidgiMiniWindowSyncWorkspaceWithMainWindow": "TidGi Mini Window syncs with main window workspace", "TidgiMiniWindowSyncWorkspaceWithMainWindow": "TidGi Mini Window syncs with main window workspace",
"TidgiMiniWindowSyncWorkspaceWithMainWindowDetail": "When checked, TidGi Mini Window will display the same workspace content as main window", "TidgiMiniWindowSyncWorkspaceWithMainWindowDetail": "When checked, TidGi Mini Window will display the same workspace content as main window",
"ShowTidgiMiniWindowTitleBar": "Show title bar on TidGi Mini Window", "TidgiMiniWindowShowTitleBar": "Show title bar on TidGi Mini Window",
"ShowTidgiMiniWindowTitleBarDetail": "Show draggable title bar on TidGi Mini Window", "TidgiMiniWindowShowTitleBarDetail": "Show draggable title bar on TidGi Mini Window",
"Miscellaneous": "Miscellaneous", "Miscellaneous": "Miscellaneous",
"MoreWorkspaceSyncSettings": "More Workspace Sync Settings", "MoreWorkspaceSyncSettings": "More Workspace Sync Settings",
"MoreWorkspaceSyncSettingsDescription": "Please right-click the workspace icon, open its workspace setting by click on \"Edit Workspace\" context menu item, and configure its independent synchronization settings in it.", "MoreWorkspaceSyncSettingsDescription": "Please right-click the workspace icon, open its workspace setting by click on \"Edit Workspace\" context menu item, and configure its independent synchronization settings in it.",

View file

@ -324,10 +324,10 @@
"AlwaysOnTopDetail": "Garder la fenêtre principale de TidGi toujours au-dessus des autres fenêtres, et ne sera pas couverte par d'autres fenêtres", "AlwaysOnTopDetail": "Garder la fenêtre principale de TidGi toujours au-dessus des autres fenêtres, et ne sera pas couverte par d'autres fenêtres",
"AntiAntiLeech": "Certains sites web ont une protection anti-leech, empêchant certaines images d'être affichées sur votre wiki, nous simulons un en-tête de requête qui ressemble à la visite de ce site web pour contourner cette protection.", "AntiAntiLeech": "Certains sites web ont une protection anti-leech, empêchant certaines images d'être affichées sur votre wiki, nous simulons un en-tête de requête qui ressemble à la visite de ce site web pour contourner cette protection.",
"AskDownloadLocation": "Demander où enregistrer chaque fichier avant de télécharger", "AskDownloadLocation": "Demander où enregistrer chaque fichier avant de télécharger",
"AttachToTidgiMiniWindow": "Attacher à la mini-fenêtre TidGi", "TidgiMiniWindow": "Attacher à la mini-fenêtre TidGi",
"AttachToTidgiMiniWindowShowSidebar": "Attacher à la mini-fenêtre TidGi Afficher la barre latérale", "TidgiMiniWindowShowSidebar": "Attacher à la mini-fenêtre TidGi Afficher la barre latérale",
"AttachToTidgiMiniWindowShowSidebarTip": "En général, la petite fenêtre TidGi est uniquement utilisée pour visualiser rapidement l'espace de travail actuel, donc la synchronisation avec l'espace de travail de la fenêtre principale n'est pas nécessaire, la barre latérale est masquée par défaut.", "TidgiMiniWindowShowSidebarTip": "En général, la petite fenêtre TidGi est uniquement utilisée pour visualiser rapidement l'espace de travail actuel, donc la synchronisation avec l'espace de travail de la fenêtre principale n'est pas nécessaire, la barre latérale est masquée par défaut.",
"AttachToTidgiMiniWindowTip": "Créer une petite fenêtre contextuelle TidGi qui apparaît lorsque vous cliquez sur l'icône mini de la barre d'application. Astuce : Cliquez avec le bouton droit sur l'icône mini de l'application pour accéder au menu contextuel.", "TidgiMiniWindowTip": "Créer une petite fenêtre contextuelle TidGi qui apparaît lorsque vous cliquez sur l'icône mini de la barre d'application. Astuce : Cliquez avec le bouton droit sur l'icône mini de l'application pour accéder au menu contextuel.",
"AttachToTaskbar": "Attacher à la barre des tâches", "AttachToTaskbar": "Attacher à la barre des tâches",
"AttachToTaskbarShowSidebar": "Attacher à la barre des tâches Afficher la barre latérale", "AttachToTaskbarShowSidebar": "Attacher à la barre des tâches Afficher la barre latérale",
"ChooseLanguage": "Choisir la langue 选择语言", "ChooseLanguage": "Choisir la langue 选择语言",

View file

@ -332,10 +332,10 @@
"AlwaysOnTopDetail": "让太记的主窗口永远保持在其它窗口上方,不会被其他窗口覆盖", "AlwaysOnTopDetail": "让太记的主窗口永远保持在其它窗口上方,不会被其他窗口覆盖",
"AntiAntiLeech": "有的网站做了防盗链,会阻止某些图片在你的知识库上显示,我们通过模拟访问该网站的请求头来绕过这种限制。", "AntiAntiLeech": "有的网站做了防盗链,会阻止某些图片在你的知识库上显示,我们通过模拟访问该网站的请求头来绕过这种限制。",
"AskDownloadLocation": "下载前询问每个文件的保存位置", "AskDownloadLocation": "下载前询问每个文件的保存位置",
"AttachToTidgiMiniWindow": "附加到太记小窗", "TidgiMiniWindow": "附加到太记小窗",
"AttachToTidgiMiniWindowShowSidebar": "太记小窗包含侧边栏", "TidgiMiniWindowShowSidebar": "太记小窗包含侧边栏",
"AttachToTidgiMiniWindowShowSidebarTip": "一般太记小窗仅用于快速查看当前工作区,所以默认与主窗口工作区同步,不需要侧边栏,默认隐藏侧边栏。", "TidgiMiniWindowShowSidebarTip": "一般太记小窗仅用于快速查看当前工作区,所以默认与主窗口工作区同步,不需要侧边栏,默认隐藏侧边栏。",
"AttachToTidgiMiniWindowTip": "创建一个点击系统托盘图标会弹出的小太记窗口。提示:右键单击小图标以访问上下文菜单。", "TidgiMiniWindowTip": "创建一个点击系统托盘图标会弹出的小太记窗口。提示:右键单击小图标以访问上下文菜单。",
"AttachToTaskbar": "附加到任务栏", "AttachToTaskbar": "附加到任务栏",
"AttachToTaskbarShowSidebar": "附加到任务栏的窗口包含侧边栏", "AttachToTaskbarShowSidebar": "附加到任务栏的窗口包含侧边栏",
"ChooseLanguage": "选择语言 Choose Language", "ChooseLanguage": "选择语言 Choose Language",
@ -379,8 +379,8 @@
"TidgiMiniWindowShortcutKeyPlaceholder": "例如Ctrl+Shift+D", "TidgiMiniWindowShortcutKeyPlaceholder": "例如Ctrl+Shift+D",
"TidgiMiniWindowSyncWorkspaceWithMainWindow": "小窗和主窗口展示同样的工作区", "TidgiMiniWindowSyncWorkspaceWithMainWindow": "小窗和主窗口展示同样的工作区",
"TidgiMiniWindowSyncWorkspaceWithMainWindowDetail": "勾选后,小窗将与主窗口同步显示相同的工作区内容", "TidgiMiniWindowSyncWorkspaceWithMainWindowDetail": "勾选后,小窗将与主窗口同步显示相同的工作区内容",
"ShowTidgiMiniWindowTitleBar": "小窗显示标题栏", "TidgiMiniWindowShowTitleBar": "小窗显示标题栏",
"ShowTidgiMiniWindowTitleBarDetail": "在太记小窗口上显示可拖动的标题栏", "TidgiMiniWindowShowTitleBarDetail": "在太记小窗口上显示可拖动的标题栏",
"Miscellaneous": "其他设置", "Miscellaneous": "其他设置",
"MoreWorkspaceSyncSettings": "更多工作区同步设置", "MoreWorkspaceSyncSettings": "更多工作区同步设置",
"MoreWorkspaceSyncSettingsDescription": "请右键工作区图标,点右键菜单里的「编辑工作区」来打开工作区设置,在里面配各个工作区的同步设置。", "MoreWorkspaceSyncSettingsDescription": "请右键工作区图标,点右键菜单里的「编辑工作区」来打开工作区设置,在里面配各个工作区的同步设置。",

View file

@ -324,10 +324,10 @@
"AlwaysOnTopDetail": "讓太記的主窗口永遠保持在其它窗口上方,不會被其他窗口覆蓋", "AlwaysOnTopDetail": "讓太記的主窗口永遠保持在其它窗口上方,不會被其他窗口覆蓋",
"AntiAntiLeech": "有的網站做了防盜鏈,會阻止某些圖片在你的知識庫上顯示,我們透過模擬訪問該網站的請求頭來繞過這種限制。", "AntiAntiLeech": "有的網站做了防盜鏈,會阻止某些圖片在你的知識庫上顯示,我們透過模擬訪問該網站的請求頭來繞過這種限制。",
"AskDownloadLocation": "下載前詢問每個文件的保存位置", "AskDownloadLocation": "下載前詢問每個文件的保存位置",
"AttachToTidgiMiniWindow": "附加到太記小窗", "TidgiMiniWindow": "附加到太記小窗",
"AttachToTidgiMiniWindowShowSidebar": "太記小窗包含側邊欄", "TidgiMiniWindowShowSidebar": "太記小窗包含側邊欄",
"AttachToTidgiMiniWindowShowSidebarTip": "一般太記小窗僅用於快速查看當前工作區,所以默認與主窗口工作區同步,不需要側邊欄,默認隱藏側邊欄。", "TidgiMiniWindowShowSidebarTip": "一般太記小窗僅用於快速查看當前工作區,所以默認與主窗口工作區同步,不需要側邊欄,默認隱藏側邊欄。",
"AttachToTidgiMiniWindowTip": "創建一個點擊系統托盤圖示會彈出的小太記窗口。提示:右鍵單擊小圖示以訪問上下文菜單。", "TidgiMiniWindowTip": "創建一個點擊系統托盤圖示會彈出的小太記窗口。提示:右鍵單擊小圖示以訪問上下文菜單。",
"AttachToTaskbar": "附加到任務欄", "AttachToTaskbar": "附加到任務欄",
"AttachToTaskbarShowSidebar": "附加到任務欄的窗口包含側邊欄", "AttachToTaskbarShowSidebar": "附加到任務欄的窗口包含側邊欄",
"ChooseLanguage": "選擇語言 Choose Language", "ChooseLanguage": "選擇語言 Choose Language",

View file

@ -139,8 +139,8 @@ const commonInit = async (): Promise<void> => {
await workspaceService.initializeDefaultPageWorkspaces(); await workspaceService.initializeDefaultPageWorkspaces();
// perform wiki startup and git sync for each workspace // perform wiki startup and git sync for each workspace
await workspaceViewService.initializeAllWorkspaceView(); await workspaceViewService.initializeAllWorkspaceView();
const attachToTidgiMiniWindow = await preferenceService.get('attachToTidgiMiniWindow'); const tidgiMiniWindow = await preferenceService.get('tidgiMiniWindow');
if (attachToTidgiMiniWindow) { if (tidgiMiniWindow) {
await windowService.openTidgiMiniWindow(true, false); await windowService.openTidgiMiniWindow(true, false);
} }

View file

@ -14,7 +14,7 @@ import Main from '../index';
// Mock window.observables to provide realistic API behavior // Mock window.observables to provide realistic API behavior
const preferencesSubject = new BehaviorSubject({ const preferencesSubject = new BehaviorSubject({
sidebar: true, sidebar: true,
sidebarOnTidgiMiniWindow: true, tidgiMiniWindowShowSidebar: true,
showSideBarText: true, showSideBarText: true,
showSideBarIcon: true, showSideBarIcon: true,
}); });

View file

@ -63,7 +63,7 @@ export default function Main(): React.JSX.Element {
const { t } = useTranslation(); const { t } = useTranslation();
useInitialPage(); useInitialPage();
const preferences = usePreferenceObservable(); const preferences = usePreferenceObservable();
const showSidebar = (windowName === WindowNames.tidgiMiniWindow ? preferences?.sidebarOnTidgiMiniWindow : preferences?.sidebar) ?? true; const showSidebar = (windowName === WindowNames.tidgiMiniWindow ? preferences?.tidgiMiniWindowShowSidebar : preferences?.sidebar) ?? true;
return ( return (
<OuterRoot> <OuterRoot>
<Helmet> <Helmet>

View file

@ -53,7 +53,7 @@ export class DatabaseService implements IDatabaseService {
hasContent: !!this.settingFileContent, hasContent: !!this.settingFileContent,
keys: this.settingFileContent ? Object.keys(this.settingFileContent).length : 0, keys: this.settingFileContent ? Object.keys(this.settingFileContent).length : 0,
hasPreferences: !!this.settingFileContent?.preferences, hasPreferences: !!this.settingFileContent?.preferences,
attachToTidgiMiniWindow: this.settingFileContent?.preferences?.attachToTidgiMiniWindow, tidgiMiniWindow: this.settingFileContent?.preferences?.tidgiMiniWindow,
settingsFilePath: settings.file(), settingsFilePath: settings.file(),
function: 'DatabaseService.initializeForApp', function: 'DatabaseService.initializeForApp',
}); });

View file

@ -11,8 +11,8 @@ export default async function getViewBounds(
): Promise<{ height: number; width: number; x: number; y: number }> { ): Promise<{ height: number; width: number; x: number; y: number }> {
const { findInPage = false, windowName } = config; const { findInPage = false, windowName } = config;
const preferencesService = container.get<IPreferenceService>(serviceIdentifier.Preference); const preferencesService = container.get<IPreferenceService>(serviceIdentifier.Preference);
const [sidebar, sidebarOnTidgiMiniWindow] = await Promise.all([preferencesService.get('sidebar'), preferencesService.get('sidebarOnTidgiMiniWindow')]); const [sidebar, tidgiMiniWindowShowSidebar] = await Promise.all([preferencesService.get('sidebar'), preferencesService.get('tidgiMiniWindowShowSidebar')]);
const showSidebar = windowName === WindowNames.tidgiMiniWindow ? sidebarOnTidgiMiniWindow : sidebar; const showSidebar = windowName === WindowNames.tidgiMiniWindow ? tidgiMiniWindowShowSidebar : sidebar;
// Now showing sidebar on secondary window // Now showing sidebar on secondary window
const secondary = windowName === WindowNames.secondary; const secondary = windowName === WindowNames.secondary;
const x = (showSidebar && !secondary) ? 68 : 0; const x = (showSidebar && !secondary) ? 68 : 0;

View file

@ -7,7 +7,7 @@ export const defaultPreferences: IPreferences = {
allowPrerelease: Boolean(semver.prerelease(app.getVersion())), allowPrerelease: Boolean(semver.prerelease(app.getVersion())),
alwaysOnTop: false, alwaysOnTop: false,
askForDownloadPath: true, askForDownloadPath: true,
attachToTidgiMiniWindow: false, tidgiMiniWindow: false,
disableAntiAntiLeech: false, disableAntiAntiLeech: false,
disableAntiAntiLeechForUrls: [], disableAntiAntiLeechForUrls: [],
downloadPath: DEFAULT_DOWNLOADS_PATH, downloadPath: DEFAULT_DOWNLOADS_PATH,
@ -19,7 +19,7 @@ export const defaultPreferences: IPreferences = {
tidgiMiniWindowAlwaysOnTop: false, tidgiMiniWindowAlwaysOnTop: false,
tidgiMiniWindowFixedWorkspaceId: '', tidgiMiniWindowFixedWorkspaceId: '',
tidgiMiniWindowSyncWorkspaceWithMainWindow: true, tidgiMiniWindowSyncWorkspaceWithMainWindow: true,
showTidgiMiniWindowTitleBar: false, tidgiMiniWindowShowTitleBar: false,
keyboardShortcuts: {}, keyboardShortcuts: {},
pauseNotifications: '', pauseNotifications: '',
pauseNotificationsBySchedule: false, pauseNotificationsBySchedule: false,
@ -32,7 +32,7 @@ export const defaultPreferences: IPreferences = {
showSideBarIcon: true, showSideBarIcon: true,
showSideBarText: true, showSideBarText: true,
sidebar: true, sidebar: true,
sidebarOnTidgiMiniWindow: false, tidgiMiniWindowShowSidebar: false,
spellcheck: true, spellcheck: true,
spellcheckLanguages: ['en-US'], spellcheckLanguages: ['en-US'],
swipeToNavigate: true, swipeToNavigate: true,

View file

@ -8,7 +8,7 @@ export interface IPreferences {
allowPrerelease: boolean; allowPrerelease: boolean;
alwaysOnTop: boolean; alwaysOnTop: boolean;
askForDownloadPath: boolean; askForDownloadPath: boolean;
attachToTidgiMiniWindow: boolean; tidgiMiniWindow: boolean;
/** /**
* *
*/ */
@ -44,7 +44,7 @@ export interface IPreferences {
/** /**
* Should show sidebar on tidgi mini window? * Should show sidebar on tidgi mini window?
*/ */
sidebarOnTidgiMiniWindow: boolean; tidgiMiniWindowShowSidebar: boolean;
spellcheck: boolean; spellcheck: boolean;
spellcheckLanguages: HunspellLanguages[]; spellcheckLanguages: HunspellLanguages[];
swipeToNavigate: boolean; swipeToNavigate: boolean;
@ -59,7 +59,7 @@ export interface IPreferences {
/** /**
* Whether to show title bar on tidgi mini window (independent of main window's titleBar setting) * Whether to show title bar on tidgi mini window (independent of main window's titleBar setting)
*/ */
showTidgiMiniWindowTitleBar: boolean; tidgiMiniWindowShowTitleBar: boolean;
/** /**
* Keyboard shortcuts configuration stored as serviceIdentifier.methodName -> shortcut * Keyboard shortcuts configuration stored as serviceIdentifier.methodName -> shortcut
*/ */

View file

@ -247,7 +247,7 @@ export class View implements IViewService {
}; };
const checkNotExistResult = await Promise.all([ const checkNotExistResult = await Promise.all([
checkNotExist(workspace, WindowNames.main), checkNotExist(workspace, WindowNames.main),
this.preferenceService.get('attachToTidgiMiniWindow').then((attachToTidgiMiniWindow) => attachToTidgiMiniWindow && checkNotExist(workspace, WindowNames.tidgiMiniWindow)), this.preferenceService.get('tidgiMiniWindow').then((tidgiMiniWindow) => tidgiMiniWindow && checkNotExist(workspace, WindowNames.tidgiMiniWindow)),
]); ]);
return checkNotExistResult.every((result) => !result); return checkNotExistResult.every((result) => !result);
} }
@ -412,15 +412,15 @@ export class View implements IViewService {
public async setActiveViewForAllBrowserViews(workspaceID: string): Promise<void> { public async setActiveViewForAllBrowserViews(workspaceID: string): Promise<void> {
// Set main window workspace // Set main window workspace
const mainWindowTask = this.setActiveView(workspaceID, WindowNames.main); const mainWindowTask = this.setActiveView(workspaceID, WindowNames.main);
const [attachToTidgiMiniWindow, tidgiMiniWindowSyncWorkspaceWithMainWindow, tidgiMiniWindowFixedWorkspaceId] = await Promise.all([ const [tidgiMiniWindow, tidgiMiniWindowSyncWorkspaceWithMainWindow, tidgiMiniWindowFixedWorkspaceId] = await Promise.all([
this.preferenceService.get('attachToTidgiMiniWindow'), this.preferenceService.get('tidgiMiniWindow'),
this.preferenceService.get('tidgiMiniWindowSyncWorkspaceWithMainWindow'), this.preferenceService.get('tidgiMiniWindowSyncWorkspaceWithMainWindow'),
this.preferenceService.get('tidgiMiniWindowFixedWorkspaceId'), this.preferenceService.get('tidgiMiniWindowFixedWorkspaceId'),
]); ]);
// For tidgi mini window, decide which workspace to show based on preferences // For tidgi mini window, decide which workspace to show based on preferences
let tidgiMiniWindowTask = Promise.resolve(); let tidgiMiniWindowTask = Promise.resolve();
if (attachToTidgiMiniWindow) { if (tidgiMiniWindow) {
// Default to sync (undefined or true), otherwise use fixed workspace ID (fallback to main if not set) // Default to sync (undefined or true), otherwise use fixed workspace ID (fallback to main if not set)
const shouldSync = tidgiMiniWindowSyncWorkspaceWithMainWindow === undefined || tidgiMiniWindowSyncWorkspaceWithMainWindow; const shouldSync = tidgiMiniWindowSyncWorkspaceWithMainWindow === undefined || tidgiMiniWindowSyncWorkspaceWithMainWindow;
const tidgiMiniWindowWorkspaceId = shouldSync ? workspaceID : (tidgiMiniWindowFixedWorkspaceId || workspaceID); const tidgiMiniWindowWorkspaceId = shouldSync ? workspaceID : (tidgiMiniWindowFixedWorkspaceId || workspaceID);

View file

@ -25,7 +25,7 @@ export async function handleAttachToTidgiMiniWindow(
const preferenceService = container.get<IPreferenceService>(serviceIdentifier.Preference); const preferenceService = container.get<IPreferenceService>(serviceIdentifier.Preference);
// Get tidgi mini window-specific titleBar preference // Get tidgi mini window-specific titleBar preference
const showTidgiMiniWindowTitleBar = await preferenceService.get('showTidgiMiniWindowTitleBar'); const tidgiMiniWindowShowTitleBar = await preferenceService.get('tidgiMiniWindowShowTitleBar');
// setImage after Tray instance is created to avoid // setImage after Tray instance is created to avoid
// "Segmentation fault (core dumped)" bug on Linux // "Segmentation fault (core dumped)" bug on Linux
@ -43,15 +43,15 @@ export async function handleAttachToTidgiMiniWindow(
minHeight: 100, minHeight: 100,
minWidth: 250, minWidth: 250,
// Use tidgi mini window-specific titleBar setting instead of inheriting from main window // Use tidgi mini window-specific titleBar setting instead of inheriting from main window
titleBarStyle: showTidgiMiniWindowTitleBar ? 'default' : 'hidden', titleBarStyle: tidgiMiniWindowShowTitleBar ? 'default' : 'hidden',
frame: showTidgiMiniWindowTitleBar, frame: tidgiMiniWindowShowTitleBar,
// Always hide the menu bar (File, Edit, View menu), even when showing title bar // Always hide the menu bar (File, Edit, View menu), even when showing title bar
autoHideMenuBar: true, autoHideMenuBar: true,
}; };
logger.info('Creating tidgi mini window with titleBar configuration', { logger.info('Creating tidgi mini window with titleBar configuration', {
function: 'handleAttachToTidgiMiniWindow', function: 'handleAttachToTidgiMiniWindow',
showTidgiMiniWindowTitleBar, tidgiMiniWindowShowTitleBar,
titleBarStyle: tidgiMiniWindowConfig.titleBarStyle, titleBarStyle: tidgiMiniWindowConfig.titleBarStyle,
frame: tidgiMiniWindowConfig.frame, frame: tidgiMiniWindowConfig.frame,
}); });

View file

@ -350,13 +350,13 @@ export class Window implements IWindowService {
logger.info('Closing tidgi mini window', { function: 'toggleTidgiMiniWindow' }); logger.info('Closing tidgi mini window', { function: 'toggleTidgiMiniWindow' });
await this.closeTidgiMiniWindow(); await this.closeTidgiMiniWindow();
} else { } else {
const attachToTidgiMiniWindow = await preferenceService.get('attachToTidgiMiniWindow'); const tidgiMiniWindow = await preferenceService.get('tidgiMiniWindow');
logger.debug('attachToTidgiMiniWindow preference checked', { function: 'toggleTidgiMiniWindow', attachToTidgiMiniWindow }); logger.debug('tidgiMiniWindow preference checked', { function: 'toggleTidgiMiniWindow', tidgiMiniWindow });
if (attachToTidgiMiniWindow) { if (tidgiMiniWindow) {
logger.info('Opening tidgi mini window', { function: 'toggleTidgiMiniWindow' }); logger.info('Opening tidgi mini window', { function: 'toggleTidgiMiniWindow' });
await this.openTidgiMiniWindow(true, true); // Explicitly show window when toggling await this.openTidgiMiniWindow(true, true); // Explicitly show window when toggling
} else { } else {
logger.warn('Cannot open tidgi mini window: attachToTidgiMiniWindow preference is disabled', { function: 'toggleTidgiMiniWindow' }); logger.warn('Cannot open tidgi mini window: tidgiMiniWindow preference is disabled', { function: 'toggleTidgiMiniWindow' });
} }
} }
} catch (error) { } catch (error) {
@ -498,7 +498,7 @@ export class Window implements IWindowService {
public async reactWhenPreferencesChanged(key: string, value: unknown): Promise<void> { public async reactWhenPreferencesChanged(key: string, value: unknown): Promise<void> {
switch (key) { switch (key) {
case 'attachToTidgiMiniWindow': { case 'tidgiMiniWindow': {
if (value) { if (value) {
// Enable tidgi mini window without showing the window; visibility controlled by toggle/shortcut // Enable tidgi mini window without showing the window; visibility controlled by toggle/shortcut
await this.openTidgiMiniWindow(true, false); await this.openTidgiMiniWindow(true, false);
@ -549,10 +549,10 @@ export class Window implements IWindowService {
await this.updateWindowProperties(WindowNames.tidgiMiniWindow, { alwaysOnTop: value as boolean }); await this.updateWindowProperties(WindowNames.tidgiMiniWindow, { alwaysOnTop: value as boolean });
return; return;
} }
case 'showTidgiMiniWindowTitleBar': { case 'tidgiMiniWindowShowTitleBar': {
// Title bar style requires recreating the window // Title bar style requires recreating the window
// We need to fully destroy and recreate the tidgi mini window with new titleBar settings // We need to fully destroy and recreate the tidgi mini window with new titleBar settings
logger.info('showTidgiMiniWindowTitleBar changed, recreating tidgi mini window', { logger.info('tidgiMiniWindowShowTitleBar changed, recreating tidgi mini window', {
function: 'reactWhenPreferencesChanged', function: 'reactWhenPreferencesChanged',
newValue: value, newValue: value,
}); });

View file

@ -207,13 +207,13 @@ export class WorkspaceView implements IWorkspaceViewService {
// For tidgi mini window, decide which workspace to show based on preferences // For tidgi mini window, decide which workspace to show based on preferences
const tidgiMiniWindowTask = (async () => { const tidgiMiniWindowTask = (async () => {
const [attachToTidgiMiniWindow, tidgiMiniWindowSyncWorkspaceWithMainWindow, tidgiMiniWindowFixedWorkspaceId] = await Promise.all([ const [tidgiMiniWindow, tidgiMiniWindowSyncWorkspaceWithMainWindow, tidgiMiniWindowFixedWorkspaceId] = await Promise.all([
this.preferenceService.get('attachToTidgiMiniWindow'), this.preferenceService.get('tidgiMiniWindow'),
this.preferenceService.get('tidgiMiniWindowSyncWorkspaceWithMainWindow'), this.preferenceService.get('tidgiMiniWindowSyncWorkspaceWithMainWindow'),
this.preferenceService.get('tidgiMiniWindowFixedWorkspaceId'), this.preferenceService.get('tidgiMiniWindowFixedWorkspaceId'),
]); ]);
if (!attachToTidgiMiniWindow) { if (!tidgiMiniWindow) {
return; return;
} }

View file

@ -30,22 +30,22 @@ export function TidGiMiniWindow(props: Partial<ISectionProps>): React.JSX.Elemen
<Switch <Switch
edge='end' edge='end'
color='primary' color='primary'
checked={preference.attachToTidgiMiniWindow} checked={preference.tidgiMiniWindow}
onChange={async (event) => { onChange={async (event) => {
await window.service.preference.set('attachToTidgiMiniWindow', event.target.checked); await window.service.preference.set('tidgiMiniWindow', event.target.checked);
}} }}
data-testid='attach-to-tidgi-mini-window-switch' data-testid='attach-to-tidgi-mini-window-switch'
/> />
} }
> >
<ListItemText <ListItemText
primary={platform === 'win32' ? t('Preference.AttachToTaskbar') : t('Preference.AttachToTidgiMiniWindow')} primary={platform === 'win32' ? t('Preference.AttachToTaskbar') : t('Preference.TidgiMiniWindow')}
secondary={platform === 'linux' ? undefined : t('Preference.AttachToTidgiMiniWindowTip')} secondary={platform === 'linux' ? undefined : t('Preference.TidgiMiniWindowTip')}
/> />
</ListItem> </ListItem>
{/* Other settings are only visible when attached to taskbar/system tray */} {/* Other settings are only visible when attached to taskbar/system tray */}
{preference.attachToTidgiMiniWindow && ( {preference.tidgiMiniWindow && (
<> <>
{/* Sidebar display settings */} {/* Sidebar display settings */}
<ListItem <ListItem
@ -53,17 +53,17 @@ export function TidGiMiniWindow(props: Partial<ISectionProps>): React.JSX.Elemen
<Switch <Switch
edge='end' edge='end'
color='primary' color='primary'
checked={preference.sidebarOnTidgiMiniWindow} checked={preference.tidgiMiniWindowShowSidebar}
onChange={async (event) => { onChange={async (event) => {
await window.service.preference.set('sidebarOnTidgiMiniWindow', event.target.checked); await window.service.preference.set('tidgiMiniWindowShowSidebar', event.target.checked);
}} }}
data-testid='sidebar-on-tidgi-mini-window-switch' data-testid='sidebar-on-tidgi-mini-window-switch'
/> />
} }
> >
<ListItemText <ListItemText
primary={platform === 'win32' ? t('Preference.AttachToTaskbarShowSidebar') : t('Preference.AttachToTidgiMiniWindowShowSidebar')} primary={platform === 'win32' ? t('Preference.AttachToTaskbarShowSidebar') : t('Preference.TidgiMiniWindowShowSidebar')}
secondary={platform === 'linux' ? undefined : t('Preference.AttachToTidgiMiniWindowShowSidebarTip')} secondary={platform === 'linux' ? undefined : t('Preference.TidgiMiniWindowShowSidebarTip')}
/> />
</ListItem> </ListItem>
@ -75,17 +75,17 @@ export function TidGiMiniWindow(props: Partial<ISectionProps>): React.JSX.Elemen
<Switch <Switch
edge='end' edge='end'
color='primary' color='primary'
checked={preference.showTidgiMiniWindowTitleBar} checked={preference.tidgiMiniWindowShowTitleBar}
onChange={async (event) => { onChange={async (event) => {
await window.service.preference.set('showTidgiMiniWindowTitleBar', event.target.checked); await window.service.preference.set('tidgiMiniWindowShowTitleBar', event.target.checked);
}} }}
data-testid='tidgi-mini-window-titlebar-switch' data-testid='tidgi-mini-window-titlebar-switch'
/> />
} }
> >
<ListItemText <ListItemText
primary={t('Preference.ShowTidgiMiniWindowTitleBar')} primary={t('Preference.TidgiMiniWindowShowTitleBar')}
secondary={t('Preference.ShowTidgiMiniWindowTitleBarDetail')} secondary={t('Preference.TidgiMiniWindowShowTitleBarDetail')}
/> />
</ListItem> </ListItem>

View file

@ -94,7 +94,7 @@ describe('TidGiMiniWindow Component', () => {
vi.clearAllMocks(); vi.clearAllMocks();
preferenceSubject = new BehaviorSubject<IPreferences | undefined>( preferenceSubject = new BehaviorSubject<IPreferences | undefined>(
createMockPreference({ attachToTidgiMiniWindow: false }), createMockPreference({ tidgiMiniWindow: false }),
); );
Object.defineProperty(window.observables.preference, 'preference$', { Object.defineProperty(window.observables.preference, 'preference$', {
@ -214,13 +214,13 @@ describe('TidGiMiniWindow Component', () => {
await renderComponent(); await renderComponent();
expect(screen.getByText('Preference.AttachToTidgiMiniWindow')).toBeInTheDocument(); expect(screen.getByText('Preference.TidgiMiniWindow')).toBeInTheDocument();
}); });
}); });
describe('Attach to tidgi mini window toggle', () => { describe('Attach to tidgi mini window toggle', () => {
it('should display attach to tidgi mini window switch with correct initial state', async () => { it('should display attach to tidgi mini window switch with correct initial state', async () => {
preferenceSubject.next(createMockPreference({ attachToTidgiMiniWindow: false })); preferenceSubject.next(createMockPreference({ tidgiMiniWindow: false }));
await renderComponent(); await renderComponent();
const switches = screen.getAllByRole('checkbox'); const switches = screen.getAllByRole('checkbox');
@ -230,7 +230,7 @@ describe('TidGiMiniWindow Component', () => {
it('should call backend API when attach to tidgi mini window is toggled', async () => { it('should call backend API when attach to tidgi mini window is toggled', async () => {
const user = userEvent.setup(); const user = userEvent.setup();
preferenceSubject.next(createMockPreference({ attachToTidgiMiniWindow: false })); preferenceSubject.next(createMockPreference({ tidgiMiniWindow: false }));
await renderComponent(); await renderComponent();
const switches = screen.getAllByRole('checkbox'); const switches = screen.getAllByRole('checkbox');
@ -239,13 +239,13 @@ describe('TidGiMiniWindow Component', () => {
await user.click(attachSwitch); await user.click(attachSwitch);
await waitFor(() => { await waitFor(() => {
expect(window.service.preference.set).toHaveBeenCalledWith('attachToTidgiMiniWindow', true); expect(window.service.preference.set).toHaveBeenCalledWith('tidgiMiniWindow', true);
}); });
}); });
it('should toggle attach to tidgi mini window setting', async () => { it('should toggle attach to tidgi mini window setting', async () => {
const user = userEvent.setup(); const user = userEvent.setup();
preferenceSubject.next(createMockPreference({ attachToTidgiMiniWindow: false })); preferenceSubject.next(createMockPreference({ tidgiMiniWindow: false }));
await renderComponent(); await renderComponent();
const switches = screen.getAllByRole('checkbox'); const switches = screen.getAllByRole('checkbox');
@ -254,27 +254,27 @@ describe('TidGiMiniWindow Component', () => {
await user.click(attachSwitch); await user.click(attachSwitch);
await waitFor(() => { await waitFor(() => {
expect(window.service.preference.set).toHaveBeenCalledWith('attachToTidgiMiniWindow', true); expect(window.service.preference.set).toHaveBeenCalledWith('tidgiMiniWindow', true);
}); });
}); });
}); });
describe('Conditional settings visibility', () => { describe('Conditional settings visibility', () => {
it('should hide additional settings when attachToTidgiMiniWindow is false', async () => { it('should hide additional settings when tidgiMiniWindow is false', async () => {
preferenceSubject.next(createMockPreference({ attachToTidgiMiniWindow: false })); preferenceSubject.next(createMockPreference({ tidgiMiniWindow: false }));
await renderComponent(); await renderComponent();
expect(screen.queryByText('Preference.AttachToTaskbarShowSidebar')).not.toBeInTheDocument(); expect(screen.queryByText('Preference.AttachToTaskbarShowSidebar')).not.toBeInTheDocument();
expect(screen.queryByText('Preference.AttachToTidgiMiniWindowShowSidebar')).not.toBeInTheDocument(); expect(screen.queryByText('Preference.TidgiMiniWindowShowSidebar')).not.toBeInTheDocument();
expect(screen.queryByText('Preference.TidgiMiniWindowAlwaysOnTop')).not.toBeInTheDocument(); expect(screen.queryByText('Preference.TidgiMiniWindowAlwaysOnTop')).not.toBeInTheDocument();
expect(screen.queryByText('Preference.TidgiMiniWindowSyncWorkspaceWithMainWindow')).not.toBeInTheDocument(); expect(screen.queryByText('Preference.TidgiMiniWindowSyncWorkspaceWithMainWindow')).not.toBeInTheDocument();
}); });
it('should show additional settings when attachToTidgiMiniWindow is true', async () => { it('should show additional settings when tidgiMiniWindow is true', async () => {
preferenceSubject.next( preferenceSubject.next(
createMockPreference({ createMockPreference({
attachToTidgiMiniWindow: true, tidgiMiniWindow: true,
sidebarOnTidgiMiniWindow: false, tidgiMiniWindowShowSidebar: false,
tidgiMiniWindowAlwaysOnTop: false, tidgiMiniWindowAlwaysOnTop: false,
tidgiMiniWindowSyncWorkspaceWithMainWindow: true, tidgiMiniWindowSyncWorkspaceWithMainWindow: true,
}), }),
@ -291,8 +291,8 @@ describe('TidGiMiniWindow Component', () => {
it('should display sidebar toggle with correct initial state', async () => { it('should display sidebar toggle with correct initial state', async () => {
preferenceSubject.next( preferenceSubject.next(
createMockPreference({ createMockPreference({
attachToTidgiMiniWindow: true, tidgiMiniWindow: true,
sidebarOnTidgiMiniWindow: false, tidgiMiniWindowShowSidebar: false,
}), }),
); );
await renderComponent(); await renderComponent();
@ -310,8 +310,8 @@ describe('TidGiMiniWindow Component', () => {
const user = userEvent.setup(); const user = userEvent.setup();
preferenceSubject.next( preferenceSubject.next(
createMockPreference({ createMockPreference({
attachToTidgiMiniWindow: true, tidgiMiniWindow: true,
sidebarOnTidgiMiniWindow: false, tidgiMiniWindowShowSidebar: false,
}), }),
); );
await renderComponent(); await renderComponent();
@ -322,7 +322,7 @@ describe('TidGiMiniWindow Component', () => {
await user.click(sidebarSwitch); await user.click(sidebarSwitch);
await waitFor(() => { await waitFor(() => {
expect(window.service.preference.set).toHaveBeenCalledWith('sidebarOnTidgiMiniWindow', true); expect(window.service.preference.set).toHaveBeenCalledWith('tidgiMiniWindowShowSidebar', true);
}); });
}); });
}); });
@ -331,7 +331,7 @@ describe('TidGiMiniWindow Component', () => {
it('should display always on top toggle with correct initial state', async () => { it('should display always on top toggle with correct initial state', async () => {
preferenceSubject.next( preferenceSubject.next(
createMockPreference({ createMockPreference({
attachToTidgiMiniWindow: true, tidgiMiniWindow: true,
tidgiMiniWindowAlwaysOnTop: false, tidgiMiniWindowAlwaysOnTop: false,
}), }),
); );
@ -350,7 +350,7 @@ describe('TidGiMiniWindow Component', () => {
const user = userEvent.setup(); const user = userEvent.setup();
preferenceSubject.next( preferenceSubject.next(
createMockPreference({ createMockPreference({
attachToTidgiMiniWindow: true, tidgiMiniWindow: true,
tidgiMiniWindowAlwaysOnTop: false, tidgiMiniWindowAlwaysOnTop: false,
}), }),
); );
@ -371,7 +371,7 @@ describe('TidGiMiniWindow Component', () => {
it('should display workspace sync toggle with correct initial state', async () => { it('should display workspace sync toggle with correct initial state', async () => {
preferenceSubject.next( preferenceSubject.next(
createMockPreference({ createMockPreference({
attachToTidgiMiniWindow: true, tidgiMiniWindow: true,
tidgiMiniWindowSyncWorkspaceWithMainWindow: true, tidgiMiniWindowSyncWorkspaceWithMainWindow: true,
}), }),
); );
@ -390,7 +390,7 @@ describe('TidGiMiniWindow Component', () => {
const user = userEvent.setup(); const user = userEvent.setup();
preferenceSubject.next( preferenceSubject.next(
createMockPreference({ createMockPreference({
attachToTidgiMiniWindow: true, tidgiMiniWindow: true,
tidgiMiniWindowSyncWorkspaceWithMainWindow: true, tidgiMiniWindowSyncWorkspaceWithMainWindow: true,
}), }),
); );
@ -421,7 +421,7 @@ describe('TidGiMiniWindow Component', () => {
it('should show fixed workspace selector when sync is disabled', async () => { it('should show fixed workspace selector when sync is disabled', async () => {
preferenceSubject.next( preferenceSubject.next(
createMockPreference({ createMockPreference({
attachToTidgiMiniWindow: true, tidgiMiniWindow: true,
tidgiMiniWindowSyncWorkspaceWithMainWindow: false, tidgiMiniWindowSyncWorkspaceWithMainWindow: false,
}), }),
); );
@ -437,7 +437,7 @@ describe('TidGiMiniWindow Component', () => {
const user = userEvent.setup(); const user = userEvent.setup();
preferenceSubject.next( preferenceSubject.next(
createMockPreference({ createMockPreference({
attachToTidgiMiniWindow: true, tidgiMiniWindow: true,
tidgiMiniWindowSyncWorkspaceWithMainWindow: false, tidgiMiniWindowSyncWorkspaceWithMainWindow: false,
}), }),
); );
@ -455,7 +455,7 @@ describe('TidGiMiniWindow Component', () => {
it('should have workspace selector that can trigger API calls', async () => { it('should have workspace selector that can trigger API calls', async () => {
preferenceSubject.next( preferenceSubject.next(
createMockPreference({ createMockPreference({
attachToTidgiMiniWindow: true, tidgiMiniWindow: true,
tidgiMiniWindowSyncWorkspaceWithMainWindow: false, tidgiMiniWindowSyncWorkspaceWithMainWindow: false,
tidgiMiniWindowFixedWorkspaceId: '', tidgiMiniWindowFixedWorkspaceId: '',
}), }),
@ -474,7 +474,7 @@ describe('TidGiMiniWindow Component', () => {
it('should display currently selected workspace', async () => { it('should display currently selected workspace', async () => {
preferenceSubject.next( preferenceSubject.next(
createMockPreference({ createMockPreference({
attachToTidgiMiniWindow: true, tidgiMiniWindow: true,
tidgiMiniWindowSyncWorkspaceWithMainWindow: false, tidgiMiniWindowSyncWorkspaceWithMainWindow: false,
tidgiMiniWindowFixedWorkspaceId: 'workspace-2', tidgiMiniWindowFixedWorkspaceId: 'workspace-2',
}), }),
@ -494,7 +494,7 @@ describe('TidGiMiniWindow Component', () => {
it('should display keyboard shortcut button when tidgi mini window is attached', async () => { it('should display keyboard shortcut button when tidgi mini window is attached', async () => {
preferenceSubject.next( preferenceSubject.next(
createMockPreference({ createMockPreference({
attachToTidgiMiniWindow: true, tidgiMiniWindow: true,
keyboardShortcuts: {}, keyboardShortcuts: {},
}), }),
); );
@ -507,7 +507,7 @@ describe('TidGiMiniWindow Component', () => {
it('should display current keyboard shortcut value', async () => { it('should display current keyboard shortcut value', async () => {
preferenceSubject.next( preferenceSubject.next(
createMockPreference({ createMockPreference({
attachToTidgiMiniWindow: true, tidgiMiniWindow: true,
keyboardShortcuts: { keyboardShortcuts: {
'Window.toggleTidgiMiniWindow': 'Ctrl+Shift+M', 'Window.toggleTidgiMiniWindow': 'Ctrl+Shift+M',
}, },
@ -522,7 +522,7 @@ describe('TidGiMiniWindow Component', () => {
const user = userEvent.setup(); const user = userEvent.setup();
preferenceSubject.next( preferenceSubject.next(
createMockPreference({ createMockPreference({
attachToTidgiMiniWindow: true, tidgiMiniWindow: true,
keyboardShortcuts: {}, keyboardShortcuts: {},
}), }),
); );
@ -553,7 +553,7 @@ describe('TidGiMiniWindow Component', () => {
const user = userEvent.setup(); const user = userEvent.setup();
preferenceSubject.next( preferenceSubject.next(
createMockPreference({ createMockPreference({
attachToTidgiMiniWindow: true, tidgiMiniWindow: true,
keyboardShortcuts: { keyboardShortcuts: {
'Window.toggleTidgiMiniWindow': 'Ctrl+Shift+M', 'Window.toggleTidgiMiniWindow': 'Ctrl+Shift+M',
}, },
@ -585,7 +585,7 @@ describe('TidGiMiniWindow Component', () => {
it('should display helper text for keyboard shortcut', async () => { it('should display helper text for keyboard shortcut', async () => {
preferenceSubject.next( preferenceSubject.next(
createMockPreference({ createMockPreference({
attachToTidgiMiniWindow: true, tidgiMiniWindow: true,
keyboardShortcuts: {}, keyboardShortcuts: {},
}), }),
); );
@ -601,7 +601,7 @@ describe('TidGiMiniWindow Component', () => {
// Create a fresh subject for this test to avoid interference // Create a fresh subject for this test to avoid interference
const toggleTestSubject = new BehaviorSubject<IPreferences | undefined>( const toggleTestSubject = new BehaviorSubject<IPreferences | undefined>(
createMockPreference({ attachToTidgiMiniWindow: false }), createMockPreference({ tidgiMiniWindow: false }),
); );
Object.defineProperty(window.observables.preference, 'preference$', { Object.defineProperty(window.observables.preference, 'preference$', {
@ -642,7 +642,7 @@ describe('TidGiMiniWindow Component', () => {
// Wait for API call // Wait for API call
await waitFor(() => { await waitFor(() => {
expect(window.service.preference.set).toHaveBeenCalledWith('attachToTidgiMiniWindow', true); expect(window.service.preference.set).toHaveBeenCalledWith('tidgiMiniWindow', true);
}); });
// Now verify new elements appear (they should appear automatically after the state update) // Now verify new elements appear (they should appear automatically after the state update)
@ -656,8 +656,8 @@ describe('TidGiMiniWindow Component', () => {
const user = userEvent.setup(); const user = userEvent.setup();
preferenceSubject.next( preferenceSubject.next(
createMockPreference({ createMockPreference({
attachToTidgiMiniWindow: true, tidgiMiniWindow: true,
sidebarOnTidgiMiniWindow: false, tidgiMiniWindowShowSidebar: false,
tidgiMiniWindowAlwaysOnTop: false, tidgiMiniWindowAlwaysOnTop: false,
tidgiMiniWindowSyncWorkspaceWithMainWindow: true, tidgiMiniWindowSyncWorkspaceWithMainWindow: true,
}), }),
@ -668,7 +668,7 @@ describe('TidGiMiniWindow Component', () => {
await user.click(switches[1]); await user.click(switches[1]);
await waitFor(() => { await waitFor(() => {
expect(window.service.preference.set).toHaveBeenCalledWith('sidebarOnTidgiMiniWindow', true); expect(window.service.preference.set).toHaveBeenCalledWith('tidgiMiniWindowShowSidebar', true);
}); });
await user.click(switches[3]); await user.click(switches[3]);