#!/bin/bash
source /etc/profile

# Kill old portals
killall -q \
  xdg-desktop-portal \
  xdg-desktop-portal-gtk \
  xdg-desktop-portal-hyprland \
  gsd-xsettings

sleep 1

# Start xsettings (needed by GTK portal)
/usr/libexec/gsd-xsettings &
sleep 1

# Start GTK portal FIRST (for Location)
/usr/libexec/xdg-desktop-portal-gtk &
sleep 2

# Start Hyprland portal SECOND (screenshots, screencast)
/usr/libexec/xdg-desktop-portal-hyprland &
sleep 2

# Start the broker LAST
/usr/libexec/xdg-desktop-portal &
