This commit is contained in:
Eugene Pankov
2017-06-20 22:11:08 +02:00
parent 65e9cbe759
commit d9fd78fb42
14 changed files with 117 additions and 17 deletions

View File

@@ -5,3 +5,4 @@ appearance:
tabsLocation: top
theme: Standard
frame: thin
css: '/* * { color: blue !important; } */'

View File

@@ -1,7 +1,8 @@
import { Subject } from 'rxjs'
import * as yaml from 'js-yaml'
import * as path from 'path'
import * as fs from 'fs'
import { EventEmitter, Injectable, Inject } from '@angular/core'
import { Injectable, Inject } from '@angular/core'
import { ConfigProvider } from '../api/configProvider'
import { ElectronService } from './electron.service'
import { HostAppService } from './hostApp.service'
@@ -51,7 +52,7 @@ export class ConfigProxy {
@Injectable()
export class ConfigService {
store: any
change = new EventEmitter()
changed$ = new Subject<void>()
restartRequested: boolean
private _store: any
private path: string
@@ -91,7 +92,7 @@ export class ConfigService {
}
emitChange (): void {
this.change.emit()
this.changed$.next()
}
requestRestart (): void {

View File

@@ -15,13 +15,13 @@ export class ElectronService {
constructor () {
this.electron = require('electron')
this.remoteElectron = this.remoteRequire('electron')
this.app = this.remoteElectron.app
this.screen = this.remoteElectron.screen
this.dialog = this.remoteElectron.dialog
this.app = this.electron.remote.app
this.screen = this.electron.remote.screen
this.dialog = this.electron.remote.dialog
this.shell = this.electron.shell
this.clipboard = this.electron.clipboard
this.ipcRenderer = this.electron.ipcRenderer
this.globalShortcut = this.remoteElectron.globalShortcut
this.globalShortcut = this.electron.remote.globalShortcut
}
remoteRequire (name: string): any {

View File

@@ -43,7 +43,7 @@ export class HotkeysService {
})
})
this.hotkeyDescriptions = hotkeyProviders.map(x => x.hotkeys).reduce((a, b) => a.concat(b))
this.config.change.subscribe(() => {
this.config.changed$.subscribe(() => {
this.registerGlobalHotkey()
})
this.registerGlobalHotkey()

View File

@@ -11,8 +11,9 @@ export class ThemesService {
@Inject(Theme) private themes: Theme[],
) {
this.applyCurrentTheme()
config.change.subscribe(() => {
config.changed$.subscribe(() => {
this.applyCurrentTheme()
document.querySelector('style#custom-css').innerHTML = config.store.appearance.css
})
}