Skip to content

Commit

Permalink
fix: Avoid calling system76-scheduler if it fails
Browse files Browse the repository at this point in the history
Closes #1513
  • Loading branch information
mmstick committed Sep 6, 2022
1 parent 4520e78 commit a63fb83
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/scheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,21 @@ const SchedProxy = new SchedulerProxy(
)

let foreground: number = 0
let failed: boolean = false

export function setForeground(win: Meta.Window) {
if (failed) return

const pid = win.get_pid()
if (pid) {
if (foreground === pid) return
foreground = pid

try {
log.debug(`setting priority for ${win.get_title()}`)
SchedProxy.SetForegroundProcessRemote(pid)
} catch (_) {}
} catch (_) {
log.warn('system76-scheduler may not be installed and running')
failed = true
}
}
}

0 comments on commit a63fb83

Please sign in to comment.