clipboard_manager 3.0.0 → 4.1.230115

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: b3482809f7953076b0f8c8ce62c6ba14b010b886405b1dc048fb570037510eaf
4
- data.tar.gz: ebb4dac2ba0f2aad8efa86b1eea59bc13034af259c8311ea22d6d15863942e69
3
+ metadata.gz: 8b96ba3d75015dd40d59ea3efa098d6d090b81e458ed5d0a57dfbdbba3727632
4
+ data.tar.gz: 35ea53a9adc2ae3909576bfc2a205a830f9d75ecebf41a7f4462fc30eb99d52a
5
5
  SHA512:
6
- metadata.gz: 73fffaa22f58886ab4f6b80185d14884a1094dbe5c3d359ac9014de19fbd0341fad55a7663144341ce6397eef636ae1d9c886dc476971bb68dd3c35f4e992248
7
- data.tar.gz: 2e36667fadd205feecaa9a3714e24c154b385dc0329dda455870e7ac21d0bff6f364179fb5f5f289148f0275f5bad098c64c491df4711d48c792b97f32ece47a
6
+ metadata.gz: '0481924b166c53ba75bf99aac65d8a071ee4da07fd66d14a56c63fe77fd6777644b0118c5831f7c6d9adff0630b7166effee906fb4ee1df3f5e046d1ddb071df'
7
+ data.tar.gz: e93addef2f37e550069e10899bc08208c85faf769217f927006c6f343cc286b17170eb5a4e61ee0319050f4851d3fc3c70d4b52c634872be9120620ceb7ccefc
data/README.md CHANGED
@@ -1,81 +1,123 @@
1
- # clipboard_manager
1
+ # ClipboardManager
2
+
3
+ * [VERSION 4.1.230115](https://github.com/carlosjhr64/clipboard_manager/releases)
4
+ * [github](https://github.com/carlosjhr64/clipboard_manager)
5
+ * [rubygems](https://rubygems.org/gems/clipboard_manager)
2
6
 
3
7
  ## DESCRIPTION:
4
8
 
5
9
  Ruby Gtk3App Clipboard Manager.
6
10
 
11
+ ## SCREENSHOT:
12
+
13
+ ![screenshot](img/screenshot.png)
14
+
7
15
  ## FEATURES
8
16
 
9
- * history
10
- * wget youtube-dl mplayer command to play youtube video
11
- * firefox opens url
17
+ * eval-calculator
18
+ * Wiktionary
19
+ * xdg-open url
12
20
  * espeak
13
- * zbarcam qrcode
14
-
15
- ## INSTALL:
16
21
 
17
- Note that you'll need gtk3app:
22
+ Also:
18
23
 
19
- $ sudo gem install gtk3app
20
- $ sudo gem install clipboard_manager
24
+ * History
25
+ * QR-Code copy to clipboard
21
26
 
27
+ ## INSTALL:
28
+ ```shell
29
+ $ gem install clipboard_manager
30
+ ```
22
31
  ## CONFIGURATION:
23
32
 
24
33
  After an initial run, your user configuration will found in:
25
34
 
26
- ~/.config/gtk3app/clipboardmanager/config-?.?.yml
27
-
28
- Towards the bottom of the file you will find the available tasks:
29
-
30
- :tasks:
31
- :mplayer:
32
- - "(https?://www\\.youtube\\.com/watch\\?v=[\\w\\-]+)"
33
- - :bashit
34
- - true
35
- - wget --quiet -O - $(youtube-dl -f 5/36/17/18 -g '$1') | mplayer -really-quiet
36
- -cache 8192 -cache-min 1 -
37
- :firefox:
38
- - "^https?://"
39
- - :firefox
40
- - true
41
- :espeak:
42
- - ".{80,}"
43
- - :espeak
44
- - true
45
-
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
+ :reply,
44
+ true
45
+ ],
46
+ dictionary: [
47
+ "^(\\w+)$",
48
+ :bashit,
49
+ true,
50
+ "xdg-open 'https://en.wiktionary.org/wiki/$1'"
51
+ ],
52
+ url: [
53
+ "^https?://\\w[\\-\\+\\.\\w]*(\\.\\w+)(:\\d+)?(/\\S*)?$",
54
+ :open,
55
+ true
56
+ ],
57
+ espeak: [
58
+ ".{80,}",
59
+ :espeak,
60
+ true
61
+ ]
62
+ },
63
+ # ...
64
+ }
65
+ ```
46
66
  It is by this configuration that one can modify and add tasks.
67
+ Note that this is an [RBON](https://rubygems.org/gems/rbon) file.
68
+ ClipboardManager has four tasks methods:
69
+
70
+ * `:bashit` will take a command to be run by the system.
71
+ * `:open` will `xdg-open` the clip.
72
+ * `:espeak` will `espeak` the clip.
73
+ * `:reply` will `eval` the clip and display a message with the result.
74
+
47
75
  With the boolean `true` value the clipboard will clear on the matched task.
48
76
  If you don't want the clipboard cleared on a matched task,
49
77
  set the boolean value to `false`.
50
78
 
51
- The _mplayer_ task will run when the clipboard text matches a youtube link.
52
- It will run the given system command `wget.. youtube_dl... '$1' | mplayer ...`,
53
- where $1 will be replaced by the captured 1 match.
79
+ Note that `:bashit` requires a extra command string which
80
+ it will substitute $0, $1, $2... with match data.
81
+ It then passes the string to system.
54
82
 
55
- The _firefox_ task will run when the clipboard text matches a http address.
56
- It will open the address with firefox.
83
+ The `:caculator` task will run when the clip looks like a bunch of number being operated.
57
84
 
58
- The _espeak_ task will run when the clipboard text is at least 80 characters long.
85
+ The `:espeak` task will run when the clip is at least 80 characters long.
59
86
  It will have espeak read the text.
60
87
 
61
- Currently, clipboard_manager has three tasks methods: bashit, firefox, and espeak.
62
-
63
- For firefox and espeak, the pattern is used to recognize the text.
64
- The whole copied text is used to pass on to firefox as a url, or espeak as text to be read.
65
-
66
- bashit is more complicated.
67
- It requires a command string which it will substitute $0, $1, $2... with match data.
68
- It then passes the string to system.
69
-
70
- See [clipboard_manager/clipboard_manager.rb](https://github.com/carlosjhr64/clipboard_manager/blob/master/lib/clipboard_manager/clipboard_manager.rb)
71
- for details.
72
- Specifically, methods #espeak, #firefox, and #bashit, which are called from #manage.
73
-
74
88
  ## HELP:
75
-
76
- Usage:
77
- clipboard_manager [:options+]
78
- Options:
79
- -h --help
80
- -v --version
81
-
89
+ ```console
90
+ $ clipboard_manager --help
91
+ Usage:
92
+ clipboard_manager [:options+]
93
+ Options:
94
+ -h --help
95
+ -v --version
96
+ --minime Real minime
97
+ --notoggle Minime wont toggle decorated and keep above
98
+ --notdecorated Dont decorate window
99
+ ```
100
+ ## LICENSE:
101
+
102
+ (The MIT License)
103
+
104
+ Copyright (c) 2023 CarlosJHR64
105
+
106
+ Permission is hereby granted, free of charge, to any person obtaining
107
+ a copy of this software and associated documentation files (the
108
+ 'Software'), to deal in the Software without restriction, including
109
+ without limitation the rights to use, copy, modify, merge, publish,
110
+ distribute, sublicense, and/or sell copies of the Software, and to
111
+ permit persons to whom the Software is furnished to do so, subject to
112
+ the following conditions:
113
+
114
+ The above copyright notice and this permission notice shall be
115
+ included in all copies or substantial portions of the Software.
116
+
117
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
118
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
119
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
120
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
121
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
122
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
123
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,14 +1,17 @@
1
1
  #!/usr/bin/env ruby
2
- require 'help_parser'
3
2
  require 'clipboard_manager'
4
3
 
5
- OPTIONS = HelpParser[ClipboardManager::VERSION, <<HELP]
6
- Usage:
7
- clipboard_manager [:options+]
8
- Options:
9
- -h --help
10
- -v --version
11
- HELP
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
12
16
 
13
- ClipboardManager.requires
14
- Gtk3App.main ClipboardManager
17
+ exit
@@ -1,53 +1,73 @@
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
- def self.run(program)
5
- ClipboardManager.new(program)
6
- end
12
+ class NoYes < Such::Dialog
13
+ def initialize(key)
14
+ super
15
+ add_button '_No', Gtk::ResponseType::CANCEL
16
+ add_button '_Yes', Gtk::ResponseType::OK
17
+ end
7
18
 
8
- class NoYes < Such::Dialog
9
- def initialize(*par)
10
- super
11
- add_button '_No', Gtk::ResponseType::CANCEL
12
- add_button '_Yes', Gtk::ResponseType::OK
13
- end
19
+ def label(key)
20
+ Such::Label.new child, key
21
+ end
14
22
 
15
- def label(*par)
16
- Such::Label.new child, *par
23
+ def ok?
24
+ show_all
25
+ response = run
26
+ destroy
27
+ response == Gtk::ResponseType::OK
28
+ end
17
29
  end
18
30
 
19
- def ok?
20
- show_all
21
- response = run
22
- destroy
23
- response == Gtk::ResponseType::OK
24
- end
25
- end
31
+ class CancelOk < Such::Dialog
32
+ def initialize(key)
33
+ super
34
+ add_button(Gtk::Stock::CANCEL, Gtk::ResponseType::CANCEL)
35
+ add_button(Gtk::Stock::OK, Gtk::ResponseType::OK)
36
+ end
26
37
 
27
- class CancelOk < Such::Dialog
28
- def initialize(*par)
29
- super
30
- add_button(Gtk::Stock::CANCEL, Gtk::ResponseType::CANCEL)
31
- add_button(Gtk::Stock::OK, Gtk::ResponseType::OK)
32
- end
38
+ def combo(key)
39
+ Such::ComboBoxText.new child, key
40
+ end
33
41
 
34
- def combo(*par)
35
- Such::ComboBoxText.new child, *par
42
+ def runs
43
+ show_all
44
+ response = run
45
+ yield if response == Gtk::ResponseType::OK
46
+ destroy
47
+ end
36
48
  end
37
49
 
38
- def runs
39
- show_all
40
- response = run
41
- yield if response == Gtk::ResponseType::OK
42
- destroy
50
+ class Message < Such::Dialog
51
+ def initialize(key)
52
+ super
53
+ add_button '_OK', Gtk::ResponseType::OK
54
+ end
55
+
56
+ def label(key)
57
+ Such::Label.new child, key
58
+ end
59
+
60
+ def runs
61
+ show_all
62
+ response = run
63
+ destroy
64
+ end
43
65
  end
44
- end
45
66
 
46
- class ClipboardManager
47
67
  CLIPBOARD = Gtk::Clipboard.get(Gdk::Selection::CLIPBOARD)
48
68
 
49
- def initialize(program)
50
- @image = program.mini.children.first
69
+ def initialize(stage, toolbar, options)
70
+ @image = toolbar.parent.children[0].child # Expander:hbox:EventImage:Image
51
71
  @timer = nil
52
72
 
53
73
  @working = GdkPixbuf::Pixbuf.new(file: CONFIG[:Working])
@@ -58,9 +78,7 @@ class ClipboardManager
58
78
 
59
79
  @is_pwd = Regexp.new(CONFIG[:IsPwd], Regexp::EXTENDED)
60
80
 
61
- @window = program.window
62
- vbox = Such::Box.new @window, :vbox!
63
-
81
+ vbox = Such::Box.new(stage, :vbox!)
64
82
  @running = Such::CheckButton.new(vbox, :running!, 'toggled'){toggled}
65
83
  @running.active = true
66
84
 
@@ -70,19 +88,12 @@ class ClipboardManager
70
88
  Such::Label.new vbox, :tasks!
71
89
 
72
90
  @checks = {}
73
- CONFIG[:tasks].keys.each do |key|
91
+ CONFIG[:Tasks!].keys.each do |key|
74
92
  @checks[key] = Such::CheckButton.new(vbox, [key.to_s.capitalize], {set_active: true})
75
93
  end
76
94
 
77
95
  Such::Button.new(vbox, :history_button!){do_history!}
78
- Such::Button.new(vbox, :qrcode_button!){do_qrcode!}
79
-
80
- program.app_menu.each{|_|_.destroy if _.key==:fs!}
81
-
82
- mm = program.mini_menu
83
- mm.add_menu_item(:do_toggle!){do_toggle!}
84
- mm.add_menu_item(:do_history!){do_history!}
85
- mm.add_menu_item(:do_qrcode!){do_qrcode!}
96
+ Such::Button.new(vbox, :qrcode_button!){do_qrcode!} if ClipboardManager.do_qrcode
86
97
 
87
98
  @history, @previous = [], nil
88
99
  text = request_text
@@ -95,14 +106,15 @@ class ClipboardManager
95
106
  true # repeat
96
107
  end
97
108
 
109
+ Gtk3App.clipboard_manager_hook(self)
110
+
98
111
  status(@ready)
99
- @window.show_all
100
112
  end
101
113
 
102
114
  # https://github.com/ruby-gnome2/ruby-gnome2/blob/master/gtk3/sample/misc/dialog.rb
103
115
  def do_history!
104
116
  dialog = CancelOk.new(:history_dialog!)
105
- dialog.transient_for = @window
117
+ Gtk3App.transient dialog
106
118
  combo = dialog.combo :history_combo!
107
119
  @history.each do |str|
108
120
  if str.length > CONFIG[:MaxString]
@@ -120,21 +132,20 @@ class ClipboardManager
120
132
  end
121
133
 
122
134
  def do_qrcode!
123
- qrcode = Helpema::ZBar.cam(CONFIG[:QrcTimeOut])
124
- if qrcode.nil?
125
- CLIPBOARD.clear
126
- status(@nope)
127
- else
128
- CLIPBOARD.text = qrcode
129
- status(@ok)
130
- end
135
+ qrcode = Timeout::timeout(CONFIG[:QrcTimeOut]){ Helpema::ZBar.cam() }
136
+ CLIPBOARD.text = qrcode
137
+ status(@ok)
138
+ rescue
139
+ $!.puts
140
+ CLIPBOARD.clear
141
+ status(@nope)
131
142
  end
132
143
 
133
144
  def question?(name)
134
145
  return true unless @ask.active?
135
146
  dialog = NoYes.new :question_dialog!
136
- dialog.transient_for = @window
137
- dialog.label.text = "Run #{name}?"
147
+ Gtk3App.transient dialog
148
+ dialog.label(:question_label!).text = "Run #{name}?"
138
149
  dialog.ok?
139
150
  end
140
151
 
@@ -185,7 +196,7 @@ class ClipboardManager
185
196
 
186
197
  def manage(text)
187
198
  add_history text
188
- CONFIG[:tasks].each do |name, _|
199
+ CONFIG[:Tasks!].each do |name, _|
189
200
  next unless @checks[name].active?
190
201
  rgx, mth, clr, str = _
191
202
  rgx = Regexp.new(rgx, Regexp::EXTENDED | Regexp::MULTILINE)
@@ -195,10 +206,12 @@ class ClipboardManager
195
206
  case mth
196
207
  when :espeak
197
208
  espeak(text)
198
- when :firefox
199
- firefox(text)
209
+ when :open
210
+ open(text)
200
211
  when :bashit
201
212
  bashit(md, str)
213
+ when :reply
214
+ reply(text)
202
215
  else
203
216
  raise "Method #{mth} not implemented."
204
217
  end
@@ -213,13 +226,15 @@ class ClipboardManager
213
226
  status(@nope)
214
227
  end
215
228
 
229
+ ESPEAK = IO.popen(CONFIG[:Espeak], 'w')
230
+ ESPEAK.puts # b/c :-???
231
+ Gtk3App.finalize{ESPEAK.close}
216
232
  def espeak(text)
217
- Rafini.thread_bang!{IO.popen(CONFIG[:Espeak], 'w'){|e|e.puts text.strip}}
233
+ Rafini.thread_bang!{ESPEAK.puts text.strip}
218
234
  end
219
235
 
220
- def firefox(text)
221
- raise "quote not allowed in url" if text =~ /'/
222
- Process.detach spawn "#{CONFIG[:Firefox]} '#{text}'"
236
+ def open(text)
237
+ Process.detach spawn CONFIG[:Open], text
223
238
  end
224
239
 
225
240
  def bashit(md, str)
@@ -230,5 +245,15 @@ class ClipboardManager
230
245
  Process.detach spawn str
231
246
  end
232
247
 
233
- end
248
+ def reply(text)
249
+ dialog = Message.new(:reply_dialog!)
250
+ Gtk3App.transient dialog
251
+ begin
252
+ dialog.label(:reply_label!).text = text
253
+ dialog.label(:reply_label!).text = "#{eval text}"
254
+ rescue
255
+ dialog.label(:reply_label!).text = $!.message
256
+ end
257
+ dialog.runs
258
+ end
234
259
  end
@@ -1,25 +1,36 @@
1
- module ClipboardManager
2
- using Rafini::String
3
-
4
- APPDIR = File.dirname File.dirname __dir__
1
+ class ClipboardManager
2
+ using Rafini::String # String#semantic
3
+ extend Rafini::Empty # a0 and h0
5
4
 
6
5
  is_pwd =
7
6
  '\A
8
7
  (?!\w+:\/\/) # not like url
9
8
  (?!\/[a-z]+\/[a-z]) # not like linux path
10
9
  (?![a-z]+\/[a-z]+\/) # not like relative path
11
- (?=.*\d) # at least one diget
10
+ (?=.*\d) # at least one digit
12
11
  (?=.*[a-z]) # at least one lower case letter
13
12
  (?=.*[A-Z]) # at least one upper case letter
14
13
  (?=.*[^\w\s]) # at least one special character
15
14
  \S*$ # no spaces
16
15
  \Z'
17
16
 
18
- a0 = Rafini::Empty::ARRAY
19
- h0 = Rafini::Empty::HASH
20
- #s0 = Rafini::Empty::STRING
21
-
22
17
  CONFIG = {
18
+ Tasks!: { # Note that Ruby's Hash preserves order, and order here is important.
19
+ calculator: [
20
+ '^([\d\.\+\-\*\/\%\(\) ]{3,80})$',
21
+ :reply,
22
+ true, # clears clipboard
23
+ ],
24
+ dictionary: [
25
+ '^(\w+)$',
26
+ :bashit,
27
+ true, # clears clipboard
28
+ "xdg-open 'https://en.wiktionary.org/wiki/$1'",
29
+ ],
30
+ url: ['^https?://\w[\-\+\.\w]*(\.\w+)(:\d+)?(/\S*)?$', :open, true],
31
+ espeak: ['.{80,}', :espeak, true],
32
+ },
33
+
23
34
  StatusTimeOut: 3,
24
35
  Sleep: 750,
25
36
  MaxHistory: 13,
@@ -29,96 +40,91 @@ module ClipboardManager
29
40
 
30
41
  IsPwd: is_pwd,
31
42
 
32
- Espeak: 'espeak --stdin',
33
- Firefox: 'firefox',
34
-
35
- Working: "#{XDG['DATA']}/gtk3app/clipboardmanager/working.png",
36
- Ok: "#{XDG['DATA']}/gtk3app/clipboardmanager/ok.png",
37
- Nope: "#{XDG['DATA']}/gtk3app/clipboardmanager/nope.png",
38
- Ready: "#{XDG['DATA']}/gtk3app/clipboardmanager/ready.png",
39
- Off: "#{XDG['DATA']}/gtk3app/clipboardmanager/off.png",
40
-
41
- thing: {
42
-
43
- HelpFile: "https://github.com/carlosjhr64/clipboard_manager",
44
- Logo: "#{XDG['DATA']}/gtk3app/clipboardmanager/logo.png",
45
-
46
- about_dialog: {
47
- set_program_name: 'Clipboard Manager',
48
- set_version: VERSION.semantic(0..1),
49
- set_copyright: '(c) 2018 CarlosJHR64',
50
- set_comments: 'A Ruby Gtk3App Clipboard Manager ',
51
- set_website: 'https://github.com/carlosjhr64/clipboard_manager',
52
- set_website_label: 'See it at GitHub!',
53
- },
54
-
55
- DO_TOGGLE: [label:'Toggle On/Off'],
56
- do_toggle!: [:DO_TOGGLE, 'activate'],
57
-
58
- DO_HISTORY: [label:'History'],
59
- do_history!: [:DO_HISTORY, 'activate'],
60
-
61
- DO_QRCODE: [label:'QR-Code'],
62
- do_qrcode!: [:DO_QRCODE, 'activate'],
63
-
64
- window: {
65
- set_title: "Clipboard Manager",
66
- set_window_position: :center,
67
- },
68
-
69
- VBOX: [:vertical],
70
- vbox: h0,
71
- vbox!: [:VBOX, :vbox],
72
-
73
- ASK: ['Ask For Confirmation'],
74
- ask: h0,
75
- ask!: [:ASK, :ask],
76
-
77
- RUNNING: ['On/Off'],
78
- running: h0,
79
- running!: [:RUNNING, :running],
80
-
81
- TASKS: ['Tasks:'],
82
- tasks: h0,
83
- tasks!: [:TASKS, :tasks],
84
-
85
- HISTORY_BUTTON: [label: 'History'],
86
- history_button: h0,
87
- history_button!: [:HISTORY_BUTTON, :history_button],
88
-
89
- HISTORY_DIALOG: a0,
90
- history_dialog: {
91
- set_window_position: :center,
92
- },
93
- history_dialog!: [:HISTORY_DIALOG, :history_dialog],
94
-
95
- HISTORY_COMBO: a0,
96
- history_combo: h0,
97
- history_combo!: [:HISTORY_COMBO, :history_combo],
98
-
99
- QRCODE_BUTTON: [label: 'QR-Code'],
100
- qrcode_button: h0,
101
- qrcode_button!: [:QRCODE_BUTTON, :qrcode_button],
102
-
103
- QUESTION_DIALOG: a0,
104
- question_dialog: {
105
- set_window_position: :center,
106
- set_keep_above: true,
107
- },
108
- question_dialog!: [:question_dialog, :QUESTION_DIALOG],
43
+ # The text-to-speech needs to be able to receive text from stdin
44
+ Espeak: 'espeak',
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) 2023 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!',
109
64
  },
110
65
 
111
- # Note that Ruby 2 hashes preserves order, and order here is important.
112
- tasks: {
113
- mplayer: [
114
- '(https?://www\.youtube\.com/watch\?v=[\w\-]+)',
115
- :bashit,
116
- true, # clears clipboard
117
- "wget --quiet -O - $(youtube-dl -f 5/36/17/18 -g '$1') | mplayer -really-quiet -cache 8192 -cache-min 1 -",
118
- ],
119
- firefox: ['^https?://', :firefox, true],
120
- espeak: ['.{80,}', :espeak, true],
121
- }
122
- }
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],
123
86
 
87
+ HISTORY_BUTTON: [label: 'History'],
88
+ history_button: h0,
89
+ history_button!: [:HISTORY_BUTTON, :history_button],
90
+
91
+ HISTORY_DIALOG: a0,
92
+ history_dialog: h0,
93
+ history_dialog!: [:HISTORY_DIALOG, :history_dialog],
94
+
95
+ HISTORY_COMBO: a0,
96
+ history_combo: h0,
97
+ history_combo!: [:HISTORY_COMBO, :history_combo],
98
+
99
+ QRCODE_BUTTON: [label: 'QR-Code'],
100
+ qrcode_button: h0,
101
+ qrcode_button!: [:QRCODE_BUTTON, :qrcode_button],
102
+
103
+ QUESTION_DIALOG: a0,
104
+ question_dialog: {
105
+ set_keep_above: true,
106
+ },
107
+ question_dialog!: [:question_dialog, :QUESTION_DIALOG],
108
+
109
+ QUESTION_LABEL: a0,
110
+ question_label: h0,
111
+ question_label!: [:question_label, :QUESTION_LABEL],
112
+
113
+ REPLY_LABEL: a0,
114
+ reply_label: h0,
115
+ reply_label!: [:reply_label, :REPLY_LABEL],
116
+
117
+ REPLY_DIALOG: a0,
118
+ reply_dialog: h0,
119
+ reply_dialog!: [:reply_dialog, :REPLY_DIALOG],
120
+
121
+ # Toggle's app-menu item.
122
+ # Application MAY modify :TOGGLE for language.
123
+ TOGGLE: [label: 'Toggle'],
124
+ toggle: h0,
125
+ toggle!: [:TOGGLE, :toggle, 'activate'],
126
+ app_menu: {
127
+ add_menu_item: [ :toggle!, :minime!, :help!, :about!, :quit! ],
128
+ },
129
+ }
124
130
  end
@@ -1,26 +1,45 @@
1
- module ClipboardManager
2
- VERSION = '3.0.0'
1
+ class ClipboardManager
2
+ class << self; attr_accessor :do_qrcode; end
3
+ ClipboardManager.do_qrcode = true
3
4
 
4
- def self.requires
5
- # Standard Libraries
6
- require 'timeout'
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.1.230115'
7
16
 
8
- # Work gems
17
+
18
+ def self.run
19
+
20
+ # Gems
9
21
  require 'gtk3app'
10
- require 'helpema/zbar'
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
11
30
 
12
31
  # This Gem
13
32
  require_relative 'clipboard_manager/config.rb'
14
33
  require_relative 'clipboard_manager/clipboard_manager.rb'
34
+
35
+ # Run
36
+ Gtk3App.run(klass:ClipboardManager)
15
37
  end
16
38
  end
17
39
 
18
40
  # Requires:
19
- #`ruby`
20
- #`gtk3app`
21
- #`zbarcam`
22
- #`firefox`
23
41
  #`espeak`
24
- #`wget`
25
- #`youtube-dl`
26
42
  #`system`
43
+ #`ruby`
44
+ #`xdg-open`
45
+ #`zbarcam`
metadata CHANGED
@@ -1,78 +1,58 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clipboard_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 4.1.230115
5
5
  platform: ruby
6
6
  authors:
7
- - carlosjhr64
7
+ - CarlosJHR64
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-19 00:00:00.000000000 Z
11
+ date: 2023-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: help_parser
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '6.5'
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: 6.5.0
23
- type: :runtime
24
- prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- requirements:
27
- - - "~>"
28
- - !ruby/object:Gem::Version
29
- version: '6.5'
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: 6.5.0
33
13
  - !ruby/object:Gem::Dependency
34
14
  name: gtk3app
35
15
  requirement: !ruby/object:Gem::Requirement
36
16
  requirements:
37
17
  - - "~>"
38
18
  - !ruby/object:Gem::Version
39
- version: '3.0'
19
+ version: '5.4'
40
20
  - - ">="
41
21
  - !ruby/object:Gem::Version
42
- version: 3.0.0
22
+ version: 5.4.230109
43
23
  type: :runtime
44
24
  prerelease: false
45
25
  version_requirements: !ruby/object:Gem::Requirement
46
26
  requirements:
47
27
  - - "~>"
48
28
  - !ruby/object:Gem::Version
49
- version: '3.0'
29
+ version: '5.4'
50
30
  - - ">="
51
31
  - !ruby/object:Gem::Version
52
- version: 3.0.0
32
+ version: 5.4.230109
53
33
  - !ruby/object:Gem::Dependency
54
34
  name: helpema
55
35
  requirement: !ruby/object:Gem::Requirement
56
36
  requirements:
57
37
  - - "~>"
58
38
  - !ruby/object:Gem::Version
59
- version: '1.0'
39
+ version: '5.0'
60
40
  - - ">="
61
41
  - !ruby/object:Gem::Version
62
- version: 1.0.1
42
+ version: 5.0.221213
63
43
  type: :runtime
64
44
  prerelease: false
65
45
  version_requirements: !ruby/object:Gem::Requirement
66
46
  requirements:
67
47
  - - "~>"
68
48
  - !ruby/object:Gem::Version
69
- version: '1.0'
49
+ version: '5.0'
70
50
  - - ">="
71
51
  - !ruby/object:Gem::Version
72
- version: 1.0.1
52
+ version: 5.0.221213
73
53
  description: 'Ruby Gtk3App Clipboard Manager.
74
54
 
75
- '
55
+ '
76
56
  email: carlosjhr64@gmail.com
77
57
  executables:
78
58
  - clipboard_manager
@@ -82,7 +62,6 @@ files:
82
62
  - LICENSE
83
63
  - README.md
84
64
  - bin/clipboard_manager
85
- - data/VERSION
86
65
  - data/logo.png
87
66
  - data/nope.png
88
67
  - data/off.png
@@ -111,15 +90,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
90
  - !ruby/object:Gem::Version
112
91
  version: '0'
113
92
  requirements:
114
- - 'ruby: ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux]'
93
+ - 'espeak: eSpeak text-to-speech: 1.48.15 16.Apr.15 Data at: /usr/lib/aarch64-linux-gnu/espeak-data'
115
94
  - 'system: linux/bash'
116
- - 'zbarcam: 0.20.1'
117
- - 'firefox: Mozilla Firefox 63.0.3'
118
- - 'espeak: eSpeak text-to-speech: 1.48.03 04.Mar.14 Data at: /usr/share/espeak-data'
119
- - 'wget: GNU Wget 1.19.5 built on linux-gnu.'
120
- - 'youtube-dl: 2018.11.07'
121
- rubyforge_project:
122
- rubygems_version: 2.7.6
95
+ - 'ruby: ruby 3.2.0 (2022-12-25 revision a528908271) [aarch64-linux]'
96
+ - 'xdg-open: xdg-open 1.1.3'
97
+ - 'zbarcam: 0.23.90'
98
+ rubygems_version: 3.4.3
123
99
  signing_key:
124
100
  specification_version: 4
125
101
  summary: Ruby Gtk3App Clipboard Manager.
data/data/VERSION DELETED
@@ -1 +0,0 @@
1
- 3.0.0