30 lines
637 B
TypeScript
30 lines
637 B
TypeScript
// Desc: Custom hook to handle window resizing
|
|
|
|
export enum ElectronTheme {
|
|
SYSTEM = 'system',
|
|
DARK = 'dark',
|
|
LIGHT = 'light'
|
|
}
|
|
|
|
const useWindow = () => {
|
|
|
|
const setSize = (width : number, height : number) => {
|
|
window.api.send('window-resize', { width: width, height: height });
|
|
}
|
|
|
|
const setResizeble = (isResizeble : boolean) => {
|
|
window.api.send('window-resizeble', isResizeble);
|
|
}
|
|
|
|
const setTheme = (theme : ElectronTheme) => {
|
|
window.api.send('window-theme', theme);
|
|
}
|
|
|
|
return {
|
|
setSize,
|
|
setResizeble,
|
|
setTheme
|
|
}
|
|
}
|
|
|
|
export default useWindow; |