Coder Social home page Coder Social logo

xpc_set_event_stream_handler's Introduction

xpc_set_event_stream_handler

Consume a com.apple.iokit.matching event, then run the executable specified in the first parameter.

This is useful when creating launchd LaunchAgents that are triggered by IO events (e.g., run a script when keyboard/mouse attached). Failing to consume the com.apple.iokit.matching event will result in the executable being called repeatedly.

This isn't really documented anywhere other than the man page for xpc_set_event_stream_handler.

Example Property List

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Label</key>
	<string>com.example.KeyboardAttach</string>
	<key>ProgramArguments</key>
	<array>
		<string>/usr/local/bin/xpc_set_event_stream_handler</string>
		<string>/usr/local/bin/KeyboardAttachScript.sh</string>
	</array>
	<key>LaunchEvents</key>
	<dict>
		<key>com.apple.iokit.matching</key>
		<dict>
			<key>com.example.KeyboardAttach.Event</key>
			<dict>
				<key>idVendor</key>
				<integer>1234</integer>
				<key>idProduct</key>
				<integer>56789</integer>
				<key>IOProviderClass</key>
				<string>IOUSBDevice</string>
				<key>IOMatchLaunchStream</key>
				<true/>
			</dict>
		</dict>
	</dict>
</dict>
</plist>

xpc_set_event_stream_handler's People

Contributors

snosrap avatar

Stargazers

 avatar adam kaminski avatar Nils Hayat avatar Jevin Sweval avatar Jeremy Legendre avatar Stephan Casas avatar Alexander Solovyov avatar  avatar Yi, Huanlin avatar Vlad Cotfas avatar Paul Colusso avatar Claudio Luck avatar  avatar Kevin Bernhagen avatar Marcio Fonseca avatar Russell Finn avatar Alexandre GV. avatar Harry Gallagher avatar Jason P. Scharf avatar CP Clermont avatar Travis A. Everett avatar Giorgio Strano avatar vi avatar Nadav Goldstein avatar Simon Leiner avatar Chris Ross avatar Anes Abismail avatar Ruben Maher avatar  avatar Aidil F avatar Richard Wiesinger avatar Jason Bush avatar Ben Longo avatar Victor Torres avatar Steffen Uhlig avatar CR Milburn avatar Daniel Zen avatar Lisa Voigtländer avatar  avatar  avatar Benjamin Graf avatar Lio李歐 avatar CaiRuJi avatar

Watchers

 avatar Jevin Sweval avatar James Cloos avatar Vlad Cotfas avatar Simon Leiner avatar  avatar

xpc_set_event_stream_handler's Issues

Complied Binary Does Not Work on Apple Silicon

I have tried re-compiling this on Apple Silicon, as Universal Binary, ARM64, and Intel X64. None of them actually appear to function. I've tried signing it with a Self Signed cert, and also tried with an Apple Developer Account cert. No combination seems to get it to work on Apple Silicon when re-compiled. A version I compiled 2 years ago on 10.15 Catalina Intel continues to work fine via Rosetta. Am I missing something?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.