Skip to content

Commit 70c5462

Browse files
garyshengMagiCrazy
andcommitted
Merge PR #29: Add native Linux support
Adds native Linux support by @MagiCrazy with cascading audio backends (pw-play/paplay/ffplay/mpv/play/aplay), notify-send notifications, xdotool terminal focus detection, and comprehensive test coverage. Resolves VERSION conflict (1.3.0 vs 1.3.4 → 1.4.0). Co-Authored-By: Magic.Crazy <MagiCrazy@users.noreply.github.com>
2 parents 6c544d5 + 5390cf9 commit 70c5462

204 files changed

Lines changed: 830 additions & 42 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 21 additions & 1 deletion

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.3.0
1+
1.4.0
14.6 KB
Binary file not shown.
16.8 KB
Binary file not shown.
16 KB
Binary file not shown.
16.4 KB
Binary file not shown.
46.2 KB
Binary file not shown.
32.7 KB
Binary file not shown.

docs/index.html

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,6 +1141,50 @@ <h2 class="section-title">Choose your character</h2>
11411141
</div>
11421142
</div>
11431143
</div>
1144+
<!-- Pack 6: TF2 Engineer -->
1145+
<div class="carousel-slide" data-pack="tf2_engineer">
1146+
<div class="pack-card-full">
1147+
<div class="pack-header">
1148+
<div class="pack-badge">New</div>
1149+
<div class="pack-name">TF2 Engineer</div>
1150+
<div class="pack-game">Team Fortress 2</div>
1151+
<code class="pack-id">tf2_engineer</code>
1152+
<div class="pack-credit">Added by <a href="https://github.com/Arie">@Arie</a></div>
1153+
</div>
1154+
<div class="pack-sounds">
1155+
<button class="pack-sound-btn" data-src="audio/Engineer_battlecry03.mp3" aria-label="Play: Cowboy up!">
1156+
<span class="pack-sound-icon">&#9654;</span>
1157+
<span class="pack-sound-quote">"Cowboy up!"</span>
1158+
<span class="pack-sound-cat">greeting</span>
1159+
</button>
1160+
<button class="pack-sound-btn" data-src="audio/Engineer_autobuildingsentry01.mp3" aria-label="Play: Sentry going up.">
1161+
<span class="pack-sound-icon">&#9654;</span>
1162+
<span class="pack-sound-quote">"Sentry going up."</span>
1163+
<span class="pack-sound-cat">acknowledge</span>
1164+
</button>
1165+
<button class="pack-sound-btn" data-src="audio/Eng_quest_complete_easy_01.mp3" aria-label="Play: Nice work!">
1166+
<span class="pack-sound-icon">&#9654;</span>
1167+
<span class="pack-sound-quote">"Nice work!"</span>
1168+
<span class="pack-sound-cat">complete</span>
1169+
</button>
1170+
<button class="pack-sound-btn" data-src="audio/Engineer_autodestroyedsentry01.mp3" aria-label="Play: Sentry down!">
1171+
<span class="pack-sound-icon">&#9654;</span>
1172+
<span class="pack-sound-quote">"Sentry down!"</span>
1173+
<span class="pack-sound-cat">error</span>
1174+
</button>
1175+
<button class="pack-sound-btn" data-src="audio/Engineer_wranglekills01.mp3" aria-label="Play: This thing ain't on auto-pilot, son!">
1176+
<span class="pack-sound-icon">&#9654;</span>
1177+
<span class="pack-sound-quote">"Ain't on auto-pilot, son!"</span>
1178+
<span class="pack-sound-cat">permission</span>
1179+
</button>
1180+
<button class="pack-sound-btn" data-src="audio/Engineer_goldenwrenchkill04.mp3" aria-label="Play: Erectin' a statue of a moron.">
1181+
<span class="pack-sound-icon">&#9654;</span>
1182+
<span class="pack-sound-quote">"Erectin' a statue of a moron."</span>
1183+
<span class="pack-sound-cat">annoyed</span>
1184+
</button>
1185+
</div>
1186+
</div>
1187+
</div>
11441188
</div>
11451189

11461190
<button class="carousel-arrow carousel-next" aria-label="Next pack">
@@ -1154,6 +1198,7 @@ <h2 class="section-title">Choose your character</h2>
11541198
<button class="carousel-dot" data-index="2" aria-label="Soviet Engineer"></button>
11551199
<button class="carousel-dot" data-index="3" aria-label="Battlecruiser"></button>
11561200
<button class="carousel-dot" data-index="4" aria-label="Sarah Kerrigan"></button>
1201+
<button class="carousel-dot" data-index="5" aria-label="TF2 Engineer"></button>
11571202
</div>
11581203

11591204
<div class="contribute-cta">

install.sh

Lines changed: 71 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,24 @@
44
# Re-running updates core files; sounds are version-controlled in the repo
55
set -euo pipefail
66

7-
INSTALL_DIR="$HOME/.claude/hooks/peon-ping"
8-
SETTINGS="$HOME/.claude/settings.json"
7+
LOCAL_MODE=false
8+
for arg in "$@"; do
9+
case "$arg" in
10+
--local) LOCAL_MODE=true ;;
11+
esac
12+
done
13+
14+
if [ "$LOCAL_MODE" = true ]; then
15+
BASE_DIR="$PWD/.claude"
16+
else
17+
BASE_DIR="$HOME/.claude"
18+
fi
19+
INSTALL_DIR="$BASE_DIR/hooks/peon-ping"
20+
SETTINGS="$BASE_DIR/settings.json"
921
REPO_BASE="https://raw.githubusercontent.com/tonyyont/peon-ping/main"
1022

1123
# All available sound packs (add new packs here)
12-
PACKS="peon peon_fr peon_pl peasant peasant_fr ra2_soviet_engineer sc_battlecruiser sc_kerrigan"
24+
PACKS="acolyte_ru glados peon peon_fr peon_pl peon_ru peasant peasant_fr peasant_ru ra2_soviet_engineer sc_battlecruiser sc_firebat sc_kerrigan sc_medic sc_scv sc_tank sc_terran sc_vessel tf2_engineer"
1325

1426
# --- Platform detection ---
1527
detect_platform() {
@@ -87,8 +99,12 @@ elif [ "$PLATFORM" = "linux" ]; then
8799
fi
88100
fi
89101

90-
if [ ! -d "$HOME/.claude" ]; then
91-
echo "Error: ~/.claude/ not found. Is Claude Code installed?"
102+
if [ ! -d "$BASE_DIR" ]; then
103+
if [ "$LOCAL_MODE" = true ]; then
104+
echo "Error: .claude/ not found in current directory. Is this a Claude Code project?"
105+
else
106+
echo "Error: ~/.claude/ not found. Is Claude Code installed?"
107+
fi
92108
exit 1
93109
fi
94110

@@ -152,35 +168,50 @@ fi
152168
chmod +x "$INSTALL_DIR/peon.sh"
153169

154170
# --- Install skill (slash command) ---
155-
SKILL_DIR="$HOME/.claude/skills/peon-ping-toggle"
171+
SKILL_DIR="$BASE_DIR/skills/peon-ping-toggle"
156172
mkdir -p "$SKILL_DIR"
173+
if [ "$LOCAL_MODE" = true ]; then
174+
SKILL_HOOK_CMD="bash .claude/hooks/peon-ping/peon.sh"
175+
else
176+
SKILL_HOOK_CMD="bash ~/.claude/hooks/peon-ping/peon.sh"
177+
fi
157178
if [ -n "$SCRIPT_DIR" ] && [ -d "$SCRIPT_DIR/skills/peon-ping-toggle" ]; then
158179
cp "$SCRIPT_DIR/skills/peon-ping-toggle/SKILL.md" "$SKILL_DIR/"
180+
if [ "$LOCAL_MODE" = true ]; then
181+
sed -i.bak 's|bash ~/.claude/hooks/peon-ping/peon.sh|'"$SKILL_HOOK_CMD"'|g' "$SKILL_DIR/SKILL.md"
182+
rm -f "$SKILL_DIR/SKILL.md.bak"
183+
fi
159184
elif [ -z "$SCRIPT_DIR" ]; then
160185
curl -fsSL "$REPO_BASE/skills/peon-ping-toggle/SKILL.md" -o "$SKILL_DIR/SKILL.md"
186+
if [ "$LOCAL_MODE" = true ]; then
187+
sed -i.bak 's|bash ~/.claude/hooks/peon-ping/peon.sh|'"$SKILL_HOOK_CMD"'|g' "$SKILL_DIR/SKILL.md"
188+
rm -f "$SKILL_DIR/SKILL.md.bak"
189+
fi
161190
else
162191
echo "Warning: skills/peon-ping-toggle not found in local clone, skipping skill install"
163192
fi
164193

165-
# --- Add shell alias ---
166-
ALIAS_LINE='alias peon="bash ~/.claude/hooks/peon-ping/peon.sh"'
167-
for rcfile in "$HOME/.zshrc" "$HOME/.bashrc"; do
168-
if [ -f "$rcfile" ] && ! grep -qF 'alias peon=' "$rcfile"; then
169-
echo "" >> "$rcfile"
170-
echo "# peon-ping quick controls" >> "$rcfile"
171-
echo "$ALIAS_LINE" >> "$rcfile"
172-
echo "Added peon alias to $(basename "$rcfile")"
173-
fi
174-
done
194+
# --- Add shell alias (global install only) ---
195+
if [ "$LOCAL_MODE" = false ]; then
196+
ALIAS_LINE='alias peon="bash ~/.claude/hooks/peon-ping/peon.sh"'
197+
for rcfile in "$HOME/.zshrc" "$HOME/.bashrc"; do
198+
if [ -f "$rcfile" ] && ! grep -qF 'alias peon=' "$rcfile"; then
199+
echo "" >> "$rcfile"
200+
echo "# peon-ping quick controls" >> "$rcfile"
201+
echo "$ALIAS_LINE" >> "$rcfile"
202+
echo "Added peon alias to $(basename "$rcfile")"
203+
fi
204+
done
175205

176-
# --- Add tab completion ---
177-
COMPLETION_LINE='[ -f ~/.claude/hooks/peon-ping/completions.bash ] && source ~/.claude/hooks/peon-ping/completions.bash'
178-
for rcfile in "$HOME/.zshrc" "$HOME/.bashrc"; do
179-
if [ -f "$rcfile" ] && ! grep -qF 'peon-ping/completions.bash' "$rcfile"; then
180-
echo "$COMPLETION_LINE" >> "$rcfile"
181-
echo "Added tab completion to $(basename "$rcfile")"
182-
fi
183-
done
206+
# --- Add tab completion ---
207+
COMPLETION_LINE='[ -f ~/.claude/hooks/peon-ping/completions.bash ] && source ~/.claude/hooks/peon-ping/completions.bash'
208+
for rcfile in "$HOME/.zshrc" "$HOME/.bashrc"; do
209+
if [ -f "$rcfile" ] && ! grep -qF 'peon-ping/completions.bash' "$rcfile"; then
210+
echo "$COMPLETION_LINE" >> "$rcfile"
211+
echo "Added tab completion to $(basename "$rcfile")"
212+
fi
213+
done
214+
fi
184215

185216
# --- Verify sounds are installed ---
186217
echo ""
@@ -194,8 +225,8 @@ for pack in $PACKS; do
194225
fi
195226
done
196227

197-
# --- Backup existing notify.sh (fresh install only) ---
198-
if [ "$UPDATING" = false ]; then
228+
# --- Backup existing notify.sh (global fresh install only) ---
229+
if [ "$LOCAL_MODE" = false ] && [ "$UPDATING" = false ]; then
199230
NOTIFY_SH="$HOME/.claude/hooks/notify.sh"
200231
if [ -f "$NOTIFY_SH" ]; then
201232
cp "$NOTIFY_SH" "$NOTIFY_SH.backup"
@@ -208,11 +239,17 @@ fi
208239
echo ""
209240
echo "Updating Claude Code hooks in settings.json..."
210241

242+
if [ "$LOCAL_MODE" = true ]; then
243+
HOOK_CMD=".claude/hooks/peon-ping/peon.sh"
244+
else
245+
HOOK_CMD="$HOME/.claude/hooks/peon-ping/peon.sh"
246+
fi
247+
211248
python3 -c "
212249
import json, os, sys
213250
214-
settings_path = os.path.expanduser('~/.claude/settings.json')
215-
hook_cmd = os.path.expanduser('~/.claude/hooks/peon-ping/peon.sh')
251+
settings_path = '$SETTINGS'
252+
hook_cmd = '$HOOK_CMD'
216253
217254
# Load existing settings
218255
if os.path.exists(settings_path):
@@ -268,9 +305,9 @@ fi
268305
echo ""
269306
echo "Testing sound..."
270307
ACTIVE_PACK=$(python3 -c "
271-
import json, os
308+
import json
272309
try:
273-
c = json.load(open(os.path.expanduser('~/.claude/hooks/peon-ping/config.json')))
310+
c = json.load(open('$INSTALL_DIR/config.json'))
274311
print(c.get('active_pack', 'peon'))
275312
except:
276313
print('peon')
@@ -329,7 +366,9 @@ fi
329366
echo ""
330367
echo "Quick controls:"
331368
echo " /peon-ping-toggle — toggle sounds in Claude Code"
332-
echo " peon --toggle — toggle sounds from any terminal"
333-
echo " peon --status — check if sounds are paused"
369+
if [ "$LOCAL_MODE" = false ]; then
370+
echo " peon --toggle — toggle sounds from any terminal"
371+
echo " peon --status — check if sounds are paused"
372+
fi
334373
echo ""
335374
echo "Ready to work!"

0 commit comments

Comments
 (0)