uinput-keyboard 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -4
- data/lib/uinput/keyboard.rb +10 -9
- data/lib/uinput/keyboard/{factory.rb → system_initializer.rb} +3 -2
- data/lib/uinput/keyboard/version.rb +1 -1
- data/uinput-keyboard.gemspec +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a0a3ef8a0e4df95d54f4a2867b60045e03b88c7
|
4
|
+
data.tar.gz: f6cdfe99d17f3e60bb50d53cc665116a247f2d72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e73ca04e07a58e44b8d9265d84e477642bcba85980361e55bf7d011a4b71d272c5673d06ab4dcf880efde8269efe4bb9f7ef257e5d8c96f6ba0f76d2f00b2a9
|
7
|
+
data.tar.gz: 76b99e4927c48a845c61a78834b5468850bf79deac42bb4a888a85f7e53ea08b3cccb0bee716c75d86d74636224f6b5596401c3ca8955021aef90c91c6b01e71
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Uinput::Keyboard
|
2
2
|
|
3
|
-
Ruby wrapper around uinput to create a virtual keyboard.
|
3
|
+
Ruby wrapper around uinput to create a virtual keyboard from an xkb keymap.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -29,9 +29,9 @@ begin
|
|
29
29
|
|
30
30
|
sleep 1 # to give linux time to setup the new device
|
31
31
|
|
32
|
-
# While
|
33
|
-
keyboard.type('
|
34
|
-
keyboard.tap(:Return)
|
32
|
+
# While pasting this code into irb
|
33
|
+
keyboard.type('Time.now') # types 'Time.now'
|
34
|
+
keyboard.tap(:Return) # presses the Return key and returns the timestamp
|
35
35
|
ensure
|
36
36
|
keyboard.destroy if keyboard
|
37
37
|
end
|
data/lib/uinput/keyboard.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
+
require 'bundler/setup'
|
1
2
|
require 'uinput/device'
|
2
3
|
require 'xkbcommon'
|
3
4
|
require "uinput/keyboard/version"
|
4
|
-
require 'uinput/keyboard/
|
5
|
+
require 'uinput/keyboard/system_initializer'
|
5
6
|
|
6
7
|
module Uinput
|
7
8
|
class Keyboard < Device
|
@@ -19,13 +20,17 @@ module Uinput
|
|
19
20
|
attr_accessor :keymap
|
20
21
|
|
21
22
|
def press(*symbols)
|
22
|
-
symbols_to_keys(*symbols).each
|
23
|
-
|
23
|
+
symbols_to_keys(*symbols).each do |key|
|
24
|
+
send_event(:EV_KEY, key.scan_code, 1)
|
25
|
+
end
|
26
|
+
send_event(:EV_SYN, :SYN_REPORT)
|
24
27
|
end
|
25
28
|
|
26
29
|
def release(*symbols)
|
27
|
-
symbols_to_keys(*symbols).each
|
28
|
-
|
30
|
+
symbols_to_keys(*symbols).each do |key|
|
31
|
+
send_event(:EV_KEY, key.scan_code, 0)
|
32
|
+
end
|
33
|
+
send_event(:EV_SYN, :SYN_REPORT)
|
29
34
|
end
|
30
35
|
|
31
36
|
def tap(*symbols)
|
@@ -37,10 +42,6 @@ module Uinput
|
|
37
42
|
string_to_symbols(string).each{ |symbols| tap(*symbols) }
|
38
43
|
end
|
39
44
|
|
40
|
-
def send_key_event(scan_code, state: 1)
|
41
|
-
send_event(EV_KEY, scan_code, state)
|
42
|
-
end
|
43
|
-
|
44
45
|
private
|
45
46
|
|
46
47
|
def symbols_to_keys(*names)
|
data/uinput-keyboard.gemspec
CHANGED
@@ -18,6 +18,6 @@ Gem::Specification.new do |spec|
|
|
18
18
|
|
19
19
|
spec.add_development_dependency "bundler", "~> 1.8"
|
20
20
|
spec.add_development_dependency "rake", "~> 10.0"
|
21
|
-
spec.add_dependency "uinput-device", "~> 0.
|
21
|
+
spec.add_dependency "uinput-device", "~> 0.2"
|
22
22
|
spec.add_dependency "xkbcommon", "~> 0.1"
|
23
23
|
end
|
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.1
|
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-08-
|
11
|
+
date: 2015-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0.
|
47
|
+
version: '0.2'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0.
|
54
|
+
version: '0.2'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: xkbcommon
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,7 +81,7 @@ files:
|
|
81
81
|
- README.md
|
82
82
|
- Rakefile
|
83
83
|
- lib/uinput/keyboard.rb
|
84
|
-
- lib/uinput/keyboard/
|
84
|
+
- lib/uinput/keyboard/system_initializer.rb
|
85
85
|
- lib/uinput/keyboard/version.rb
|
86
86
|
- test.rb
|
87
87
|
- uinput-keyboard.gemspec
|