You have to use wlr-layer-shell to tell the compositor where to place the taskbar it works in hyprland, sway but I don't about DE's like gnome which uses mutter and doesn’t support it directly you would use gtk-layer-shell.
wlr-layer-shell
gtk-layer-shell.
This might be helpful