Skip to content

Commit

Permalink
Fix focus loop on production method
Browse files Browse the repository at this point in the history
  • Loading branch information
OrigamingWasTaken committed Oct 5, 2024
1 parent 33bf0d4 commit 45b4dc2
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions frontend/src/windows/main/ts/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,11 @@ hotkeys('cmd+q,cmd+w', (e) => {

export async function focusWindow() {
try {
if (getMode() === 'dev') {
// So the app can be focused in dev environnement
shell(
`osascript -e 'tell application "System Events" to set frontmost of every process whose unix id is ${window.NL_PID} to true'`
,[],{skipStderrCheck: true, completeCommand: true});
} else {
// Better way of focusing the app
shellFS.open("",{application: "AppleBlox"})
// <os.ececCommand>(`open -a "AppleBlox"`);
}
shell(
`osascript -e 'tell application "System Events" to set frontmost of every process whose unix id is ${window.NL_PID} to true'`,
[],
{ skipStderrCheck: true, completeCommand: true }
);
} catch (err) {
console.error(err);
}
Expand All @@ -53,8 +48,10 @@ export async function focusWindow() {
export async function setWindowVisibility(state: boolean) {
try {
shell(
`osascript -e 'tell application "System Events" to set visible of every process whose unix id is ${window.NL_PID} to ${state}'`
,[],{skipStderrCheck: true, completeCommand: true});
`osascript -e 'tell application "System Events" to set visible of every process whose unix id is ${window.NL_PID} to ${state}'`,
[],
{ skipStderrCheck: true, completeCommand: true }
);
} catch (err) {
console.error(err);
}
Expand Down

0 comments on commit 45b4dc2

Please sign in to comment.