Skip to content

Commit

Permalink
fix rounding error with timeouts causing large performance penalty
Browse files Browse the repository at this point in the history
  • Loading branch information
khimaros committed Apr 23, 2024
1 parent b86d6d6 commit 2379d0a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions smart-auto-move@khimaros.com/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ function handleTimeoutSave() {
GLib.Source.remove(timeoutSaveSignal);
timeoutSaveSignal = null;
saveSettings();
timeoutSaveSignal = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, saveFrequencyMs / 1000.0, handleTimeoutSave);
timeoutSaveSignal = GLib.timeout_add(GLib.PRIORITY_DEFAULT, saveFrequencyMs, handleTimeoutSave);
return GLib.SOURCE_CONTINUE;
}

Expand All @@ -401,7 +401,7 @@ function handleTimeoutSync() {
GLib.Source.remove(timeoutSyncSignal);
timeoutSyncSignal = null;
syncWindows();
timeoutSyncSignal = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, syncFrequencyMs / 1000.0, handleTimeoutSync);
timeoutSyncSignal = GLib.timeout_add(GLib.PRIORITY_DEFAULT, syncFrequencyMs, handleTimeoutSync);
return GLib.SOURCE_CONTINUE;
}

Expand Down Expand Up @@ -479,10 +479,8 @@ function disconnectSignals() {
}

function addTimeouts() {
timeoutSyncSignal = GLib.timeout_add_seconds(
GLib.PRIORITY_DEFAULT, syncFrequencyMs / 1000.0, handleTimeoutSync);
timeoutSaveSignal = GLib.timeout_add_seconds(
GLib.PRIORITY_DEFAULT, saveFrequencyMs / 1000.0, handleTimeoutSave);
timeoutSyncSignal = GLib.timeout_add(GLib.PRIORITY_DEFAULT, syncFrequencyMs, handleTimeoutSync);
timeoutSaveSignal = GLib.timeout_add(GLib.PRIORITY_DEFAULT, saveFrequencyMs, handleTimeoutSave);
}

function removeTimeouts() {
Expand Down
2 changes: 1 addition & 1 deletion smart-auto-move@khimaros.com/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"description": "Smart Auto Move learns the position, size, and workspace of your application windows and restores them on subsequent launches. Supports Wayland.\n\nNOTE: Optimized for use with static workspaces. For more control, set the default behavior to IGNORE and then selectively RESTORE only desired apps.\n\nKNOWN ISSUES: Multi-monitor is not yet well supported. You may need to manually delete Saved Windows in preferences after adding or removing a display.",
"settings-schema": "org.gnome.shell.extensions.smart-auto-move",
"original-author": "khimaros",
"version": "25",
"version": "26",
"shell-version": ["45", "46"]
}

0 comments on commit 2379d0a

Please sign in to comment.