#!/bin/bash

# 定義 PID 檔案路徑
PID_FILE="/tmp/eww-inhibit.pid"

if [ -f "$PID_FILE" ]; then
  # 讀取 PID 並殺掉程序
  PID=$(cat "$PID_FILE")
  kill "$PID" 2>/dev/null
  rm "$PID_FILE"
else
  # 啟動並記錄 PID
  systemd-inhibit --what=idle --mode=block sleep infinity &
  echo $! > "$PID_FILE"
fi
