Skip to content

fix: resolve false setup notification on startup caused by FileView.loaded race condition - #5

Open
mehdichamani wants to merge 1 commit into
Codesmith28:masterfrom
mehdichamani:fix/startup-bindings-race-condition
Open

mehdichamani wants to merge 1 commit into
Codesmith28:masterfrom
mehdichamani:fix/startup-bindings-race-condition

Conversation

@mehdichamani

Copy link
Copy Markdown

Problem

Every time the system reboots or the Omarchy shell starts up, users who have already configured their Hyprland keybindings in ~/.config/hypr/bindings.lua receive a false omalt-tab: Setup Required desktop notification telling them to run make prod.

Root Cause

In AltTabOverlay.qml, the hasBindingsHook property is declared as:

readonly property bool hasBindingsHook: {
    if (!hyprBindingsFile.loaded) return false;
    var txt = hyprBindingsFile.text();
    return txt.indexOf("io.github.codesmith28.omalt-tab") !== -1 ||
           txt.indexOf("omalt-tab") !== -1 ||
           (txt.indexOf("find") !== -1 && txt.indexOf("bindings.lua") !== -1);
}

When Component.onCompleted fires on startup:

  1. Although FileView has blockLoading: true (which buffers the file content synchronously so text() is already available), Quickshell does not emit/set loaded = true until the next tick in the Qt/QML event loop.
  2. Because of if (!hyprBindingsFile.loaded) return false;, hasBindingsHook evaluates to false during Component.onCompleted.
  3. This triggers setupNotifier.running = true.
  4. Because the notification flag is kept in ${XDG_RUNTIME_DIR} (a tmpfs RAM disk), it is wiped on every reboot, causing the notification to trigger repeatedly after each system restart.

Solution

Removed the early if (!hyprBindingsFile.loaded) return false; guard from hasBindingsHook.
hyprBindingsFile.text() already holds the file's text synchronously; if the file does not exist or is empty, text() returns an empty string "" which safely results in indexOf(...) === -1 and correctly returns false.

Verification & Testing

  • Ran make test & make validate (all 23 modular unit tests, manifest checks, bash syntax, and lua syntax passed).
  • Tested directly on live Omarchy / Quickshell environment across shell reloads and reboots: verified hasBindingsHook resolves to true during Component.onCompleted without false notifications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant