omnibar 0.0.4 → 0.0.5

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
  SHA1:
3
- metadata.gz: b41a9526e32d5ec2113bb75da77b7f2ffc6fc255
4
- data.tar.gz: 7917caf73613169b4a9fca688fd124c38d78bae3
3
+ metadata.gz: 8ac95e6ea1b99df44bf41c79f7a3790b3f579753
4
+ data.tar.gz: 3d3b992d0cd08ae4e45f6e6df63b8de5ad9a2af3
5
5
  SHA512:
6
- metadata.gz: 93dd41173672b03dd6aed59afb6e5a0600abc90f35763e856b85e43c520b33df92751ad8e5645ebff82b8ecdcfb27195890e4ad8f588f23ff5d38eaf6e33414d
7
- data.tar.gz: f7141936b728964078c79924ca5ff4908e6c20e92ea7b6ee8966c636dfe2d0acdfe5e7673e6b82224b59fd6086ecc04bca4faac79dc512180ca992653c3d1727
6
+ metadata.gz: aad77472a565a347b6b9ae4db75294b9f3976ae515be84e5a17d2f40cc9075c1c96904a732694d838d2d76a237c80912afa2b96fc16866c04e8041d1c5881b06
7
+ data.tar.gz: 779c6a126717a08620abf45d43575d32a3900c30119c25c38d5c723a7a6577750b783479527d8799b5c4cd6c175b6a2f7a3534c2f9866b9537d85ecd9401f55b
@@ -1,18 +1,34 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- omnibar (0.0.3)
4
+ omnibar (0.0.5)
5
+ amatch (~> 0.4.0)
5
6
  dry-configurable (~> 0.7.0)
6
- fuzzy_match (~> 2.1.0)
7
+ ffi-aspell (~> 1.1, >= 1.1.0)
8
+ fuzzy_match (~> 2.1, >= 2.1.0)
7
9
 
8
10
  GEM
9
11
  remote: https://rubygems.org/
10
12
  specs:
13
+ amatch (0.4.0)
14
+ mize
15
+ tins (~> 1.0)
11
16
  concurrent-ruby (1.0.5)
12
17
  dry-configurable (0.7.0)
13
18
  concurrent-ruby (~> 1.0)
19
+ ffi (1.9.18)
20
+ ffi-aspell (1.1.0)
21
+ ffi
14
22
  fuzzy_match (2.1.0)
23
+ mize (0.3.4)
24
+ protocol
25
+ protocol (1.0.1)
26
+ ruby_parser (~> 3.0)
15
27
  rake (10.5.0)
28
+ ruby_parser (3.10.1)
29
+ sexp_processor (~> 4.9)
30
+ sexp_processor (4.10.0)
31
+ tins (1.15.0)
16
32
 
17
33
  PLATFORMS
18
34
  ruby
data/README.md CHANGED
@@ -36,6 +36,16 @@ end
36
36
  | render.highlight.bg | Symbol | `:yellow` |
37
37
  | events.after_perform | Lambda | `-> {}` |
38
38
 
39
+ ## OS Limitations
40
+
41
+ This gem has been developed on Ubuntu, and should work on most linux distributions.
42
+ All the code is in ruby, but there are several dependencies that are linux-only.
43
+
44
+ | Library | Usage |
45
+ |---------|-------|
46
+ | xdg-open | Opening urls and files |
47
+ | GNU aspell | Spell checking and suggestions |
48
+
39
49
  ## Contributing
40
50
 
41
51
  Bug reports and pull requests are welcome on GitHub at https://github.com/shreve/omnibar.
@@ -1,9 +1,16 @@
1
+ # coding: utf-8
1
2
  require 'dry-configurable'
3
+ require 'fuzzy_match'
4
+ require 'amatch'
2
5
 
3
6
  require 'omnibar/version'
4
7
  require 'omnibar/app'
5
8
 
6
9
  require 'omnibar/calculate'
10
+ require 'omnibar/emoji'
11
+ require 'omnibar/spell'
12
+ require 'omnibar/system'
13
+ require 'omnibar/snippet'
7
14
  require 'omnibar/github'
8
15
  require 'omnibar/popular'
9
16
  require 'omnibar/duck_duck_go'
@@ -20,6 +27,12 @@ module Omnibar
20
27
  setting :sites, []
21
28
  end
22
29
 
30
+ setting :spell do
31
+ setting :dict, '/usr/share/dict/american-english'
32
+ end
33
+
34
+ setting :snippets, 'shrug' => '¯\_(ツ)_/¯'
35
+
23
36
  setting :render do
24
37
  setting :prompt, ->(width) { ('-' * width) << '>' }
25
38
 
@@ -38,3 +51,5 @@ module Omnibar
38
51
  rescue LoadError => _
39
52
  end
40
53
  end
54
+
55
+ FuzzyMatch.engine = :amatch
@@ -14,7 +14,7 @@ module Omnibar
14
14
  end
15
15
 
16
16
  def perform!
17
- `echo #{value} | xsel -i --clipboard`
17
+ copy_to_clipboard value
18
18
  end
19
19
 
20
20
  def pi
@@ -0,0 +1,353 @@
1
+ module Omnibar
2
+ class Emoji < Query
3
+
4
+ def result
5
+ key = search.find(input)
6
+ value = DICTIONARY[key]
7
+
8
+ "#{key} :: #{value}" if (key and value)
9
+ end
10
+
11
+ def self.search
12
+ @fm ||= FuzzyMatch.new(DICTIONARY.keys)
13
+ end
14
+
15
+ def search
16
+ self.class.search
17
+ end
18
+
19
+ def perform!
20
+ copy_to_clipboard DICTIONARY[search.find(input)]
21
+ end
22
+
23
+ DICTIONARY = {
24
+ "grinning" => "\u{1f600}",
25
+ "smiley" => "\u{1f603}",
26
+ "smile" => "\u{1f604}",
27
+ "grin" => "\u{1f601}",
28
+ "laughing" => "\u{1f606}",
29
+ "sweat_smile" => "\u{1f605}",
30
+ "joy" => "\u{1f602}",
31
+ "rofl" => "\u{1f923}",
32
+ "relaxed" => "\u{263a}",
33
+ "blush" => "\u{1f60a}",
34
+ "innocent" => "\u{1f607}",
35
+ "slight_smile" => "\u{1f642}",
36
+ "upside_down" => "\u{1f643}",
37
+ "wink" => "\u{1f609}",
38
+ "relieved" => "\u{1f60c}",
39
+ "heart_eyes" => "\u{1f60d}",
40
+ "kissing_heart" => "\u{1f618}",
41
+ "kissing" => "\u{1f617}",
42
+ "kissing_smiling_eyes" => "\u{1f619}",
43
+ "kissing_closed_eyes" => "\u{1f61a}",
44
+ "yum" => "\u{1f60b}",
45
+ "stuck_out_tongue_winking_eye" => "\u{1f61c}",
46
+ "stuck_out_tongue_closed_eyes" => "\u{1f61d}",
47
+ "stuck_out_tongue" => "\u{1f61b}",
48
+ "money_mouth" => "\u{1f911}",
49
+ "hugging" => "\u{1f917}",
50
+ "nerd" => "\u{1f913}",
51
+ "sunglasses" => "\u{1f60e}",
52
+ "clown" => "\u{1f921}",
53
+ "cowboy" => "\u{1f920}",
54
+ "smirk" => "\u{1f60f}",
55
+ "unamused" => "\u{1f612}",
56
+ "disappointed" => "\u{1f61e}",
57
+ "pensive" => "\u{1f614}",
58
+ "worried" => "\u{1f61f}",
59
+ "confused" => "\u{1f615}",
60
+ "slight_frown" => "\u{1f641}",
61
+ "frowning2" => "\u{2639}",
62
+ "persevere" => "\u{1f623}",
63
+ "confounded" => "\u{1f616}",
64
+ "tired_face" => "\u{1f62b}",
65
+ "weary" => "\u{1f629}",
66
+ "triumph" => "\u{1f624}",
67
+ "angry" => "\u{1f620}",
68
+ "rage" => "\u{1f621}",
69
+ "no_mouth" => "\u{1f636}",
70
+ "neutral_face" => "\u{1f610}",
71
+ "expressionless" => "\u{1f611}",
72
+ "hushed" => "\u{1f62f}",
73
+ "frowning" => "\u{1f626}",
74
+ "anguished" => "\u{1f627}",
75
+ "open_mouth" => "\u{1f62e}",
76
+ "astonished" => "\u{1f632}",
77
+ "dizzy_face" => "\u{1f635}",
78
+ "flushed" => "\u{1f633}",
79
+ "scream" => "\u{1f631}",
80
+ "fearful" => "\u{1f628}",
81
+ "cold_sweat" => "\u{1f630}",
82
+ "cry" => "\u{1f622}",
83
+ "disappointed_relieved" => "\u{1f625}",
84
+ "drooling_face" => "\u{1f924}",
85
+ "sob" => "\u{1f62d}",
86
+ "sweat" => "\u{1f613}",
87
+ "sleepy" => "\u{1f62a}",
88
+ "sleeping" => "\u{1f634}",
89
+ "rolling_eyes" => "\u{1f644}",
90
+ "thinking" => "\u{1f914}",
91
+ "lying_face" => "\u{1f925}",
92
+ "grimacing" => "\u{1f62c}",
93
+ "zipper_mouth" => "\u{1f910}",
94
+ "nauseated_face" => "\u{1f922}",
95
+ "sneezing_face" => "\u{1f927}",
96
+ "mask" => "\u{1f637}",
97
+ "thermometer_face" => "\u{1f912}",
98
+ "head_bandage" => "\u{1f915}",
99
+ "smiling_imp" => "\u{1f608}",
100
+ "imp" => "\u{1f47f}",
101
+ "japanese_ogre" => "\u{1f479}",
102
+ "japanese_goblin" => "\u{1f47a}",
103
+ "poop" => "\u{1f4a9}",
104
+ "ghost" => "\u{1f47b}",
105
+ "skull" => "\u{1f480}",
106
+ "skull_crossbones" => "\u{2620}",
107
+ "alien" => "\u{1f47d}",
108
+ "space_invader" => "\u{1f47e}",
109
+ "robot" => "\u{1f916}",
110
+ "jack_o_lantern" => "\u{1f383}",
111
+ "smiley_cat" => "\u{1f63a}",
112
+ "smile_cat" => "\u{1f638}",
113
+ "joy_cat" => "\u{1f639}",
114
+ "heart_eyes_cat" => "\u{1f63b}",
115
+ "smirk_cat" => "\u{1f63c}",
116
+ "kissing_cat" => "\u{1f63d}",
117
+ "scream_cat" => "\u{1f640}",
118
+ "crying_cat_face" => "\u{1f63f}",
119
+ "pouting_cat" => "\u{1f63e}",
120
+ "open_hands" => "\u{1f450}",
121
+ "raised_hands" => "\u{1f64c}",
122
+ "clap" => "\u{1f44f}",
123
+ "pray" => "\u{1f64f}",
124
+ "handshake" => "\u{1f91d}",
125
+ "thumbsup" => "\u{1f44d}",
126
+ "thumbsdown" => "\u{1f44e}",
127
+ "punch" => "\u{1f44a}",
128
+ "fist" => "\u{270a}",
129
+ "left_facing_fist" => "\u{1f91b}",
130
+ "right_facing_fist" => "\u{1f91c}",
131
+ "fingers_crossed" => "\u{1f91e}",
132
+ "v" => "\u{270c}",
133
+ "metal" => "\u{1f918}",
134
+ "ok_hand" => "\u{1f44c}",
135
+ "point_left" => "\u{1f448}",
136
+ "point_right" => "\u{1f449}",
137
+ "point_up_2" => "\u{1f446}",
138
+ "point_down" => "\u{1f447}",
139
+ "point_up" => "\u{261d}",
140
+ "raised_hand" => "\u{270b}",
141
+ "raised_back_of_hand" => "\u{1f91a}",
142
+ "hand_splayed" => "\u{1f590}",
143
+ "vulcan" => "\u{1f596}",
144
+ "wave" => "\u{1f44b}",
145
+ "call_me" => "\u{1f919}",
146
+ "muscle" => "\u{1f4aa}",
147
+ "middle_finger" => "\u{1f595}",
148
+ "writing_hand" => "\u{270d}",
149
+ "selfie" => "\u{1f933}",
150
+ "nail_care" => "\u{1f485}",
151
+ "ring" => "\u{1f48d}",
152
+ "lipstick" => "\u{1f484}",
153
+ "kiss" => "\u{1f48b}",
154
+ "lips" => "\u{1f444}",
155
+ "tongue" => "\u{1f445}",
156
+ "ear" => "\u{1f442}",
157
+ "nose" => "\u{1f443}",
158
+ "footprints" => "\u{1f463}",
159
+ "eye" => "\u{1f441}",
160
+ "eyes" => "\u{1f440}",
161
+ "speaking_head" => "\u{1f5e3}",
162
+ "bust_in_silhouette" => "\u{1f464}",
163
+ "busts_in_silhouette" => "\u{1f465}",
164
+ "baby" => "\u{1f476}",
165
+ "boy" => "\u{1f466}",
166
+ "girl" => "\u{1f467}",
167
+ "man" => "\u{1f468}",
168
+ "woman" => "\u{1f469}",
169
+ "blond haired_woman" => "\u{1f471 2640}",
170
+ "blond_haired_person" => "\u{1f471}",
171
+ "older_man" => "\u{1f474}",
172
+ "older_woman" => "\u{1f475}",
173
+ "man_with_chinese_cap" => "\u{1f472}",
174
+ "woman_wearing_turban" => "\u{1f473 2640}",
175
+ "person_wearing_turban" => "\u{1f473}",
176
+ "woman_police_officer" => "\u{1f46e 2640}",
177
+ "police_officer" => "\u{1f46e}",
178
+ "woman_construction_worker" => "\u{1f477 2640}",
179
+ "construction_worker" => "\u{1f477}",
180
+ "woman_guard" => "\u{1f482 2640}",
181
+ "guard" => "\u{1f482}",
182
+ "woman_detective" => "\u{1f575 2640}",
183
+ "detective" => "\u{1f575}",
184
+ "woman_health_worker" => "\u{1f469 2695}",
185
+ "man_health_worker" => "\u{1f468 2695}",
186
+ "woman_farmer" => "\u{1f469 1f33e}",
187
+ "man_farmer" => "\u{1f468 1f33e}",
188
+ "woman_cook" => "\u{1f469 1f373}",
189
+ "man_cook" => "\u{1f468 1f373}",
190
+ "woman_student" => "\u{1f469 1f393}",
191
+ "man_student" => "\u{1f468 1f393}",
192
+ "woman_singer" => "\u{1f469 1f3a4}",
193
+ "man_singer" => "\u{1f468 1f3a4}",
194
+ "woman_teacher" => "\u{1f469 1f3eb}",
195
+ "man_teacher" => "\u{1f468 1f3eb}",
196
+ "woman_factory_worker" => "\u{1f469 1f3ed}",
197
+ "man_factory_worker" => "\u{1f468 1f3ed}",
198
+ "woman_technologist" => "\u{1f469 1f4bb}",
199
+ "man_technologist" => "\u{1f468 1f4bb}",
200
+ "woman_office_worker" => "\u{1f469 1f4bc}",
201
+ "man_office_worker" => "\u{1f468 1f4bc}",
202
+ "woman_mechanic" => "\u{1f469 1f527}",
203
+ "man_mechanic" => "\u{1f468 1f527}",
204
+ "woman_scientist" => "\u{1f469 1f52c}",
205
+ "man_scientist" => "\u{1f468 1f52c}",
206
+ "woman_artist" => "\u{1f469 1f3a8}",
207
+ "man_artist" => "\u{1f468 1f3a8}",
208
+ "woman_firefighter" => "\u{1f469 1f692}",
209
+ "man_firefighter" => "\u{1f468 1f692}",
210
+ "woman_pilot" => "\u{1f469 2708}",
211
+ "man_pilot" => "\u{1f468 2708}",
212
+ "woman_astronaut" => "\u{1f469 1f680}",
213
+ "man_astronaut" => "\u{1f468 1f680}",
214
+ "woman_judge" => "\u{1f469 2696}",
215
+ "man_judge" => "\u{1f468 2696}",
216
+ "mrs_claus" => "\u{1f936}",
217
+ "santa" => "\u{1f385}",
218
+ "princess" => "\u{1f478}",
219
+ "prince" => "\u{1f934}",
220
+ "bride_with_veil" => "\u{1f470}",
221
+ "man_in_tuxedo" => "\u{1f935}",
222
+ "angel" => "\u{1f47c}",
223
+ "pregnant_woman" => "\u{1f930}",
224
+ "woman_bowing" => "\u{1f647 2640}",
225
+ "person_bowing" => "\u{1f647}",
226
+ "person_tipping_hand" => "\u{1f481}",
227
+ "man_tipping_hand" => "\u{1f481 2642}",
228
+ "person_gesturing_no" => "\u{1f645}",
229
+ "man_gesturing_no" => "\u{1f645 2642}",
230
+ "person_gesturing_ok" => "\u{1f646}",
231
+ "man_gesturing_ok" => "\u{1f646 2642}",
232
+ "person_raising_hand" => "\u{1f64b}",
233
+ "man_raising_hand" => "\u{1f64b 2642}",
234
+ "woman_facepalming" => "\u{1f926 2640}",
235
+ "man_facepalming" => "\u{1f926 2642}",
236
+ "woman_shrugging" => "\u{1f937 2640}",
237
+ "man_shrugging" => "\u{1f937 2642}",
238
+ "person_pouting" => "\u{1f64e}",
239
+ "man_pouting" => "\u{1f64e 2642}",
240
+ "person_frowning" => "\u{1f64d}",
241
+ "man_frowning" => "\u{1f64d 2642}",
242
+ "person_getting_haircut" => "\u{1f487}",
243
+ "man_getting_haircut" => "\u{1f487 2642}",
244
+ "person_getting_massage" => "\u{1f486}",
245
+ "man_getting_face_massage" => "\u{1f486 2642}",
246
+ "levitate" => "\u{1f574}",
247
+ "dancer" => "\u{1f483}",
248
+ "man_dancing" => "\u{1f57a}",
249
+ "people_with_bunny_ears_partying" => "\u{1f46f}",
250
+ "men_with_bunny_ears_partying" => "\u{1f46f 2642}",
251
+ "woman_walking" => "\u{1f6b6 2640}",
252
+ "person_walking" => "\u{1f6b6}",
253
+ "woman_running" => "\u{1f3c3 2640}",
254
+ "person_running" => "\u{1f3c3}",
255
+ "couple" => "\u{1f46b}",
256
+ "two_women_holding_hands" => "\u{1f46d}",
257
+ "two_men_holding_hands" => "\u{1f46c}",
258
+ "couple_with_heart" => "\u{1f491}",
259
+ "couple_ww" => "\u{1f469 2764 1f469}",
260
+ "couple_mm" => "\u{1f468 2764 1f468}",
261
+ "couplekiss" => "\u{1f48f}",
262
+ "kiss_ww" => "\u{1f469 2764 1f48b 1f469}",
263
+ "kiss_mm" => "\u{1f468 2764 1f48b 1f468}",
264
+ "family" => "\u{1f46a}",
265
+ "family_mwg" => "\u{1f468 1f469 1f467}",
266
+ "family_mwgb" => "\u{1f468 1f469 1f467 1f466}",
267
+ "family_mwbb" => "\u{1f468 1f469 1f466 1f466}",
268
+ "family_mwgg" => "\u{1f468 1f469 1f467 1f467}",
269
+ "family_wwb" => "\u{1f469 1f469 1f466}",
270
+ "family_wwg" => "\u{1f469 1f469 1f467}",
271
+ "family_wwgb" => "\u{1f469 1f469 1f467 1f466}",
272
+ "family_wwbb" => "\u{1f469 1f469 1f466 1f466}",
273
+ "family_wwgg" => "\u{1f469 1f469 1f467 1f467}",
274
+ "family_mmb" => "\u{1f468 1f468 1f466}",
275
+ "family_mmg" => "\u{1f468 1f468 1f467}",
276
+ "family_mmgb" => "\u{1f468 1f468 1f467 1f466}",
277
+ "family_mmbb" => "\u{1f468 1f468 1f466 1f466}",
278
+ "family_mmgg" => "\u{1f468 1f468 1f467 1f467}",
279
+ "family_woman_boy" => "\u{1f469 1f466}",
280
+ "family_woman_girl" => "\u{1f469 1f467}",
281
+ "family_woman_girl_boy" => "\u{1f469 1f467 1f466}",
282
+ "family_woman_boy_boy" => "\u{1f469 1f466 1f466}",
283
+ "family_woman_girl_girl" => "\u{1f469 1f467 1f467}",
284
+ "family_man_boy" => "\u{1f468 1f466}",
285
+ "family_man_girl" => "\u{1f468 1f467}",
286
+ "family_man_girl_boy" => "\u{1f468 1f467 1f466}",
287
+ "family_man_boy_boy" => "\u{1f468 1f466 1f466}",
288
+ "family_man_girl_girl" => "\u{1f468 1f467 1f467}",
289
+ "womans_clothes" => "\u{1f45a}",
290
+ "shirt" => "\u{1f455}",
291
+ "jeans" => "\u{1f456}",
292
+ "necktie" => "\u{1f454}",
293
+ "dress" => "\u{1f457}",
294
+ "bikini" => "\u{1f459}",
295
+ "kimono" => "\u{1f458}",
296
+ "high_heel" => "\u{1f460}",
297
+ "sandal" => "\u{1f461}",
298
+ "boot" => "\u{1f462}",
299
+ "mans_shoe" => "\u{1f45e}",
300
+ "athletic_shoe" => "\u{1f45f}",
301
+ "womans_hat" => "\u{1f452}",
302
+ "tophat" => "\u{1f3a9}",
303
+ "mortar_board" => "\u{1f393}",
304
+ "crown" => "\u{1f451}",
305
+ "helmet_with_cross" => "\u{26d1}",
306
+ "school_satchel" => "\u{1f392}",
307
+ "pouch" => "\u{1f45d}",
308
+ "purse" => "\u{1f45b}",
309
+ "handbag" => "\u{1f45c}",
310
+ "briefcase" => "\u{1f4bc}",
311
+ "eyeglasses" => "\u{1f453}",
312
+ "dark_sunglasses" => "\u{1f576}",
313
+ "closed_umbrella" => "\u{1f302}",
314
+ "umbrella2" => "\u{2602}",
315
+ "face_with_raised_eyebrow" => "\u{1f928}",
316
+ "star_struck" => "\u{1f929}",
317
+ "crazy_face" => "\u{1f92a}",
318
+ "shushing_face" => "\u{1f92b}",
319
+ "face_with_symbols_over_mouth" => "\u{1f92c}",
320
+ "face_with_hand_over_mouth" => "\u{1f92d}",
321
+ "face_vomiting" => "\u{1f92e}",
322
+ "exploding_head" => "\u{1f92f}",
323
+ "face_with_monocle" => "\u{1f9d0}",
324
+ "adult" => "\u{1f9d1}",
325
+ "child" => "\u{1f9d2}",
326
+ "older_adult" => "\u{1f9d3}",
327
+ "bearded_person" => "\u{1f9d4}",
328
+ "woman_with_headscarf" => "\u{1f9d5}",
329
+ "brain" => "\u{1f9e0}",
330
+ "billed_cap" => "\u{1f9e2}",
331
+ "scarf" => "\u{1f9e3}",
332
+ "gloves" => "\u{1f9e4}",
333
+ "coat" => "\u{1f9e5}",
334
+ "socks" => "\u{1f9e6}",
335
+ "love_you_gesture" => "\u{1f91f}",
336
+ "palms_up_together" => "\u{1f932}",
337
+ "woman_mage" => "\u{1f9d9 2640}",
338
+ "man_mage" => "\u{1f9d9 2642}",
339
+ "woman_fairy" => "\u{1f9da 2640}",
340
+ "man_fairy" => "\u{1f9da 2642}",
341
+ "woman_vampire" => "\u{1f9db 2640}",
342
+ "man_vampire" => "\u{1f9db 2642}",
343
+ "mermaid" => "\u{1f9dc 2640}",
344
+ "merman" => "\u{1f9dc 2642}",
345
+ "woman_elf" => "\u{1f9dd 2640}",
346
+ "man_elf" => "\u{1f9dd 2642}",
347
+ "woman_genie" => "\u{1f9de 2640}",
348
+ "man_genie" => "\u{1f9de 2642}",
349
+ "woman_zombie" => "\u{1f9df 2640}",
350
+ "man_zombie" => "\u{1f9df 2642}"
351
+ }.freeze
352
+ end
353
+ end
@@ -1,5 +1,3 @@
1
- require 'fuzzy_match'
2
-
3
1
  module Omnibar
4
2
  class Popular < Query
5
3
  def result
@@ -22,6 +22,10 @@ module Omnibar
22
22
  input
23
23
  end
24
24
 
25
+ def copy_to_clipboard(value)
26
+ `echo "#{value}" | xsel -i --clipboard`
27
+ end
28
+
25
29
  def open_in_browser(url)
26
30
  Thread.new { `xdg-open "#{url}" >/dev/null 2>&1` }
27
31
  end
@@ -1,5 +1,7 @@
1
1
  module Omnibar
2
2
  class Renderer
3
+ NON_ASCII_REGEX = /[^\x00-\x7F]/.freeze
4
+
3
5
  attr_reader :input, :results, :selection
4
6
 
5
7
  def initialize(input, results, selection)
@@ -38,15 +40,21 @@ module Omnibar
38
40
  end
39
41
 
40
42
  def rpad(text, length = ANSI.size[:width])
41
- text + (' ' * [0, (length - text.length)].max)
43
+ textlength = text.length + non_ascii_chars(text).length
44
+ text + (' ' * [0, (length - textlength)].max)
42
45
  end
43
46
 
44
47
  def lpad(text, length = ANSI.size[:width])
45
- (' ' * [0, (length - text.length)].max) + text
48
+ textlength = text.length + non_ascii_chars(text).length
49
+ (' ' * [0, (length - textlength)].max) + text
46
50
  end
47
51
 
48
52
  def max_label_length
49
53
  @mll ||= results.map(&:first).map(&:length).max || 10
50
54
  end
55
+
56
+ def non_ascii_chars(string)
57
+ string.chars.select { |c| c.match?(NON_ASCII_REGEX) }
58
+ end
51
59
  end
52
60
  end
@@ -0,0 +1,26 @@
1
+ module Omnibar
2
+ class Snippet < Query
3
+ def result
4
+ key = search.find(input)
5
+ value = snippets[key]
6
+ "#{key} :: #{value}" if (key and value)
7
+ end
8
+
9
+ def snippets
10
+ Omnibar.config.snippets
11
+ end
12
+
13
+ def self.search
14
+ @fz ||= FuzzyMatch.new(Omnibar.config.snippets.keys)
15
+ end
16
+
17
+ def search
18
+ self.class.search
19
+ end
20
+
21
+ def perform!
22
+ key = search.find(input)
23
+ copy_to_clipboard snippets[key]
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,21 @@
1
+ require 'ffi/aspell'
2
+
3
+ module Omnibar
4
+ class Spell < Query
5
+ def result
6
+ speller.suggestions(input.split(' ').last).first if input.match?(/^spe?l?l? \w+/)
7
+ end
8
+
9
+ def self.speller
10
+ @sp ||= FFI::Aspell::Speller.new('en_US')
11
+ end
12
+
13
+ def speller
14
+ self.class.speller
15
+ end
16
+
17
+ def perform!
18
+ copy_to_clipboard result
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,27 @@
1
+ module Omnibar
2
+ #
3
+ # System Commands
4
+ #
5
+ # Interact with your system
6
+ #
7
+ class System < Query
8
+ COMMANDS = {
9
+ 'sleep' => 'xset -display :0.0 dpms force off',
10
+ 'reboot' => 'reboot',
11
+ 'shutdown' => 'shutdown now',
12
+ 'power off' => 'shutdown now'
13
+ }.freeze
14
+
15
+ def result
16
+ search.find(input)
17
+ end
18
+
19
+ def search
20
+ @fz ||= FuzzyMatch.new(COMMANDS.keys)
21
+ end
22
+
23
+ def perform!
24
+ puts COMMANDS[result]
25
+ end
26
+ end
27
+ end
@@ -1,3 +1,3 @@
1
1
  module Omnibar
2
- VERSION = '0.0.4'.freeze
2
+ VERSION = '0.0.5'.freeze
3
3
  end
@@ -20,8 +20,10 @@ Gem::Specification.new do |spec|
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ['lib']
22
22
 
23
- spec.add_dependency 'dry-configurable', '~> 0.7.0'
24
- spec.add_dependency 'fuzzy_match', '~> 2.1.0'
23
+ spec.add_runtime_dependency 'dry-configurable', '~> 0.7.0'
24
+ spec.add_runtime_dependency 'fuzzy_match', '~> 2.1', '>= 2.1.0'
25
+ spec.add_runtime_dependency 'amatch', '~> 0.4.0'
26
+ spec.add_runtime_dependency 'ffi-aspell', '~> 1.1', '>= 1.1.0'
25
27
 
26
28
  spec.add_development_dependency 'bundler', '~> 1.16.a'
27
29
  spec.add_development_dependency 'rake', '~> 10.0'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omnibar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacob Evan Shreve
@@ -29,6 +29,9 @@ dependencies:
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.1'
34
+ - - ">="
32
35
  - !ruby/object:Gem::Version
33
36
  version: 2.1.0
34
37
  type: :runtime
@@ -36,8 +39,45 @@ dependencies:
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
41
  - - "~>"
42
+ - !ruby/object:Gem::Version
43
+ version: '2.1'
44
+ - - ">="
39
45
  - !ruby/object:Gem::Version
40
46
  version: 2.1.0
47
+ - !ruby/object:Gem::Dependency
48
+ name: amatch
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: 0.4.0
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: 0.4.0
61
+ - !ruby/object:Gem::Dependency
62
+ name: ffi-aspell
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '1.1'
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: 1.1.0
71
+ type: :runtime
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - "~>"
76
+ - !ruby/object:Gem::Version
77
+ version: '1.1'
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: 1.1.0
41
81
  - !ruby/object:Gem::Dependency
42
82
  name: bundler
43
83
  requirement: !ruby/object:Gem::Requirement
@@ -88,11 +128,15 @@ files:
88
128
  - lib/omnibar/app.rb
89
129
  - lib/omnibar/calculate.rb
90
130
  - lib/omnibar/duck_duck_go.rb
131
+ - lib/omnibar/emoji.rb
91
132
  - lib/omnibar/github.rb
92
133
  - lib/omnibar/google.rb
93
134
  - lib/omnibar/popular.rb
94
135
  - lib/omnibar/query.rb
95
136
  - lib/omnibar/renderer.rb
137
+ - lib/omnibar/snippet.rb
138
+ - lib/omnibar/spell.rb
139
+ - lib/omnibar/system.rb
96
140
  - lib/omnibar/version.rb
97
141
  - omnibar.gemspec
98
142
  homepage: https://github.com/shreve/omnibar