No release in over 3 years
Lightweight Ruby library for low-level keyboard monitoring on macOS, implemented through FFI bindings to Darwin system libraries.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

~> 1.15
 Project Readme

🎹 rbnput-darwin-minimal 🍎

Gem Version GitHub

ไลบรารี Ruby ขนาดเล็กสำหรับตรวจจับการกดแป้นพิมพ์บนระบบ macOS โดยใช้ FFI เชื่อมต่อกับ system library ของ Darwin โดยตรง

✨ คุณสมบัติ

  • 🔍 ตรวจจับการกดคีย์แบบ low-level
  • 🧬 ใช้ FFI เชื่อมต่อกับ Carbon / IOKit
  • 🪶 ไม่มี dependency หนัก
  • 📦 โค้ดสั้นและเข้าใจง่าย เหมาะสำหรับเรียนรู้หรือฝังใช้งานในโปรเจคเล็กๆ

🚀 ตัวอย่างเริ่ม Listener เพื่อรับ keycode

require "rbnput"
listener = Rbnput::Listener.new
listener.on_press do |key|
  puts "Key up   : #{key}"
end
listener.on_release do |key|
  puts "Key down : #{key}"
end

listener.start
listener.join

🖥️ การรันแบบ Shell

💎 ใช้ ruby ตรงๆ

APP_MODE=local ruby ./examples/keyboard_listener.rb

🧰 ใช้ rake

# สำหรับทดสอบ local lib
rake test_local
# สำหรับทดสอบ production gem
rake test_local

⚠️ ข้อจำกัด - 🐧 รองรับเฉพาะ macOS (Darwin) - 💎 ต้องรันบน Ruby ที่รองรับ ffi - 🔐 ต้องมีสิทธิ์ “Input Monitoring” ใน System Settings

🔑 การให้สิทธิ์ (Permissions) 1. ⚙️ เปิด System Settings 2. 🔐 ไปที่ Privacy & Security 3. ⌨️ เลือก Input Monitoring 4. ➕ เพิ่ม Ruby หรือ Terminal ที่ใช้รันโปรแกรมของคุณเข้าไป

📂 โฟลเดอร์ / ไฟล์สำคัญ