Files
workphone-sdk/sdk/scripts/reset_docker_desktop_window.sh

27 lines
844 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
# 重置 Docker Desktop 仪表盘窗口位置(怀疑窗口在屏幕外、最大化状态异常时使用)
# 请先退出 Docker Desktop或活动监视器结束相关进程再执行本脚本。
set -euo pipefail
WM="${HOME}/Library/Application Support/Docker Desktop/window-management.json"
if [[ "$(uname -s)" != "Darwin" ]]; then
echo "仅支持 macOS。"
exit 1
fi
if pgrep -f "com.docker.backend" >/dev/null 2>&1; then
echo "请先退出 Docker Desktop菜单栏鲸鱼 → Quit或活动监视器结束 Docker再运行本脚本。"
exit 1
fi
if [[ -f "$WM" ]]; then
cp -f "$WM" "${WM}.bak.$(date +%Y%m%d%H%M%S)"
rm -f "$WM"
echo "已备份并删除: $WM"
else
echo "未找到窗口状态文件(可能已重置过)。"
fi
echo "现在可重新打开 Dockeropen -a Docker"