custom-electron-titlebar 3.2.10 → 4.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -96
- package/{build → dist}/browser/browser.d.ts +0 -0
- package/{build → dist}/browser/event.d.ts +0 -0
- package/{build → dist}/browser/iframe.d.ts +0 -0
- package/{build → dist}/browser/keyboardEvent.d.ts +0 -0
- package/{build → dist}/browser/mouseEvent.d.ts +0 -0
- package/{build → dist}/common/arrays.d.ts +0 -0
- package/{build → dist}/common/async.d.ts +0 -0
- package/{build → dist}/common/charCode.d.ts +0 -0
- package/{build → dist}/common/color.d.ts +0 -0
- package/{build → dist}/common/dom.d.ts +0 -0
- package/{build → dist}/common/event.d.ts +0 -0
- package/{build → dist}/common/iterator.d.ts +0 -0
- package/{build → dist}/common/keyCodes.d.ts +0 -0
- package/{build → dist}/common/lifecycle.d.ts +0 -0
- package/{build → dist}/common/linkedList.d.ts +0 -0
- package/{build → dist}/common/platform.d.ts +0 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +453 -0
- package/dist/interfaces.d.ts +96 -0
- package/{build → dist}/menu/menu.d.ts +3 -1
- package/{build → dist}/menu/menuitem.d.ts +3 -4
- package/{build → dist}/menubar.d.ts +1 -24
- package/dist/titlebar.d.ts +69 -0
- package/package.json +22 -14
- package/webpack.config.js +37 -0
- package/.github/FUNDING.yml +0 -1
- package/.github/ISSUE_TEMPLATE/issue-report.md +0 -29
- package/.vscode/launch.json +0 -49
- package/.vscode/tasks.json +0 -34
- package/build/browser/browser.js +0 -157
- package/build/browser/browser.js.map +0 -1
- package/build/browser/event.js +0 -30
- package/build/browser/event.js.map +0 -1
- package/build/browser/iframe.js +0 -110
- package/build/browser/iframe.js.map +0 -1
- package/build/browser/keyboardEvent.js +0 -226
- package/build/browser/keyboardEvent.js.map +0 -1
- package/build/browser/mouseEvent.js +0 -110
- package/build/browser/mouseEvent.js.map +0 -1
- package/build/common/arrays.js +0 -18
- package/build/common/arrays.js.map +0 -1
- package/build/common/async.js +0 -95
- package/build/common/async.js.map +0 -1
- package/build/common/charCode.js +0 -7
- package/build/common/charCode.js.map +0 -1
- package/build/common/color.js +0 -494
- package/build/common/color.js.map +0 -1
- package/build/common/dom.js +0 -984
- package/build/common/dom.js.map +0 -1
- package/build/common/event.js +0 -611
- package/build/common/event.js.map +0 -1
- package/build/common/iterator.js +0 -164
- package/build/common/iterator.js.map +0 -1
- package/build/common/keyCodes.js +0 -268
- package/build/common/keyCodes.js.map +0 -1
- package/build/common/lifecycle.js +0 -63
- package/build/common/lifecycle.js.map +0 -1
- package/build/common/linkedList.js +0 -139
- package/build/common/linkedList.js.map +0 -1
- package/build/common/platform.js +0 -115
- package/build/common/platform.js.map +0 -1
- package/build/index.d.ts +0 -3
- package/build/index.js +0 -20
- package/build/index.js.map +0 -1
- package/build/menu/menu.js +0 -538
- package/build/menu/menu.js.map +0 -1
- package/build/menu/menuitem.js +0 -339
- package/build/menu/menuitem.js.map +0 -1
- package/build/menubar.js +0 -608
- package/build/menubar.js.map +0 -1
- package/build/themebar.d.ts +0 -20
- package/build/themebar.js +0 -568
- package/build/themebar.js.map +0 -1
- package/build/titlebar.d.ts +0 -135
- package/build/titlebar.js +0 -453
- package/build/titlebar.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Custom Electron Titlebar
|
|
1
|
+
# Custom Electron Titlebar 4
|
|
2
2
|
|
|
3
3
|
This project is a typescript library for electron that allows you to configure a fully customizable title bar.
|
|
4
4
|
|
|
@@ -9,8 +9,6 @@ This project is a typescript library for electron that allows you to configure a
|
|
|
9
9
|
|
|
10
10
|

|
|
11
11
|
|
|
12
|
-

|
|
13
|
-
|
|
14
12
|
## Install
|
|
15
13
|
|
|
16
14
|
```
|
|
@@ -22,17 +20,19 @@ or use example folder to init basic electron project with this titlebar.
|
|
|
22
20
|
## Usage
|
|
23
21
|
|
|
24
22
|
#### Step 1
|
|
25
|
-
In your **
|
|
23
|
+
In your **preload** file add:
|
|
24
|
+
|
|
25
|
+
For javascript
|
|
26
26
|
|
|
27
27
|
```js
|
|
28
28
|
const customTitlebar = require('custom-electron-titlebar');
|
|
29
29
|
|
|
30
30
|
new customTitlebar.Titlebar({
|
|
31
|
-
backgroundColor: customTitlebar.Color.fromHex('#
|
|
31
|
+
backgroundColor: customTitlebar.Color.fromHex('#ECECEC')
|
|
32
32
|
});
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
For typescript
|
|
36
36
|
```ts
|
|
37
37
|
import { Titlebar, Color } from 'custom-electron-titlebar'
|
|
38
38
|
|
|
@@ -47,10 +47,13 @@ The parameter `backgroundColor: Color` is required, this should be `Color` type.
|
|
|
47
47
|
#### Step 2
|
|
48
48
|
Update the code that launches browser window
|
|
49
49
|
```js
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
let mainWindow = new BrowserWindow({
|
|
51
|
+
width: 1000,
|
|
52
|
+
height: 600,
|
|
53
|
+
titleBarStyle: "hidden", // add this line
|
|
54
|
+
webPreferences: {
|
|
55
|
+
preload: path.join(__dirname, 'preload.js')
|
|
56
|
+
}
|
|
54
57
|
});
|
|
55
58
|
```
|
|
56
59
|
|
|
@@ -58,25 +61,24 @@ var mainWindow = new BrowserWindow({
|
|
|
58
61
|
|
|
59
62
|
The interface [`TitleBarOptions`] is managed, which has the following configurable options for the title bar. Some parameters are optional.
|
|
60
63
|
|
|
61
|
-
| Parameter | Type
|
|
62
|
-
| ------------------------------ |
|
|
63
|
-
| backgroundColor **(required)** | Color
|
|
64
|
-
| icon | string
|
|
65
|
-
|
|
|
66
|
-
|
|
|
67
|
-
|
|
|
68
|
-
|
|
|
69
|
-
|
|
|
70
|
-
|
|
|
71
|
-
|
|
|
72
|
-
|
|
|
73
|
-
|
|
|
74
|
-
| menuPosition | string
|
|
75
|
-
| enableMnemonics | boolean
|
|
76
|
-
|
|
|
77
|
-
|
|
|
78
|
-
|
|
|
79
|
-
| unfocusEffect | boolean | Enables or disables the blur option in the title bar. | false |
|
|
64
|
+
| Parameter | Type | Description | Default |
|
|
65
|
+
| ------------------------------ | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------- |
|
|
66
|
+
| backgroundColor **(required)** | Color | The background color of the titlebar. | #444444 |
|
|
67
|
+
| icon | string | The icon shown on the left side of the title bar. | null |
|
|
68
|
+
| shadow | boolean | The shadow of the titlebar. | false |
|
|
69
|
+
| drag | boolean | Define whether or not you can drag the window by holding the click on the title bar. | true |
|
|
70
|
+
| onMinimize | Funtion | Enables or disables the option to minimize the window by clicking on the corresponding button in the title bar. | undefined |
|
|
71
|
+
| onMaximize | Funtion | Enables or disables the option to maximize and un-maximize the window by clicking on the corresponding button in the title bar. | undefined |
|
|
72
|
+
| onClose | Funtion | Enables or disables the option of the close window by clicking on the corresponding button in the title bar. | undefined |
|
|
73
|
+
| isMaximized | Funtion | Check if window is maximized. | undefined |
|
|
74
|
+
| onMenuItemClick | Funtion(commandId: number)| Fires when any menu option is pressed. | undefined |
|
|
75
|
+
| order | string | Set the order of the elements on the title bar. (`inverted`, `first-buttons`) | null |
|
|
76
|
+
| titleHorizontalAlignment | string | Set horizontal alignment of the window title. (`left`, `center`, `right`) | center |
|
|
77
|
+
| menuPosition | string | The position of menubar on titlebar. | left |
|
|
78
|
+
| enableMnemonics | boolean | Enable the mnemonics on menubar and menu items. | true |
|
|
79
|
+
| hideWhenClickingClose | boolean | When the close button is clicked, the window is hidden instead of closed. | false |
|
|
80
|
+
| overflow | string | The overflow of the container (`auto`, `visible`, `hidden`) | auto |
|
|
81
|
+
| unfocusEffect | boolean | Enables or disables the blur option in the title bar. | false |
|
|
80
82
|
|
|
81
83
|
## Methods
|
|
82
84
|
|
|
@@ -122,51 +124,6 @@ With this method you can update the icon. This method receives the url of the im
|
|
|
122
124
|
titlebar.updateIcon('./images/my-icon.svg');
|
|
123
125
|
```
|
|
124
126
|
|
|
125
|
-
### Update Menu
|
|
126
|
-
|
|
127
|
-
This method updates or creates the menu, to create the menu use remote.Menu and remote.MenuItem.
|
|
128
|
-
|
|
129
|
-
```js
|
|
130
|
-
const menu = new Menu();
|
|
131
|
-
menu.append(new MenuItem({
|
|
132
|
-
label: 'Item 1',
|
|
133
|
-
submenu: [
|
|
134
|
-
{
|
|
135
|
-
label: 'Subitem 1',
|
|
136
|
-
click: () => console.log('Click on subitem 1')
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
type: 'separator'
|
|
140
|
-
}
|
|
141
|
-
]
|
|
142
|
-
}));
|
|
143
|
-
|
|
144
|
-
menu.append(new MenuItem({
|
|
145
|
-
label: 'Item 2',
|
|
146
|
-
submenu: [
|
|
147
|
-
{
|
|
148
|
-
label: 'Subitem checkbox',
|
|
149
|
-
type: 'checkbox',
|
|
150
|
-
checked: true
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
type: 'separator'
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
label: 'Subitem with submenu',
|
|
157
|
-
submenu: [
|
|
158
|
-
{
|
|
159
|
-
label: 'Submenu &item 1',
|
|
160
|
-
accelerator: 'Ctrl+T'
|
|
161
|
-
}
|
|
162
|
-
]
|
|
163
|
-
}
|
|
164
|
-
]
|
|
165
|
-
}));
|
|
166
|
-
|
|
167
|
-
titlebar.updateMenu(menu);
|
|
168
|
-
```
|
|
169
|
-
|
|
170
127
|
### Update Menu Position
|
|
171
128
|
|
|
172
129
|
You can change the position of the menu bar. `left` and `bottom` are allowed.
|
|
@@ -177,9 +134,7 @@ titlebar.updateMenuPosition('bottom');
|
|
|
177
134
|
|
|
178
135
|
### Set Horizontal Alignment
|
|
179
136
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
`left`, `center` and `right` are allowed
|
|
137
|
+
You can change the position of the title of title bar. `left`, `center` and `right` are allowed
|
|
183
138
|
|
|
184
139
|
```js
|
|
185
140
|
titlebar.setHorizontalAlignment('right');
|
|
@@ -193,25 +148,6 @@ This method removes the title bar completely and all recorded events.
|
|
|
193
148
|
titlebar.dispose();
|
|
194
149
|
```
|
|
195
150
|
|
|
196
|
-
## CSS Classes
|
|
197
|
-
The following CSS classes exist and can be used to customize the titlebar
|
|
198
|
-
|
|
199
|
-
| Class name | Description |
|
|
200
|
-
| --------------------------- | -----------------------------------------------------------------|
|
|
201
|
-
| .titlebar | Styles the titlebar. |
|
|
202
|
-
| .window-appicon | Styles the app icon on the titlebar. |
|
|
203
|
-
| .window-title | Styles the window title. (Example: font-size) |
|
|
204
|
-
| .window-controls-container | Styles the window controls section. |
|
|
205
|
-
| .resizer top | Styles the resizer invisible top bar |
|
|
206
|
-
| .resizer left | Styles the resizer invisible left bar |
|
|
207
|
-
| .menubar | Styles the top menus |
|
|
208
|
-
| .menubar-menu-button | Styles the main menu elements. (Example: color) |
|
|
209
|
-
| .menubar-menu-button open | Styles the main menu elements when open menu. (Example: color) |
|
|
210
|
-
| .menubar-menu-title | Description missing |
|
|
211
|
-
| .action-item | Description missing |
|
|
212
|
-
| .action-menu-item | Styles action menu elements. (Example: color) |
|
|
213
|
-
|
|
214
|
-
|
|
215
151
|
## License
|
|
216
152
|
|
|
217
153
|
This project is under the [MIT](https://github.com/AlexTorresSk/custom-electron-titlebar/blob/master/LICENSE) license.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|