1
0
mirror of https://github.com/kremalicious/blowfish.git synced 2024-12-29 16:17:52 +01:00

Linux fixes

This commit is contained in:
Matthias Kretschmann 2019-05-29 01:46:41 +02:00
parent 5c5e21fda4
commit 6ea9f7ffb3
Signed by: m
GPG Key ID: 606EEEF3C479A91F
5 changed files with 57 additions and 30 deletions

View File

@ -32,7 +32,7 @@ const createWindow = async () => {
titleBarStyle: 'hiddenInset', titleBarStyle: 'hiddenInset',
fullscreenWindowTitle: true, fullscreenWindowTitle: true,
backgroundColor: isDarkMode ? '#141414' : '#fff', backgroundColor: isDarkMode ? '#141414' : '#fff',
frame: false, frame: process.platform === 'darwin' ? false : true,
show: false, show: false,
title: pkg.productName, title: pkg.productName,
webPreferences: { webPreferences: {
@ -59,8 +59,9 @@ const createWindow = async () => {
mainWindow = null mainWindow = null
}) })
// Load menubar // Load menu
buildMenu(mainWindow) buildMenu(mainWindow)
// Load touchbar // Load touchbar
if (process.platform === 'darwin') { if (process.platform === 'darwin') {
const accentColor = getAccentColor() const accentColor = getAccentColor()
@ -82,6 +83,13 @@ app.on('ready', () => {
mainWindow.webContents.on('dom-ready', () => { mainWindow.webContents.on('dom-ready', () => {
switchTheme() switchTheme()
switchAccentColor() switchAccentColor()
// add platform as class
mainWindow.webContents.executeJavaScript(
`document.getElementsByTagName('html')[0].classList.add('${
process.platform
}')`
)
}) })
}) })
@ -154,23 +162,31 @@ const getAccentColor = () => {
} }
const switchAccentColor = () => { const switchAccentColor = () => {
if (process.platform !== 'linux') {
const accentColor = getAccentColor() const accentColor = getAccentColor()
mainWindow.webContents.send('accent-color', accentColor) mainWindow.webContents.send('accent-color', accentColor)
} }
}
// Listen for accent color changes in System Preferences // Listen for accent color changes in System Preferences
// macOS // macOS
if (process.platform === 'darwin') {
systemPreferences.subscribeNotification('AppleAquaColorVariantChanged', () => systemPreferences.subscribeNotification('AppleAquaColorVariantChanged', () =>
switchAccentColor() switchAccentColor()
) )
}
// Windows // Windows
if (process.platform === 'windows') {
systemPreferences.on('accent-color-changed', () => switchAccentColor()) systemPreferences.on('accent-color-changed', () => switchAccentColor())
}
// //
// Appearance setting // Appearance setting
// macOS // macOS
// //
const switchTheme = () => { const switchTheme = () => {
if (process.platform === 'darwin') {
const isDarkMode = systemPreferences.isDarkMode() const isDarkMode = systemPreferences.isDarkMode()
isDarkMode isDarkMode
@ -181,9 +197,12 @@ const switchTheme = () => {
'document.getElementsByTagName(\'html\')[0].classList.remove(\'dark\')' 'document.getElementsByTagName(\'html\')[0].classList.remove(\'dark\')'
) )
} }
}
// Listen for appearance changes in System Preferences // Listen for appearance changes in System Preferences
if (process.platform === 'darwin') {
systemPreferences.subscribeNotification( systemPreferences.subscribeNotification(
'AppleInterfaceThemeChangedNotification', 'AppleInterfaceThemeChangedNotification',
() => switchTheme() () => switchTheme()
) )
}

View File

@ -32,7 +32,7 @@ html.fullscreen {
position: relative; position: relative;
font-size: 1rem; font-size: 1rem;
line-height: 1.3; line-height: 1.3;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Ubuntu,
Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
'Segoe UI Symbol'; 'Segoe UI Symbol';
font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1, 'pnum' 1, 'tnum' 0, font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1, 'pnum' 1, 'tnum' 0,
@ -69,7 +69,6 @@ a h1 {
} }
.app { .app {
margin-top: 35px;
padding: 5% 7%; padding: 5% 7%;
cursor: default; cursor: default;
height: calc(100vh - 5%); height: calc(100vh - 5%);
@ -78,6 +77,10 @@ a h1 {
overflow-y: auto; overflow-y: auto;
} }
.darwin .app {
margin-top: 35px;
}
.app > div, .app > div,
.app > div > div { .app > div > div {
width: 100%; width: 100%;
@ -91,7 +94,7 @@ a h1 {
width: 100%; width: 100%;
} }
.fullscreen .app { .fullscreen.darwin .app {
transform: translate3d(0, -36px, 0); transform: translate3d(0, -36px, 0);
} }

View File

@ -20,7 +20,7 @@
padding: .2rem .4rem; padding: .2rem .4rem;
display: block; display: block;
transition: border .2s ease-out; transition: border .2s ease-out;
color: #8b98a9; color: #41474e;
} }
.ticker button:disabled { .ticker button:disabled {
@ -29,6 +29,7 @@
.dark .ticker button { .dark .ticker button {
border-color: #303030; border-color: #303030;
color: #8b98a9;
} }
.label--price { .label--price {

View File

@ -2,10 +2,14 @@ import './Titlebar.css'
import React from 'react' import React from 'react'
import pkg from '../../../package.json' import pkg from '../../../package.json'
const Titlebar = () => ( const Titlebar = () => {
if (process.platform !== 'darwin') return
return (
<header className="titlebar"> <header className="titlebar">
<span className="header-title">{pkg.productName}</span> <span className="header-title">{pkg.productName}</span>
</header> </header>
) )
}
export default Titlebar export default Titlebar

View File

@ -28,7 +28,7 @@ export default class AppProvider extends PureComponent {
prices: pricesMap, prices: pricesMap,
toggleCurrencies: currency => this.toggleCurrencies(currency), toggleCurrencies: currency => this.toggleCurrencies(currency),
setBalances: () => this.setBalances(), setBalances: () => this.setBalances(),
accentColor: '' accentColor: '#f6388a'
} }
async componentDidMount() { async componentDidMount() {