diff --git a/src/public/app/widgets/touch_bar.ts b/src/public/app/widgets/touch_bar.ts index 48ab23688..272f0cb1c 100644 --- a/src/public/app/widgets/touch_bar.ts +++ b/src/public/app/widgets/touch_bar.ts @@ -3,10 +3,12 @@ import Component from "../components/component.js"; export default class TouchBarWidget extends Component { + nativeImage: typeof import("electron").nativeImage; remote: typeof import("@electron/remote"); constructor() { super(); + this.nativeImage = utils.dynamicRequire("electron").nativeImage; this.remote = utils.dynamicRequire("@electron/remote") as typeof import("@electron/remote"); this.#setTouchBar(); } @@ -14,22 +16,24 @@ export default class TouchBarWidget extends Component { #setTouchBar() { const touchBarData = this.#buildTouchBar(); this.remote.getCurrentWindow().setTouchBar(touchBarData); - console.log("Setting touch bar", touchBarData); } #buildTouchBar() { + const { nativeImage } = this; + const { TouchBar } = this.remote; const { TouchBarButton } = this.remote.TouchBar; const items = [ new TouchBarButton({ - label: "New note", + icon: nativeImage.createFromNamedImage("NSTouchBarAddDetailTemplate", [-1, 0, 1]), click: () => { console.log("New note pressed."); } }) ]; - return new this.remote.TouchBar({ + console.log("Update ", items); + return new TouchBar({ items }); }