chore: small update/fixes for quick ask window (#2279)
Signed-off-by: James <james@jan.ai> Co-authored-by: James <james@jan.ai>
This commit is contained in:
parent
e22fdec230
commit
3320162ea9
@ -1,4 +1,4 @@
|
|||||||
import { app, BrowserWindow, globalShortcut, Menu, Tray } from 'electron'
|
import { app, BrowserWindow, Menu, Tray } from 'electron'
|
||||||
|
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
/**
|
/**
|
||||||
@ -106,9 +106,6 @@ function createMainWindow() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function registerGlobalShortcuts() {
|
function registerGlobalShortcuts() {
|
||||||
// TODO: Toggle below line when build production
|
|
||||||
// const ret = globalShortcut.register(quickAskHotKey, () => {
|
|
||||||
// const selectedText = ''
|
|
||||||
const ret = registerShortcut(quickAskHotKey, (selectedText: string) => {
|
const ret = registerShortcut(quickAskHotKey, (selectedText: string) => {
|
||||||
if (!windowManager.isQuickAskWindowVisible()) {
|
if (!windowManager.isQuickAskWindowVisible()) {
|
||||||
windowManager.showQuickAskWindow()
|
windowManager.showQuickAskWindow()
|
||||||
|
|||||||
@ -6,7 +6,16 @@ export const quickAskWindowConfig: Electron.BrowserWindowConstructorOptions = {
|
|||||||
width: DEFAULT_WIDTH,
|
width: DEFAULT_WIDTH,
|
||||||
height: DEFAULT_HEIGHT,
|
height: DEFAULT_HEIGHT,
|
||||||
skipTaskbar: true,
|
skipTaskbar: true,
|
||||||
|
acceptFirstMouse: true,
|
||||||
|
hasShadow: true,
|
||||||
|
alwaysOnTop: true,
|
||||||
|
show: false,
|
||||||
|
fullscreenable: false,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
|
center: true,
|
||||||
|
movable: false,
|
||||||
|
maximizable: false,
|
||||||
|
focusable: true,
|
||||||
transparent: true,
|
transparent: true,
|
||||||
frame: false,
|
frame: false,
|
||||||
type: 'panel',
|
type: 'panel',
|
||||||
|
|||||||
@ -64,7 +64,6 @@ class WindowManager {
|
|||||||
this._quickAskWindow.on('blur', () => {
|
this._quickAskWindow.on('blur', () => {
|
||||||
this.hideQuickAskWindow()
|
this.hideQuickAskWindow()
|
||||||
})
|
})
|
||||||
this.hideQuickAskWindow()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isMainWindowVisible(): boolean {
|
isMainWindowVisible(): boolean {
|
||||||
|
|||||||
@ -18,10 +18,10 @@ const UserInput: React.FC = () => {
|
|||||||
const selectedText = useAtomValue(selectedTextAtom)
|
const selectedText = useAtomValue(selectedTextAtom)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (inputRef.current) {
|
inputRef.current?.focus()
|
||||||
inputRef.current.focus()
|
})
|
||||||
}
|
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
const onKeyDown = (e: KeyboardEvent) => {
|
const onKeyDown = (e: KeyboardEvent) => {
|
||||||
if (e.key === 'Escape') {
|
if (e.key === 'Escape') {
|
||||||
window.core?.api?.hideQuickAskWindow()
|
window.core?.api?.hideQuickAskWindow()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user