chore: prevent shortcuts from invoking recording when in shortcut recording state

This commit is contained in:
haritabh-z01 2025-07-06 14:49:55 +05:30
parent fd7f4bff49
commit 3f8ea518f6
5 changed files with 60 additions and 2 deletions

View file

@ -74,8 +74,14 @@ export class AppManager {
// tRPC handler is now set up in WindowManager when windows are created
if (app.dock) {
app.dock.show();
logger.main.info("Explicitly showing app in dock");
app.dock
.show()
.then(() => {
logger.main.info("Explicitly showing app in dock");
})
.catch((error) => {
logger.main.error("Error showing app in dock", error);
});
} else {
logger.main.warn("app.dock is not available");
}

View file

@ -156,4 +156,11 @@ export const setupApplicationMenu = (
const menu = Menu.buildFromTemplate(menuTemplate);
Menu.setApplicationMenu(menu);
// Add "Version" prefix on macOS About panel
if (process.platform === "darwin") {
app.setAboutPanelOptions({
applicationVersion: `Version ${app.getVersion()}`,
});
}
};

View file

@ -26,6 +26,7 @@ export class ShortcutManager extends EventEmitter {
};
private settingsService: SettingsService;
private swiftIOBridge: SwiftIOBridge | null = null;
private isRecordingShortcut: boolean = false;
constructor(settingsService: SettingsService) {
super();
@ -52,6 +53,11 @@ export class ShortcutManager extends EventEmitter {
await this.loadShortcuts();
}
setIsRecordingShortcut(isRecording: boolean) {
this.isRecordingShortcut = isRecording;
log.info("Shortcut recording state changed", { isRecording });
}
private setupEventListeners() {
if (!this.swiftIOBridge) {
log.warn("SwiftIOBridge not available, shortcuts will not work");
@ -139,6 +145,11 @@ export class ShortcutManager extends EventEmitter {
}
private checkShortcuts() {
// Skip shortcut detection when recording shortcuts
if (this.isRecordingShortcut) {
return;
}
// Check PTT shortcut
const isPTTPressed = this.isPTTShortcutPressed();
this.emit("ptt-state-changed", isPTTPressed);