Eugene Pankov 7 лет назад
Родитель
Сommit
0b56259a36
5 измененных файлов с 31 добавлено и 12 удалено
  1. 1 1
      app/index.pug
  2. 16 7
      app/main.js
  3. 6 0
      app/src/preload.scss
  4. 5 1
      package.json
  5. 3 3
      yarn.lock

+ 1 - 1
app/index.pug

@@ -11,7 +11,7 @@ html
         style#custom-css
         style.
             body { transition: 0.5s background; }
-    body(style='min-height: 100vh; overflow: hidden')
+    body
         app-root
             .preload-logo
                 div

+ 16 - 7
app/main.js

@@ -30,6 +30,15 @@ if (!process.env.TERMINUS_PLUGINS) {
   process.env.TERMINUS_PLUGINS = ''
 }
 
+setWindowVibrancy = (enabled) => {
+  if (enabled && !app.window.vibrancyViewID) {
+    app.window.vibrancyViewID = electronVibrancy.SetVibrancy(app.window, 0)
+  } else if (!enabled && app.window.vibrancyViewID) {
+    electronVibrancy.RemoveView(app.window, app.window.vibrancyViewID)
+    app.window.vibrancyViewID = null
+  }
+}
+
 setupWindowManagement = () => {
     app.window.on('show', () => {
       app.window.webContents.send('host:window-shown')
@@ -89,12 +98,7 @@ setupWindowManagement = () => {
     })
 
     electron.ipcMain.on('window-set-vibrancy', (event, enabled) => {
-      if (enabled && !app.window.vibrancyViewID) {
-        app.window.vibrancyViewID = electronVibrancy.SetVibrancy(app.window, 0)
-      } else if (!enabled && app.window.vibrancyViewID) {
-        electronVibrancy.RemoveView(app.window, app.window.vibrancyViewID)
-        app.window.vibrancyViewID = null
-      }
+      setWindowVibrancy(enabled)
     })
 }
 
@@ -225,7 +229,7 @@ start = () => {
         title: 'Terminus',
         minWidth: 400,
         minHeight: 300,
-        'web-preferences': {'web-security': false},
+        webPreferences: {webSecurity: false},
         //- background to avoid the flash of unstyled window
         backgroundColor: '#131d27',
         frame: false,
@@ -250,6 +254,11 @@ start = () => {
 
     app.window = new electron.BrowserWindow(options)
     app.window.once('ready-to-show', () => {
+      if (process.platform == 'darwin') {
+        app.window.setVibrancy('dark')
+      } else if (process.platform == 'windows') {
+        setWindowVibrancy(true)
+      }
       app.window.show()
       app.window.focus()
     })

+ 6 - 0
app/src/preload.scss

@@ -66,3 +66,9 @@
 [ngbradiogroup] input[type="radio"] {
     display: none;
 }
+
+body {
+    min-height: 100vh;
+    overflow: hidden;
+    background: rgba(0,0,0,.4);
+}

+ 5 - 1
package.json

@@ -9,7 +9,7 @@
     "core-js": "2.4.1",
     "cross-env": "4.0.0",
     "css-loader": "0.28.0",
-    "electron": "2.0.0",
+    "electron": "2.0.7",
     "electron-builder": "^20.27.1",
     "electron-builder-squirrel-windows": "17.0.1",
     "electron-rebuild": "^1.8.2",
@@ -53,6 +53,10 @@
     "appId": "org.terminus",
     "productName": "Terminus",
     "compression": "normal",
+    "files": [
+      "**/*",
+      "dist"
+    ],
     "extraResources": [
       "builtin-plugins",
       "clink"

+ 3 - 3
yarn.lock

@@ -2615,9 +2615,9 @@ electron-to-chromium@^1.2.7:
   version "1.3.31"
   resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.31.tgz#00d832cba9fe2358652b0c48a8816c8e3a037e9f"
 
-electron@2.0.0:
-  version "2.0.0"
-  resolved "https://registry.yarnpkg.com/electron/-/electron-2.0.0.tgz#e95dc7f3a089a52b8c2a52c7c9e1024db0c8d46e"
+electron@^2.0.7:
+  version "2.0.7"
+  resolved "https://registry.yarnpkg.com/electron/-/electron-2.0.7.tgz#f7ce410433298e319032ce31f0e6ffd709ff052c"
   dependencies:
     "@types/node" "^8.0.24"
     electron-download "^3.0.1"