uinput-keyboard 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/uinput/keyboard.rb +9 -3
- data/lib/uinput/keyboard/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39a2acc0faedbe6d57f2b046746dd185fde0cf3e
|
4
|
+
data.tar.gz: 63237b2ee8672c9f3b60588fa894f23d861e64db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6a5d69e00cf83ebb14c15ff01716fea7b7e000a9503a949d7b7842242e743a1d5d1e7102ba2aed1b244df883ca643129b88bf03948d116f96f297a590b65b37
|
7
|
+
data.tar.gz: 11351658ec058f30ac890ea33dd404c9b9c79229142999c22860d750aaec3a5b48b840d9fa22f47f552d654924c141cc7826fa3fa1c2340af996da69bbd96ded
|
data/lib/uinput/keyboard.rb
CHANGED
@@ -20,17 +20,21 @@ module Uinput
|
|
20
20
|
attr_accessor :keymap
|
21
21
|
|
22
22
|
def press(*symbols)
|
23
|
-
symbols_to_keys(*symbols)
|
23
|
+
keys = symbols_to_keys(*symbols)
|
24
|
+
keys.each do |key|
|
24
25
|
send_event(:EV_KEY, key.scan_code, 1)
|
25
26
|
end
|
26
27
|
send_event(:EV_SYN, :SYN_REPORT)
|
28
|
+
keys.map(&:code)
|
27
29
|
end
|
28
30
|
|
29
31
|
def release(*symbols)
|
30
|
-
symbols_to_keys(*symbols)
|
32
|
+
keys = symbols_to_keys(*symbols)
|
33
|
+
keys.each do |key|
|
31
34
|
send_event(:EV_KEY, key.scan_code, 0)
|
32
35
|
end
|
33
36
|
send_event(:EV_SYN, :SYN_REPORT)
|
37
|
+
keys.map(&:code)
|
34
38
|
end
|
35
39
|
|
36
40
|
def tap(*symbols)
|
@@ -41,10 +45,12 @@ module Uinput
|
|
41
45
|
def type(string)
|
42
46
|
# prevent dropped key events (b/c of evdev buffer overflow?) by sending
|
43
47
|
# out the event chain in chunks rather than in one piece
|
48
|
+
keycodes = []
|
44
49
|
string_to_symbols(string).each_slice(8) do |symbols|
|
45
|
-
symbols.
|
50
|
+
keycodes += symbols.flat_map{ |symbol| tap(symbol) }
|
46
51
|
sleep 0.01 # time to breath
|
47
52
|
end
|
53
|
+
keycodes
|
48
54
|
end
|
49
55
|
|
50
56
|
private
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uinput-keyboard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christopher Aue
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
105
|
version: '0'
|
106
106
|
requirements: []
|
107
107
|
rubyforge_project:
|
108
|
-
rubygems_version: 2.4.
|
108
|
+
rubygems_version: 2.4.5.1
|
109
109
|
signing_key:
|
110
110
|
specification_version: 4
|
111
111
|
summary: Ruby wrapper around uinput to create a virtual keyboard.
|