xtabbedwindow 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ee172da35c2a388cd282c481463a620f29cc09445f94623bcd3fddb97396243b
4
+ data.tar.gz: c579da97c72999af60d216ff9f386b467c600a963b8817e44b624829011fdcd6
5
+ SHA512:
6
+ metadata.gz: c3948d639a6b84850083968e849d9a373be313155950a3c937cd4b131797fb143add80ca603a17848f5314c705caede664f386b6314aa92d434a723e69f09788
7
+ data.tar.gz: '01244954ece4d9237dc9edf3092f87638fe8924d414aa1d6a0a9015a0b645754a8bbb442b07b6fc6766c597cdc7fc1dca9fa3e89fc2e24c6d0832601bf55b709'
checksums.yaml.gz.sig ADDED
Binary file
@@ -0,0 +1,85 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: xtabbedwindow.rb
4
+
5
+ require 'wmctrl'
6
+ require "xdo/xwindow"
7
+ require "xdo/keyboard"
8
+
9
+
10
+ class XTabbedWindow
11
+
12
+ attr_reader :window, :tabs
13
+
14
+ def initialize(name)
15
+
16
+ a = WMCtrl.instance.windows
17
+ @window = a.detect {|x| x.title =~ /#{name}/i}
18
+
19
+ if @window
20
+ sleep 0.3
21
+ @window.activate
22
+ end
23
+
24
+ read_tabs()
25
+
26
+ end
27
+
28
+ def goto_tab(pattern)
29
+
30
+ regex = pattern.is_a?(String) ? /^#{pattern}/i : pattern
31
+
32
+ a = @tabs
33
+ r = a.grep(regex)
34
+
35
+ if r.empty? and pattern.is_a? String then
36
+ regex = /#{pattern}/i
37
+ r = a.grep(regex)
38
+ end
39
+
40
+ return if r.empty?
41
+
42
+ i = a.index(r.first)
43
+
44
+ @window.activate
45
+ sleep 0.1
46
+
47
+ XDo::Keyboard.char("Alt+1")
48
+ sleep 0.1
49
+ i.times { XDo::Keyboard.char("Ctrl+Tab") }
50
+
51
+ end
52
+
53
+ def next_tab()
54
+ sleep 0.05
55
+ XDo::Keyboard.char("Ctrl+Tab")
56
+ end
57
+
58
+ def read_tabs()
59
+
60
+ XDo::Keyboard.char("Alt+1")
61
+
62
+ start_tab_title = title()
63
+ @tabs = [start_tab_title]
64
+
65
+ next_tab()
66
+ window_title = title()
67
+
68
+ while window_title != start_tab_title do
69
+
70
+ @tabs << window_title
71
+ next_tab()
72
+ window_title = title()
73
+
74
+ end
75
+
76
+ @tabs
77
+
78
+ end
79
+
80
+ def title()
81
+ sleep 0.05
82
+ XDo::XWindow.from_active.title
83
+ end
84
+
85
+ end
data.tar.gz.sig ADDED
Binary file
metadata ADDED
@@ -0,0 +1,112 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: xtabbedwindow
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
14
+ YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMTgwOTA0MTYxNjMwWhcN
15
+ MTkwOTA0MTYxNjMwWjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
16
+ cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQCowcwP
17
+ 6/5ysjnJPydmnT/bokaPG0eLr49zM+8hbIJNV1Lmqgayg5QZR89tpPgeg4wZie8E
18
+ evTaEk4O0b8Tm4eKdoIWqsr8ULQRsJiFBn1hx9RsjLGXay4fw41qmagbuEQiIfdJ
19
+ ncDxCJclYW2o31ZY97vhJvSgqQGl5eHsz0DAlqbsGkt21bVbm9OO7yGkFJHnPTcj
20
+ FYt5K2VIpwiyU5Ub6lZNDk+0gY8gNDxCNe6VscVb3s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3zeuSu0drpsmOs57Rd07nL
37
+ -----END CERTIFICATE-----
38
+ date: 2018-09-04 00:00:00.000000000 Z
39
+ dependencies:
40
+ - !ruby/object:Gem::Dependency
41
+ name: xdo
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '0.0'
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: 0.0.4
50
+ type: :runtime
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - "~>"
55
+ - !ruby/object:Gem::Version
56
+ version: '0.0'
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: 0.0.4
60
+ - !ruby/object:Gem::Dependency
61
+ name: ruby-wmctrl
62
+ requirement: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - "~>"
65
+ - !ruby/object:Gem::Version
66
+ version: '0.0'
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: 0.0.6
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '0.0'
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: 0.0.6
80
+ description:
81
+ email: james@jamesrobertson.eu
82
+ executables: []
83
+ extensions: []
84
+ extra_rdoc_files: []
85
+ files:
86
+ - lib/xtabbedwindow.rb
87
+ homepage: https://github.com/jrobertson/xtabbedwindow
88
+ licenses:
89
+ - MIT
90
+ metadata: {}
91
+ post_install_message:
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ requirements: []
106
+ rubyforge_project:
107
+ rubygems_version: 2.7.6
108
+ signing_key:
109
+ specification_version: 4
110
+ summary: Finds and selects a tabbed document within a window automatically (X11 Windows
111
+ only).
112
+ test_files: []
metadata.gz.sig ADDED
Binary file