#!/bin/bash

# Define your monitor names
EXTERNAL="DP-1" 
LAPTOP="eDP-1"  

# Kill any existing dock instances
pkill -f nwg-dock-hyprland

# Give Wayland a little more time to clear the screen edge
sleep 0.6 

# Check if the external monitor is actively connected
if hyprctl monitors | grep -q "Monitor $EXTERNAL"; then
    # Launch on external using Hyprland's native exec
    hyprctl dispatch exec "nwg-dock-hyprland -o $EXTERNAL -p bottom -a center -ml 10 -mr 10 -mb 10 -i 28 -nolauncher -x"
else
    # Fallback to laptop
    hyprctl dispatch exec "nwg-dock-hyprland -o $LAPTOP -p bottom -a center -ml 10 -mr 10 -mb 10 -i 28 -nolauncher -x"
fi
