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
aadeb9a2
Unverified
Commit
aadeb9a2
authored
Feb 25, 2019
by
Thibaut Sardan
Committed by
GitHub
Feb 25, 2019
Browse files
Merge branch 'master' into tbaut-fix-window-size
parents
c6b93abb
0281d013
Pipeline
#31594
failed with stage
in 1 minute and 6 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
packages/fether-electron/src/main/app/methods/loadTray.js
View file @
aadeb9a2
...
...
@@ -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
);
}
pino
.
info
(
'
Detected right click on Windows
'
);
});
tray
.
setToolTip
(
options
.
tooltip
);
tray
.
setHighlightMode
(
'
never
'
);
...
...
packages/fether-electron/src/main/app/methods/setupWin32Listeners.js
View file @
aadeb9a2
...
...
@@ -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 @
aadeb9a2
...
...
@@ -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 @
aadeb9a2
...
...
@@ -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 @
aadeb9a2
...
...
@@ -17,7 +17,7 @@ const INDEX_HTML_PATH =
});
// Icon path differs when started with `yarn electron` or `yarn start`
let
iconPath
=
path
.
join
(
staticPath
,
'
assets
'
,
'
icons
'
,
'
icon
.png
'
);
let
iconPath
=
path
.
join
(
staticPath
,
'
assets
'
,
'
icons
'
,
'
mac
'
,
'
iconDock
.png
'
);
let
iconDockPath
=
''
;
if
(
process
.
platform
===
'
win32
'
)
{
...
...
@@ -40,8 +40,6 @@ if (process.platform === 'win32') {
);
}
const
shouldUseFrame
=
false
;
const
windowPosition
=
process
.
platform
===
'
win32
'
?
'
trayBottomCenter
'
:
'
trayCenter
'
;
...
...
@@ -69,8 +67,8 @@ const DEFAULT_OPTIONS = {
};
const
TASKBAR_OPTIONS
=
{
frame
:
shouldUseFrame
,
height
:
515
,
frame
:
false
,
// On Linux the user must click the tray icon and then click the tooltip
// to toggle the Fether window open/close
tooltip
:
'
Click to toggle Fether window
'
,
...
...
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