Comments (2)
A fix for this is in the index.js
in the custom-electron-titlebar/titlebar
folder in this.currentOptions
under the last option which is tooltips for me
tooltips: {
close: 'Close',
maximize: 'Maximize',
minimize: 'Minimize',
restoreDown: 'Restore Down'
},
then add
minWidth: 400,
minHeight: 270,
then in the same file in the setupMenubar
function located at line 157
for me add
_get__("electron_1").ipcRenderer.send('window-set-minimumSize', this.currentOptions.minWidth, this.currentOptions.minHeight)
at the bottom of the function under (0, _get__("dom_1").append)(this.titlebar, this.menuBarContainer);
in the options.d.ts
file located in cusotm-electron-titlebar/titlebar
add
/**
* Controls the Minimum Width the user is allowed to resize the window to.
* **The default is 400*
*/
minWidth?: 400,
/**
* Controls the Minimum Height the user is allowed to resize the window to.
* **The default is 270*
*/
minHeight?: 270,
under the tooltips defintion, and lastly in the custom-electron-titlebar/main
in setup-titlebar.js
add
ipcMain.on('window-set-minimumSize', (event, width, height) => {
const window = BrowserWindow.fromWebContents(event.sender);
/* eslint-disable indent */
if (window) {
console.log(width, height);
window?.setMinimumSize(width, height);
}
});
under
ipcMain.on('window-event', (event, eventName) => {
const window = BrowserWindow.fromWebContents(event.sender);
/* eslint-disable indent */
if (window) {
switch (eventName) {
case 'window-minimize':
window?.minimize();
break;
case 'window-maximize':
window?.isMaximized() ? window.unmaximize() : window?.maximize();
break;
case 'window-close':
window?.close();
break;
case 'window-is-maximized':
event.returnValue = window?.isMaximized();
break;
default:
break;
}
}
});
To use this in your preload.js
file in the titlebar options add a minWidth and minHeight like you would normally to the mainWindow just this time its in titlebarOptions instead an example of this in the options is
window.addEventListener("DOMContentLoaded", () => {
// Title bar implementation
new Titlebar({
minWidth: 1080,
minHeight: 720,
});
});
from custom-electron-titlebar.
@AlexTorresDev I created a pr that fixes this issue
from custom-electron-titlebar.
Related Issues (20)
- Link to titlebar documentation is dead HOT 2
- The icon option crashes the toolbar
- Window Maximization button not change when window is maximized
- When I mouse-click the titlebar, the window does not get focus
- ERR_PACKAGE_PATH_NOT_EXPORTED on build
- Not sure how to add menu items HOT 1
- [Bug] Linux titlebar is broken? HOT 1
- Focus vc NonFocus revist? HOT 4
- Use getMenu instead of getApplicationMenu
- updateMenu should be public HOT 1
- OS detection fails in packaged/production builds, causing `undefined` instead of menu icons
- Impossible to update the menu HOT 1
- Title moves to the left after resizing HOT 5
- The submenus are not aligned with the title menu HOT 2
- [New Feature] Customize the title bar right-click menu and right-click events
- Click eventListener is not working for menu that doesn't have any submenu
- First Item in submenu not working HOT 3
- unable to use path for icon in preload.js options
- Icons missing in Production (electron-react boilerplate)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from custom-electron-titlebar.