clipboard_manager 1.0.4 → 4.0.210706

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
- SHA1:
3
- metadata.gz: 0fd839d070fd705e05d8beceedf7c4f2781696d1
4
- data.tar.gz: abce9790a308601479200afb390ebe64e605a027
2
+ SHA256:
3
+ metadata.gz: 884536f28b9e8d38614cd4df4861889f577147e3684f684878d27a8bd9e27c29
4
+ data.tar.gz: 91d89fd8260c22fc1183a4ea3a33b6e9a7b58dac653a9ce474418f597981d556
5
5
  SHA512:
6
- metadata.gz: 1cdfa738e9952e978b0d4ba6cc8a9e18689848fb43616591782495c08724eb335fa7d454534fccf80684ff986ead9eb163d70d054ef0c93b1a3de7128be50c0b
7
- data.tar.gz: 035980213d3c790fee2b792cb792d412ff73417b690940b14697a93e168d13bf5b54682b52b9e94ad4aeedcae42dd9425858ed48427c6284a57bfcc89f15c1ee
6
+ metadata.gz: acab8881f685c92a7173e5fd090e4d3566543ed5107eff5f6243b044169da3ae7a476728a122f0fdbee4c95fde598b8a22f507a5b3d9d1882b953f504222995d
7
+ data.tar.gz: fe1aded68b9451e87475970ed405c6fc48a58f060f93a05fb6887f6c3481f4a2c077714b1b9999cf71af6ebcbbc7ab0393758bdb5d6806d065bcc3e20768a338
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 carlosjhr64
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,125 @@
1
+ # ClipboardManager
2
+
3
+ * [VERSION 4.0.210706](https://github.com/carlosjhr64/clipboard_manager/releases)
4
+ * [github](https://github.com/carlosjhr64/clipboard_manager)
5
+ * [rubygems](https://rubygems.org/gems/clipboard_manager)
6
+
7
+ ## DESCRIPTION:
8
+
9
+ Ruby Gtk3App Clipboard Manager.
10
+
11
+ ## FEATURES
12
+
13
+ Clipboard auto sends to:
14
+
15
+ * gnome-calculator
16
+ * google dictionary
17
+ * xdg-open url
18
+ * espeak
19
+
20
+ Also:
21
+
22
+ * History
23
+ * QR-Code copy to clipboard
24
+
25
+ ## INSTALL:
26
+
27
+ Note that you'll need gtk3app:
28
+ ```shell
29
+ $ gem install clipboard_manager
30
+ ```
31
+ ## CONFIGURATION:
32
+
33
+ After an initial run, your user configuration will found in:
34
+
35
+ ~/.config/gtk3app/clipboardmanager/config-?.?.rbon
36
+
37
+ At top of the file you will find the available tasks:
38
+ ```ruby
39
+ {
40
+ Tasks!: {
41
+ calculator: [
42
+ "^([\\d\\.\\+\\-\\*\\/\\%\\(\\) ]{3,80})$",
43
+ :bashit,
44
+ true,
45
+ "gnome-calculator -e '$1'"
46
+ ],
47
+ dictionary: [
48
+ "^(\\w+)$",
49
+ :bashit,
50
+ true,
51
+ "xdg-open 'https://www.google.com/search?q=definition+of+$1'"
52
+ ],
53
+ url: [
54
+ "^https?://\\w[\\-\\+\\.\\w]*(\\.\\w+)(:\\d+)?(/\\S*)?$",
55
+ :open,
56
+ true
57
+ ],
58
+ espeak: [
59
+ ".{80,}",
60
+ :espeak,
61
+ true
62
+ ]
63
+ },
64
+ #...
65
+ }
66
+ ```
67
+ It is by this configuration that one can modify and add tasks.
68
+ Warning: although the config file looks like `ruby` code,
69
+ it is read like a config file(not evaled).
70
+ Within tolerance(see [rbon](https://rubygems.org/gems/rbon)) you must maintain it's structure.
71
+
72
+ ClipboardManager has three tasks methods: `:bashit`, `:open`, and `:espeak`.
73
+ `:bashit` will take a command to be run by the system.
74
+ `:open` will `xdg-open` the clip.
75
+ `:espeak` will `espeak` the clip.
76
+
77
+ With the boolean `true` value the clipboard will clear on the matched task.
78
+ If you don't want the clipboard cleared on a matched task,
79
+ set the boolean value to `false`.
80
+
81
+ Note that `:bashit` requires a extra command string which
82
+ it will substitute $0, $1, $2... with match data.
83
+ It then passes the string to system.
84
+
85
+ The `:caculator` task will run when the clip looks like a bunch of number being operated.
86
+
87
+ The `:espeak` task will run when the clip is at least 80 characters long.
88
+ It will have espeak read the text.
89
+
90
+ ## HELP:
91
+ ```shell
92
+ $ clipboard_manager --help
93
+ Usage:
94
+ clipboard_manager [:options+]
95
+ Options:
96
+ -h --help
97
+ -v --version
98
+ --minime Real minime
99
+ --notoggle Minime wont toggle decorated and keep above
100
+ --notdecorated Dont decorate window
101
+ ```
102
+ ## LICENSE:
103
+
104
+ (The MIT License)
105
+
106
+ Copyright (c) 2021 CarlosJHR64
107
+
108
+ Permission is hereby granted, free of charge, to any person obtaining
109
+ a copy of this software and associated documentation files (the
110
+ 'Software'), to deal in the Software without restriction, including
111
+ without limitation the rights to use, copy, modify, merge, publish,
112
+ distribute, sublicense, and/or sell copies of the Software, and to
113
+ permit persons to whom the Software is furnished to do so, subject to
114
+ the following conditions:
115
+
116
+ The above copyright notice and this permission notice shall be
117
+ included in all copies or substantial portions of the Software.
118
+
119
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
120
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
121
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
122
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
123
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
124
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
125
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ require 'clipboard_manager'
3
+
4
+ class ClipboardManager
5
+ begin
6
+ case ARGV
7
+ in [/^(-v)|(--version)$/]
8
+ puts VERSION
9
+ in [/^(-h)|(--help)$/]
10
+ puts HELP
11
+ else
12
+ ClipboardManager.run
13
+ end
14
+ end
15
+ end
16
+
17
+ exit
@@ -1,20 +1,46 @@
1
- # Standard Libraries
2
- require 'timeout'
1
+ class ClipboardManager
2
+ class << self; attr_accessor :do_qrcode; end
3
+ ClipboardManager.do_qrcode = true
3
4
 
4
- # Work gems
5
- require 'gtk3app'
6
- require 'helpema/zbar'
5
+ HELP = <<~HELP
6
+ Usage:
7
+ clipboard_manager [:options+]
8
+ Options:
9
+ -h --help
10
+ -v --version
11
+ --minime \t Real minime
12
+ --notoggle \t Minime wont toggle decorated and keep above
13
+ --notdecorated\t Dont decorate window
14
+ HELP
15
+ VERSION = '4.0.210706'
7
16
 
8
- # This Gem
9
- require_relative 'clipboard_manager/version.rb'
10
- require_relative 'clipboard_manager/config.rb'
11
- require_relative 'clipboard_manager/clipboard_manager.rb'
17
+
18
+ def self.run
19
+
20
+ # Gems
21
+ require 'gtk3app'
22
+ begin
23
+ require 'helpema'
24
+ ::Helpema::ZBar # autoload
25
+ require 'timeout' # needed to timeout zbarcam
26
+ rescue
27
+ # no ZBar? OK, nevermind.
28
+ ClipboardManager.do_qrcode = false
29
+ end
30
+
31
+ # This Gem
32
+ require_relative 'clipboard_manager/config.rb'
33
+ require_relative 'clipboard_manager/clipboard_manager.rb'
34
+
35
+ # Run
36
+ Gtk3App.run(klass:ClipboardManager)
37
+ end
38
+ end
12
39
 
13
40
  # Requires:
14
- #`ruby`
15
- #`zbarcam`
16
- #`firefox`
41
+ #`gnome-calculator`
17
42
  #`espeak`
18
- #`wget`
19
- #`youtube-dl`
20
43
  #`system`
44
+ #`ruby`
45
+ #`xdg-open`
46
+ #`zbarcam`
@@ -1,93 +1,104 @@
1
- module ClipboardManager
1
+ def Gtk3App.toggle!
2
+ @clipboard_manager_hook.do_toggle!
3
+ end
4
+
5
+ def Gtk3App.clipboard_manager_hook(hook)
6
+ @clipboard_manager_hook = hook
7
+ end
8
+
9
+ class ClipboardManager
2
10
  using Rafini::Exception
3
11
 
4
- class Dialog < Such::Dialog
12
+ class NoYes < Such::Dialog
5
13
  def initialize(*par)
6
14
  super
7
- add_button(Gtk::Stock::CANCEL, Gtk::ResponseType::CANCEL)
8
- add_button(Gtk::Stock::OK, Gtk::ResponseType::OK)
15
+ add_button '_No', Gtk::ResponseType::CANCEL
16
+ add_button '_Yes', Gtk::ResponseType::OK
9
17
  end
10
18
 
11
- def runs
19
+ def label(*par)
20
+ Such::Label.new child, *par
21
+ end
22
+
23
+ def ok?
12
24
  show_all
13
25
  response = run
14
- response = yield(response)
15
26
  destroy
16
- return response
27
+ response == Gtk::ResponseType::OK
17
28
  end
18
29
  end
19
30
 
20
- def self.options=(opts)
21
- @@options=opts
22
- end
31
+ class CancelOk < Such::Dialog
32
+ def initialize(*par)
33
+ super
34
+ add_button(Gtk::Stock::CANCEL, Gtk::ResponseType::CANCEL)
35
+ add_button(Gtk::Stock::OK, Gtk::ResponseType::OK)
36
+ end
23
37
 
24
- def self.options
25
- @@options
26
- end
38
+ def combo(*par)
39
+ Such::ComboBoxText.new child, *par
40
+ end
27
41
 
28
- def self.run(program)
29
- ClipboardManager.new(program)
42
+ def runs
43
+ show_all
44
+ response = run
45
+ yield if response == Gtk::ResponseType::OK
46
+ destroy
47
+ end
30
48
  end
31
49
 
32
- class ClipboardManager
33
- CLIPBOARD = Gtk::Clipboard.get(Gdk::Selection::CLIPBOARD)
50
+ CLIPBOARD = Gtk::Clipboard.get(Gdk::Selection::PRIMARY)
34
51
 
35
- def initialize(program)
36
- @image = program.mini.children.first
52
+ def initialize(stage, toolbar, options)
53
+ @image = toolbar.parent.children[0].child # Expander:hbox:EventImage:Image
37
54
  @timer = nil
38
55
 
39
- @working = Gdk::Pixbuf.new(file: CONFIG[:Working])
40
- @ok = Gdk::Pixbuf.new(file: CONFIG[:Ok])
41
- @nope = Gdk::Pixbuf.new(file: CONFIG[:Nope])
42
- @ready = Gdk::Pixbuf.new(file: CONFIG[:Ready])
43
- @off = Gdk::Pixbuf.new(file: CONFIG[:Off])
56
+ @working = GdkPixbuf::Pixbuf.new(file: CONFIG[:Working])
57
+ @ok = GdkPixbuf::Pixbuf.new(file: CONFIG[:Ok])
58
+ @nope = GdkPixbuf::Pixbuf.new(file: CONFIG[:Nope])
59
+ @ready = GdkPixbuf::Pixbuf.new(file: CONFIG[:Ready])
60
+ @off = GdkPixbuf::Pixbuf.new(file: CONFIG[:Off])
44
61
 
45
62
  @is_pwd = Regexp.new(CONFIG[:IsPwd], Regexp::EXTENDED)
46
63
 
47
- window = program.window
48
- vbox = Such::Box.new window, :vbox!
49
-
64
+ vbox = Such::Box.new(stage, :vbox!)
50
65
  @running = Such::CheckButton.new(vbox, :running!, 'toggled'){toggled}
51
- @running.active = ::ClipboardManager.options[:running, true]
66
+ @running.active = true
52
67
 
53
68
  @ask = Such::CheckButton.new vbox, :ask!
54
- @ask.active = ::ClipboardManager.options[:ask, true]
69
+ @ask.active = true
55
70
 
56
71
  Such::Label.new vbox, :tasks!
57
72
 
58
73
  @checks = {}
59
- CONFIG[:tasks].keys.each do |key|
74
+ CONFIG[:Tasks!].keys.each do |key|
60
75
  @checks[key] = Such::CheckButton.new(vbox, [key.to_s.capitalize], {set_active: true})
61
76
  end
62
77
 
63
78
  Such::Button.new(vbox, :history_button!){do_history!}
64
- Such::Button.new(vbox, :qrcode_button!){do_qrcode!}
65
-
66
- mm = program.mini_menu
67
- mm.append_menu_item(:do_toggle!){do_toggle!}
68
- mm.append_menu_item(:do_history!){do_history!}
69
- mm.append_menu_item(:do_qrcode!){do_qrcode!}
79
+ Such::Button.new(vbox, :qrcode_button!){do_qrcode!} if ClipboardManager.do_qrcode
70
80
 
71
81
  @history, @previous = [], nil
72
- request_text do |text|
73
- if text
74
- add_history text
75
- @previous = text
76
- end
77
- GLib::Timeout.add(CONFIG[:Sleep]) do
78
- step if @running.active?
79
- true # repeat
80
- end
82
+ text = request_text
83
+ if text
84
+ add_history text
85
+ @previous = text
86
+ end
87
+ GLib::Timeout.add(CONFIG[:Sleep]) do
88
+ step if @running.active?
89
+ true # repeat
81
90
  end
82
91
 
92
+ Gtk3App.clipboard_manager_hook(self)
93
+
83
94
  status(@ready)
84
- window.show_all
85
95
  end
86
96
 
87
97
  # https://github.com/ruby-gnome2/ruby-gnome2/blob/master/gtk3/sample/misc/dialog.rb
88
98
  def do_history!
89
- dialog = Dialog.new :history_dialog!
90
- combo = Such::ComboBoxText.new dialog.child, :history_combo!
99
+ dialog = CancelOk.new(:history_dialog!)
100
+ Gtk3App.transient dialog
101
+ combo = dialog.combo :history_combo!
91
102
  @history.each do |str|
92
103
  if str.length > CONFIG[:MaxString]
93
104
  n = CONFIG[:MaxString]/2 - 1
@@ -95,8 +106,8 @@ class ClipboardManager
95
106
  end
96
107
  combo.append_text(str)
97
108
  end
98
- dialog.runs do |response|
99
- if response==Gtk::ResponseType::OK and combo.active_text
109
+ dialog.runs do
110
+ if combo.active_text
100
111
  @previous = nil
101
112
  CLIPBOARD.text = @history[combo.active]
102
113
  end
@@ -104,21 +115,21 @@ class ClipboardManager
104
115
  end
105
116
 
106
117
  def do_qrcode!
107
- qrcode = Helpema::ZBar.qrcode(CONFIG[:QrcTimeOut])
108
- if qrcode.nil?
109
- CLIPBOARD.clear
110
- status(@nope)
111
- else
112
- CLIPBOARD.text = qrcode
113
- status(@ok)
114
- end
118
+ qrcode = Timeout::timeout(CONFIG[:QrcTimeOut]){ Helpema::ZBar.cam() }
119
+ CLIPBOARD.text = qrcode
120
+ status(@ok)
121
+ rescue
122
+ $!.puts
123
+ CLIPBOARD.clear
124
+ status(@nope)
115
125
  end
116
126
 
117
127
  def question?(name)
118
128
  return true unless @ask.active?
119
- dialog = Dialog.new :question_dialog!
120
- Such::Label.new dialog.child, ["Run #{name}?"]
121
- dialog.runs{|response| (response==Gtk::ResponseType::OK)}
129
+ dialog = NoYes.new :question_dialog!
130
+ Gtk3App.transient dialog
131
+ dialog.label.text = "Run #{name}?"
132
+ dialog.ok?
122
133
  end
123
134
 
124
135
  def toggled
@@ -126,17 +137,17 @@ class ClipboardManager
126
137
  end
127
138
 
128
139
  def do_toggle!
129
- request_text do |text|
130
- @previous = text
131
- @running.active = !@running.active?
132
- end
140
+ text = request_text
141
+ @previous = text
142
+ @running.active = !@running.active?
133
143
  end
134
144
 
135
145
  def request_text
136
- CLIPBOARD.request_text do |_, text|
137
- # nil anything that looks like a pwd.
138
- (@is_pwd=~text)? yield(nil) : yield(text)
146
+ if text = CLIPBOARD.wait_for_text
147
+ text.strip!
148
+ return text unless text.empty? or @is_pwd.match?(text)
139
149
  end
150
+ nil
140
151
  end
141
152
 
142
153
  def status(type)
@@ -149,14 +160,13 @@ class ClipboardManager
149
160
  @timer = nil
150
161
  status @ready
151
162
  end
152
- request_text do |text|
153
- unless text.nil? or @previous == text
154
- @previous = text
155
- status @working
156
- GLib::Timeout.add(0) do
157
- manage(text)
158
- false # don't repeat
159
- end
163
+ text = request_text
164
+ unless text.nil? or @previous == text
165
+ @previous = text
166
+ status @working
167
+ GLib::Timeout.add(0) do
168
+ manage(text)
169
+ false # don't repeat
160
170
  end
161
171
  end
162
172
  end
@@ -169,18 +179,18 @@ class ClipboardManager
169
179
 
170
180
  def manage(text)
171
181
  add_history text
172
- CONFIG[:tasks].each do |name, _|
182
+ CONFIG[:Tasks!].each do |name, _|
173
183
  next unless @checks[name].active?
174
- rgx, mth, str = _
175
- rgx = Regexp.new(rgx, Regexp::EXTENDED)
184
+ rgx, mth, clr, str = _
185
+ rgx = Regexp.new(rgx, Regexp::EXTENDED | Regexp::MULTILINE)
176
186
  if md=rgx.match(text) and question?(name)
177
- CLIPBOARD.text=Rafini::Empty::STRING
187
+ CLIPBOARD.clear if clr
178
188
  begin
179
189
  case mth
180
190
  when :espeak
181
191
  espeak(text)
182
- when :firefox
183
- firefox(text)
192
+ when :open
193
+ open(text)
184
194
  when :bashit
185
195
  bashit(md, str)
186
196
  else
@@ -201,18 +211,15 @@ class ClipboardManager
201
211
  Rafini.thread_bang!{IO.popen(CONFIG[:Espeak], 'w'){|e|e.puts text.strip}}
202
212
  end
203
213
 
204
- def firefox(text)
205
- raise "quote not allowed in url" if text =~ /'/
206
- Process.detach spawn "#{CONFIG[:Firefox]} '#{text}'"
214
+ def open(text)
215
+ Process.detach spawn CONFIG[:Open], text
207
216
  end
208
217
 
209
218
  def bashit(md, str)
210
219
  (md.length-1).downto(0) do |i|
211
- str = str.gsub(/\$#{i}/, md[i])
220
+ str = str.gsub(/\$#{i}/, md[i] || '')
212
221
  end
213
222
  $stderr.puts str
214
223
  Process.detach spawn str
215
224
  end
216
-
217
- end
218
225
  end
@@ -1,133 +1,121 @@
1
- module ClipboardManager
2
-
3
- help = <<-HELP
4
- Usage: gtk3app clipboardmanager [options]
5
- Options:
6
- --ask Ask for confirmation.
7
- --running Start in active mode.
8
- Default for options is true,
9
- use no-ask and no-running for false.
10
- HELP
11
-
12
- APPDIR = File.dirname File.dirname __dir__
1
+ class ClipboardManager
2
+ using Rafini::String # String#semantic
3
+ extend Rafini::Empty # a0 and h0
13
4
 
14
5
  is_pwd =
15
6
  '\A
16
7
  (?!\w+:\/\/) # not like url
17
8
  (?!\/[a-z]+\/[a-z]) # not like linux path
18
9
  (?![a-z]+\/[a-z]+\/) # not like relative path
19
- (?=.*\d) # at least on diget
10
+ (?=.*\d) # at least one digit
20
11
  (?=.*[a-z]) # at least one lower case letter
21
12
  (?=.*[A-Z]) # at least one upper case letter
22
13
  (?=.*[^\w\s]) # at least one special character
23
- .{4,43}$ # 4 to 43 in length
14
+ \S*$ # no spaces
24
15
  \Z'
25
16
 
26
- a0 = Rafini::Empty::ARRAY
27
- h0 = Rafini::Empty::HASH
28
- s0 = Rafini::Empty::STRING
29
-
30
17
  CONFIG = {
31
- Help: help,
18
+ Tasks!: { # Note that Ruby's Hash preserves order, and order here is important.
19
+ calculator: [
20
+ '^([\d\.\+\-\*\/\%\(\) ]{3,80})$',
21
+ :bashit,
22
+ true, # clears clipboard
23
+ "gnome-calculator -e '$1'",
24
+ ],
25
+ dictionary: [
26
+ '^(\w+)$',
27
+ :bashit,
28
+ true, # clears clipboard
29
+ "xdg-open 'https://www.google.com/search?q=definition+of+$1'",
30
+ ],
31
+ url: ['^https?://\w[\-\+\.\w]*(\.\w+)(:\d+)?(/\S*)?$', :open, true],
32
+ espeak: ['.{80,}', :espeak, true],
33
+ },
32
34
 
33
35
  StatusTimeOut: 3,
34
36
  Sleep: 750,
35
37
  MaxHistory: 13,
36
38
  MaxString: 60,
37
39
 
38
- QrcTimeOut: 3,
40
+ QrcTimeOut: 12,
39
41
 
40
42
  IsPwd: is_pwd,
41
43
 
42
44
  Espeak: 'espeak --stdin',
43
- Firefox: 'firefox',
44
-
45
- Working: "#{XDG['DATA']}/gtk3app/clipboardmanager/working.png",
46
- Ok: "#{XDG['DATA']}/gtk3app/clipboardmanager/ok.png",
47
- Nope: "#{XDG['DATA']}/gtk3app/clipboardmanager/nope.png",
48
- Ready: "#{XDG['DATA']}/gtk3app/clipboardmanager/ready.png",
49
- Off: "#{XDG['DATA']}/gtk3app/clipboardmanager/off.png",
50
-
51
- thing: {
52
-
53
- HelpFile: "https://github.com/carlosjhr64/clipboard_manager",
54
- Logo: "#{XDG['DATA']}/gtk3app/clipboardmanager/logo.png",
55
-
56
- about_dialog: {
57
- set_program_name: 'Clipboard Manager',
58
- set_version: VERSION,
59
- set_copyright: '(c) 2014 CarlosJHR64',
60
- set_comments: 'A Ruby Gtk3App Clipboard Manager ',
61
- set_website: 'https://github.com/carlosjhr64/clipboard_manager',
62
- set_website_label: 'See it at GitHub!',
63
- },
64
-
65
- DO_TOGGLE: ['Toggle On/Off'],
66
- do_toggle!: [:DO_TOGGLE, 'activate'],
67
-
68
- DO_HISTORY: ['History'],
69
- do_history!: [:DO_HISTORY, 'activate'],
70
-
71
- DO_QRCODE: ['QR-Code'],
72
- do_qrcode!: [:DO_QRCODE, 'activate'],
73
-
74
- window: {
75
- set_title: "Clipboard Manager",
76
- set_window_position: :center,
77
- },
78
-
79
- VBOX: [:vertical],
80
- vbox: h0,
81
- vbox!: [:VBOX, :vbox],
82
-
83
- ASK: ['Ask For Confirmation'],
84
- ask: h0,
85
- ask!: [:ASK, :ask],
86
-
87
- RUNNING: ['On/Off'],
88
- running: h0,
89
- running!: [:RUNNING, :running],
90
-
91
- TASKS: ['Tasks:'],
92
- tasks: h0,
93
- tasks!: [:TASKS, :tasks],
94
-
95
- HISTORY_BUTTON: [label: 'History'],
96
- history_button: h0,
97
- history_button!: [:HISTORY_BUTTON, :history_button],
98
-
99
- HISTORY_DIALOG: a0,
100
- history_dialog: {
101
- set_window_position: :center,
102
- },
103
- history_dialog!: [:HISTORY_DIALOG, :history_dialog],
104
-
105
- HISTORY_COMBO: a0,
106
- history_combo: h0,
107
- history_combo!: [:HISTORY_COMBO, :history_combo],
108
-
109
- QRCODE_BUTTON: [label: 'QR-Code'],
110
- qrcode_button: h0,
111
- qrcode_button!: [:QRCODE_BUTTON, :qrcode_button],
112
-
113
- QUESTION_DIALOG: a0,
114
- question_dialog: {
115
- set_window_position: :center,
116
- set_keep_above: true,
117
- },
118
- question_dialog!: [:question_dialog, :QUESTION_DIALOG],
45
+
46
+ Working: "#{UserSpace::XDG['data']}/gtk3app/clipboardmanager/working.png",
47
+ Ok: "#{UserSpace::XDG['data']}/gtk3app/clipboardmanager/ok.png",
48
+ Nope: "#{UserSpace::XDG['data']}/gtk3app/clipboardmanager/nope.png",
49
+ Ready: "#{UserSpace::XDG['data']}/gtk3app/clipboardmanager/ready.png",
50
+ Off: "#{UserSpace::XDG['data']}/gtk3app/clipboardmanager/off.png",
51
+
52
+ HelpFile: "https://github.com/carlosjhr64/clipboard_manager",
53
+ Logo: "#{UserSpace::XDG['data']}/gtk3app/clipboardmanager/logo.png",
54
+
55
+ ### Gui Things ###
56
+
57
+ about_dialog: {
58
+ set_program_name: 'Clipboard Manager',
59
+ set_version: VERSION.semantic(0..1),
60
+ set_copyright: '(c) 2018 CarlosJHR64',
61
+ set_comments: 'A Ruby Gtk3App Clipboard Manager ',
62
+ set_website: 'https://github.com/carlosjhr64/clipboard_manager',
63
+ set_website_label: 'See it at GitHub!',
119
64
  },
120
65
 
121
- # Note that Ruby 2 hashes preserves order, and order here is important.
122
- tasks: {
123
- mplayer: [
124
- '(https?://www\.youtube\.com/watch\?v=[\w\-]+)',
125
- :bashit,
126
- "wget --quiet -O - $(youtube-dl -f 5/36/17/18 -g '$1') | mplayer -really-quiet -cache 8192 -cache-min 1 -",
127
- ],
128
- firefox: ['^https?://www.amazon.com/', :firefox],
129
- espeak: ['.{80,}', :espeak],
130
- }
131
- }
66
+ window: {
67
+ set_title: "Clipboard Manager",
68
+ set_window_position: :center,
69
+ },
70
+
71
+ VBOX: [:vertical],
72
+ vbox: h0,
73
+ vbox!: [:VBOX, :vbox],
74
+
75
+ ASK: ['Ask For Confirmation'],
76
+ ask: h0,
77
+ ask!: [:ASK, :ask],
78
+
79
+ RUNNING: ['On/Off'],
80
+ running: h0,
81
+ running!: [:RUNNING, :running],
82
+
83
+ TASKS: ['Tasks:'],
84
+ tasks: h0,
85
+ tasks!: [:TASKS, :tasks],
86
+
87
+ HISTORY_BUTTON: [label: 'History'],
88
+ history_button: h0,
89
+ history_button!: [:HISTORY_BUTTON, :history_button],
132
90
 
91
+ HISTORY_DIALOG: a0,
92
+ history_dialog: {
93
+ set_window_position: :center,
94
+ },
95
+ history_dialog!: [:HISTORY_DIALOG, :history_dialog],
96
+
97
+ HISTORY_COMBO: a0,
98
+ history_combo: h0,
99
+ history_combo!: [:HISTORY_COMBO, :history_combo],
100
+
101
+ QRCODE_BUTTON: [label: 'QR-Code'],
102
+ qrcode_button: h0,
103
+ qrcode_button!: [:QRCODE_BUTTON, :qrcode_button],
104
+
105
+ QUESTION_DIALOG: a0,
106
+ question_dialog: {
107
+ set_window_position: :center,
108
+ set_keep_above: true,
109
+ },
110
+ question_dialog!: [:question_dialog, :QUESTION_DIALOG],
111
+
112
+ # Toggle's app-menu item.
113
+ # Application MAY modify :TOGGLE for language.
114
+ TOGGLE: [label: 'Toggle'],
115
+ toggle: h0,
116
+ toggle!: [:TOGGLE, :toggle, 'activate'],
117
+ app_menu: {
118
+ add_menu_item: [ :toggle!, :minime!, :help!, :about!, :quit! ],
119
+ },
120
+ }
133
121
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clipboard_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 4.0.210706
5
5
  platform: ruby
6
6
  authors:
7
7
  - carlosjhr64
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-29 00:00:00.000000000 Z
11
+ date: 2021-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gtk3app
@@ -16,50 +16,52 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.3'
19
+ version: '5.1'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 1.3.0
22
+ version: 5.1.210203
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '1.3'
29
+ version: '5.1'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 1.3.0
32
+ version: 5.1.210203
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: helpema
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '0.1'
39
+ version: '3.0'
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: 0.1.0
42
+ version: 3.0.210706
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: '0.1'
49
+ version: '3.0'
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
- version: 0.1.0
53
- description: |
54
- Ruby Gtk3App Clipboard Manager.
52
+ version: 3.0.210706
53
+ description: 'Ruby Gtk3App Clipboard Manager.
54
+
55
+ '
55
56
  email: carlosjhr64@gmail.com
56
- executables: []
57
+ executables:
58
+ - clipboard_manager
57
59
  extensions: []
58
- extra_rdoc_files:
59
- - README.rdoc
60
+ extra_rdoc_files: []
60
61
  files:
61
- - README.rdoc
62
- - data/VERSION
62
+ - LICENSE
63
+ - README.md
64
+ - bin/clipboard_manager
63
65
  - data/logo.png
64
66
  - data/nope.png
65
67
  - data/off.png
@@ -69,15 +71,12 @@ files:
69
71
  - lib/clipboard_manager.rb
70
72
  - lib/clipboard_manager/clipboard_manager.rb
71
73
  - lib/clipboard_manager/config.rb
72
- - lib/clipboard_manager/version.rb
73
74
  homepage: https://github.com/carlosjhr64/clipboard_manager
74
75
  licenses:
75
76
  - MIT
76
77
  metadata: {}
77
- post_install_message:
78
- rdoc_options:
79
- - "--main"
80
- - README.rdoc
78
+ post_install_message:
79
+ rdoc_options: []
81
80
  require_paths:
82
81
  - lib
83
82
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -91,17 +90,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
90
  - !ruby/object:Gem::Version
92
91
  version: '0'
93
92
  requirements:
94
- - 'ruby: ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-linux]'
95
- - 'zbarcam: 0.10'
96
- - 'firefox: Mozilla Firefox 34.0'
97
- - 'espeak: eSpeak text-to-speech: 1.47.11 03.May.13 Data at: /usr/share/espeak-data'
98
- - 'wget: GNU Wget 1.16.1 built on linux-gnu.'
99
- - 'youtube-dl: 2014.12.17.2'
93
+ - 'gnome-calculator: 40.1'
94
+ - 'espeak: eSpeak NG text-to-speech: 1.50 Data at: /usr/share/espeak-ng-data'
100
95
  - 'system: linux/bash'
101
- rubyforge_project:
102
- rubygems_version: 2.4.1
103
- signing_key:
96
+ - 'ruby: ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [x86_64-linux]'
97
+ - 'xdg-open: xdg-open 1.1.3+'
98
+ - 'zbarcam: 0.23'
99
+ rubygems_version: 3.2.15
100
+ signing_key:
104
101
  specification_version: 4
105
102
  summary: Ruby Gtk3App Clipboard Manager.
106
103
  test_files: []
107
- has_rdoc:
data/README.rdoc DELETED
@@ -1,95 +0,0 @@
1
- = clipboard_manager
2
-
3
- {<img src="https://badge.fury.io/rb/clipboard_manager.svg" alt="Gem Version" />}[http://badge.fury.io/rb/clipboard_manager]
4
-
5
- == DESCRIPTION:
6
-
7
- Ruby Gtk3App Clipboard Manager.
8
-
9
- == SYNOPSIS:
10
-
11
- gtk3app clipboard_manager [options]
12
-
13
- == FEATURES
14
-
15
- * history
16
- * wget youtube-dl mplayer command to play youtube video
17
- * firefox opens amazon webpage
18
- * espeak
19
- * zbarcam qrcode
20
-
21
- == INSTALL:
22
-
23
- $ sudo gem install clipboard_manager
24
-
25
- == CONFIGURATION:
26
-
27
- After an initial run, your user configuration will found in:
28
-
29
- ~/.config/gtk3app/clipboardmanager/config.yml
30
-
31
- Towards the bottom of the file you will find the available tasks:
32
-
33
- :tasks:
34
- :mplayer:
35
- - "(https?://www\\.youtube\\.com/watch\\?v=[\\w\\-]+)"
36
- - :bashit
37
- - wget --quiet -O - $(youtube-dl -f 5/36/17/18 -g '$1') | mplayer -really-quiet
38
- -cache 8192 -cache-min 1 -
39
- :firefox:
40
- - "^https?://www.amazon.com/"
41
- - :firefox
42
- :espeak:
43
- - ".{80,}"
44
- - :espeak
45
-
46
-
47
- It is by this configuration that one can modify and add tasks.
48
-
49
- The _mplayer_ task will run when the clipboard text matches a youtube link.
50
- It will run the given system command "wget.. youtube_dl... '$0' | mplayer ...",
51
- where $1 will be replaced by the match.
52
-
53
- The _firefox_ task will run when the clipboard text matches an amazon link.
54
- It will open the link with firefox.
55
-
56
- The _espeak_ task will run when the clipboard text is at least 80 characters long.
57
- It will have espeak read the text.
58
-
59
- Currently, clipboard_manager has three tasks methods: bashit, firefox, and espeak.
60
-
61
- For firefox and espeak, the pattern is used to recognize the text.
62
- The whole copied text is used to pass on to firefox as a url, or espeak as text to be read.
63
-
64
- bashit is more complicated.
65
- It requires a command string which it will substitute $0, $1, $2... with match data.
66
- It then passes the string to system.
67
-
68
- See clipboard_manager/clipboard_manager.rb[https://github.com/carlosjhr64/clipboard_manager/blob/master/lib/clipboard_manager/clipboard_manager.rb]
69
- for details.
70
- Specifically, methods #espeak, #firefox, and #bashit, which are called from #manage.
71
-
72
- == LICENSE:
73
-
74
- (The MIT License)
75
-
76
- Copyright (c) 2014 carlosjhr64
77
-
78
- Permission is hereby granted, free of charge, to any person obtaining
79
- a copy of this software and associated documentation files (the
80
- 'Software'), to deal in the Software without restriction, including
81
- without limitation the rights to use, copy, modify, merge, publish,
82
- distribute, sublicense, and/or sell copies of the Software, and to
83
- permit persons to whom the Software is furnished to do so, subject to
84
- the following conditions:
85
-
86
- The above copyright notice and this permission notice shall be
87
- included in all copies or substantial portions of the Software.
88
-
89
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
90
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
91
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
92
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
93
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
94
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
95
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/data/VERSION DELETED
@@ -1 +0,0 @@
1
- 1.0.4
@@ -1,3 +0,0 @@
1
- module ClipboardManager
2
- VERSION = '1.0.4'
3
- end