// Opens the theme editor tab. The Settings window asks the workspace window that opened it. import { isTauri } from '@tauri-apps/api/core'; import { emitTo } from '@tauri-apps/api/event'; import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow'; export const THEME_EDITOR_EVENT = 'runestone-theme-editor-open'; export async function requestThemeEditor() { const label = isTauri() ? getCurrentWebviewWindow().label : ''; // Settings window labels are settings- (src-tauri/src/settings.rs). if (label.startsWith('settings-')) await emitTo(label.slice('settings-'.length), THEME_EDITOR_EVENT); else window.dispatchEvent(new Event(THEME_EDITOR_EVENT)); }