Skip to content

Commit 81c4c4f

Browse files
committed
Add detached mode
1 parent f8b1ac3 commit 81c4c4f

3 files changed

Lines changed: 25 additions & 1 deletion

File tree

public/electron.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,21 @@ function bindIpc() {
6969
});
7070
}
7171

72+
// Makes the app start receiving the mouse interactions again
73+
function disableDetachedMode() {
74+
app.dock && app.dock.setBadge('');
75+
mainWindow.setIgnoreMouseEvents(false);
76+
}
77+
7278
// This method will be called when Electron has finished
7379
// initialization and is ready to create browser windows.
7480
// Some APIs can only be used after this event occurs.
7581
app.on('ready', createWindow);
7682

83+
// Make the window start receiving mouse events on focus/activate
84+
app.on('browser-window-focus', disableDetachedMode);
85+
app.on('activate', disableDetachedMode);
86+
7787
// Quit when all windows are closed.
7888
app.on('window-all-closed', function () {
7989
// On OS X it is common for applications and their menu bar

public/menu.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ function setMainMenu(mainWindow) {
8181
{
8282
label: 'Edit',
8383
submenu: [
84-
...getOpacityMenuItems(mainWindow),
8584
{ role: 'undo' },
8685
{ role: 'redo' },
8786
{ type: 'separator' },
@@ -94,6 +93,7 @@ function setMainMenu(mainWindow) {
9493
{
9594
label: 'View',
9695
submenu: [
96+
...getOpacityMenuItems(mainWindow),
9797
{
9898
label: 'Toggle Navbar',
9999
accelerator: 'CmdOrCtrl+Shift+L',
@@ -112,6 +112,17 @@ function setMainMenu(mainWindow) {
112112
{
113113
type: 'separator'
114114
},
115+
{
116+
label: 'Detached Mode',
117+
accelerator: 'CmdOrCtrl+Shift+D',
118+
click() {
119+
app.dock && app.dock.setBadge('Detached');
120+
mainWindow.setIgnoreMouseEvents(true);
121+
}
122+
},
123+
{
124+
type: 'separator'
125+
},
115126
{
116127
label: 'Developer Tools',
117128
accelerator: 'CmdOrCtrl+Alt+I',

readme.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,16 @@ yarn start
6060
| **Shortcut** | **Description** |
6161
|---------------------------------|----------------------------|
6262
| <kbd>CmdOrCtrl + L</kbd> | Show Navbar and focus URL input |
63+
| <kbd>CmdOrCtrl + Shift + M</kbd> | Enable detached mode |
6364
| <kbd>CmdOrCtrl + Shift + L</kbd> | Toggle Navbar on WebPages |
6465
| <kbd>CmdOrCtrl + Shift + Up</kbd> | Increase Opacity |
6566
| <kbd>CmdOrCtrl + Shift + Down</kbd> | Decrease Opacity |
6667
| <kbd>CmdOrCtrl + Alt + I</kbd> | Show Developer Tools |
6768

6869
> **Note** – Changing the opacity is only supported in Windows and MacOS
6970
71+
**Detached Mode** Enabling the detached mode makes Pennywise non-interactive – it will let any interactions fall through to the window below it. To remove the detached mode, focus the window either by clicking the dock icon or by activating it using <kbd>alt + tab</kbd>
72+
7073
## Screenshots
7174

7275
> Homescreen for the application

0 commit comments

Comments
 (0)