clipboard_manager 4.0.210706 → 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: 884536f28b9e8d38614cd4df4861889f577147e3684f684878d27a8bd9e27c29
4
- data.tar.gz: 91d89fd8260c22fc1183a4ea3a33b6e9a7b58dac653a9ce474418f597981d556
3
+ metadata.gz: 8b96ba3d75015dd40d59ea3efa098d6d090b81e458ed5d0a57dfbdbba3727632
4
+ data.tar.gz: 35ea53a9adc2ae3909576bfc2a205a830f9d75ecebf41a7f4462fc30eb99d52a
5
5
  SHA512:
6
- metadata.gz: acab8881f685c92a7173e5fd090e4d3566543ed5107eff5f6243b044169da3ae7a476728a122f0fdbee4c95fde598b8a22f507a5b3d9d1882b953f504222995d
7
- data.tar.gz: fe1aded68b9451e87475970ed405c6fc48a58f060f93a05fb6887f6c3481f4a2c077714b1b9999cf71af6ebcbbc7ab0393758bdb5d6806d065bcc3e20768a338
6
+ metadata.gz: '0481924b166c53ba75bf99aac65d8a071ee4da07fd66d14a56c63fe77fd6777644b0118c5831f7c6d9adff0630b7166effee906fb4ee1df3f5e046d1ddb071df'
7
+ data.tar.gz: e93addef2f37e550069e10899bc08208c85faf769217f927006c6f343cc286b17170eb5a4e61ee0319050f4851d3fc3c70d4b52c634872be9120620ceb7ccefc
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # ClipboardManager
2
2
 
3
- * [VERSION 4.0.210706](https://github.com/carlosjhr64/clipboard_manager/releases)
3
+ * [VERSION 4.1.230115](https://github.com/carlosjhr64/clipboard_manager/releases)
4
4
  * [github](https://github.com/carlosjhr64/clipboard_manager)
5
5
  * [rubygems](https://rubygems.org/gems/clipboard_manager)
6
6
 
@@ -8,12 +8,14 @@
8
8
 
9
9
  Ruby Gtk3App Clipboard Manager.
10
10
 
11
- ## FEATURES
11
+ ## SCREENSHOT:
12
+
13
+ ![screenshot](img/screenshot.png)
12
14
 
13
- Clipboard auto sends to:
15
+ ## FEATURES
14
16
 
15
- * gnome-calculator
16
- * google dictionary
17
+ * eval-calculator
18
+ * Wiktionary
17
19
  * xdg-open url
18
20
  * espeak
19
21
 
@@ -23,8 +25,6 @@ Also:
23
25
  * QR-Code copy to clipboard
24
26
 
25
27
  ## INSTALL:
26
-
27
- Note that you'll need gtk3app:
28
28
  ```shell
29
29
  $ gem install clipboard_manager
30
30
  ```
@@ -40,15 +40,14 @@ At top of the file you will find the available tasks:
40
40
  Tasks!: {
41
41
  calculator: [
42
42
  "^([\\d\\.\\+\\-\\*\\/\\%\\(\\) ]{3,80})$",
43
- :bashit,
44
- true,
45
- "gnome-calculator -e '$1'"
43
+ :reply,
44
+ true
46
45
  ],
47
46
  dictionary: [
48
47
  "^(\\w+)$",
49
48
  :bashit,
50
49
  true,
51
- "xdg-open 'https://www.google.com/search?q=definition+of+$1'"
50
+ "xdg-open 'https://en.wiktionary.org/wiki/$1'"
52
51
  ],
53
52
  url: [
54
53
  "^https?://\\w[\\-\\+\\.\\w]*(\\.\\w+)(:\\d+)?(/\\S*)?$",
@@ -61,18 +60,17 @@ At top of the file you will find the available tasks:
61
60
  true
62
61
  ]
63
62
  },
64
- #...
63
+ # ...
65
64
  }
66
65
  ```
67
66
  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.
67
+ Note that this is an [RBON](https://rubygems.org/gems/rbon) file.
68
+ ClipboardManager has four tasks methods:
71
69
 
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.
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.
76
74
 
77
75
  With the boolean `true` value the clipboard will clear on the matched task.
78
76
  If you don't want the clipboard cleared on a matched task,
@@ -88,7 +86,7 @@ The `:espeak` task will run when the clip is at least 80 characters long.
88
86
  It will have espeak read the text.
89
87
 
90
88
  ## HELP:
91
- ```shell
89
+ ```console
92
90
  $ clipboard_manager --help
93
91
  Usage:
94
92
  clipboard_manager [:options+]
@@ -103,7 +101,7 @@ Options:
103
101
 
104
102
  (The MIT License)
105
103
 
106
- Copyright (c) 2021 CarlosJHR64
104
+ Copyright (c) 2023 CarlosJHR64
107
105
 
108
106
  Permission is hereby granted, free of charge, to any person obtaining
109
107
  a copy of this software and associated documentation files (the
@@ -10,14 +10,14 @@ class ClipboardManager
10
10
  using Rafini::Exception
11
11
 
12
12
  class NoYes < Such::Dialog
13
- def initialize(*par)
13
+ def initialize(key)
14
14
  super
15
15
  add_button '_No', Gtk::ResponseType::CANCEL
16
16
  add_button '_Yes', Gtk::ResponseType::OK
17
17
  end
18
18
 
19
- def label(*par)
20
- Such::Label.new child, *par
19
+ def label(key)
20
+ Such::Label.new child, key
21
21
  end
22
22
 
23
23
  def ok?
@@ -29,14 +29,14 @@ class ClipboardManager
29
29
  end
30
30
 
31
31
  class CancelOk < Such::Dialog
32
- def initialize(*par)
32
+ def initialize(key)
33
33
  super
34
34
  add_button(Gtk::Stock::CANCEL, Gtk::ResponseType::CANCEL)
35
35
  add_button(Gtk::Stock::OK, Gtk::ResponseType::OK)
36
36
  end
37
37
 
38
- def combo(*par)
39
- Such::ComboBoxText.new child, *par
38
+ def combo(key)
39
+ Such::ComboBoxText.new child, key
40
40
  end
41
41
 
42
42
  def runs
@@ -47,7 +47,24 @@ class ClipboardManager
47
47
  end
48
48
  end
49
49
 
50
- CLIPBOARD = Gtk::Clipboard.get(Gdk::Selection::PRIMARY)
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
65
+ end
66
+
67
+ CLIPBOARD = Gtk::Clipboard.get(Gdk::Selection::CLIPBOARD)
51
68
 
52
69
  def initialize(stage, toolbar, options)
53
70
  @image = toolbar.parent.children[0].child # Expander:hbox:EventImage:Image
@@ -128,7 +145,7 @@ class ClipboardManager
128
145
  return true unless @ask.active?
129
146
  dialog = NoYes.new :question_dialog!
130
147
  Gtk3App.transient dialog
131
- dialog.label.text = "Run #{name}?"
148
+ dialog.label(:question_label!).text = "Run #{name}?"
132
149
  dialog.ok?
133
150
  end
134
151
 
@@ -193,6 +210,8 @@ class ClipboardManager
193
210
  open(text)
194
211
  when :bashit
195
212
  bashit(md, str)
213
+ when :reply
214
+ reply(text)
196
215
  else
197
216
  raise "Method #{mth} not implemented."
198
217
  end
@@ -207,8 +226,11 @@ class ClipboardManager
207
226
  status(@nope)
208
227
  end
209
228
 
229
+ ESPEAK = IO.popen(CONFIG[:Espeak], 'w')
230
+ ESPEAK.puts # b/c :-???
231
+ Gtk3App.finalize{ESPEAK.close}
210
232
  def espeak(text)
211
- Rafini.thread_bang!{IO.popen(CONFIG[:Espeak], 'w'){|e|e.puts text.strip}}
233
+ Rafini.thread_bang!{ESPEAK.puts text.strip}
212
234
  end
213
235
 
214
236
  def open(text)
@@ -222,4 +244,16 @@ class ClipboardManager
222
244
  $stderr.puts str
223
245
  Process.detach spawn str
224
246
  end
247
+
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
225
259
  end
@@ -18,15 +18,14 @@ class ClipboardManager
18
18
  Tasks!: { # Note that Ruby's Hash preserves order, and order here is important.
19
19
  calculator: [
20
20
  '^([\d\.\+\-\*\/\%\(\) ]{3,80})$',
21
- :bashit,
21
+ :reply,
22
22
  true, # clears clipboard
23
- "gnome-calculator -e '$1'",
24
23
  ],
25
24
  dictionary: [
26
25
  '^(\w+)$',
27
26
  :bashit,
28
27
  true, # clears clipboard
29
- "xdg-open 'https://www.google.com/search?q=definition+of+$1'",
28
+ "xdg-open 'https://en.wiktionary.org/wiki/$1'",
30
29
  ],
31
30
  url: ['^https?://\w[\-\+\.\w]*(\.\w+)(:\d+)?(/\S*)?$', :open, true],
32
31
  espeak: ['.{80,}', :espeak, true],
@@ -41,7 +40,8 @@ class ClipboardManager
41
40
 
42
41
  IsPwd: is_pwd,
43
42
 
44
- Espeak: 'espeak --stdin',
43
+ # The text-to-speech needs to be able to receive text from stdin
44
+ Espeak: 'espeak',
45
45
 
46
46
  Working: "#{UserSpace::XDG['data']}/gtk3app/clipboardmanager/working.png",
47
47
  Ok: "#{UserSpace::XDG['data']}/gtk3app/clipboardmanager/ok.png",
@@ -57,7 +57,7 @@ class ClipboardManager
57
57
  about_dialog: {
58
58
  set_program_name: 'Clipboard Manager',
59
59
  set_version: VERSION.semantic(0..1),
60
- set_copyright: '(c) 2018 CarlosJHR64',
60
+ set_copyright: '(c) 2023 CarlosJHR64',
61
61
  set_comments: 'A Ruby Gtk3App Clipboard Manager ',
62
62
  set_website: 'https://github.com/carlosjhr64/clipboard_manager',
63
63
  set_website_label: 'See it at GitHub!',
@@ -89,9 +89,7 @@ class ClipboardManager
89
89
  history_button!: [:HISTORY_BUTTON, :history_button],
90
90
 
91
91
  HISTORY_DIALOG: a0,
92
- history_dialog: {
93
- set_window_position: :center,
94
- },
92
+ history_dialog: h0,
95
93
  history_dialog!: [:HISTORY_DIALOG, :history_dialog],
96
94
 
97
95
  HISTORY_COMBO: a0,
@@ -104,11 +102,22 @@ class ClipboardManager
104
102
 
105
103
  QUESTION_DIALOG: a0,
106
104
  question_dialog: {
107
- set_window_position: :center,
108
105
  set_keep_above: true,
109
106
  },
110
107
  question_dialog!: [:question_dialog, :QUESTION_DIALOG],
111
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
+
112
121
  # Toggle's app-menu item.
113
122
  # Application MAY modify :TOGGLE for language.
114
123
  TOGGLE: [label: 'Toggle'],
@@ -12,7 +12,7 @@ class ClipboardManager
12
12
  --notoggle \t Minime wont toggle decorated and keep above
13
13
  --notdecorated\t Dont decorate window
14
14
  HELP
15
- VERSION = '4.0.210706'
15
+ VERSION = '4.1.230115'
16
16
 
17
17
 
18
18
  def self.run
@@ -38,7 +38,6 @@ class ClipboardManager
38
38
  end
39
39
 
40
40
  # Requires:
41
- #`gnome-calculator`
42
41
  #`espeak`
43
42
  #`system`
44
43
  #`ruby`
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: 4.0.210706
4
+ version: 4.1.230115
5
5
  platform: ruby
6
6
  authors:
7
- - carlosjhr64
8
- autorequire:
7
+ - CarlosJHR64
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-06 00:00:00.000000000 Z
11
+ date: 2023-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gtk3app
@@ -16,40 +16,40 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '5.1'
19
+ version: '5.4'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 5.1.210203
22
+ version: 5.4.230109
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: '5.1'
29
+ version: '5.4'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 5.1.210203
32
+ version: 5.4.230109
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: '3.0'
39
+ version: '5.0'
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: 3.0.210706
42
+ version: 5.0.221213
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: '3.0'
49
+ version: '5.0'
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
- version: 3.0.210706
52
+ version: 5.0.221213
53
53
  description: 'Ruby Gtk3App Clipboard Manager.
54
54
 
55
55
  '
@@ -75,7 +75,7 @@ homepage: https://github.com/carlosjhr64/clipboard_manager
75
75
  licenses:
76
76
  - MIT
77
77
  metadata: {}
78
- post_install_message:
78
+ post_install_message:
79
79
  rdoc_options: []
80
80
  require_paths:
81
81
  - lib
@@ -90,14 +90,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  - !ruby/object:Gem::Version
91
91
  version: '0'
92
92
  requirements:
93
- - 'gnome-calculator: 40.1'
94
- - 'espeak: eSpeak NG text-to-speech: 1.50 Data at: /usr/share/espeak-ng-data'
93
+ - 'espeak: eSpeak text-to-speech: 1.48.15 16.Apr.15 Data at: /usr/lib/aarch64-linux-gnu/espeak-data'
95
94
  - 'system: linux/bash'
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:
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
99
+ signing_key:
101
100
  specification_version: 4
102
101
  summary: Ruby Gtk3App Clipboard Manager.
103
102
  test_files: []