* fix: wrong direction icon collapse right panel * fix: add back social icon * fix: modal troubleshoot * fix: shadow transparent theme * fix: enable nitro_tensorrt_llm * fix: disabled model dropdown when local server running
37 lines
834 B
TypeScript
37 lines
834 B
TypeScript
import { app } from 'electron'
|
|
import Store from 'electron-store'
|
|
|
|
const DEFAULT_WIDTH = 1000
|
|
const DEFAULT_HEIGHT = 800
|
|
|
|
const storage = new Store()
|
|
|
|
export const setupCore = async () => {
|
|
// Setup core api for main process
|
|
global.core = {
|
|
// Define appPath function for app to retrieve app path globally
|
|
appPath: () => app.getPath('userData'),
|
|
}
|
|
}
|
|
|
|
export const getBounds = async () => {
|
|
const defaultBounds = {
|
|
x: undefined,
|
|
y: undefined,
|
|
width: DEFAULT_WIDTH,
|
|
height: DEFAULT_HEIGHT,
|
|
}
|
|
|
|
const bounds = await storage.get('windowBounds')
|
|
if (bounds) {
|
|
return bounds as Electron.Rectangle
|
|
} else {
|
|
storage.set('windowBounds', defaultBounds)
|
|
return defaultBounds
|
|
}
|
|
}
|
|
|
|
export const saveBounds = (bounds: Electron.Rectangle | undefined) => {
|
|
storage.set('windowBounds', bounds)
|
|
}
|