xinput_wrapper 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/xinput_wrapper.rb +52 -50
- metadata +3 -45
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6e1b5f2e6105f33b76431173f63596ae7e96461
|
4
|
+
data.tar.gz: 19ff16d496d5f940ae43fe37d839ae84b6dfbe50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf611312a0c7b010621c6b3505afce6816370798f92f069e3d76eb60635610e38e9a1ce9b3753d112fe9816f9096a8603325f4cfb66b0701532dc70e3b83fc1b
|
7
|
+
data.tar.gz: 9af14598e6af1c75d4c22d610c7a6c950480eb27e81e4513da42a5e4020e50e81cbf6c3f181ad0a475b57f39eec46451bf2d8fa51e4519e40316102be0badc7a
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/xinput_wrapper.rb
CHANGED
@@ -3,49 +3,40 @@
|
|
3
3
|
# file: xinput_wrapper.rb
|
4
4
|
|
5
5
|
|
6
|
-
require 'sps-pub'
|
7
|
-
require 'secret_knock'
|
8
|
-
|
9
6
|
|
10
7
|
class XInputWrapper
|
11
8
|
|
12
|
-
def initialize(device: '3',
|
13
|
-
topic: 'input/keyboard', verbose: true, lookup: {},
|
14
|
-
interval: nil, debug: false)
|
9
|
+
def initialize(device: '3', verbose: true, lookup: {}, debug: false )
|
15
10
|
|
16
11
|
@lookup = {
|
17
|
-
37 => :control,
|
18
|
-
50 => :
|
19
|
-
|
12
|
+
37 => :control,
|
13
|
+
50 => :shift,
|
14
|
+
62 => :shift,
|
15
|
+
67 => :f1,
|
16
|
+
68 => :f2,
|
17
|
+
69 => :f3,
|
18
|
+
70 => :f4,
|
19
|
+
71 => :f5,
|
20
|
+
72 => :f6,
|
21
|
+
73 => :f7,
|
22
|
+
74 => :f8,
|
23
|
+
75 => :f9,
|
24
|
+
76 => :f10,
|
25
|
+
95 => :f11,
|
26
|
+
96 => :f12,
|
27
|
+
105 => :control,
|
28
|
+
133 => :super,
|
29
|
+
134 => :super
|
20
30
|
}.merge(lookup)
|
21
|
-
|
22
|
-
@device, @topic, @verbose, @debug = device, topic, verbose, debug
|
23
|
-
@sps = SPSPub.new host: host, port: port
|
24
|
-
@sk = SecretKnock.new short_delay: 0.25, long_delay: 0.5,
|
25
|
-
external: self, verbose: verbose, debug: debug
|
26
|
-
@interval = interval
|
27
|
-
@time = Time.now if interval
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
def knock()
|
32
|
-
puts 'knock' if @verbose
|
33
|
-
end
|
34
|
-
|
35
|
-
def message(msg)
|
36
31
|
|
37
|
-
|
32
|
+
@device, @verbose, @debug = device, verbose, debug
|
38
33
|
|
39
|
-
return if msg.strip.empty?
|
40
|
-
|
41
|
-
@sps.notice "%s: %s" % [@topic, msg]
|
42
34
|
end
|
43
35
|
|
44
36
|
def listen()
|
45
37
|
|
46
38
|
command = "xinput test-xi2 --root #{@device}"
|
47
|
-
|
48
|
-
sk = @sk
|
39
|
+
|
49
40
|
type = 0
|
50
41
|
|
51
42
|
IO.popen(command).each_line do |x|
|
@@ -64,28 +55,39 @@ class XInputWrapper
|
|
64
55
|
puts 'keycode: ' + keycode.to_s if keycode > 0 and @verbose
|
65
56
|
puts '>keycode: ' + keycode.to_s if @debug
|
66
57
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
when :lshift
|
77
|
-
puts 'left shift' if @verbose
|
78
|
-
when :control
|
79
|
-
puts 'control' if @verbose
|
80
|
-
sk.knock
|
81
|
-
when :super
|
82
|
-
puts 'super key pressed' if @verbose
|
83
|
-
message 'super key pressed'
|
84
|
-
end
|
85
|
-
|
86
|
-
sk.reset if @lookup[keycode] != :control
|
58
|
+
on_key_press(keycode)
|
59
|
+
|
60
|
+
key = @lookup[keycode]
|
61
|
+
puts 'key: ' + key.inspect if @debug
|
62
|
+
|
63
|
+
if key then
|
64
|
+
puts key.to_s + ' key presssed' if @verbose
|
65
|
+
method("on_#{key}_key".to_sym).call
|
66
|
+
end
|
87
67
|
|
88
68
|
end
|
89
69
|
end
|
90
70
|
end
|
71
|
+
|
72
|
+
protected
|
73
|
+
|
74
|
+
def on_control_key() end
|
75
|
+
def on_key_press(keycode) end
|
76
|
+
|
77
|
+
def on_shift_key() end
|
78
|
+
def on_super_key() end
|
79
|
+
|
80
|
+
def on_f1_key() end
|
81
|
+
def on_f2_key() end
|
82
|
+
def on_f3_key() end
|
83
|
+
def on_f4_key() end
|
84
|
+
def on_f5_key() end
|
85
|
+
def on_f6_key() end
|
86
|
+
def on_f7_key() end
|
87
|
+
def on_f8_key() end
|
88
|
+
def on_f9_key() end
|
89
|
+
def on_f10_key() end
|
90
|
+
def on_f11_key() end
|
91
|
+
def on_f12_key() end
|
92
|
+
|
91
93
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xinput_wrapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -32,47 +32,7 @@ cert_chain:
|
|
32
32
|
5bdH23akkNF4CA==
|
33
33
|
-----END CERTIFICATE-----
|
34
34
|
date: 2018-08-05 00:00:00.000000000 Z
|
35
|
-
dependencies:
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: sps-pub
|
38
|
-
requirement: !ruby/object:Gem::Requirement
|
39
|
-
requirements:
|
40
|
-
- - "~>"
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
version: '0.5'
|
43
|
-
- - ">="
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: 0.5.5
|
46
|
-
type: :runtime
|
47
|
-
prerelease: false
|
48
|
-
version_requirements: !ruby/object:Gem::Requirement
|
49
|
-
requirements:
|
50
|
-
- - "~>"
|
51
|
-
- !ruby/object:Gem::Version
|
52
|
-
version: '0.5'
|
53
|
-
- - ">="
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: 0.5.5
|
56
|
-
- !ruby/object:Gem::Dependency
|
57
|
-
name: secret_knock
|
58
|
-
requirement: !ruby/object:Gem::Requirement
|
59
|
-
requirements:
|
60
|
-
- - "~>"
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: '0.3'
|
63
|
-
- - ">="
|
64
|
-
- !ruby/object:Gem::Version
|
65
|
-
version: 0.3.0
|
66
|
-
type: :runtime
|
67
|
-
prerelease: false
|
68
|
-
version_requirements: !ruby/object:Gem::Requirement
|
69
|
-
requirements:
|
70
|
-
- - "~>"
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
version: '0.3'
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 0.3.0
|
35
|
+
dependencies: []
|
76
36
|
description:
|
77
37
|
email: james@jamesrobertson.eu
|
78
38
|
executables: []
|
@@ -103,7 +63,5 @@ rubyforge_project:
|
|
103
63
|
rubygems_version: 2.6.13
|
104
64
|
signing_key:
|
105
65
|
specification_version: 4
|
106
|
-
summary: A wrapper for the Linux utility xinput.
|
107
|
-
the super key is pressed as well as publishing a deciphered message when the control
|
108
|
-
key is pressed more than once
|
66
|
+
summary: A wrapper for the Linux utility xinput.
|
109
67
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|