Skip to content

feat: generalize monitor wait and apply stability fixes#203

Open
ndev-hoster wants to merge 1 commit into
Axenide:mainfrom
ndev-hoster:ndev-hoster
Open

feat: generalize monitor wait and apply stability fixes#203
ndev-hoster wants to merge 1 commit into
Axenide:mainfrom
ndev-hoster:ndev-hoster

Conversation

@ndev-hoster

@ndev-hoster ndev-hoster commented Jun 9, 2026

Copy link
Copy Markdown

Description

This PR introduces critical fixes for Ambxst shell startup synchronization, lockscreen stability, and resource cleanup.

1. Generalizing cli.sh Startup Monitor Wait Loop

  • Problem: When starting up or logging in with an external monitor plugged in, a race condition occurred between Kanshi's screen configuration and Ambxst's UI initialization. Ambxst would start drawing elements while monitor states were changing, causing partial UI load failures (missing bar, dock, etc.).
  • Fix: Replaced the hardcoded monitor check with a dynamic wait loop using hyprctl and jq.
    • Scans hyprctl monitors all -j to detect if an external monitor (non-eDP, non-LVDS, non-Virtual, non-HEADLESS) is physically connected.
    • If connected, it waits (up to 10 seconds, in 0.2s increments) for the external monitor to become active (disabled: false in hyprctl monitors -j), sleeping for an additional 1.0s to let the layout settle.
    • If no external monitor is physically connected (e.g. laptop-on-the-go), the loop is skipped instantly, preventing boot delay.
    • Ensures a clean slate on startup by cleaning up early-start quickshell and axctl daemons.

2. Enhancing LockScreen.qml Null Safety

  • Problem: The session lockscreen would randomly crash when trying to capture a screenshot or retrieve the wallpaper frame path due to null properties.
  • Fix:
    • Added null checks on GlobalStates.wallpaperManager.currentWallpaper before retrieving the frame path, wrapping it in a try-catch block.
    • Added null safety checks on root.screen for screencopyBackground.captureSource and guarded screencopyBackground.captureFrame() call.

3. Fixing Wallpaper.qml Resource Cleanup

  • Problem: Memory leaks or dangling references could occur when switching wallpapers or destroying wallpaper views.
  • Fix: Added Component.onDestruction clean up to set GlobalStates.wallpaperManager = null when the component is destroyed.

…y fixes

- Generalize monitor wait loop in cli.sh: dynamics checks for physically connected external displays (non-eDP, non-LVDS, non-Virtual, non-HEADLESS) using hyprctl and jq, skipping loop if none present
- Apply null-safety and try-catch frames to LockScreen.qml to prevent random lockscreen crashes on session lock or screencopy
- Add Component.onDestruction hook to Wallpaper.qml to cleanly nullify GlobalStates.wallpaperManager reference and prevent memory leaks
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