fix: 添加更多caffeinate参数以防止系统睡眠
添加-i和-s参数以全面防止系统睡眠,包括用户不活动和系统睡眠的情况
This commit is contained in:
@@ -125,7 +125,7 @@ class AppState: ObservableObject {
|
|||||||
// 简化实现,直接启动 caffeinate 进程
|
// 简化实现,直接启动 caffeinate 进程
|
||||||
caffeinateProcess = Process()
|
caffeinateProcess = Process()
|
||||||
caffeinateProcess?.executableURL = URL(fileURLWithPath: "/usr/bin/caffeinate")
|
caffeinateProcess?.executableURL = URL(fileURLWithPath: "/usr/bin/caffeinate")
|
||||||
caffeinateProcess?.arguments = ["-d"] // -d 指示系统不要关闭显示屏
|
caffeinateProcess?.arguments = ["-i", "-s", "-d"] // -i 防止用户不活动导致睡眠,-s 防止系统进入睡眠,-d 防止显示屏关闭
|
||||||
|
|
||||||
// 配置输出,避免产生不必要的输出
|
// 配置输出,避免产生不必要的输出
|
||||||
let outputPipe = Pipe()
|
let outputPipe = Pipe()
|
||||||
|
|||||||
Reference in New Issue
Block a user