Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make floating window stay always on top #2539

Open
Hritik14 opened this issue Feb 12, 2025 · 3 comments
Open

Make floating window stay always on top #2539

Hritik14 opened this issue Feb 12, 2025 · 3 comments

Comments

@Hritik14
Copy link

Hello

Sorry if this a very beginner question but I'm unable to figure out a way to keep floating windows always on top.

For eg:
I'm on a tiled window occupying full screen, suddenly a floating window appears as popup. I've focus follows mouse set, so as soon as I move my mouse out of the floating window, it disappears. It goes behind my currently tiled window. It is very frustrating to pull it out and then interact with it.

Is it possible that make all floating windows to always stay on top, no matter what ?

@koekeishiya
Copy link
Owner

@Hritik14
Copy link
Author

There seem to be a bug with this.
Here's my yabairc

#!/usr/bin/env sh

# Load scripting additions
yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa"
sudo yabai --load-sa

# global settings
yabai -m config mouse_follows_focus          on \
                 focus_follows_mouse          autoraise \
                 window_origin_display        default \
                 window_placement             second_child \
                 window_opacity               off \
                 active_window_opacity        1.0 \
                 normal_window_opacity        0.001 \
                 insert_feedback_color        0xffd75f5f \
                 split_ratio                  0.3 \
                 auto_balance                 off \
                 mouse_modifier               fn \
                 mouse_action1                resize \
                 mouse_action2                move \
                 mouse_drop_action            swap \

# general space settings
yabai -m config layout                       bsp
# yabai -m config layout                       float
yabai -m config top_padding    0
yabai -m config bottom_padding 0
yabai -m config left_padding   0
yabai -m config right_padding  0
yabai -m config window_gap     10

# focus window after active space changes
yabai -m signal --add event=space_changed action="yabai -m window --focus \$(yabai -m query --windows --space | jq .[0].id)"

# needs SIP disabled
yabai -m config window_shadow float

# rules
# yabai -m rule --add app="^(Calculator|VLC|System Preferences|Flow)$" manage=off layer=above
# yabai -m rule --add app="^MyApp$" sticky=off manage=off

# Jetbrains / IDEA needs special treatment
JB_Apps='^(CLion|PyCharm|IntelliJ IDEA)$'
yabai -m rule --add app="${JB_Apps}" manage=off
# If `Open last project when launch` is checked, add this rule. And make sure `always show project path` is also checked.
# yabai -m rule --add app="${JB_Apps}" title=".*\[.*\].*" manage=on 
yabai -m rule --add app="${JB_Apps}" title="^$"  manage=on
yabai -m rule --add app="^eclipse-workspace" manage=off

# janky borders
borders active_color=0xff494d64 width=5.0 &

echo "yabai configuration loaded.."

SIP is also disabled

; csrutil status
System Integrity Protection status: unknown (Custom Configuration).

Configuration:
        Apple Internal: disabled
        Kext Signing: enabled
        Filesystem Protections: disabled
        Debugging Restrictions: disabled
        DTrace Restrictions: enabled
        NVRAM Protections: disabled
        BaseSystem Verification: enabled
        Boot-arg Restrictions: disabled
        Kernel Integrity Protections: disabled
        Authenticated Root Requirement: enabled

This is an unsupported configuration, likely to break in the future and leave your machine in an unknown state.

Here's a video I've attached.
When I move away from floating window, it goes to back. This is a problem.

https://youtu.be/1npWrz8qbPo

When I toggle float for this window (skhd yabai -m window --toggle float), it tiles nicely.
When I toggle float again, it stays on top even when pointer goes away as intended.

@koekeishiya
Copy link
Owner

koekeishiya commented Feb 14, 2025

Make a bind in skhd that runs: yabai -m window --sub-layer below and press that bind while a tiled window is active. Focus a window that is floating. If the floating window does not stay above that tiled window, there is something wrong with your setup, and you need to read the wiki instructions more carefully.

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

No branches or pull requests

2 participants