rbnput-darwin-minimal 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE +22 -0
- data/README.md +67 -0
- data/lib/rbnput/version.rb +1 -1
- metadata +14 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3317cf0ccce42301ac2051688baf804f1f17f56bdf71b2af9c6a8e27b90d4869
|
|
4
|
+
data.tar.gz: c11a98352c3eff90c3618188ee865501649b48a6fb1fa23342871e9e2fe35e0e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5a019ea1d2117c1794eacfd1a4583b319bde5cd0ee030d6c208c66fa6ae7a8d7c1c8e9b8904108e6590562672f3e4e0da3893e34011750d39e20b3b2baabc9aa
|
|
7
|
+
data.tar.gz: 887fe4b1c904f54da8b42d0a28556c5933c06a839cf79665e33a3d4050f6bb4b94bbca18ed3dbc78ba8bf978d39697e3b39564cf1e489a7c26449a7cdc2aaef4
|
data/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
This is free and unencumbered software released into the public domain.
|
|
2
|
+
|
|
3
|
+
Anyone is free to copy, modify, publish, use, compile, sell, or
|
|
4
|
+
distribute this software, either in source code form or as a compiled
|
|
5
|
+
binary, for any purpose, commercial or non-commercial, and by any
|
|
6
|
+
means.
|
|
7
|
+
|
|
8
|
+
In jurisdictions that recognize copyright laws, the author or authors
|
|
9
|
+
of this software dedicate any and all copyright interest in the
|
|
10
|
+
software to the public domain. We make this dedication for the benefit
|
|
11
|
+
of the public at large and to the detriment of our heirs and
|
|
12
|
+
successors. We intend this dedication to be an overt act of
|
|
13
|
+
relinquishment in perpetuity of all present and future rights to this
|
|
14
|
+
software under copyright law.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
20
|
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
21
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# 🎹 rbnput-darwin-minimal 🍎
|
|
2
|
+
|
|
3
|
+
ไลบรารี Ruby ขนาดเล็กสำหรับตรวจจับการกดแป้นพิมพ์บนระบบ macOS โดยใช้ FFI เชื่อมต่อกับ system library ของ Darwin โดยตรง
|
|
4
|
+
|
|
5
|
+
## ✨ คุณสมบัติ
|
|
6
|
+
|
|
7
|
+
- 🔍 ตรวจจับการกดคีย์แบบ low-level
|
|
8
|
+
- 🧬 ใช้ FFI เชื่อมต่อกับ Carbon / IOKit
|
|
9
|
+
- 🪶 ไม่มี dependency หนัก
|
|
10
|
+
- 📦 โค้ดสั้นและเข้าใจง่าย เหมาะสำหรับเรียนรู้หรือฝังใช้งานในโปรเจคเล็กๆ
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## 🚀 ตัวอย่างเริ่ม Listener เพื่อรับ keycode
|
|
14
|
+
|
|
15
|
+
```ruby
|
|
16
|
+
require "rbnput"
|
|
17
|
+
listener = Rbnput::Listener.new
|
|
18
|
+
listener.on_press do |key|
|
|
19
|
+
puts "Key up : #{key}"
|
|
20
|
+
end
|
|
21
|
+
listener.on_release do |key|
|
|
22
|
+
puts "Key down : #{key}"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
listener.start
|
|
26
|
+
listener.join
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## 🖥️ การรันแบบ Shell
|
|
30
|
+
|
|
31
|
+
### 💎 ใช้ ruby ตรงๆ
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
APP_MODE=local ruby ./examples/keyboard_listener.rb
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### 🧰 ใช้ rake
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# สำหรับทดสอบ local lib
|
|
41
|
+
rake test_local
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# สำหรับทดสอบ production gem
|
|
46
|
+
rake test_local
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
⚠️ ข้อจำกัด
|
|
50
|
+
- 🐧 รองรับเฉพาะ macOS (Darwin)
|
|
51
|
+
- 💎 ต้องรันบน Ruby ที่รองรับ ffi
|
|
52
|
+
- 🔐 ต้องมีสิทธิ์ “Input Monitoring” ใน System Settings
|
|
53
|
+
|
|
54
|
+
🔑 การให้สิทธิ์ (Permissions)
|
|
55
|
+
1. ⚙️ เปิด System Settings
|
|
56
|
+
2. 🔐 ไปที่ Privacy & Security
|
|
57
|
+
3. ⌨️ เลือก Input Monitoring
|
|
58
|
+
4. ➕ เพิ่ม Ruby หรือ Terminal ที่ใช้รันโปรแกรมของคุณเข้าไป
|
|
59
|
+
|
|
60
|
+
📂 โฟลเดอร์ / ไฟล์สำคัญ
|
|
61
|
+
|
|
62
|
+
- [./lib/rbnput/darwin_listener.rb | Most Of Implement 🧠](./lib/rbnput/darwin_listener.rb)
|
|
63
|
+
- [./lib/rbnput.rb | Lib Endpoint](./lib/rbnput.rb)
|
|
64
|
+
- [./lib/rbnput/key_code_const.rb | All Key Map](./lib/rbnput/key_code_const.rb)
|
|
65
|
+
- [./lib/rbnput/key_code.rb | Class KeyCode(vk, is_media)](./lib/rbnput/key_code.rb)
|
|
66
|
+
- [./lib/rbnput/darwin_ffi.rb | SystemLibrary Bind FFI 🪪](./lib/rbnput/darwin_ffi.rb)
|
|
67
|
+
- [./lib/rbnput/simple_mutex_thread.rb | Boring Thread Implement ](./lib/rbnput/simple_mutex_thread.rb)
|
data/lib/rbnput/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rbnput-darwin-minimal
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Krist Ponpairin
|
|
@@ -23,13 +23,16 @@ dependencies:
|
|
|
23
23
|
- - "~>"
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
25
|
version: '1.15'
|
|
26
|
-
description:
|
|
26
|
+
description: Lightweight Ruby library for low-level keyboard monitoring on macOS,
|
|
27
|
+
implemented through FFI bindings to Darwin system libraries.
|
|
27
28
|
email:
|
|
28
29
|
- krist7599555@gmail.com
|
|
29
30
|
executables: []
|
|
30
31
|
extensions: []
|
|
31
32
|
extra_rdoc_files: []
|
|
32
33
|
files:
|
|
34
|
+
- LICENSE
|
|
35
|
+
- README.md
|
|
33
36
|
- lib/rbnput-darwin-minimal.rb
|
|
34
37
|
- lib/rbnput/darwin_ffi.rb
|
|
35
38
|
- lib/rbnput/darwin_listener.rb
|
|
@@ -37,8 +40,14 @@ files:
|
|
|
37
40
|
- lib/rbnput/key_code_const.rb
|
|
38
41
|
- lib/rbnput/simple_mutex_thread.rb
|
|
39
42
|
- lib/rbnput/version.rb
|
|
43
|
+
homepage: https://github.com/krist7599555/rbnput-darwin-minimal
|
|
40
44
|
licenses: []
|
|
41
|
-
metadata:
|
|
45
|
+
metadata:
|
|
46
|
+
homepage_uri: https://github.com/krist7599555/rbnput-darwin-minimal
|
|
47
|
+
source_code_uri: https://github.com/krist7599555/rbnput-darwin-minimal
|
|
48
|
+
bug_tracker_uri: https://github.com/krist7599555/rbnput-darwin-minimal/issues
|
|
49
|
+
documentation_uri: https://github.com/krist7599555/rbnput-darwin-minimal
|
|
50
|
+
changelog_uri: https://github.com/krist7599555/rbnput-darwin-minimal/releases
|
|
42
51
|
rdoc_options: []
|
|
43
52
|
require_paths:
|
|
44
53
|
- lib
|
|
@@ -46,7 +55,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
46
55
|
requirements:
|
|
47
56
|
- - ">="
|
|
48
57
|
- !ruby/object:Gem::Version
|
|
49
|
-
version: '0'
|
|
58
|
+
version: '3.0'
|
|
50
59
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
51
60
|
requirements:
|
|
52
61
|
- - ">="
|
|
@@ -55,5 +64,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
55
64
|
requirements: []
|
|
56
65
|
rubygems_version: 3.7.2
|
|
57
66
|
specification_version: 4
|
|
58
|
-
summary: Ruby
|
|
67
|
+
summary: Minimal Ruby keyboard listener for macOS using FFI
|
|
59
68
|
test_files: []
|