From 321c91d4eefafdf84d2312fc890264a1d0f905a1 Mon Sep 17 00:00:00 2001 From: Ken D'Ambrosio Date: Wed, 3 Jun 2026 21:58:41 -0400 Subject: Add hard-landing bounce and --exit flag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- esheep.py | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) 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) -- cgit v1.2.3