boaw 0.0.1 → 0.0.2

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
  SHA256:
3
- metadata.gz: a66c674c62720be3972467caf3322c8cca2611d8166735e22cff118782721c95
4
- data.tar.gz: 6ac808cdea27a87d871068aded16b6a57d077444c0c2296b09f15e752e84044b
3
+ metadata.gz: b7888bcff81bb35a03e6c4e756fa14fbdf8bb4afdc09955aa769d4267776c41c
4
+ data.tar.gz: 9abf00d8b7287c7dc0b68a3658ad1a2ca36294c0fc7e69680c70b5a1d37e927f
5
5
  SHA512:
6
- metadata.gz: a9f05b107e3482e21f4561cfbbad1783106cf5acd150dbea742959297f3a42f47e5c903478b2bc86ca17e3c7ddbd5130b0cc4f1598cf3e09733b280ad8abe66e
7
- data.tar.gz: 52967893a3236e1fe2dc61475d5a79aecc4281dab7be2adb8caccb1066450c6b29f427e9125e2cec565c8d01f293a0c7cd428a9d4c1205aadf114dfb090bee7d
6
+ metadata.gz: 5586887d3fc18a6b5d14db1a379fb3e34821a65f0bf8fcede9aaab182801ee093b50bb5c7d7d0f008954b9e2739d1961f6ab42de5ee35c172bd16c522319710a
7
+ data.tar.gz: c7c470bc142556f9022061d4f8592a2781e40050f375538a4647cba610e2cc6088a5ea117aee832de4bf3eb82060f659676494cdfce101bf67543d74fba8d6a3
data/lib/boaw/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Boaw
4
- VERSION = '0.0.1'
4
+ VERSION = '0.0.2'
5
5
  end
data/lib/boaw.rb CHANGED
@@ -1,8 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative 'xdotool/adapter'
4
+
3
5
  # Main class
4
6
  class Boaw
5
- def hello
6
- 'dsa'
7
+ attr_reader :adapter
8
+
9
+ def initialize
10
+ @adapter = Xdotool::Adapter.new
11
+ end
12
+
13
+ def position
14
+ adapter.position
15
+ end
16
+
17
+ def left_click(position)
18
+ adapter.left_click(position)
7
19
  end
8
20
  end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Xdotool
4
+ # Xdotool adapter for mouse control
5
+ class Adapter
6
+ def position
7
+ system('xdotool getmouselocation>temp.txt')
8
+
9
+ current_position = parse_position
10
+
11
+ {
12
+ x: current_position['x'].to_i,
13
+ y: current_position['y'].to_i
14
+ }
15
+ end
16
+
17
+ def left_click(position)
18
+ system("xdotool mousemove #{position[:x]} #{position[:y]} click 1")
19
+ end
20
+
21
+ private
22
+
23
+ def parse_position
24
+ file = File.open('./temp.txt', 'r')
25
+ position = file.gets.scan(/(\w+):(\d+)/).to_h
26
+ file.close
27
+ delete_temp_file
28
+ position
29
+ end
30
+
31
+ def delete_temp_file
32
+ File.delete('./temp.txt')
33
+ end
34
+ end
35
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boaw
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kirill Leonov
@@ -18,6 +18,7 @@ extra_rdoc_files: []
18
18
  files:
19
19
  - lib/boaw.rb
20
20
  - lib/boaw/version.rb
21
+ - lib/xdotool/adapter.rb
21
22
  homepage: https://github.com/leonovk/boaw
22
23
  licenses:
23
24
  - MIT