clipboard_manager 4.0.210706 → 4.2.230117
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +26 -22
- data/lib/clipboard_manager/clipboard_manager.rb +58 -9
- data/lib/clipboard_manager/config.rb +20 -11
- data/lib/clipboard_manager.rb +1 -2
- metadata +19 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa76932e386e569c94ee74414fc52cda287df0ff492b71e685022b27e5a9f0d2
|
4
|
+
data.tar.gz: 29b11811b2c3b8eb16f32351b9193cca5d536b48fe1a45084f893237b8d9a5b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7dd3b90711b076e6b67105ac6bc603dc53ee920d38362f17e25eb59565264e9c72746baf6172c30454ce057d038a94a4eeff363529c7d38079d6663abbf673b4
|
7
|
+
data.tar.gz: cd39d59ef86d9102deca56430e07f67cd32c079209043955257943da45f70bb6c3f6d4fd121c46f5cb08f1045655f4f0fae422f42eb06a4e7f2650f564f109a4
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# ClipboardManager
|
2
2
|
|
3
|
-
* [VERSION 4.
|
3
|
+
* [VERSION 4.2.230117](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
|
-
##
|
11
|
+
## SCREENSHOT:
|
12
|
+
|
13
|
+
![screenshot](img/screenshot.png)
|
12
14
|
|
13
|
-
|
15
|
+
## FEATURES
|
14
16
|
|
15
|
-
*
|
16
|
-
*
|
17
|
+
* eval-calculator
|
18
|
+
* Wiktionary
|
17
19
|
* xdg-open url
|
18
20
|
* espeak
|
19
21
|
|
@@ -23,11 +25,15 @@ 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
|
```
|
31
|
+
## MOUSE CLICKS ON LOGO:
|
32
|
+
|
33
|
+
+ Button #1: Toggle Minime
|
34
|
+
+ Button #2: Toggle On/Off
|
35
|
+
+ Button #3: Pop-up Application Menu
|
36
|
+
|
31
37
|
## CONFIGURATION:
|
32
38
|
|
33
39
|
After an initial run, your user configuration will found in:
|
@@ -40,15 +46,14 @@ At top of the file you will find the available tasks:
|
|
40
46
|
Tasks!: {
|
41
47
|
calculator: [
|
42
48
|
"^([\\d\\.\\+\\-\\*\\/\\%\\(\\) ]{3,80})$",
|
43
|
-
:
|
44
|
-
true
|
45
|
-
"gnome-calculator -e '$1'"
|
49
|
+
:reply,
|
50
|
+
true
|
46
51
|
],
|
47
52
|
dictionary: [
|
48
53
|
"^(\\w+)$",
|
49
54
|
:bashit,
|
50
55
|
true,
|
51
|
-
"xdg-open 'https://
|
56
|
+
"xdg-open 'https://en.wiktionary.org/wiki/$1'"
|
52
57
|
],
|
53
58
|
url: [
|
54
59
|
"^https?://\\w[\\-\\+\\.\\w]*(\\.\\w+)(:\\d+)?(/\\S*)?$",
|
@@ -56,23 +61,22 @@ At top of the file you will find the available tasks:
|
|
56
61
|
true
|
57
62
|
],
|
58
63
|
espeak: [
|
59
|
-
".{
|
64
|
+
".{40,}",
|
60
65
|
:espeak,
|
61
66
|
true
|
62
67
|
]
|
63
68
|
},
|
64
|
-
|
69
|
+
# ...
|
65
70
|
}
|
66
71
|
```
|
67
72
|
It is by this configuration that one can modify and add tasks.
|
68
|
-
|
69
|
-
|
70
|
-
Within tolerance(see [rbon](https://rubygems.org/gems/rbon)) you must maintain it's structure.
|
73
|
+
Note that this is an [RBON](https://rubygems.org/gems/rbon) file.
|
74
|
+
ClipboardManager has four tasks methods:
|
71
75
|
|
72
|
-
|
73
|
-
`:
|
74
|
-
`:
|
75
|
-
`:
|
76
|
+
* `:bashit` will take a command to be run by the system.
|
77
|
+
* `:open` will `xdg-open` the clip.
|
78
|
+
* `:espeak` will `espeak` the clip.
|
79
|
+
* `:reply` will `eval` the clip and display a message with the result.
|
76
80
|
|
77
81
|
With the boolean `true` value the clipboard will clear on the matched task.
|
78
82
|
If you don't want the clipboard cleared on a matched task,
|
@@ -88,7 +92,7 @@ The `:espeak` task will run when the clip is at least 80 characters long.
|
|
88
92
|
It will have espeak read the text.
|
89
93
|
|
90
94
|
## HELP:
|
91
|
-
```
|
95
|
+
```console
|
92
96
|
$ clipboard_manager --help
|
93
97
|
Usage:
|
94
98
|
clipboard_manager [:options+]
|
@@ -103,7 +107,7 @@ Options:
|
|
103
107
|
|
104
108
|
(The MIT License)
|
105
109
|
|
106
|
-
Copyright (c)
|
110
|
+
Copyright (c) 2023 CarlosJHR64
|
107
111
|
|
108
112
|
Permission is hereby granted, free of charge, to any person obtaining
|
109
113
|
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(
|
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(
|
20
|
-
Such::Label.new child,
|
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(
|
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(
|
39
|
-
Such::ComboBoxText.new child,
|
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
|
-
|
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
|
@@ -90,6 +107,15 @@ class ClipboardManager
|
|
90
107
|
end
|
91
108
|
|
92
109
|
Gtk3App.clipboard_manager_hook(self)
|
110
|
+
Gtk3App.logo_press_event do |button|
|
111
|
+
case button
|
112
|
+
when 1
|
113
|
+
Gtk3App.minime!
|
114
|
+
when 2
|
115
|
+
Gtk3App.toggle!
|
116
|
+
# When 3 gets captured by Gtk3App's main menu
|
117
|
+
end
|
118
|
+
end
|
93
119
|
|
94
120
|
status(@ready)
|
95
121
|
end
|
@@ -128,7 +154,7 @@ class ClipboardManager
|
|
128
154
|
return true unless @ask.active?
|
129
155
|
dialog = NoYes.new :question_dialog!
|
130
156
|
Gtk3App.transient dialog
|
131
|
-
dialog.label.text = "Run #{name}?"
|
157
|
+
dialog.label(:question_label!).text = "Run #{name}?"
|
132
158
|
dialog.ok?
|
133
159
|
end
|
134
160
|
|
@@ -140,6 +166,7 @@ class ClipboardManager
|
|
140
166
|
text = request_text
|
141
167
|
@previous = text
|
142
168
|
@running.active = !@running.active?
|
169
|
+
ClipboardManager.kill_espeak unless @running.active?
|
143
170
|
end
|
144
171
|
|
145
172
|
def request_text
|
@@ -193,6 +220,8 @@ class ClipboardManager
|
|
193
220
|
open(text)
|
194
221
|
when :bashit
|
195
222
|
bashit(md, str)
|
223
|
+
when :reply
|
224
|
+
reply(text)
|
196
225
|
else
|
197
226
|
raise "Method #{mth} not implemented."
|
198
227
|
end
|
@@ -207,8 +236,16 @@ class ClipboardManager
|
|
207
236
|
status(@nope)
|
208
237
|
end
|
209
238
|
|
239
|
+
def ClipboardManager.kill_espeak
|
240
|
+
espeak = CONFIG[:Espeak].split.first
|
241
|
+
system "killall --quiet #{espeak}"
|
242
|
+
end
|
243
|
+
Gtk3App.finalize{ClipboardManager.kill_espeak}
|
210
244
|
def espeak(text)
|
211
|
-
Rafini.thread_bang!
|
245
|
+
Rafini.thread_bang! do
|
246
|
+
ClipboardManager.kill_espeak
|
247
|
+
IO.popen(CONFIG[:Espeak], 'w'){_1.puts text.strip}
|
248
|
+
end
|
212
249
|
end
|
213
250
|
|
214
251
|
def open(text)
|
@@ -222,4 +259,16 @@ class ClipboardManager
|
|
222
259
|
$stderr.puts str
|
223
260
|
Process.detach spawn str
|
224
261
|
end
|
262
|
+
|
263
|
+
def reply(text)
|
264
|
+
dialog = Message.new(:reply_dialog!)
|
265
|
+
Gtk3App.transient dialog
|
266
|
+
begin
|
267
|
+
dialog.label(:reply_label!).text = text
|
268
|
+
dialog.label(:reply_label!).text = "#{eval text}"
|
269
|
+
rescue
|
270
|
+
dialog.label(:reply_label!).text = $!.message
|
271
|
+
end
|
272
|
+
dialog.runs
|
273
|
+
end
|
225
274
|
end
|
@@ -18,18 +18,17 @@ 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
|
-
:
|
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://
|
28
|
+
"xdg-open 'https://en.wiktionary.org/wiki/$1'",
|
30
29
|
],
|
31
30
|
url: ['^https?://\w[\-\+\.\w]*(\.\w+)(:\d+)?(/\S*)?$', :open, true],
|
32
|
-
espeak: ['.{
|
31
|
+
espeak: ['.{40,}', :espeak, true],
|
33
32
|
},
|
34
33
|
|
35
34
|
StatusTimeOut: 3,
|
@@ -41,7 +40,8 @@ class ClipboardManager
|
|
41
40
|
|
42
41
|
IsPwd: is_pwd,
|
43
42
|
|
44
|
-
|
43
|
+
# The text-to-speech needs to be able to receive text from stdin
|
44
|
+
Espeak: 'espeak -s 180 --stdin',
|
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)
|
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,14 +102,25 @@ 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
|
-
TOGGLE: [label: 'Toggle'],
|
123
|
+
TOGGLE: [label: 'Toggle On/Off'],
|
115
124
|
toggle: h0,
|
116
125
|
toggle!: [:TOGGLE, :toggle, 'activate'],
|
117
126
|
app_menu: {
|
data/lib/clipboard_manager.rb
CHANGED
@@ -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.
|
15
|
+
VERSION = '4.2.230117'
|
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.
|
4
|
+
version: 4.2.230117
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
8
|
-
autorequire:
|
7
|
+
- CarlosJHR64
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-17 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.
|
19
|
+
version: '5.4'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 5.
|
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.
|
29
|
+
version: '5.4'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 5.
|
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: '
|
39
|
+
version: '5.0'
|
40
40
|
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
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: '
|
49
|
+
version: '5.0'
|
50
50
|
- - ">="
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version:
|
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
|
-
- '
|
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
|
97
|
-
- 'xdg-open: xdg-open 1.1.3
|
98
|
-
- 'zbarcam: 0.23'
|
99
|
-
rubygems_version: 3.
|
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: []
|