Browse Source

skip unnecessary ops

Eugene Pankov 7 years ago
parent
commit
33281b5caf

+ 7 - 5
terminus-core/src/services/docking.service.ts

@@ -20,21 +20,23 @@ export class DockingService {
     }
 
     dock () {
+        let dockSide = this.config.store.appearance.dock
+
+        if (dockSide === 'off') {
+            this.hostApp.setAlwaysOnTop(false)
+            return
+        }
+
         let display = this.electron.screen.getAllDisplays()
             .filter((x) => x.id === this.config.store.appearance.dockScreen)[0]
         if (!display) {
             display = this.getCurrentScreen()
         }
 
-        let dockSide = this.config.store.appearance.dock
         let newBounds: Bounds = { x: 0, y: 0, width: 0, height: 0 }
         let fill = this.config.store.appearance.dockFill
         let [minWidth, minHeight] = this.hostApp.getWindow().getMinimumSize()
 
-        if (dockSide === 'off') {
-            this.hostApp.setAlwaysOnTop(false)
-            return
-        }
         if (dockSide === 'left' || dockSide === 'right') {
             newBounds.width = Math.max(minWidth, Math.round(fill * display.bounds.width))
             newBounds.height = display.bounds.height

+ 5 - 1
terminus-core/src/services/touchbar.service.ts

@@ -3,7 +3,7 @@ import { TouchBarSegmentedControl, SegmentedControlSegment } from 'electron'
 import { AppService } from './app.service'
 import { ConfigService } from './config.service'
 import { ElectronService } from './electron.service'
-import { HostAppService } from './hostApp.service'
+import { HostAppService, Platform } from './hostApp.service'
 import { IToolbarButton, ToolbarButtonProvider } from '../api'
 
 @Injectable({ providedIn: 'root' })
@@ -31,6 +31,10 @@ export class TouchbarService {
     }
 
     update () {
+        if (this.hostApp.platform !== Platform.macOS) {
+            return
+        }
+
         let buttons: IToolbarButton[] = []
         this.config.enabledServices(this.toolbarButtonProviders).forEach(provider => {
             buttons = buttons.concat(provider.provide())