Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
parity
fether
Commits
bc3ec951
Unverified
Commit
bc3ec951
authored
Feb 25, 2019
by
Thibaut Sardan
Committed by
GitHub
Feb 25, 2019
Browse files
Merge branch 'master' into luke-421-linux-dock-icon
parents
334aa181
a11fa20b
Pipeline
#44435
canceled with stage
Changes
6
Pipelines
2
Show whitespace changes
Inline
Side-by-side
packages/fether-electron/src/main/app/messages/index.js
View file @
bc3ec951
...
...
@@ -26,14 +26,7 @@ export default async (fetherAppWindow, event, action, ...args) => {
// Conversion to integer is required to pass as argument to setContentSize.
// Reference: https://electronjs.org/docs/all#winsetcontentsizewidth-height-animate
const
newHeight
=
parseInt
(
args
[
0
]);
const
feedbackButtonHeight
=
20
;
const
resizeHeight
=
newHeight
+
2
;
const
height
=
process
.
platform
===
'
win32
'
&&
fetherAppWindow
.
isMenuBarVisible
()
?
resizeHeight
+
feedbackButtonHeight
:
resizeHeight
;
fetherAppWindow
.
setContentSize
(
width
,
height
);
fetherAppWindow
.
setContentSize
(
width
,
Math
.
round
(
newHeight
)
+
2
);
break
;
}
case
'
check-clock-sync
'
:
{
...
...
packages/fether-electron/src/main/app/methods/loadTray.js
View file @
bc3ec951
...
...
@@ -30,10 +30,7 @@ function loadTray (fetherApp) {
tray
.
on
(
'
double-click
'
,
()
=>
onTrayClick
(
fetherApp
));
// Right click event handler does not work on Windows as intended
tray
.
on
(
'
right-click
'
,
()
=>
{
if
(
process
.
platform
===
'
win32
'
)
{
pino
.
info
(
'
Detected right click on Windows
'
);
showTrayBalloon
(
fetherApp
);
}
});
tray
.
setToolTip
(
options
.
tooltip
);
tray
.
setHighlightMode
(
'
never
'
);
...
...
packages/fether-electron/src/main/app/methods/setupWin32Listeners.js
View file @
bc3ec951
...
...
@@ -8,13 +8,7 @@ import Pino from '../utils/pino';
const
pino
=
Pino
();
function
setupWin32Listeners
(
fetherApp
)
{
const
{
moveWindowUp
,
onWindowClose
,
processSaveWinPosition
,
showTrayBalloon
,
win
}
=
fetherApp
;
const
{
onWindowClose
,
processSaveWinPosition
,
win
}
=
fetherApp
;
if
(
process
.
platform
===
'
win32
'
)
{
/**
...
...
@@ -52,7 +46,6 @@ function setupWin32Listeners (fetherApp) {
}
else
if
(
wParam
.
readUInt32LE
(
0
)
===
0xf030
)
{
// SC_MAXIMIZE
eventName
=
'
maximize
'
;
showTrayBalloon
(
fetherApp
);
}
else
if
(
wParam
.
readUInt32LE
(
0
)
===
0xf020
)
{
// SC_MINIMIZE
eventName
=
'
minimize
'
;
...
...
@@ -60,7 +53,6 @@ function setupWin32Listeners (fetherApp) {
}
else
if
(
wParam
.
readUInt32LE
(
0
)
===
0xf120
)
{
// SC_RESTORE
eventName
=
'
restored
'
;
showTrayBalloon
(
fetherApp
);
}
if
(
eventName
!==
null
)
{
...
...
@@ -74,17 +66,7 @@ function setupWin32Listeners (fetherApp) {
* Detect event on Windows when Fether window was moved or resized
*/
win
.
hookWindowMessage
(
Number
.
parseInt
(
'
0x0232
'
),
(
wParam
,
lParam
)
=>
{
pino
.
info
(
'
Detected completion of move or resize event
'
);
// Move Fether window back up into view if it was a resize event
// that causes the bottom to be cropped
moveWindowUp
(
fetherApp
);
// Try again after a delay incase Fether window resize occurs
// x seconds after navigating to a new page.
setTimeout
(()
=>
{
moveWindowUp
(
fetherApp
);
},
5000
);
pino
.
info
(
'
Detected completion of moved or resize event
'
);
// Save Fether window position to Electron settings
processSaveWinPosition
(
fetherApp
);
...
...
packages/fether-electron/src/main/app/methods/setupWinListeners.js
View file @
bc3ec951
...
...
@@ -11,12 +11,7 @@ import Pino from '../utils/pino';
const
pino
=
Pino
();
function
setupWinListeners
(
fetherApp
)
{
const
{
moveWindowUp
,
onWindowClose
,
processSaveWinPosition
,
win
}
=
fetherApp
;
const
{
onWindowClose
,
processSaveWinPosition
,
win
}
=
fetherApp
;
// Open external links in browser
win
.
webContents
.
on
(
'
new-window
'
,
(
event
,
url
)
=>
{
...
...
@@ -24,7 +19,7 @@ function setupWinListeners (fetherApp) {
electron
.
shell
.
openExternal
(
url
);
});
// Linux (unchecked on others)
//
Windows and
Linux (unchecked on others)
win
.
on
(
'
move
'
,
()
=>
{
/**
* On Linux using this with debouncing is the closest equivalent
...
...
@@ -49,17 +44,12 @@ function setupWinListeners (fetherApp) {
* On Linux the closest equivalent to achieving 'moved' is debouncing
* on the 'move' event. It also works in 'close' even when app crashes
*/
p
rocessSaveWinPosition
(
fetherApp
);
p
ino
.
info
(
'
Detected moved event
'
);
});
// macOS and Linux
(not
Windows
)
// macOS and Linux
and
Windows
win
.
on
(
'
resize
'
,
()
=>
{
pino
.
info
(
'
Detected resize event
'
);
moveWindowUp
(
fetherApp
);
setTimeout
(()
=>
{
moveWindowUp
(
fetherApp
);
},
5000
);
});
win
.
on
(
'
blur
'
,
()
=>
{
...
...
packages/fether-electron/src/main/app/methods/showWindow.js
View file @
bc3ec951
...
...
@@ -16,6 +16,8 @@ function showWindow (fetherApp, trayPos) {
calculateWinPosition
,
createWindow
,
fixWinPosition
,
moveWindowUp
,
processSaveWinPosition
,
setupWinListeners
,
setupWin32Listeners
,
win
...
...
@@ -84,6 +86,13 @@ function showWindow (fetherApp, trayPos) {
fetherApp
.
hasSetupWinListeners
=
true
;
}
moveWindowUp
(
fetherApp
);
setTimeout
(()
=>
{
moveWindowUp
(
fetherApp
);
},
5000
);
processSaveWinPosition
(
fetherApp
);
fetherApp
.
emit
(
'
after-show-window
'
);
}
...
...
packages/fether-electron/src/main/app/options/config/index.js
View file @
bc3ec951
...
...
@@ -40,8 +40,6 @@ if (process.platform === 'win32') {
);
}
const
shouldUseFrame
=
process
.
platform
===
'
win32
'
;
const
windowPosition
=
process
.
platform
===
'
win32
'
?
'
trayBottomCenter
'
:
'
trayCenter
'
;
...
...
@@ -69,7 +67,9 @@ const DEFAULT_OPTIONS = {
};
const
TASKBAR_OPTIONS
=
{
frame
:
shouldUseFrame
,
// Do not use frame but context menu required on non-macOS.
// Without frame it causes window height to shrink upon show/hide
frame
:
false
,
height
:
464
,
// On Linux the user must click the tray icon and then click the tooltip
// to toggle the Fether window open/close
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment