Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion public/locales/en/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@
"download": "Download the update"
},
"CommandBar": {
"Placeholder": "Enter a phone number...",
"Placeholder": "Search contact or dial number...",
"Call": "Call"
},
"Errors": {
Expand Down
2 changes: 1 addition & 1 deletion public/locales/it/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@
"download": "Scarica l'aggiornamento"
},
"CommandBar": {
"Placeholder": "Inserisci un numero di telefono...",
"Placeholder": "Cerca contatto o componi numero...",
"Call": "Chiama"
},
"Errors": {
Expand Down
37 changes: 26 additions & 11 deletions src/main/classes/controllers/CommandBarController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,20 @@ export class CommandBarController {
// Start grace period to ignore blur events during focus transition
this.isShowingInProgress = true

// Restore original size if it was reset to [0,0]
window.setBounds({
width: this.originalSize.width,
height: this.originalSize.height
})

const cursorPoint = screen.getCursorScreenPoint()
const currentDisplay = screen.getDisplayNearestPoint(cursorPoint)
const { x, y, width, height } = currentDisplay.workArea
const windowBounds = window.getBounds()

const centerX = x + Math.round((width - windowBounds.width) / 2)
const centerX = x + Math.round((width - this.originalSize.width) / 2)
const centerY = y + Math.round(height * 0.3)

window.setBounds({ x: centerX, y: centerY })
// Always pass the full rect to setBounds to avoid DPI issues on Windows
window.setBounds({
x: centerX,
y: centerY,
width: this.originalSize.width,
height: this.originalSize.height
})

const isWindows = process.platform === 'win32'

Expand Down Expand Up @@ -102,8 +101,6 @@ export class CommandBarController {
const window = this.window.getWindow()
if (window && this.isVisible) {
this.isVisible = false
// Reset size to [0,0] to avoid slowness/inconsistent state - same as PhoneIsland pattern
window.setBounds({ width: 0, height: 0 })

if (isMac) {
window.hide()
Expand All @@ -124,6 +121,24 @@ export class CommandBarController {
}
}

resize(size: { width: number, height: number }) {
try {
const window = this.window.getWindow()
if (window && this.isVisible) {
const bounds = window.getBounds()
// Always pass the full rect to avoid DPI issues on Windows
window.setBounds({
x: bounds.x,
y: bounds.y,
width: size.width,
height: size.height
})
}
} catch (e) {
Log.warning('error during resizing CommandBarWindow:', e)
}
}

toggle() {
// Throttle toggle calls to prevent rapid open/close cycles
const now = Date.now()
Expand Down
8 changes: 8 additions & 0 deletions src/main/lib/ipcEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,14 @@ export function registerIpcEvents() {
}
})

ipcMain.on(IPC_EVENTS.COMMAND_BAR_RESIZE, (_, size: { width: number, height: number }) => {
try {
CommandBarController.instance?.resize(size)
} catch (e) {
Log.error('COMMAND_BAR_RESIZE error', e)
}
})

ipcMain.on(IPC_EVENTS.CHANGE_COMMAND_BAR_SHORTCUT, async (_, combo) => {
if (!isUserLoggedIn()) {
disableCommandBarShortcuts()
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/public/locales/en/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@
"download": "Download the update"
},
"CommandBar": {
"Placeholder": "Enter a phone number...",
"Placeholder": "Search contact or dial number...",
"Call": "Call"
},
"Errors": {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/public/locales/it/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@
"download": "Scarica l'aggiornamento"
},
"CommandBar": {
"Placeholder": "Inserisci un numero di telefono...",
"Placeholder": "Cerca contatto o componi numero...",
"Call": "Chiama"
},
"Errors": {
Expand Down
Loading