set_pref focus-mode click

new_client 1 x11
create 1/normal
show 1/normal
wait
assert_focused 1/normal

create 1/desktop
show 1/desktop
set_window_type 1/desktop desktop
wait

assert_focused 1/normal

# Adding a dock window to ensure it does not take focus
create 1/dock
show 1/dock
set_window_type 1/dock dock
wait

assert_focused 1/normal

# Explicitly focus the desktop window first, then ensure default focus
# selection still prefers a normal window when one is available.
local_activate 1/desktop
wait
assert_focused 1/desktop

focus_default_window
wait
assert_focused 1/normal

# Explicitly focus the dock window
local_activate 1/dock
wait
assert_focused 1/dock

focus_default_window
wait
assert_focused 1/normal

# Desktop remains the fallback when no other focusable window is left.
destroy 1/normal
wait
assert_focused 1/desktop

# Dock does not take focus neither when desktop disappears
destroy 1/desktop
wait
assert_focused none
