Skip to content

Commit

Permalink
🚸 drag window when title bar style is different from nice
Browse files Browse the repository at this point in the history
  • Loading branch information
adlerluiz committed Aug 27, 2020
1 parent 2d82db9 commit 4d5c860
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 19 deletions.
6 changes: 1 addition & 5 deletions src/pages/shared/window-buttons/window-buttons.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@
</head>

<body>
<div
style="height: 15px; width: 90vw; z-index: 9999; position: fixed;"
class="drag"
></div>
<div id="nice-titlebar" class="bar drag">
<div id="mac" class="hide no-drag">
<span id="window-title" class="hide"></span>
Expand All @@ -40,7 +36,7 @@

<div id="win" class="hide">
<div class="row">
<div class="col s9 left-align no-drag">
<div class="col s9 left-align">
<div class="title">
<i
class="material-icons tiny tiny-margin left"
Expand Down
29 changes: 15 additions & 14 deletions src/pages/shared/window-buttons/window-buttons.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,26 @@ const macElement = document.getElementById('mac')

const webview = document.querySelector('webview')

if (isMac()) {
winElement.remove()
macElement.classList.remove('hide')
} else if (isWindows()) {
macElement.remove()
winElement.classList.remove('hide')
} else if (isLinux()) {
winElement.remove()
macElement.remove()
}

if (store.get('titlebar-type', 'nice') !== 'nice') {
document.getElementById('nice-titlebar').style.display = 'none'
document.getElementById('nice-titlebar').style.height = 0
document.getElementById('nice-titlebar').style.height = '15px'
document
.getElementById('nice-titlebar')
.removeChild(document.getElementById('nice-titlebar').firstChild)

document.getElementById('webview').style.height = '100vh'
} else {
if (isMac()) {
winElement.remove()
macElement.classList.remove('hide')
} else if (isWindows()) {
macElement.remove()
winElement.classList.remove('hide')
} else if (isLinux()) {
winElement.remove()
macElement.remove()
}
document.getElementById('webview').style.height = '95vh'
document.getElementById('content').style.marginTop = '29px'
document.getElementById('content').style.marginTop = '5vh'
}

ipc.on('window-is-maximized', function (_, value) {
Expand Down

0 comments on commit 4d5c860

Please sign in to comment.