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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 10affa386faea155c4dd9aaf1fbe3156acb7efc0
4
- data.tar.gz: 1a8ac475e5d7f99b2247f1e272ad04893fb9de44
3
+ metadata.gz: 6a0a3ef8a0e4df95d54f4a2867b60045e03b88c7
4
+ data.tar.gz: f6cdfe99d17f3e60bb50d53cc665116a247f2d72
5
5
  SHA512:
6
- metadata.gz: 0ab3074c1b532c3658d4b995b98599560a400c000e821d7bc78eb451cb2945ec067c8850a394fa4b31416ff054e9e5362e7075216bb0f46032487aa21568768c
7
- data.tar.gz: e59de67c8452bb7ae4fb670f2736e0569ded9bd800b7828386f5db2134b5b51cc073eb55fee0a204d2720a88061039795d911530699cae9b9fd7f933e1efdaff
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 a terminal has focus
33
- keyboard.type('date') # => $ date
34
- keyboard.tap(:Return) # => Sun Aug 23 22:57:28 CEST 2015
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
@@ -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/factory'
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{ |key| send_key_event(key.scan_code, state: 1) }
23
- send_syn_event
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{ |key| send_key_event(key.scan_code, state: 0) }
28
- send_syn_event
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)
@@ -3,8 +3,9 @@ module Uinput
3
3
  class SystemInitializer < Device::SystemInitializer
4
4
  def initialize(keyboard, &block)
5
5
  @keyboard = keyboard
6
- super(&block)
7
- receive_key_events
6
+ super(keyboard, &block)
7
+ add_event(:EV_KEY)
8
+ add_event(:EV_SYN)
8
9
  add_all_keys
9
10
  end
10
11
 
@@ -1,3 +1,3 @@
1
1
  module Uinput
2
- Keyboard_VERSION = "0.1.0"
2
+ Keyboard_VERSION = "0.1.1"
3
3
  end
@@ -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.1"
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.0
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-23 00:00:00.000000000 Z
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.1'
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.1'
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/factory.rb
84
+ - lib/uinput/keyboard/system_initializer.rb
85
85
  - lib/uinput/keyboard/version.rb
86
86
  - test.rb
87
87
  - uinput-keyboard.gemspec