Skip to content

Commit

Permalink
feat(mac): Support macOS Mojave Dark Mode
Browse files Browse the repository at this point in the history
Close #3496
  • Loading branch information
develar committed Nov 26, 2018
1 parent 68e5573 commit e85ef88
Show file tree
Hide file tree
Showing 27 changed files with 79 additions and 99 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- deps-{{ checksum "yarn.lock" }}
- restore_cache:
keys:
- v-3.0.8-electron
- v-3.0.10-electron
- run:
command: yarn --frozen-lockfile
- run:
Expand All @@ -23,7 +23,7 @@ jobs:
- run:
command: node ./test/out/helpers/downloadElectron.js
- save_cache:
key: v-3.0.8-electron
key: v-3.0.10-electron
paths:
- ~/.cache/electron

Expand All @@ -41,7 +41,7 @@ jobs:
- deps-{{ checksum "yarn.lock" }}
- restore_cache:
keys:
- v-3.0.8-electron
- v-3.0.10-electron
# because in the build job we use circleci docker image and circleci restores cache to original user home
- run:
command: |
Expand Down
1 change: 1 addition & 0 deletions .idea/dictionaries/develar.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"schema": "typescript-json-schema packages/app-builder-lib/tsconfig.json Configuration --out packages/app-builder-lib/scheme.json --noExtraProps --useTypeOfKeyword --strictNullChecks --titles --required",
"jsdoc": "ts2jsdoc packages/builder-util-runtime packages/builder-util packages/app-builder-lib packages/electron-builder packages/electron-publish",
"jsdoc2md": "node scripts/jsdoc2md.js",
"/////": " git clone --single-branch -b docs [email protected]:electron-userland/electron-builder.git docs",
"docs": "tsc -p ./scripts/renderer/tsconfig.json && yarn jsdoc && yarn jsdoc2md",
"deploy-docs": "mkdocs build --clean && netlifyctl deploy --publish-directory site",
"////": "pip3 install mkdocs-material mkdocs pymdown-extensions markdown-include Pygments --upgrade"
Expand All @@ -31,7 +32,7 @@
"dependencies": {
"7zip-bin": "~4.1.0",
"@types/is-ci": "^1.1.0",
"app-builder-bin": "2.5.1",
"app-builder-bin": "2.5.4",
"archiver": "^3.0.0",
"async-exit-hook": "^2.0.1",
"bluebird-lst": "^1.0.6",
Expand Down Expand Up @@ -65,7 +66,7 @@
"temp-file": "^3.3.2",
"tunnel-agent": "^0.6.0",
"update-notifier": "^2.5.0",
"yargs": "^12.0.2"
"yargs": "^12.0.5"
},
"devDependencies": {
"@babel/core": "^7.1.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/app-builder-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"homepage": "https://github.com/electron-userland/electron-builder",
"dependencies": {
"7zip-bin": "~4.1.0",
"app-builder-bin": "2.5.1",
"app-builder-bin": "2.5.4",
"async-exit-hook": "^2.0.1",
"bluebird-lst": "^1.0.6",
"chromium-pickle-js": "^0.2.0",
Expand Down
4 changes: 4 additions & 0 deletions packages/app-builder-lib/src/macPackager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,10 @@ export default class MacPackager extends PlatformPackager<MacConfiguration> {
use(this.platformSpecificBuildOptions.category || (this.config as any).category, it => appPlist.LSApplicationCategoryType = it)
appPlist.NSHumanReadableCopyright = appInfo.copyright

if (this.platformSpecificBuildOptions.darkModeSupport) {
appPlist.NSRequiresAquaSystemAppearance = false
}

const extendInfo = this.platformSpecificBuildOptions.extendInfo
if (extendInfo != null) {
Object.assign(appPlist, extendInfo)
Expand Down
6 changes: 6 additions & 0 deletions packages/app-builder-lib/src/options/macOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ export interface MacConfiguration extends PlatformSpecificBuildOptions {
*/
readonly bundleShortVersion?: string | null

/**
* Whether a dark mode is supported. If your app does have a dark mode, you can make your app follow the system-wide dark mode setting.
* @default false
*/
readonly darkModeSupport?: boolean

/**
* The bundle identifier to use in the application helper's plist.
* @default ${appBundleIdentifier}.helper
Expand Down
2 changes: 1 addition & 1 deletion packages/builder-util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"out"
],
"dependencies": {
"app-builder-bin": "2.5.1",
"app-builder-bin": "2.5.4",
"temp-file": "^3.3.2",
"fs-extra-p": "^7.0.0",
"is-ci": "^1.2.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"read-config-file": "3.2.0",
"sanitize-filename": "^1.6.1",
"update-notifier": "^2.5.0",
"yargs": "^12.0.2",
"yargs": "^12.0.5",
"lazy-val": "^1.0.3",
"app-builder-lib": "0.0.0-semantic-release",
"dmg-builder": "0.0.0-semantic-release"
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/test-app-build-sub/electron-builder.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
electronVersion: 3.0.8
electronVersion: 3.0.10
appId: org.electron-builder.testApp
compression: store
npmRebuild: false
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/test-app-one/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"author": "Foo Bar <[email protected]>",
"license": "MIT",
"build": {
"electronVersion": "3.0.8",
"electronVersion": "3.0.10",
"appId": "org.electron-builder.testApp",
"compression": "store",
"npmRebuild": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"author": "Foo Bar <[email protected]>",
"license": "MIT",
"build": {
"electronVersion": "3.0.8",
"electronVersion": "3.0.10",
"appId": "org.electron-builder.testApp",
"compression": "store",
"npmRebuild": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"author": "Foo Bar <[email protected]>",
"license": "MIT",
"build": {
"electronVersion": "3.0.8",
"electronVersion": "3.0.10",
"appId": "org.electron-builder.testApp",
"compression": "store",
"npmRebuild": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"author": "Foo Bar <[email protected]>",
"license": "MIT",
"build": {
"electronVersion": "3.0.8",
"electronVersion": "3.0.10",
"appId": "org.electron-builder.testApp",
"compression": "store",
"npmRebuild": false,
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/test-app/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"build": {
"electronVersion": "3.0.8",
"electronVersion": "3.0.10",
"appId": "org.electron-builder.testApp",
"compression": "store",
"npmRebuild": false,
Expand Down
3 changes: 0 additions & 3 deletions test/out/__snapshots__/PublishManagerTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ Object {
"CFBundlePackageType": "APPL",
"CFBundleShortVersionString": "1.1.0",
"LSApplicationCategoryType": "your.app.category.type",
"LSMinimumSystemVersion": "10.9.0",
"NSAppTransportSecurity": Object {
"NSAllowsLocalNetworking": true,
"NSExceptionDomains": Object {
Expand Down Expand Up @@ -275,7 +274,6 @@ Object {
"CFBundlePackageType": "APPL",
"CFBundleShortVersionString": "1.1.0",
"LSApplicationCategoryType": "your.app.category.type",
"LSMinimumSystemVersion": "10.9.0",
"NSAppTransportSecurity": Object {
"NSAllowsLocalNetworking": true,
"NSExceptionDomains": Object {
Expand Down Expand Up @@ -353,7 +351,6 @@ Object {
"CFBundlePackageType": "APPL",
"CFBundleShortVersionString": "1.1.0",
"LSApplicationCategoryType": "your.app.category.type",
"LSMinimumSystemVersion": "10.9.0",
"NSAppTransportSecurity": Object {
"NSAllowsLocalNetworking": true,
"NSExceptionDomains": Object {
Expand Down
14 changes: 1 addition & 13 deletions test/out/mac/__snapshots__/dmgTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ Object {
"CFBundlePackageType": "APPL",
"CFBundleShortVersionString": "2017.1-alpha5",
"LSApplicationCategoryType": "your.app.category.type",
"LSMinimumSystemVersion": "10.9.0",
"NSAppTransportSecurity": Object {
"NSAllowsLocalNetworking": true,
"NSExceptionDomains": Object {
Expand All @@ -56,6 +55,7 @@ Object {
"NSHighResolutionCapable": true,
"NSMainNibFile": "MainMenu",
"NSPrincipalClass": "AtomApplication",
"NSRequiresAquaSystemAppearance": false,
"NSSupportsAutomaticGraphicsSwitching": true,
}
`;
Expand Down Expand Up @@ -88,7 +88,6 @@ Object {
"CFBundlePackageType": "APPL",
"CFBundleShortVersionString": "1.1.0",
"LSApplicationCategoryType": "your.app.category.type",
"LSMinimumSystemVersion": "10.9.0",
"NSAppTransportSecurity": Object {
"NSAllowsLocalNetworking": true,
"NSExceptionDomains": Object {
Expand Down Expand Up @@ -143,7 +142,6 @@ Object {
"CFBundlePackageType": "APPL",
"CFBundleShortVersionString": "1.1.0",
"LSApplicationCategoryType": "your.app.category.type",
"LSMinimumSystemVersion": "10.9.0",
"NSAppTransportSecurity": Object {
"NSAllowsLocalNetworking": true,
"NSExceptionDomains": Object {
Expand Down Expand Up @@ -2267,7 +2265,6 @@ Object {
"CFBundlePackageType": "APPL",
"CFBundleShortVersionString": "1.1.0",
"LSApplicationCategoryType": "your.app.category.type",
"LSMinimumSystemVersion": "10.9.0",
"NSAppTransportSecurity": Object {
"NSAllowsLocalNetworking": true,
"NSExceptionDomains": Object {
Expand Down Expand Up @@ -2329,7 +2326,6 @@ Object {
"CFBundlePackageType": "APPL",
"CFBundleShortVersionString": "1.1.0",
"LSApplicationCategoryType": "your.app.category.type",
"LSMinimumSystemVersion": "10.9.0",
"NSAppTransportSecurity": Object {
"NSAllowsLocalNetworking": true,
"NSExceptionDomains": Object {
Expand Down Expand Up @@ -2391,7 +2387,6 @@ Object {
"CFBundlePackageType": "APPL",
"CFBundleShortVersionString": "1.1.0",
"LSApplicationCategoryType": "your.app.category.type",
"LSMinimumSystemVersion": "10.9.0",
"NSAppTransportSecurity": Object {
"NSAllowsLocalNetworking": true,
"NSExceptionDomains": Object {
Expand Down Expand Up @@ -2453,7 +2448,6 @@ Object {
"CFBundlePackageType": "APPL",
"CFBundleShortVersionString": "1.1.0",
"LSApplicationCategoryType": "your.app.category.type",
"LSMinimumSystemVersion": "10.9.0",
"NSAppTransportSecurity": Object {
"NSAllowsLocalNetworking": true,
"NSExceptionDomains": Object {
Expand Down Expand Up @@ -2515,7 +2509,6 @@ Object {
"CFBundlePackageType": "APPL",
"CFBundleShortVersionString": "1.1.0",
"LSApplicationCategoryType": "your.app.category.type",
"LSMinimumSystemVersion": "10.9.0",
"NSAppTransportSecurity": Object {
"NSAllowsLocalNetworking": true,
"NSExceptionDomains": Object {
Expand Down Expand Up @@ -2599,7 +2592,6 @@ Object {
"CFBundlePackageType": "APPL",
"CFBundleShortVersionString": "1.1.0",
"LSApplicationCategoryType": "your.app.category.type",
"LSMinimumSystemVersion": "10.9.0",
"NSAppTransportSecurity": Object {
"NSAllowsLocalNetworking": true,
"NSExceptionDomains": Object {
Expand Down Expand Up @@ -2659,7 +2651,6 @@ Object {
"CFBundlePackageType": "APPL",
"CFBundleShortVersionString": "1.1.0",
"LSApplicationCategoryType": "your.app.category.type",
"LSMinimumSystemVersion": "10.9.0",
"NSAppTransportSecurity": Object {
"NSAllowsLocalNetworking": true,
"NSExceptionDomains": Object {
Expand Down Expand Up @@ -2734,7 +2725,6 @@ Object {
"CFBundlePackageType": "APPL",
"CFBundleShortVersionString": "1.1.0",
"LSApplicationCategoryType": "your.app.category.type",
"LSMinimumSystemVersion": "10.9.0",
"NSAppTransportSecurity": Object {
"NSAllowsLocalNetworking": true,
"NSExceptionDomains": Object {
Expand Down Expand Up @@ -2789,7 +2779,6 @@ Object {
"CFBundlePackageType": "APPL",
"CFBundleShortVersionString": "1.1.0",
"LSApplicationCategoryType": "your.app.category.type",
"LSMinimumSystemVersion": "10.9.0",
"NSAppTransportSecurity": Object {
"NSAllowsLocalNetworking": true,
"NSExceptionDomains": Object {
Expand Down Expand Up @@ -2851,7 +2840,6 @@ Object {
"CFBundlePackageType": "APPL",
"CFBundleShortVersionString": "1.1.0",
"LSApplicationCategoryType": "your.app.category.type",
"LSMinimumSystemVersion": "10.9.0",
"NSAppTransportSecurity": Object {
"NSAllowsLocalNetworking": true,
"NSExceptionDomains": Object {
Expand Down
7 changes: 0 additions & 7 deletions test/out/mac/__snapshots__/macArchiveTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ Object {
"CFBundlePackageType": "APPL",
"CFBundleShortVersionString": "1.1.0",
"LSApplicationCategoryType": "your.app.category.type",
"LSMinimumSystemVersion": "10.9.0",
"NSAppTransportSecurity": Object {
"NSAllowsLocalNetworking": true,
"NSExceptionDomains": Object {
Expand Down Expand Up @@ -78,7 +77,6 @@ Object {
"CFBundlePackageType": "APPL",
"CFBundleShortVersionString": "1.1.0",
"LSApplicationCategoryType": "your.app.category.type",
"LSMinimumSystemVersion": "10.9.0",
"NSAppTransportSecurity": Object {
"NSAllowsLocalNetworking": true,
"NSExceptionDomains": Object {
Expand Down Expand Up @@ -135,7 +133,6 @@ Object {
"CFBundlePackageType": "APPL",
"CFBundleShortVersionString": "1.1.0",
"LSApplicationCategoryType": "your.app.category.type",
"LSMinimumSystemVersion": "10.10.0",
"NSAppTransportSecurity": Object {
"NSAllowsLocalNetworking": true,
"NSExceptionDomains": Object {
Expand Down Expand Up @@ -185,7 +182,6 @@ Object {
"CFBundlePackageType": "APPL",
"CFBundleShortVersionString": "1.1.0",
"LSApplicationCategoryType": "your.app.category.type",
"LSMinimumSystemVersion": "10.9.0",
"NSAppTransportSecurity": Object {
"NSAllowsLocalNetworking": true,
"NSExceptionDomains": Object {
Expand Down Expand Up @@ -235,7 +231,6 @@ Object {
"CFBundlePackageType": "APPL",
"CFBundleShortVersionString": "1.1.0",
"LSApplicationCategoryType": "your.app.category.type",
"LSMinimumSystemVersion": "10.9.0",
"NSAppTransportSecurity": Object {
"NSAllowsLocalNetworking": true,
"NSExceptionDomains": Object {
Expand Down Expand Up @@ -285,7 +280,6 @@ Object {
"CFBundlePackageType": "APPL",
"CFBundleShortVersionString": "1.1.0",
"LSApplicationCategoryType": "your.app.category.type",
"LSMinimumSystemVersion": "10.9.0",
"NSAppTransportSecurity": Object {
"NSAllowsLocalNetworking": true,
"NSExceptionDomains": Object {
Expand Down Expand Up @@ -847,7 +841,6 @@ Object {
"CFBundlePackageType": "APPL",
"CFBundleShortVersionString": "1.1.0",
"LSApplicationCategoryType": "your.app.category.type",
"LSMinimumSystemVersion": "10.9.0",
"NSAppTransportSecurity": Object {
"NSAllowsLocalNetworking": true,
"NSExceptionDomains": Object {
Expand Down
1 change: 0 additions & 1 deletion test/out/mac/__snapshots__/macPackagerTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ Object {
"CFBundlePackageType": "APPL",
"CFBundleShortVersionString": "1.1.0",
"LSApplicationCategoryType": "your.app.category.type",
"LSMinimumSystemVersion": "10.9.0",
"NSAppTransportSecurity": Object {
"NSAllowsLocalNetworking": true,
"NSExceptionDomains": Object {
Expand Down
3 changes: 0 additions & 3 deletions test/out/mac/__snapshots__/masTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ Object {
"CFBundleShortVersionString": "1.1.0",
"ElectronTeamID": "744739DJ4Y",
"LSApplicationCategoryType": "your.app.category.type",
"LSMinimumSystemVersion": "10.9.0",
"NSHighResolutionCapable": true,
"NSMainNibFile": "MainMenu",
"NSPrincipalClass": "AtomApplication",
Expand Down Expand Up @@ -50,7 +49,6 @@ Object {
"CFBundleShortVersionString": "1.1.0",
"ElectronTeamID": "X8C9Z9L4HW",
"LSApplicationCategoryType": "your.app.category.type",
"LSMinimumSystemVersion": "10.9.0",
"NSHighResolutionCapable": true,
"NSMainNibFile": "MainMenu",
"NSPrincipalClass": "AtomApplication",
Expand Down Expand Up @@ -87,7 +85,6 @@ Object {
"CFBundleShortVersionString": "1.1.0",
"ElectronTeamID": "X8C9Z9L4HW",
"LSApplicationCategoryType": "your.app.category.type",
"LSMinimumSystemVersion": "10.9.0",
"NSHighResolutionCapable": true,
"NSMainNibFile": "MainMenu",
"NSPrincipalClass": "AtomApplication",
Expand Down
Loading

0 comments on commit e85ef88

Please sign in to comment.