'init'
This commit is contained in:
30
app/hooks/useWindow.ts
Normal file
30
app/hooks/useWindow.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
// 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;
|
||||
Reference in New Issue
Block a user