Skip to content
This repository has been archived by the owner on Jun 19, 2022. It is now read-only.

Commit

Permalink
titlebar fix for unsupported platforms (linux etc)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zxnii committed May 6, 2022
1 parent a19c4af commit 0abbe46
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
3 changes: 2 additions & 1 deletion src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
.window-controls {
border-radius: 5px;
overflow: hidden;
display: none;
}

.win-window-control {
Expand All @@ -61,7 +62,7 @@
background-color: rgba(255, 90, 82, 1);
}

.win-window-control#win-close-button:hover > svg > polygon {
.win-window-control#win-close-button:hover>svg>polygon {
fill: #f5f5f5;
}

Expand Down
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ <h2 class="mb-8 text-4xl font-black text-gray-700">No <span class="text-indigo-5
<div id="drag-region" class="flex flex-col h-full">

<!-- Tab bar with the "create tab" and "more menu" buttons, as well as window controls -->
<div id="titlebar" class="flex items-center mt-2 pr-0 h-7">
<div id="titlebar" class="flex items-center mt-2 h-7">
<div id="window-controls-mac" class="window-controls flex items-center mx-2">
<button id="mac-close-button" class="flex items-center justify-center cursor-default w-3 h-3 mac-window-control mx-1"></button>
<button id="mac-minimize-button" class="flex items-center justify-center cursor-default w-3 h-3 mac-window-control mx-1"></button>
Expand Down
27 changes: 15 additions & 12 deletions src/js/startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,27 @@ window.ipc.send('toMain', 'platform');
window.ipc.on('platform', (data) => {
const platform = data.platform;

// get control containers so they can be hidden or shown based on platform
const winControls = byId('window-controls-win');
const macControls = byId('window-controls-mac');

const titlebar = byId('titlebar');

winControls.style.display = 'none';
macControls.style.display = 'none';

// ignore if not on a supported platform
if (platform === 'win32' || platform === 'darwin') {
// get prefix for controls
const prefix = platform === 'darwin' ? 'mac' : 'win';
const titlebar = byId('titlebar');

// add padding if on windows
if (platform === 'win32') {
titlebar.classList.add('pl-4');
}

// get control containers so they can be hidden or shown based on platform
const winControls = byId('window-controls-win');
const macControls = byId('window-controls-mac');

if (platform === 'darwin') {
winControls.style.display = 'none';
macControls.style.display = 'flex';
} else {
winControls.style.display = 'flex';
macControls.style.display = 'none';

// add padding on windows
titlebar.classList.add('px-4', 'pr-0');
}

// get control buttons
Expand Down Expand Up @@ -69,6 +69,9 @@ window.ipc.on('platform', (data) => {
svg.innerHTML = maximized ? winRestoreSvg : winMaximizeSvg;
}
});
} else {
// add padding if on unsupported platform
titlebar.classList.add('px-4');
}
});

Expand Down

0 comments on commit 0abbe46

Please sign in to comment.