fix win context on plugins, change titlebar plugin to use object call instead of ipc
This commit is contained in:
parent
a51dc79a94
commit
eb6d61ea5a
4 changed files with 11 additions and 15 deletions
|
@ -42,7 +42,7 @@ export default class PluginHandler {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
console.log('loaded plugins:', JSON.stringify(plugins))
|
||||
return plugins;
|
||||
}
|
||||
|
||||
|
|
|
@ -393,15 +393,6 @@ export class Win {
|
|||
this.win.webContents.setZoomFactor(parseFloat(scale));
|
||||
});
|
||||
|
||||
|
||||
// Titlebar #147 - Implemented as plugin
|
||||
electron.ipcMain.on('set-titlebar', (e, titlebar) => {
|
||||
this.win.title = `${titlebar} - Cider`
|
||||
})
|
||||
electron.ipcMain.on('reset-titlebar', () => {
|
||||
this.win.title = `Cider`
|
||||
})
|
||||
|
||||
/* *********************************************************************************************
|
||||
* Window Events
|
||||
* **********************************************************************************************/
|
||||
|
|
|
@ -11,7 +11,6 @@ import {AppEvents} from "./base/app";
|
|||
import PluginHandler from "./base/plugins";
|
||||
|
||||
// const test = new PluginHandler();
|
||||
let win: Promise<void> | null = null;
|
||||
const config = new ConfigStore();
|
||||
const App = new AppEvents(config.store);
|
||||
const Cider = new Win(electron.app, config.store)
|
||||
|
@ -31,10 +30,12 @@ electron.app.on('ready', () => {
|
|||
}
|
||||
|
||||
electron.components.whenReady().then(() => {
|
||||
win = Cider.createWindow();
|
||||
Cider.createWindow().then((win) => {
|
||||
plug.callPlugins('onReady', win);
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
|
|
@ -11,11 +11,15 @@ export default class sendSongToTitlebar {
|
|||
/**
|
||||
* Runs on plugin load (Currently run on application start)
|
||||
*/
|
||||
private _win: any;
|
||||
private _app: any;
|
||||
constructor() {}
|
||||
/**
|
||||
* Runs on app ready
|
||||
*/
|
||||
onReady(): void {}
|
||||
onReady(win: any): void {
|
||||
this._win = win;
|
||||
}
|
||||
/**
|
||||
* Runs on app stop
|
||||
*/
|
||||
|
@ -25,7 +29,7 @@ export default class sendSongToTitlebar {
|
|||
* @param attributes Music Attributes (attributes.state = current state)
|
||||
*/
|
||||
onPlaybackStateDidChange(attributes: any): void {
|
||||
electron.ipcRenderer.send('set-titlebar', attributes.name)
|
||||
this._win.setTitle(`${(attributes != null && attributes.name != null && attributes.name.length > 0) ? (attributes.name + " - ") : ''}Cider`)
|
||||
}
|
||||
/**
|
||||
* Runs on song change
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue