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

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexTorresDev committed Jan 24, 2022
2 parents 0082f1e + c53b78c commit 4d7c6ae
Show file tree
Hide file tree
Showing 16 changed files with 27 additions and 8,419 deletions.
9 changes: 0 additions & 9 deletions .idea/custom-electron-titlebar.iml

This file was deleted.

9 changes: 0 additions & 9 deletions .idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

4 changes: 3 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,6 @@ Gruntfile.js
tslint.json
tsconfig.json

npm-debug.log
npm-debug.log
webpack.config.js
._config.yml
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ This project is a typescript library for electron that allows you to configure a

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

![Screenshot 3](screenshots/cet-003.jpg)

## 🟢 Install
```
npm install custom-electron-titlebar
Expand Down
14 changes: 11 additions & 3 deletions example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,24 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hello World!</title>
<title>Custom Electron Title bar</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Kalam:wght@300&display=swap" rel="stylesheet">
<style>
html {
font-family: Arial, Helvetica, sans-serif;
}

.cet-titlebar,
.cet-titlebar>* {
font-family: 'Kalam', cursive;
}
</style>
</head>

<body>
<h1>Hello World!</h1>
<h1>Hi 👋🏻!</h1>
We are using Node.js <span id="node-version"></span>,
Chromium <span id="chrome-version"></span>,
and Electron <span id="electron-version"></span>.
Expand All @@ -22,4 +30,4 @@ <h1>Hello World!</h1>
<script src="./renderer.js"></script>
</body>

</html>
</html>
8 changes: 4 additions & 4 deletions example/preload.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// All of the Node.js APIs are available in the preload process.
// It has the same sandbox as a Chrome extension.
const { ipcRenderer } = require('electron');
const { Titlebar, Color } = require('..');
const path = require('path');
const cet = require('..');

let titlebar;

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

ipcRenderer.on('renderer-titlebar', (event, menu) => {
titlebar = new cet.Titlebar({
backgroundColor: cet.Color.fromHex("#388e3c"),
icon: new URL(path.join(__dirname, '/assets/images', '/icon.svg')),
titlebar = new Titlebar({
backgroundColor: Color.fromHex("#388e3c"),
icon: path.join(__dirname, '/assets/images', '/icon.svg'),
menu: menu,
onMinimize: () => ipcRenderer.send('window-event', 'window-minimize'),
onMaximize: () => ipcRenderer.send('window-event', 'window-maximize'),
Expand Down
2 changes: 1 addition & 1 deletion example/titlebar-events.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ipcMain.on('request-application-menu', (event) => {
const menu = Menu.getApplicationMenu();
const jsonMenu = JSON.parse(JSON.stringify(menu, parseMenu()));
event.sender.send('renderer-titlebar', jsonMenu);
});
})

ipcMain.on('window-event', (event, eventName) => {
const window = BrowserWindow.fromWebContents(event.sender);
Expand Down
Loading

0 comments on commit 4d7c6ae

Please sign in to comment.