#!/bin/sh
set -eu

case "$1" in
    configure)
        # 编译 GSettings 架构
        if command -v glib-compile-schemas >/dev/null 2>&1; then
            glib-compile-schemas /usr/share/glib-2.0/schemas/ >/dev/null 2>&1 || true
        fi
        # 延迟重启任务栏使插件生效：等待 dpkg 全部触发器（如 glib 重新编译 schema）完成，
        # 避免 dde-shell 过早重启导致配置加载异常、图标显示异常
        if command -v pkill >/dev/null 2>&1; then
            nohup sh -c 'sleep 3; pkill -x dde-shell' >/dev/null 2>&1 &
        fi
        ;;
esac

exit 0
