forked from fair/matrix-puppeteer-line
Try to prevent duplicate cycle/jiggle timers
This commit is contained in:
parent
ee207ce37b
commit
7ffa83252f
@ -563,6 +563,9 @@ export default class MessagesPuppeteer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async _cycleChatUnsafe() {
|
async _cycleChatUnsafe() {
|
||||||
|
this.log("Cycling chats")
|
||||||
|
const initialID = this.cycleTimerID
|
||||||
|
|
||||||
const currentChatID = await this.page.evaluate(() => window.__mautrixController.getCurrentChatID())
|
const currentChatID = await this.page.evaluate(() => window.__mautrixController.getCurrentChatID())
|
||||||
const chatList = await this.page.evaluate(() => window.__mautrixController.parseChatListForCycle())
|
const chatList = await this.page.evaluate(() => window.__mautrixController.parseChatListForCycle())
|
||||||
// Add 1 to start at the chat after the currently-viewed one
|
// Add 1 to start at the chat after the currently-viewed one
|
||||||
@ -608,7 +611,9 @@ export default class MessagesPuppeteer {
|
|||||||
this.log("Found no chats in need of read receipt updates")
|
this.log("Found no chats in need of read receipt updates")
|
||||||
}
|
}
|
||||||
|
|
||||||
this._cycleTimerStart()
|
if (this.cycleTimerID == initialID) {
|
||||||
|
this._cycleTimerStart()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -621,6 +626,8 @@ export default class MessagesPuppeteer {
|
|||||||
|
|
||||||
_jiggleMouse() {
|
_jiggleMouse() {
|
||||||
this.log("Jiggling mouse")
|
this.log("Jiggling mouse")
|
||||||
|
const initialID = this.jiggleTimerID
|
||||||
|
|
||||||
exec(`xdotool mousemove --sync --window ${this.windowID} 0 0`, {},
|
exec(`xdotool mousemove --sync --window ${this.windowID} 0 0`, {},
|
||||||
(error, stdout, stderr) => {
|
(error, stdout, stderr) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
@ -628,7 +635,10 @@ export default class MessagesPuppeteer {
|
|||||||
} else {
|
} else {
|
||||||
this.log("Jiggled mouse")
|
this.log("Jiggled mouse")
|
||||||
}
|
}
|
||||||
this._jiggleTimerStart()
|
|
||||||
|
if (this.jiggleTimerID == initialID) {
|
||||||
|
this._jiggleTimerStart()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user