muzzle-mac-awake 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -0
- package/bin/index.js +19 -0
- package/package.json +29 -0
- package/scripts/setup.sh +86 -0
package/README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# muzzle-mac-awake
|
|
2
|
+
|
|
3
|
+
macOS 잠자기 방지 자동 설정 도구.
|
|
4
|
+
|
|
5
|
+
한 번의 명령으로 새 맥북에서 잠자기 방지 설정을 완료합니다.
|
|
6
|
+
|
|
7
|
+
## 설치 및 실행
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx muzzle-mac-awake
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## 설정 내용
|
|
14
|
+
|
|
15
|
+
- **KeepingYouAwake** (Homebrew 설치 시)
|
|
16
|
+
- 로그인 시 자동 실행
|
|
17
|
+
- 실행 시 자동 활성화 (3시간)
|
|
18
|
+
|
|
19
|
+
- **caffeinate LaunchAgent**
|
|
20
|
+
- 로그인 시 자동 실행
|
|
21
|
+
- 화면 및 시스템 잠자기 방지 (`-dims`)
|
|
22
|
+
|
|
23
|
+
## 비활성화
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
launchctl unload ~/Library/LaunchAgents/com.user.caffeinate.plist
|
|
27
|
+
```
|
package/bin/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { execSync } = require('child_process');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const os = require('os');
|
|
6
|
+
|
|
7
|
+
if (os.platform() !== 'darwin') {
|
|
8
|
+
console.error('❌ This tool only supports macOS.');
|
|
9
|
+
process.exit(1);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const scriptPath = path.join(__dirname, '..', 'scripts', 'setup.sh');
|
|
13
|
+
|
|
14
|
+
try {
|
|
15
|
+
execSync(`bash "${scriptPath}"`, { stdio: 'inherit' });
|
|
16
|
+
} catch (err) {
|
|
17
|
+
console.error('❌ Setup failed:', err.message);
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "muzzle-mac-awake",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "macOS 잠자기 방지 자동 설정 도구 (KeepingYouAwake + caffeinate LaunchAgent)",
|
|
5
|
+
"bin": {
|
|
6
|
+
"muzzle-mac-awake": "./bin/index.js"
|
|
7
|
+
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"test": "node bin/index.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"bin/",
|
|
13
|
+
"scripts/"
|
|
14
|
+
],
|
|
15
|
+
"keywords": [
|
|
16
|
+
"macos",
|
|
17
|
+
"caffeinate",
|
|
18
|
+
"sleep",
|
|
19
|
+
"awake",
|
|
20
|
+
"keepingyouawake",
|
|
21
|
+
"mac"
|
|
22
|
+
],
|
|
23
|
+
"author": "Muzzle-kr",
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=16"
|
|
27
|
+
},
|
|
28
|
+
"preferGlobal": true
|
|
29
|
+
}
|
package/scripts/setup.sh
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# macOS Auto-Awake Setup Script
|
|
4
|
+
# Prevents sleep and display dimming automatically
|
|
5
|
+
|
|
6
|
+
set -e
|
|
7
|
+
|
|
8
|
+
echo "🚀 Setting up auto-awake on macOS..."
|
|
9
|
+
echo ""
|
|
10
|
+
|
|
11
|
+
# Check if Homebrew is installed
|
|
12
|
+
if command -v brew &> /dev/null; then
|
|
13
|
+
echo "📦 Installing KeepingYouAwake..."
|
|
14
|
+
brew install --cask keepingyouawake || echo "⚠️ KeepingYouAwake already installed or failed"
|
|
15
|
+
|
|
16
|
+
# Configure KeepingYouAwake to launch at login and activate automatically
|
|
17
|
+
echo "⚙️ Configuring KeepingYouAwake..."
|
|
18
|
+
defaults write info.marcel-dierkes.KeepingYouAwake.activateOnLaunch -bool true
|
|
19
|
+
defaults write info.marcel-dierkes.KeepingYouAwake.defaultDuration -int 180 # 3 hours
|
|
20
|
+
echo "✅ KeepingYouAwake configured"
|
|
21
|
+
else
|
|
22
|
+
echo "⚠️ Homebrew not found. Skipping KeepingYouAwake installation."
|
|
23
|
+
echo " Install Homebrew from https://brew.sh if needed."
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
echo ""
|
|
27
|
+
|
|
28
|
+
# Create LaunchAgent for caffeinate (backup method)
|
|
29
|
+
echo "⚙️ Creating caffeinate LaunchAgent..."
|
|
30
|
+
|
|
31
|
+
LAUNCH_AGENT_DIR="$HOME/Library/LaunchAgents"
|
|
32
|
+
LAUNCH_AGENT_FILE="$LAUNCH_AGENT_DIR/com.user.caffeinate.plist"
|
|
33
|
+
|
|
34
|
+
# Create directory if it doesn't exist
|
|
35
|
+
mkdir -p "$LAUNCH_AGENT_DIR"
|
|
36
|
+
|
|
37
|
+
# Create plist file
|
|
38
|
+
cat > "$LAUNCH_AGENT_FILE" << 'EOF'
|
|
39
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
40
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
41
|
+
<plist version="1.0">
|
|
42
|
+
<dict>
|
|
43
|
+
<key>Label</key>
|
|
44
|
+
<string>com.user.caffeinate</string>
|
|
45
|
+
<key>ProgramArguments</key>
|
|
46
|
+
<array>
|
|
47
|
+
<string>/usr/bin/caffeinate</string>
|
|
48
|
+
<string>-dims</string>
|
|
49
|
+
</array>
|
|
50
|
+
<key>RunAtLoad</key>
|
|
51
|
+
<true/>
|
|
52
|
+
<key>KeepAlive</key>
|
|
53
|
+
<true/>
|
|
54
|
+
</dict>
|
|
55
|
+
</plist>
|
|
56
|
+
EOF
|
|
57
|
+
|
|
58
|
+
# Unload if already loaded (ignore errors)
|
|
59
|
+
launchctl unload "$LAUNCH_AGENT_FILE" 2>/dev/null || true
|
|
60
|
+
|
|
61
|
+
# Load the LaunchAgent
|
|
62
|
+
launchctl load "$LAUNCH_AGENT_FILE"
|
|
63
|
+
|
|
64
|
+
echo "✅ caffeinate LaunchAgent created and activated"
|
|
65
|
+
echo ""
|
|
66
|
+
|
|
67
|
+
# Summary
|
|
68
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
69
|
+
echo "✨ Setup Complete!"
|
|
70
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
71
|
+
echo ""
|
|
72
|
+
echo "What was configured:"
|
|
73
|
+
echo " ✓ KeepingYouAwake (if Homebrew available)"
|
|
74
|
+
echo " - Launches at login"
|
|
75
|
+
echo " - Auto-activates for 3 hours"
|
|
76
|
+
echo ""
|
|
77
|
+
echo " ✓ caffeinate LaunchAgent"
|
|
78
|
+
echo " - Runs automatically at login"
|
|
79
|
+
echo " - Prevents display sleep and system sleep"
|
|
80
|
+
echo ""
|
|
81
|
+
echo "To verify caffeinate is running:"
|
|
82
|
+
echo " $ launchctl list | grep caffeinate"
|
|
83
|
+
echo ""
|
|
84
|
+
echo "To disable caffeinate LaunchAgent:"
|
|
85
|
+
echo " $ launchctl unload ~/Library/LaunchAgents/com.user.caffeinate.plist"
|
|
86
|
+
echo ""
|