electron#TouchBar TypeScript Examples

The following examples show how to use electron#TouchBar. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: touchbar.ts    From fluent-reader with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
function createTouchBarFunctionButton(
    window: BrowserWindow,
    text: string,
    key: string
) {
    return new TouchBar.TouchBarButton({
        label: text,
        click: () => window.webContents.send("touchbar-event", key),
    })
}
Example #2
Source File: touchbar.ts    From fluent-reader with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
export function initMainTouchBar(texts: TouchBarTexts, window: BrowserWindow) {
    const touchBar = new TouchBar({
        items: [
            createTouchBarFunctionButton(window, texts.menu, "F1"),
            createTouchBarFunctionButton(window, texts.search, "F2"),
            new TouchBar.TouchBarSpacer({ size: "small" }),
            createTouchBarFunctionButton(window, texts.refresh, "F5"),
            createTouchBarFunctionButton(window, texts.markAll, "F6"),
            createTouchBarFunctionButton(window, texts.notifications, "F7"),
        ],
    })
    window.setTouchBar(touchBar)
}