Skip to content
This repository was archived by the owner on Sep 13, 2024. It is now read-only.

Commit 4d7c6ae

Browse files
committed
Merge branch 'develop'
2 parents 0082f1e + c53b78c commit 4d7c6ae

16 files changed

+27
-8419
lines changed

.idea/custom-electron-titlebar.iml

Lines changed: 0 additions & 9 deletions
This file was deleted.

.idea/misc.xml

Lines changed: 0 additions & 9 deletions
This file was deleted.

.idea/modules.xml

Lines changed: 0 additions & 8 deletions
This file was deleted.

.idea/vcs.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

.npmignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,6 @@ Gruntfile.js
3333
tslint.json
3434
tsconfig.json
3535

36-
npm-debug.log
36+
npm-debug.log
37+
webpack.config.js
38+
._config.yml

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ This project is a typescript library for electron that allows you to configure a
99

1010
![Screenshot 2](screenshots/cet-002.jpg)
1111

12+
![Screenshot 3](screenshots/cet-003.jpg)
13+
1214
## 🟢 Install
1315
```
1416
npm install custom-electron-titlebar

example/index.html

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,24 @@
44
<head>
55
<meta charset="UTF-8">
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7-
<title>Hello World!</title>
7+
<title>Custom Electron Title bar</title>
8+
<link rel="preconnect" href="https://fonts.googleapis.com">
9+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
10+
<link href="https://fonts.googleapis.com/css2?family=Kalam:wght@300&display=swap" rel="stylesheet">
811
<style>
912
html {
1013
font-family: Arial, Helvetica, sans-serif;
1114
}
15+
16+
.cet-titlebar,
17+
.cet-titlebar>* {
18+
font-family: 'Kalam', cursive;
19+
}
1220
</style>
1321
</head>
1422

1523
<body>
16-
<h1>Hello World!</h1>
24+
<h1>Hi 👋🏻!</h1>
1725
We are using Node.js <span id="node-version"></span>,
1826
Chromium <span id="chrome-version"></span>,
1927
and Electron <span id="electron-version"></span>.
@@ -22,4 +30,4 @@ <h1>Hello World!</h1>
2230
<script src="./renderer.js"></script>
2331
</body>
2432

25-
</html>
33+
</html>

example/preload.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// All of the Node.js APIs are available in the preload process.
22
// It has the same sandbox as a Chrome extension.
33
const { ipcRenderer } = require('electron');
4+
const { Titlebar, Color } = require('..');
45
const path = require('path');
5-
const cet = require('..');
66

77
let titlebar;
88

@@ -20,9 +20,9 @@ window.addEventListener('DOMContentLoaded', () => {
2020
})
2121

2222
ipcRenderer.on('renderer-titlebar', (event, menu) => {
23-
titlebar = new cet.Titlebar({
24-
backgroundColor: cet.Color.fromHex("#388e3c"),
25-
icon: new URL(path.join(__dirname, '/assets/images', '/icon.svg')),
23+
titlebar = new Titlebar({
24+
backgroundColor: Color.fromHex("#388e3c"),
25+
icon: path.join(__dirname, '/assets/images', '/icon.svg'),
2626
menu: menu,
2727
onMinimize: () => ipcRenderer.send('window-event', 'window-minimize'),
2828
onMaximize: () => ipcRenderer.send('window-event', 'window-maximize'),

example/titlebar-events.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ipcMain.on('request-application-menu', (event) => {
99
const menu = Menu.getApplicationMenu();
1010
const jsonMenu = JSON.parse(JSON.stringify(menu, parseMenu()));
1111
event.sender.send('renderer-titlebar', jsonMenu);
12-
});
12+
})
1313

1414
ipcMain.on('window-event', (event, eventName) => {
1515
const window = BrowserWindow.fromWebContents(event.sender);

0 commit comments

Comments
 (0)