Created
May 9, 2026 16:35
-
-
Save Dadangdut33/4a9bd5ad4a5f844af0a4ddf897d616ad to your computer and use it in GitHub Desktop.
Hide xembedsniproxy black window in niri https://dadangdut33.my.id/blog/hiding-the-black-window-caused-by-xembedsniproxy-in-niri-ofpuJBXxQFt_
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # --- CONFIGURATION --- | |
| MAX_WINDOWS=2 # Set this to the maximum number of ghost windows to handle | |
| SLEEP_TIME=2 # Seconds to wait for windows to appear | |
| # --------------------- | |
| # Start the proxy | |
| QT_NO_XDG_DESKTOP_PORTAL=1 xembedsniproxy & | |
| # Wait for windows to appear | |
| sleep "$SLEEP_TIME" | |
| # Get all matching IDs | |
| WINDOW_IDS=$(niri msg --json windows | jq -r '.[] | select(.title == null and .app_id == null) | .id') | |
| # Debug output | |
| echo "Debug: Found Window IDs: $WINDOW_IDS" | |
| # Loop with limit | |
| count=0 | |
| for id in $WINDOW_IDS; do | |
| # Check if we've reached the limit | |
| if [ "$count" -ge "$MAX_WINDOWS" ]; then | |
| echo "Limit reached: processed $MAX_WINDOWS windows. Skipping remaining." | |
| break | |
| fi | |
| if [ -n "$id" ] && [ "$id" != "null" ]; then | |
| ((count++)) | |
| echo "[$count/$MAX_WINDOWS] Processing ID: $id..." | |
| niri msg action move-window-to-floating --id "$id" | |
| niri msg action set-window-height --id "$id" 1 | |
| niri msg action set-window-width --id "$id" 1 | |
| niri msg action move-floating-window --id "$id" -x 10000 -y 10000 | |
| echo "Window $id banished." | |
| fi | |
| done | |
| echo "Finished. Total processed: $count" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment