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

Commit d821dc4

Browse files
committed
Refactoring code
1 parent b7a8982 commit d821dc4

24 files changed

+420
-418
lines changed

.github/ISSUE_TEMPLATE/issue-report.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ If applicable, add screenshots to help explain your problem.
2525

2626
**Desktop (please complete the following information):**
2727
- OS: [e.g. Windows]
28-
- Electron version [e.g. 4.0.0]
29-
- Node Version [e.g. 2.2]
28+
- Electron version [e.g. 16.0.0]
29+
- Node Version [e.g. 14.0]

.github/stale.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Number of days of inactivity before an issue becomes stale
2+
daysUntilStale: 60
3+
# Number of days of inactivity before a stale issue is closed
4+
daysUntilClose: 7
5+
# Issues with these labels will never be considered stale
6+
exemptLabels:
7+
- pinned
8+
- security
9+
# Label to use when marking an issue as stale
10+
staleLabel: wontfix
11+
# Comment to post when marking an issue as stale. Set to `false` to disable
12+
markComment: false
13+
# Comment to post when closing a stale issue. Set to `false` to disable
14+
closeComment: >
15+
📢 This issue has been closed automatically because it has not had recent activity.
16+
Thank you for your contributions.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ This project is a typescript library for electron that allows you to configure a
44

55
[![LICENSE](https://img.shields.io/github/license/AlexTorresSk/custom-electron-titlebar.svg)](https://github.com/AlexTorresSk/custom-electron-titlebar/blob/master/LICENSE)
66
[![NPM Version](https://img.shields.io/npm/v/custom-electron-titlebar.svg)](https://npmjs.org/package/custom-electron-titlebar)
7+
[![install size](https://packagephobia.com/badge?p=custom-electron-titlebar)](https://packagephobia.com/result?p=custom-electron-titlebar)
78

89
![Screenshot 1](screenshots/cet-001.jpg)
910

example/assets/icons.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"check": "<svg viewBox='0 0 11 11'><path d='M3.8,9.3c-0.1,0-0.2,0-0.3-0.1L0.2,5.8C0,5.6,0,5.4,0.2,5.2C0.4,5,0.7,5,0.9,5.2l3,3l6.3-6.3c0.2-0.2,0.5-0.2,0.7,0C11,2,11,2.3,10.8,2.5L4.2,9.1C4.1,9.2,4,9.3,3.8,9.3z'/></svg>",
33
"arrow": "<svg viewBox='0 0 11 11'><path d='M3.1,10.7c-0.1,0-0.2,0-0.3-0.1c-0.2-0.2-0.2-0.5,0-0.7l4.4-4.4L2.8,1.1c-0.2-0.2-0.2-0.5,0-0.7c0.2-0.2,0.5-0.2,0.7,0l4.8,4.8c0.2,0.2,0.2,0.5,0,0.7l-4.8,4.8C3.4,10.7,3.2,10.7,3.1,10.7z'/></svg>",
4-
"win": {
4+
"windows": {
55
"minimize": "<svg viewBox='0 0 11 11'><path d='M11,4.9v1.1H0V4.399h11z'/></svg>",
66
"maximize": "<svg viewBox='0 0 11 11'><path d='M0,1.7v7.6C0,10.2,0.8,11,1.7,11h7.6c0.9,0,1.7-0.8,1.7-1.7V1.7C11,0.8,10.2,0,9.3,0H1.7C0.8,0,0,0.8,0,1.7z M8.8,9.9H2.2c-0.6,0-1.1-0.5-1.1-1.1V2.2c0-0.6,0.5-1.1,1.1-1.1h6.7c0.6,0,1.1,0.5,1.1,1.1v6.7C9.9,9.4,9.4,9.9,8.8,9.9z'/></svg>",
77
"restore": "<svg viewBox='0 0 11 11'><path d='M7.9,2.2h-7C0.4,2.2,0,2.6,0,3.1v7C0,10.6,0.4,11,0.9,11h7c0.5,0,0.9-0.4,0.9-0.9v-7C8.8,2.6,8.4,2.2,7.9,2.2z M7.7,9.6 c0,0.2-0.1,0.3-0.3,0.3h-6c-0.2,0-0.3-0.1-0.3-0.3v-6c0-0.2,0.1-0.3,0.3-0.3h6c0.2,0,0.3,0.1,0.3,0.3V9.6z'/><path d='M10,0H3.5v1.1h6.1c0.2,0,0.3,0.1,0.3,0.3v6.1H11V1C11,0.4,10.6,0,10,0z'/></svg>",

example/index.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@
3030
font-family: Arial, Helvetica, sans-serif;
3131
}
3232

33-
.cet-titlebar,
34-
.cet-titlebar>* {
35-
font-family: 'Kalam', cursive;
36-
}
33+
3734
</style>
3835
</head>
3936

example/main.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const { setupTitlebar, attachTitlebarToWindow } = require('custom-electron-title
66
// setup the titlebar main process
77
setupTitlebar();
88

9-
createWindow = () => {
9+
const createWindow = () => {
1010
// Create the browser window.
1111
const mainWindow = new BrowserWindow({
1212
width: 800,
@@ -53,7 +53,7 @@ app.on('window-all-closed', function () {
5353

5454
const exampleMenuTemplate = () => [
5555
{
56-
label: "Simple Options",
56+
label: "Simple O&ptions",
5757
submenu: [
5858
{
5959
label: "Quit",
@@ -69,7 +69,7 @@ const exampleMenuTemplate = () => [
6969
type: "radio",
7070
},
7171
{
72-
label: "Checkbox1",
72+
label: "Check&box1",
7373
type: "checkbox",
7474
checked: true,
7575
click: (item) => {
@@ -78,7 +78,7 @@ const exampleMenuTemplate = () => [
7878
},
7979
{ type: "separator" },
8080
{
81-
label: "Checkbox2",
81+
label: "Che&ckbox2",
8282
type: "checkbox",
8383
checked: false,
8484
click: (item) => {
@@ -88,7 +88,7 @@ const exampleMenuTemplate = () => [
8888
]
8989
},
9090
{
91-
label: "Advanced Options",
91+
label: "A&dvanced Options",
9292
submenu: [
9393
{
9494
label: "Quit",
@@ -124,7 +124,7 @@ const exampleMenuTemplate = () => [
124124
label: "Radio Test",
125125
submenu: [
126126
{
127-
label: "Sample Checkbox",
127+
label: "S&ample Checkbox",
128128
type: "checkbox",
129129
checked: true
130130
},
@@ -177,7 +177,7 @@ const exampleMenuTemplate = () => [
177177
]
178178
},
179179
{
180-
label: "View",
180+
label: "&View",
181181
submenu: [
182182
{ role: "reload" },
183183
{ role: "forceReload" },

example/preload.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ let titlebar;
77

88
window.addEventListener('DOMContentLoaded', () => {
99
titlebar = new Titlebar({
10-
backgroundColor: Color.fromHex("#388e3c"),
11-
itemBackgroundColor: Color.fromHex("#ffffff"),
10+
backgroundColor: Color.fromHex("#262626"),
11+
//itemBackgroundColor: Color.fromHex("#ffffff"),
1212
svgColor: Color.WHITE,
1313
icon: path.join(__dirname, '/assets/images', '/icon.svg'),
14+
//menuPosition: 'bottom',
1415
//menu: null // = do not automatically use Menu.applicationMenu
16+
menuTransparent: 80,
1517
})
1618

1719
const replaceText = (selector, text) => {

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{
22
"name": "custom-electron-titlebar",
33
"version": "4.1.1",
4-
"description": "Custom Electron Titlebar is a library for electron that allows you to configure a fully customizable title bar.",
4+
"description": "Library for electron that allows you to configure a fully customizable title bar.",
5+
"main": "./dist/index.js",
6+
"types": "./dist/index.d.ts",
57
"exports": {
68
".": "./dist/index.js",
79
"./main": "./dist/main.js"
810
},
9-
"types": "dist/index.d.ts",
1011
"scripts": {
1112
"build:develop": "webpack --mode=development",
1213
"build": "webpack --mode=production",

src/enums/menu-state.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) AlexTorresSk. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
16
export enum MenubarState {
27
HIDDEN,
38
VISIBLE,

src/main/attach-titlebar-to-window.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) AlexTorresSk. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
16
export = (browserWindow: Electron.BrowserWindow) => {
27
browserWindow.on("enter-full-screen", () => {
38
browserWindow.webContents.send("window-fullscreen", true);

0 commit comments

Comments
 (0)