Browse Source

Add windows and macOS check for resize/move

master
jeffvli 3 years ago
committed by Jeff
parent
commit
6eef23a20f
  1. 78
      src/main.dev.js

78
src/main.dev.js

@ -29,6 +29,7 @@ import multiSelectReducer from './redux/multiSelectSlice';
import MenuBuilder from './menu'; import MenuBuilder from './menu';
const isWindows = process.platform === 'win32'; const isWindows = process.platform === 'win32';
const isMacOS = process.platform === 'darwin';
export const store = configureStore({ export const store = configureStore({
reducer: { reducer: {
@ -234,34 +235,67 @@ const createWindow = async () => {
} }
}); });
mainWindow.on('resize', () => { if (isWindows) {
const window = mainWindow.getContentBounds(); mainWindow.on('resize', () => {
const window = mainWindow.getContentBounds();
// Set the current song image as thumbnail
mainWindow.setThumbnailClip({
x: 15,
y: mainWindow.getContentSize()[1] - 83,
height: 65,
width: 65,
});
settings.setSync('windowPosition', {
x: window.x,
y: window.y,
width: window.width,
height: window.height,
});
});
// Set the current song image as thumbnail mainWindow.on('moved', () => {
mainWindow.setThumbnailClip({ const window = mainWindow.getContentBounds();
x: 15, settings.setSync('windowPosition', {
y: mainWindow.getContentSize()[1] - 83, x: window.x,
height: 65, y: window.y,
width: 65, width: window.width,
height: window.height,
});
}); });
}
settings.setSync('windowPosition', { if (isMacOS) {
x: window.x, mainWindow.on('resize', () => {
y: window.y, const window = mainWindow.getContentBounds();
width: window.width,
height: window.height, // Set the current song image as thumbnail
mainWindow.setThumbnailClip({
x: 15,
y: mainWindow.getContentSize()[1] - 83,
height: 65,
width: 65,
});
settings.setSync('windowPosition', {
x: window.x,
y: window.y,
width: window.width,
height: window.height,
});
}); });
});
mainWindow.on('moved', () => { mainWindow.on('moved', () => {
const window = mainWindow.getContentBounds(); const window = mainWindow.getContentBounds();
settings.setSync('windowPosition', { settings.setSync('windowPosition', {
x: window.x, x: window.x,
y: window.y, y: window.y,
width: window.width, width: window.width,
height: window.height, height: window.height,
});
}); });
}); }
mainWindow.on('maximize', () => { mainWindow.on('maximize', () => {
console.log('entered maximize'); console.log('entered maximize');

Loading…
Cancel
Save