Skip to content

Commit

Permalink
🎉 Add support for disabling/enabling Kando
Browse files Browse the repository at this point in the history
  • Loading branch information
yar2000T committed Jan 7, 2025
1 parent dc023d9 commit e925632
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/main/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ import { UpdateChecker } from './update-checker';
declare const MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY: string;
declare const MAIN_WINDOW_WEBPACK_ENTRY: string;

let turnShortcutsVar = true;

/**
* This class contains the main host process logic of Kando. It is responsible for
* creating the transparent window and for handling IPC communication with the renderer
Expand Down Expand Up @@ -1083,6 +1085,11 @@ export class KandoApp {
click: () => this.showEditor(),
});

template.push({
label: 'Enable/Disable shortcuts',
click: () => this.turnShortcuts(),
});

template.push({ type: 'separator' });

// Add an entry to quit the application.
Expand All @@ -1095,6 +1102,17 @@ export class KandoApp {
this.tray.setContextMenu(contextMenu);
}

private turnShortcuts() {
turnShortcutsVar = !turnShortcutsVar;
if (turnShortcutsVar === true) {
this.bindShortcuts();
console.log('Shortcuts are enabled!');
} else {
this.backend.unbindAllShortcuts();
console.log('Shortcuts are disabled!');
}
}

/**
* This returns the menu item at the given path from the given root menu. The path is a
* string of numbers separated by slashes. Each number is the index of the child menu
Expand Down

0 comments on commit e925632

Please sign in to comment.