mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-19 02:49:56 +00:00
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import { Injectable } from '@angular/core'
|
|
|
|
@Injectable()
|
|
export class ElectronService {
|
|
app: any
|
|
ipcRenderer: any
|
|
shell: any
|
|
dialog: any
|
|
clipboard: any
|
|
globalShortcut: any
|
|
screen: any
|
|
remote: any
|
|
TouchBar: typeof Electron.TouchBar
|
|
private electron: any
|
|
|
|
constructor () {
|
|
this.electron = require('electron')
|
|
this.remote = this.electron.remote
|
|
this.app = this.remote.app
|
|
this.screen = this.remote.screen
|
|
this.dialog = this.remote.dialog
|
|
this.shell = this.electron.shell
|
|
this.clipboard = this.electron.clipboard
|
|
this.ipcRenderer = this.electron.ipcRenderer
|
|
this.globalShortcut = this.remote.globalShortcut
|
|
this.TouchBar = this.remote.TouchBar
|
|
}
|
|
|
|
remoteRequire (name: string): any {
|
|
return this.remote.require(name)
|
|
}
|
|
|
|
remoteRequirePluginModule (plugin: string, module: string, globals: any): any {
|
|
return this.remoteRequire(globals.require.resolve(`${plugin}/node_modules/${module}`))
|
|
}
|
|
|
|
loseFocus () {
|
|
if (process.platform === 'darwin') {
|
|
this.remote.Menu.sendActionToFirstResponder('hide:')
|
|
}
|
|
}
|
|
}
|