summaryrefslogtreecommitdiffstats
path: root/esheep.py
diff options
context:
space:
mode:
authorKen D'Ambrosio <ken.dambrosio@constantcontact.com>2026-06-03 21:58:41 -0400
committerKen D'Ambrosio <ken.dambrosio@constantcontact.com>2026-06-03 21:58:41 -0400
commit321c91d4eefafdf84d2312fc890264a1d0f905a1 (patch)
treef8a2fcff2195b608a7733c22f8f57aa03db601e9 /esheep.py
parent7a48d2a3cb7d3969be5e3e00b64a51c1da0550ee (diff)
Add hard-landing bounce and --exit flag
- 20% of hard falls (fall fast → fall hard) now trigger a boing instead of walking immediately, matching the original eSheep behaviour - esheep --exit kills all running eSheep instances (uses pgrep/SIGTERM, skips its own pid) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'esheep.py')
-rw-r--r--esheep.py27
1 files changed, 26 insertions, 1 deletions
diff --git a/esheep.py b/esheep.py
index 190c4fd..1ec71a7 100644
--- a/esheep.py
+++ b/esheep.py
@@ -727,6 +727,12 @@ class SheepOverlay:
self.cairo_surface = self._pil_to_cairo(self.sprite)
self.dark_surface = self._make_dark_surface(self.sprite)
+
+ # Patch fall-hard (10) to occasionally boing on landing — 20% chance
+ hard = self.anim_defs.get(10)
+ if hard:
+ hard.seq_nexts = [NextRef(probability=20, only='', anim_id=8),
+ NextRef(probability=80, only='', anim_id=1)]
self.wayfire = WayfireWindows()
self.sheep_list: List[Sheep] = []
self.ufos: List[UFO] = []
@@ -1113,13 +1119,32 @@ class SheepOverlay:
# ─────────────────────── entry point ───────────────────────
def main():
- import argparse
+ import argparse, signal, subprocess
p = argparse.ArgumentParser(description='eSheep for Wayland')
p.add_argument('--xml', default=os.path.join(os.path.dirname(__file__), 'animations.xml'),
help='Path to animations.xml')
p.add_argument('--count', type=int, default=1, help='Number of sheep')
+ p.add_argument('--exit', action='store_true',
+ help='Kill any running eSheep instances and quit')
args = p.parse_args()
+ if args.exit:
+ my_pid = os.getpid()
+ result = subprocess.run(['pgrep', '-f', 'esheep.py'],
+ capture_output=True, text=True)
+ pids = [int(p) for p in result.stdout.split()
+ if p.strip() and int(p.strip()) != my_pid]
+ if pids:
+ for pid in pids:
+ try:
+ os.kill(pid, signal.SIGTERM)
+ except ProcessLookupError:
+ pass
+ print(f"Stopped {len(pids)} eSheep process(es).")
+ else:
+ print("No running eSheep found.")
+ sys.exit(0)
+
if not os.path.exists(args.xml):
print(f"animations.xml not found: {args.xml}", file=sys.stderr)
sys.exit(1)