├── .gitignore
├── .idea
├── .gitignore
├── launcher.iml
├── misc.xml
├── modules.xml
└── vcs.xml
├── .vscode
├── launch.json
├── settings.json
└── tasks.json
├── COPYING
├── Cargo.lock
├── Cargo.toml
├── README.md
├── sample-config
├── a
│ ├── config.toml
│ ├── readme.md
│ ├── sirula.gif
│ └── style.css
├── b
│ ├── config.toml
│ ├── readme.md
│ ├── sirula.png
│ └── style.css
├── c
│ ├── README.md
│ ├── config.toml
│ ├── screenshot.png
│ └── style.css
├── d
│ ├── config.toml
│ ├── readme.md
│ ├── screenshot.png
│ └── style.css
├── default-config.toml
└── e
│ ├── config.toml
│ ├── readme.md
│ ├── sirula.gif
│ └── style.css
└── src
├── app_entry.rs
├── config.rs
├── consts.rs
├── history.rs
├── locale.rs
├── main.rs
└── util.rs
/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 |
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 | # Datasource local storage ignored files
5 | /dataSources/
6 | /dataSources.local.xml
7 | # Editor-based HTTP Client requests
8 | /httpRequests/
9 |
--------------------------------------------------------------------------------
/.idea/launcher.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense to learn about possible attributes.
3 | // Hover to view descriptions of existing attributes.
4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "type": "lldb",
9 | "request": "launch",
10 | "name": "Debug executable 'sirula'",
11 | "cargo": {
12 | "args": [
13 | "build",
14 | "--bin=sirula",
15 | "--package=sirula"
16 | ],
17 | "filter": {
18 | "name": "sirula",
19 | "kind": "bin"
20 | }
21 | },
22 | "args": [],
23 | "cwd": "${workspaceFolder}"
24 | },
25 | {
26 | "type": "lldb",
27 | "request": "launch",
28 | "name": "Debug unit tests in executable 'sirula'",
29 | "cargo": {
30 | "args": [
31 | "test",
32 | "--no-run",
33 | "--bin=sirula",
34 | "--package=sirula"
35 | ],
36 | "filter": {
37 | "name": "sirula",
38 | "kind": "bin"
39 | }
40 | },
41 | "args": [],
42 | "cwd": "${workspaceFolder}"
43 | }
44 | ]
45 | }
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "saveAndRun": {
3 | "commands": [
4 | {
5 | "match": ".rs",
6 | "cmd": "cargo check",
7 | "useShortcut": false,
8 | "silent": false
9 | },
10 | ]
11 | },
12 | "cSpell.enabled": false
13 | }
--------------------------------------------------------------------------------
/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "2.0.0",
3 | "tasks": [
4 | {
5 | "type": "cargo",
6 | "subcommand": "run",
7 | "problemMatcher": [
8 | "$rustc"
9 | ],
10 | "label": "Rust: cargo run - sirula",
11 | "group": {
12 | "kind": "build",
13 | "isDefault": true
14 | }
15 | },
16 | {
17 | "label": "Cargo release run",
18 | "type": "process",
19 | "command": "cargo",
20 | "args": [
21 | "run",
22 | "--release"
23 | ],
24 | "problemMatcher": [
25 | "$rustc"
26 | ]
27 | }
28 | ]
29 | }
--------------------------------------------------------------------------------
/COPYING:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
--------------------------------------------------------------------------------
/Cargo.lock:
--------------------------------------------------------------------------------
1 | # This file is automatically @generated by Cargo.
2 | # It is not intended for manual editing.
3 | version = 4
4 |
5 | [[package]]
6 | name = "aho-corasick"
7 | version = "0.7.18"
8 | source = "registry+https://github.com/rust-lang/crates.io-index"
9 | checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
10 | dependencies = [
11 | "memchr",
12 | ]
13 |
14 | [[package]]
15 | name = "anyhow"
16 | version = "1.0.44"
17 | source = "registry+https://github.com/rust-lang/crates.io-index"
18 | checksum = "61604a8f862e1d5c3229fdd78f8b02c68dcf73a4c4b05fd636d12240aaa242c1"
19 |
20 | [[package]]
21 | name = "arrayvec"
22 | version = "0.5.2"
23 | source = "registry+https://github.com/rust-lang/crates.io-index"
24 | checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
25 |
26 | [[package]]
27 | name = "atk"
28 | version = "0.15.1"
29 | source = "registry+https://github.com/rust-lang/crates.io-index"
30 | checksum = "2c3d816ce6f0e2909a96830d6911c2aff044370b1ef92d7f267b43bae5addedd"
31 | dependencies = [
32 | "atk-sys",
33 | "bitflags",
34 | "glib",
35 | "libc",
36 | ]
37 |
38 | [[package]]
39 | name = "atk-sys"
40 | version = "0.15.1"
41 | source = "registry+https://github.com/rust-lang/crates.io-index"
42 | checksum = "58aeb089fb698e06db8089971c7ee317ab9644bade33383f63631437b03aafb6"
43 | dependencies = [
44 | "glib-sys",
45 | "gobject-sys",
46 | "libc",
47 | "system-deps",
48 | ]
49 |
50 | [[package]]
51 | name = "autocfg"
52 | version = "1.0.1"
53 | source = "registry+https://github.com/rust-lang/crates.io-index"
54 | checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
55 |
56 | [[package]]
57 | name = "bitflags"
58 | version = "1.3.2"
59 | source = "registry+https://github.com/rust-lang/crates.io-index"
60 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
61 |
62 | [[package]]
63 | name = "bitvec"
64 | version = "0.19.5"
65 | source = "registry+https://github.com/rust-lang/crates.io-index"
66 | checksum = "8942c8d352ae1838c9dda0b0ca2ab657696ef2232a20147cf1b30ae1a9cb4321"
67 | dependencies = [
68 | "funty",
69 | "radium",
70 | "tap",
71 | "wyz",
72 | ]
73 |
74 | [[package]]
75 | name = "cairo-rs"
76 | version = "0.15.12"
77 | source = "registry+https://github.com/rust-lang/crates.io-index"
78 | checksum = "c76ee391b03d35510d9fa917357c7f1855bd9a6659c95a1b392e33f49b3369bc"
79 | dependencies = [
80 | "bitflags",
81 | "cairo-sys-rs",
82 | "glib",
83 | "libc",
84 | "thiserror",
85 | ]
86 |
87 | [[package]]
88 | name = "cairo-sys-rs"
89 | version = "0.15.1"
90 | source = "registry+https://github.com/rust-lang/crates.io-index"
91 | checksum = "3c55d429bef56ac9172d25fecb85dc8068307d17acd74b377866b7a1ef25d3c8"
92 | dependencies = [
93 | "glib-sys",
94 | "libc",
95 | "system-deps",
96 | ]
97 |
98 | [[package]]
99 | name = "cfg-expr"
100 | version = "0.10.3"
101 | source = "registry+https://github.com/rust-lang/crates.io-index"
102 | checksum = "0aacacf4d96c24b2ad6eb8ee6df040e4f27b0d0b39a5710c30091baa830485db"
103 | dependencies = [
104 | "smallvec",
105 | ]
106 |
107 | [[package]]
108 | name = "cfg-if"
109 | version = "1.0.0"
110 | source = "registry+https://github.com/rust-lang/crates.io-index"
111 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
112 |
113 | [[package]]
114 | name = "dirs"
115 | version = "4.0.0"
116 | source = "registry+https://github.com/rust-lang/crates.io-index"
117 | checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059"
118 | dependencies = [
119 | "dirs-sys",
120 | ]
121 |
122 | [[package]]
123 | name = "dirs-sys"
124 | version = "0.3.7"
125 | source = "registry+https://github.com/rust-lang/crates.io-index"
126 | checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6"
127 | dependencies = [
128 | "libc",
129 | "redox_users",
130 | "winapi",
131 | ]
132 |
133 | [[package]]
134 | name = "either"
135 | version = "1.9.0"
136 | source = "registry+https://github.com/rust-lang/crates.io-index"
137 | checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
138 |
139 | [[package]]
140 | name = "field-offset"
141 | version = "0.3.4"
142 | source = "registry+https://github.com/rust-lang/crates.io-index"
143 | checksum = "1e1c54951450cbd39f3dbcf1005ac413b49487dabf18a720ad2383eccfeffb92"
144 | dependencies = [
145 | "memoffset",
146 | "rustc_version",
147 | ]
148 |
149 | [[package]]
150 | name = "freedesktop_entry_parser"
151 | version = "1.2.0"
152 | source = "registry+https://github.com/rust-lang/crates.io-index"
153 | checksum = "347aa21b13048c0a0a4dc3118b661eb89d73ea675eca95b6a0f11e698ff66ec1"
154 | dependencies = [
155 | "nom",
156 | "thiserror",
157 | ]
158 |
159 | [[package]]
160 | name = "funty"
161 | version = "1.1.0"
162 | source = "registry+https://github.com/rust-lang/crates.io-index"
163 | checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7"
164 |
165 | [[package]]
166 | name = "futures"
167 | version = "0.3.21"
168 | source = "registry+https://github.com/rust-lang/crates.io-index"
169 | checksum = "f73fe65f54d1e12b726f517d3e2135ca3125a437b6d998caf1962961f7172d9e"
170 | dependencies = [
171 | "futures-channel",
172 | "futures-core",
173 | "futures-executor",
174 | "futures-io",
175 | "futures-sink",
176 | "futures-task",
177 | "futures-util",
178 | ]
179 |
180 | [[package]]
181 | name = "futures-channel"
182 | version = "0.3.21"
183 | source = "registry+https://github.com/rust-lang/crates.io-index"
184 | checksum = "c3083ce4b914124575708913bca19bfe887522d6e2e6d0952943f5eac4a74010"
185 | dependencies = [
186 | "futures-core",
187 | "futures-sink",
188 | ]
189 |
190 | [[package]]
191 | name = "futures-core"
192 | version = "0.3.21"
193 | source = "registry+https://github.com/rust-lang/crates.io-index"
194 | checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3"
195 |
196 | [[package]]
197 | name = "futures-executor"
198 | version = "0.3.21"
199 | source = "registry+https://github.com/rust-lang/crates.io-index"
200 | checksum = "9420b90cfa29e327d0429f19be13e7ddb68fa1cccb09d65e5706b8c7a749b8a6"
201 | dependencies = [
202 | "futures-core",
203 | "futures-task",
204 | "futures-util",
205 | ]
206 |
207 | [[package]]
208 | name = "futures-io"
209 | version = "0.3.21"
210 | source = "registry+https://github.com/rust-lang/crates.io-index"
211 | checksum = "fc4045962a5a5e935ee2fdedaa4e08284547402885ab326734432bed5d12966b"
212 |
213 | [[package]]
214 | name = "futures-macro"
215 | version = "0.3.21"
216 | source = "registry+https://github.com/rust-lang/crates.io-index"
217 | checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512"
218 | dependencies = [
219 | "proc-macro2",
220 | "quote",
221 | "syn",
222 | ]
223 |
224 | [[package]]
225 | name = "futures-sink"
226 | version = "0.3.21"
227 | source = "registry+https://github.com/rust-lang/crates.io-index"
228 | checksum = "21163e139fa306126e6eedaf49ecdb4588f939600f0b1e770f4205ee4b7fa868"
229 |
230 | [[package]]
231 | name = "futures-task"
232 | version = "0.3.21"
233 | source = "registry+https://github.com/rust-lang/crates.io-index"
234 | checksum = "57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a"
235 |
236 | [[package]]
237 | name = "futures-util"
238 | version = "0.3.21"
239 | source = "registry+https://github.com/rust-lang/crates.io-index"
240 | checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a"
241 | dependencies = [
242 | "futures-channel",
243 | "futures-core",
244 | "futures-io",
245 | "futures-macro",
246 | "futures-sink",
247 | "futures-task",
248 | "memchr",
249 | "pin-project-lite",
250 | "pin-utils",
251 | "slab",
252 | ]
253 |
254 | [[package]]
255 | name = "fuzzy-matcher"
256 | version = "0.3.7"
257 | source = "registry+https://github.com/rust-lang/crates.io-index"
258 | checksum = "54614a3312934d066701a80f20f15fa3b56d67ac7722b39eea5b4c9dd1d66c94"
259 | dependencies = [
260 | "thread_local",
261 | ]
262 |
263 | [[package]]
264 | name = "gdk"
265 | version = "0.15.4"
266 | source = "registry+https://github.com/rust-lang/crates.io-index"
267 | checksum = "a6e05c1f572ab0e1f15be94217f0dc29088c248b14f792a5ff0af0d84bcda9e8"
268 | dependencies = [
269 | "bitflags",
270 | "cairo-rs",
271 | "gdk-pixbuf",
272 | "gdk-sys",
273 | "gio",
274 | "glib",
275 | "libc",
276 | "pango",
277 | ]
278 |
279 | [[package]]
280 | name = "gdk-pixbuf"
281 | version = "0.15.11"
282 | source = "registry+https://github.com/rust-lang/crates.io-index"
283 | checksum = "ad38dd9cc8b099cceecdf41375bb6d481b1b5a7cd5cd603e10a69a9383f8619a"
284 | dependencies = [
285 | "bitflags",
286 | "gdk-pixbuf-sys",
287 | "gio",
288 | "glib",
289 | "libc",
290 | ]
291 |
292 | [[package]]
293 | name = "gdk-pixbuf-sys"
294 | version = "0.15.10"
295 | source = "registry+https://github.com/rust-lang/crates.io-index"
296 | checksum = "140b2f5378256527150350a8346dbdb08fadc13453a7a2d73aecd5fab3c402a7"
297 | dependencies = [
298 | "gio-sys",
299 | "glib-sys",
300 | "gobject-sys",
301 | "libc",
302 | "system-deps",
303 | ]
304 |
305 | [[package]]
306 | name = "gdk-sys"
307 | version = "0.15.1"
308 | source = "registry+https://github.com/rust-lang/crates.io-index"
309 | checksum = "32e7a08c1e8f06f4177fb7e51a777b8c1689f743a7bc11ea91d44d2226073a88"
310 | dependencies = [
311 | "cairo-sys-rs",
312 | "gdk-pixbuf-sys",
313 | "gio-sys",
314 | "glib-sys",
315 | "gobject-sys",
316 | "libc",
317 | "pango-sys",
318 | "pkg-config",
319 | "system-deps",
320 | ]
321 |
322 | [[package]]
323 | name = "getrandom"
324 | version = "0.2.7"
325 | source = "registry+https://github.com/rust-lang/crates.io-index"
326 | checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6"
327 | dependencies = [
328 | "cfg-if",
329 | "libc",
330 | "wasi",
331 | ]
332 |
333 | [[package]]
334 | name = "gio"
335 | version = "0.15.12"
336 | source = "registry+https://github.com/rust-lang/crates.io-index"
337 | checksum = "68fdbc90312d462781a395f7a16d96a2b379bb6ef8cd6310a2df272771c4283b"
338 | dependencies = [
339 | "bitflags",
340 | "futures-channel",
341 | "futures-core",
342 | "futures-io",
343 | "gio-sys",
344 | "glib",
345 | "libc",
346 | "once_cell",
347 | "thiserror",
348 | ]
349 |
350 | [[package]]
351 | name = "gio-sys"
352 | version = "0.15.10"
353 | source = "registry+https://github.com/rust-lang/crates.io-index"
354 | checksum = "32157a475271e2c4a023382e9cab31c4584ee30a97da41d3c4e9fdd605abcf8d"
355 | dependencies = [
356 | "glib-sys",
357 | "gobject-sys",
358 | "libc",
359 | "system-deps",
360 | "winapi",
361 | ]
362 |
363 | [[package]]
364 | name = "glib"
365 | version = "0.15.12"
366 | source = "registry+https://github.com/rust-lang/crates.io-index"
367 | checksum = "edb0306fbad0ab5428b0ca674a23893db909a98582969c9b537be4ced78c505d"
368 | dependencies = [
369 | "bitflags",
370 | "futures-channel",
371 | "futures-core",
372 | "futures-executor",
373 | "futures-task",
374 | "glib-macros",
375 | "glib-sys",
376 | "gobject-sys",
377 | "libc",
378 | "once_cell",
379 | "smallvec",
380 | "thiserror",
381 | ]
382 |
383 | [[package]]
384 | name = "glib-macros"
385 | version = "0.15.13"
386 | source = "registry+https://github.com/rust-lang/crates.io-index"
387 | checksum = "10c6ae9f6fa26f4fb2ac16b528d138d971ead56141de489f8111e259b9df3c4a"
388 | dependencies = [
389 | "anyhow",
390 | "heck",
391 | "proc-macro-crate",
392 | "proc-macro-error",
393 | "proc-macro2",
394 | "quote",
395 | "syn",
396 | ]
397 |
398 | [[package]]
399 | name = "glib-sys"
400 | version = "0.15.10"
401 | source = "registry+https://github.com/rust-lang/crates.io-index"
402 | checksum = "ef4b192f8e65e9cf76cbf4ea71fa8e3be4a0e18ffe3d68b8da6836974cc5bad4"
403 | dependencies = [
404 | "libc",
405 | "system-deps",
406 | ]
407 |
408 | [[package]]
409 | name = "gobject-sys"
410 | version = "0.15.10"
411 | source = "registry+https://github.com/rust-lang/crates.io-index"
412 | checksum = "0d57ce44246becd17153bd035ab4d32cfee096a657fc01f2231c9278378d1e0a"
413 | dependencies = [
414 | "glib-sys",
415 | "libc",
416 | "system-deps",
417 | ]
418 |
419 | [[package]]
420 | name = "gtk"
421 | version = "0.15.5"
422 | source = "registry+https://github.com/rust-lang/crates.io-index"
423 | checksum = "92e3004a2d5d6d8b5057d2b57b3712c9529b62e82c77f25c1fecde1fd5c23bd0"
424 | dependencies = [
425 | "atk",
426 | "bitflags",
427 | "cairo-rs",
428 | "field-offset",
429 | "futures-channel",
430 | "gdk",
431 | "gdk-pixbuf",
432 | "gio",
433 | "glib",
434 | "gtk-sys",
435 | "gtk3-macros",
436 | "libc",
437 | "once_cell",
438 | "pango",
439 | "pkg-config",
440 | ]
441 |
442 | [[package]]
443 | name = "gtk-layer-shell"
444 | version = "0.4.4"
445 | source = "registry+https://github.com/rust-lang/crates.io-index"
446 | checksum = "4316ff523ae445bd6efaf253f217598dd074619fe67b9199b5b0cd5ff99144da"
447 | dependencies = [
448 | "bitflags",
449 | "gdk",
450 | "glib",
451 | "glib-sys",
452 | "gtk",
453 | "gtk-layer-shell-sys",
454 | "libc",
455 | ]
456 |
457 | [[package]]
458 | name = "gtk-layer-shell-sys"
459 | version = "0.4.4"
460 | source = "registry+https://github.com/rust-lang/crates.io-index"
461 | checksum = "ff60230d690445577655416055dbd279d05631b03ab07f935e39f5fe81084c0a"
462 | dependencies = [
463 | "gdk-sys",
464 | "glib-sys",
465 | "gtk-sys",
466 | "libc",
467 | "system-deps",
468 | ]
469 |
470 | [[package]]
471 | name = "gtk-sys"
472 | version = "0.15.3"
473 | source = "registry+https://github.com/rust-lang/crates.io-index"
474 | checksum = "d5bc2f0587cba247f60246a0ca11fe25fb733eabc3de12d1965fc07efab87c84"
475 | dependencies = [
476 | "atk-sys",
477 | "cairo-sys-rs",
478 | "gdk-pixbuf-sys",
479 | "gdk-sys",
480 | "gio-sys",
481 | "glib-sys",
482 | "gobject-sys",
483 | "libc",
484 | "pango-sys",
485 | "system-deps",
486 | ]
487 |
488 | [[package]]
489 | name = "gtk3-macros"
490 | version = "0.15.6"
491 | source = "registry+https://github.com/rust-lang/crates.io-index"
492 | checksum = "684c0456c086e8e7e9af73ec5b84e35938df394712054550e81558d21c44ab0d"
493 | dependencies = [
494 | "anyhow",
495 | "proc-macro-crate",
496 | "proc-macro-error",
497 | "proc-macro2",
498 | "quote",
499 | "syn",
500 | ]
501 |
502 | [[package]]
503 | name = "heck"
504 | version = "0.4.0"
505 | source = "registry+https://github.com/rust-lang/crates.io-index"
506 | checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
507 |
508 | [[package]]
509 | name = "itertools"
510 | version = "0.8.2"
511 | source = "registry+https://github.com/rust-lang/crates.io-index"
512 | checksum = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484"
513 | dependencies = [
514 | "either",
515 | ]
516 |
517 | [[package]]
518 | name = "lazy_static"
519 | version = "1.4.0"
520 | source = "registry+https://github.com/rust-lang/crates.io-index"
521 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
522 |
523 | [[package]]
524 | name = "lexical-core"
525 | version = "0.7.6"
526 | source = "registry+https://github.com/rust-lang/crates.io-index"
527 | checksum = "6607c62aa161d23d17a9072cc5da0be67cdfc89d3afb1e8d9c842bebc2525ffe"
528 | dependencies = [
529 | "arrayvec",
530 | "bitflags",
531 | "cfg-if",
532 | "ryu",
533 | "static_assertions",
534 | ]
535 |
536 | [[package]]
537 | name = "libc"
538 | version = "0.2.126"
539 | source = "registry+https://github.com/rust-lang/crates.io-index"
540 | checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
541 |
542 | [[package]]
543 | name = "locale-types"
544 | version = "0.4.0"
545 | source = "registry+https://github.com/rust-lang/crates.io-index"
546 | checksum = "02be1c159bff06af0fdec8942a4f3a9242cc2ecebdfccb0d29d3c100ca5e7a97"
547 | dependencies = [
548 | "lazy_static",
549 | "regex",
550 | ]
551 |
552 | [[package]]
553 | name = "memchr"
554 | version = "2.6.2"
555 | source = "registry+https://github.com/rust-lang/crates.io-index"
556 | checksum = "5486aed0026218e61b8a01d5fbd5a0a134649abb71a0e53b7bc088529dced86e"
557 |
558 | [[package]]
559 | name = "memoffset"
560 | version = "0.6.4"
561 | source = "registry+https://github.com/rust-lang/crates.io-index"
562 | checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9"
563 | dependencies = [
564 | "autocfg",
565 | ]
566 |
567 | [[package]]
568 | name = "nom"
569 | version = "6.1.2"
570 | source = "registry+https://github.com/rust-lang/crates.io-index"
571 | checksum = "e7413f999671bd4745a7b624bd370a569fb6bc574b23c83a3c5ed2e453f3d5e2"
572 | dependencies = [
573 | "bitvec",
574 | "funty",
575 | "lexical-core",
576 | "memchr",
577 | "version_check",
578 | ]
579 |
580 | [[package]]
581 | name = "once_cell"
582 | version = "1.8.0"
583 | source = "registry+https://github.com/rust-lang/crates.io-index"
584 | checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56"
585 |
586 | [[package]]
587 | name = "osstrtools"
588 | version = "0.2.2"
589 | source = "git+https://github.com/Artturin/osstrtools.git?rev=6360f4f842eb542ff4e62e75851ea8ba83808471#6360f4f842eb542ff4e62e75851ea8ba83808471"
590 | dependencies = [
591 | "itertools",
592 | ]
593 |
594 | [[package]]
595 | name = "pango"
596 | version = "0.15.10"
597 | source = "registry+https://github.com/rust-lang/crates.io-index"
598 | checksum = "22e4045548659aee5313bde6c582b0d83a627b7904dd20dc2d9ef0895d414e4f"
599 | dependencies = [
600 | "bitflags",
601 | "glib",
602 | "libc",
603 | "once_cell",
604 | "pango-sys",
605 | ]
606 |
607 | [[package]]
608 | name = "pango-sys"
609 | version = "0.15.10"
610 | source = "registry+https://github.com/rust-lang/crates.io-index"
611 | checksum = "d2a00081cde4661982ed91d80ef437c20eacaf6aa1a5962c0279ae194662c3aa"
612 | dependencies = [
613 | "glib-sys",
614 | "gobject-sys",
615 | "libc",
616 | "system-deps",
617 | ]
618 |
619 | [[package]]
620 | name = "pest"
621 | version = "2.1.3"
622 | source = "registry+https://github.com/rust-lang/crates.io-index"
623 | checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53"
624 | dependencies = [
625 | "ucd-trie",
626 | ]
627 |
628 | [[package]]
629 | name = "pin-project-lite"
630 | version = "0.2.7"
631 | source = "registry+https://github.com/rust-lang/crates.io-index"
632 | checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443"
633 |
634 | [[package]]
635 | name = "pin-utils"
636 | version = "0.1.0"
637 | source = "registry+https://github.com/rust-lang/crates.io-index"
638 | checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
639 |
640 | [[package]]
641 | name = "pkg-config"
642 | version = "0.3.20"
643 | source = "registry+https://github.com/rust-lang/crates.io-index"
644 | checksum = "7c9b1041b4387893b91ee6746cddfc28516aff326a3519fb2adf820932c5e6cb"
645 |
646 | [[package]]
647 | name = "proc-macro-crate"
648 | version = "1.1.0"
649 | source = "registry+https://github.com/rust-lang/crates.io-index"
650 | checksum = "1ebace6889caf889b4d3f76becee12e90353f2b8c7d875534a71e5742f8f6f83"
651 | dependencies = [
652 | "thiserror",
653 | "toml",
654 | ]
655 |
656 | [[package]]
657 | name = "proc-macro-error"
658 | version = "1.0.4"
659 | source = "registry+https://github.com/rust-lang/crates.io-index"
660 | checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
661 | dependencies = [
662 | "proc-macro-error-attr",
663 | "proc-macro2",
664 | "quote",
665 | "syn",
666 | "version_check",
667 | ]
668 |
669 | [[package]]
670 | name = "proc-macro-error-attr"
671 | version = "1.0.4"
672 | source = "registry+https://github.com/rust-lang/crates.io-index"
673 | checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
674 | dependencies = [
675 | "proc-macro2",
676 | "quote",
677 | "version_check",
678 | ]
679 |
680 | [[package]]
681 | name = "proc-macro2"
682 | version = "1.0.66"
683 | source = "registry+https://github.com/rust-lang/crates.io-index"
684 | checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9"
685 | dependencies = [
686 | "unicode-ident",
687 | ]
688 |
689 | [[package]]
690 | name = "quote"
691 | version = "1.0.33"
692 | source = "registry+https://github.com/rust-lang/crates.io-index"
693 | checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
694 | dependencies = [
695 | "proc-macro2",
696 | ]
697 |
698 | [[package]]
699 | name = "radium"
700 | version = "0.5.3"
701 | source = "registry+https://github.com/rust-lang/crates.io-index"
702 | checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8"
703 |
704 | [[package]]
705 | name = "redox_syscall"
706 | version = "0.2.13"
707 | source = "registry+https://github.com/rust-lang/crates.io-index"
708 | checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42"
709 | dependencies = [
710 | "bitflags",
711 | ]
712 |
713 | [[package]]
714 | name = "redox_users"
715 | version = "0.4.3"
716 | source = "registry+https://github.com/rust-lang/crates.io-index"
717 | checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b"
718 | dependencies = [
719 | "getrandom",
720 | "redox_syscall",
721 | "thiserror",
722 | ]
723 |
724 | [[package]]
725 | name = "regex"
726 | version = "1.6.0"
727 | source = "registry+https://github.com/rust-lang/crates.io-index"
728 | checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b"
729 | dependencies = [
730 | "aho-corasick",
731 | "memchr",
732 | "regex-syntax",
733 | ]
734 |
735 | [[package]]
736 | name = "regex-syntax"
737 | version = "0.6.27"
738 | source = "registry+https://github.com/rust-lang/crates.io-index"
739 | checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244"
740 |
741 | [[package]]
742 | name = "rustc_version"
743 | version = "0.3.3"
744 | source = "registry+https://github.com/rust-lang/crates.io-index"
745 | checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee"
746 | dependencies = [
747 | "semver",
748 | ]
749 |
750 | [[package]]
751 | name = "ryu"
752 | version = "1.0.5"
753 | source = "registry+https://github.com/rust-lang/crates.io-index"
754 | checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
755 |
756 | [[package]]
757 | name = "semver"
758 | version = "0.11.0"
759 | source = "registry+https://github.com/rust-lang/crates.io-index"
760 | checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6"
761 | dependencies = [
762 | "semver-parser",
763 | ]
764 |
765 | [[package]]
766 | name = "semver-parser"
767 | version = "0.10.2"
768 | source = "registry+https://github.com/rust-lang/crates.io-index"
769 | checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7"
770 | dependencies = [
771 | "pest",
772 | ]
773 |
774 | [[package]]
775 | name = "serde"
776 | version = "1.0.185"
777 | source = "registry+https://github.com/rust-lang/crates.io-index"
778 | checksum = "be9b6f69f1dfd54c3b568ffa45c310d6973a5e5148fd40cf515acaf38cf5bc31"
779 |
780 | [[package]]
781 | name = "serde_derive"
782 | version = "1.0.138"
783 | source = "registry+https://github.com/rust-lang/crates.io-index"
784 | checksum = "023e9b1467aef8a10fb88f25611870ada9800ef7e22afce356bb0d2387b6f27c"
785 | dependencies = [
786 | "proc-macro2",
787 | "quote",
788 | "syn",
789 | ]
790 |
791 | [[package]]
792 | name = "shlex"
793 | version = "1.3.0"
794 | source = "registry+https://github.com/rust-lang/crates.io-index"
795 | checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
796 |
797 | [[package]]
798 | name = "sirula"
799 | version = "1.1.0"
800 | dependencies = [
801 | "freedesktop_entry_parser",
802 | "futures",
803 | "fuzzy-matcher",
804 | "gdk",
805 | "gdk-pixbuf",
806 | "gio",
807 | "glib",
808 | "gtk",
809 | "gtk-layer-shell",
810 | "libc",
811 | "locale-types",
812 | "osstrtools",
813 | "pango",
814 | "regex",
815 | "serde",
816 | "serde_derive",
817 | "shlex",
818 | "toml",
819 | "xdg",
820 | ]
821 |
822 | [[package]]
823 | name = "slab"
824 | version = "0.4.4"
825 | source = "registry+https://github.com/rust-lang/crates.io-index"
826 | checksum = "c307a32c1c5c437f38c7fd45d753050587732ba8628319fbdf12a7e289ccc590"
827 |
828 | [[package]]
829 | name = "smallvec"
830 | version = "1.9.0"
831 | source = "registry+https://github.com/rust-lang/crates.io-index"
832 | checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1"
833 |
834 | [[package]]
835 | name = "static_assertions"
836 | version = "1.1.0"
837 | source = "registry+https://github.com/rust-lang/crates.io-index"
838 | checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
839 |
840 | [[package]]
841 | name = "syn"
842 | version = "1.0.98"
843 | source = "registry+https://github.com/rust-lang/crates.io-index"
844 | checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd"
845 | dependencies = [
846 | "proc-macro2",
847 | "quote",
848 | "unicode-ident",
849 | ]
850 |
851 | [[package]]
852 | name = "system-deps"
853 | version = "6.0.2"
854 | source = "registry+https://github.com/rust-lang/crates.io-index"
855 | checksum = "a1a45a1c4c9015217e12347f2a411b57ce2c4fc543913b14b6fe40483328e709"
856 | dependencies = [
857 | "cfg-expr",
858 | "heck",
859 | "pkg-config",
860 | "toml",
861 | "version-compare",
862 | ]
863 |
864 | [[package]]
865 | name = "tap"
866 | version = "1.0.1"
867 | source = "registry+https://github.com/rust-lang/crates.io-index"
868 | checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
869 |
870 | [[package]]
871 | name = "thiserror"
872 | version = "1.0.30"
873 | source = "registry+https://github.com/rust-lang/crates.io-index"
874 | checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417"
875 | dependencies = [
876 | "thiserror-impl",
877 | ]
878 |
879 | [[package]]
880 | name = "thiserror-impl"
881 | version = "1.0.30"
882 | source = "registry+https://github.com/rust-lang/crates.io-index"
883 | checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b"
884 | dependencies = [
885 | "proc-macro2",
886 | "quote",
887 | "syn",
888 | ]
889 |
890 | [[package]]
891 | name = "thread_local"
892 | version = "1.1.3"
893 | source = "registry+https://github.com/rust-lang/crates.io-index"
894 | checksum = "8018d24e04c95ac8790716a5987d0fec4f8b27249ffa0f7d33f1369bdfb88cbd"
895 | dependencies = [
896 | "once_cell",
897 | ]
898 |
899 | [[package]]
900 | name = "toml"
901 | version = "0.5.9"
902 | source = "registry+https://github.com/rust-lang/crates.io-index"
903 | checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7"
904 | dependencies = [
905 | "serde",
906 | ]
907 |
908 | [[package]]
909 | name = "ucd-trie"
910 | version = "0.1.3"
911 | source = "registry+https://github.com/rust-lang/crates.io-index"
912 | checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c"
913 |
914 | [[package]]
915 | name = "unicode-ident"
916 | version = "1.0.1"
917 | source = "registry+https://github.com/rust-lang/crates.io-index"
918 | checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c"
919 |
920 | [[package]]
921 | name = "version-compare"
922 | version = "0.1.0"
923 | source = "registry+https://github.com/rust-lang/crates.io-index"
924 | checksum = "fe88247b92c1df6b6de80ddc290f3976dbdf2f5f5d3fd049a9fb598c6dd5ca73"
925 |
926 | [[package]]
927 | name = "version_check"
928 | version = "0.9.3"
929 | source = "registry+https://github.com/rust-lang/crates.io-index"
930 | checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe"
931 |
932 | [[package]]
933 | name = "wasi"
934 | version = "0.11.0+wasi-snapshot-preview1"
935 | source = "registry+https://github.com/rust-lang/crates.io-index"
936 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
937 |
938 | [[package]]
939 | name = "winapi"
940 | version = "0.3.9"
941 | source = "registry+https://github.com/rust-lang/crates.io-index"
942 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
943 | dependencies = [
944 | "winapi-i686-pc-windows-gnu",
945 | "winapi-x86_64-pc-windows-gnu",
946 | ]
947 |
948 | [[package]]
949 | name = "winapi-i686-pc-windows-gnu"
950 | version = "0.4.0"
951 | source = "registry+https://github.com/rust-lang/crates.io-index"
952 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
953 |
954 | [[package]]
955 | name = "winapi-x86_64-pc-windows-gnu"
956 | version = "0.4.0"
957 | source = "registry+https://github.com/rust-lang/crates.io-index"
958 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
959 |
960 | [[package]]
961 | name = "wyz"
962 | version = "0.2.0"
963 | source = "registry+https://github.com/rust-lang/crates.io-index"
964 | checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214"
965 |
966 | [[package]]
967 | name = "xdg"
968 | version = "2.4.1"
969 | source = "registry+https://github.com/rust-lang/crates.io-index"
970 | checksum = "0c4583db5cbd4c4c0303df2d15af80f0539db703fa1c68802d4cbbd2dd0f88f6"
971 | dependencies = [
972 | "dirs",
973 | ]
974 |
--------------------------------------------------------------------------------
/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "sirula"
3 | version = "1.1.0"
4 | authors = ["Dorian Rudolph", "Jan Luca"]
5 | edition = "2021"
6 |
7 | [dependencies]
8 | freedesktop_entry_parser = "1.2.0"
9 | locale-types = "0.4.0"
10 | libc = "0.2.103"
11 | gtk-layer-shell = "0.4.1"
12 | gtk = { version = "0.15.5", features = ["v3_22"] }
13 | gio = { version = "0.15.12", features = ["v2_60"] }
14 | gdk = "0.15.4"
15 | pango = "0.15.4"
16 | gdk-pixbuf = "0.15.11"
17 | glib = "0.15.12"
18 | futures = "0.3.21"
19 | fuzzy-matcher = "0.3.7"
20 | xdg = "2.4.1"
21 | serde = "1.0.138"
22 | serde_derive = "1.0.138"
23 | toml = "0.5.9"
24 | regex = "1.6.0"
25 | osstrtools = {git = "https://github.com/Artturin/osstrtools.git", rev="6360f4f842eb542ff4e62e75851ea8ba83808471"}
26 | shlex = "1.3.0"
27 |
28 | [profile.release]
29 | lto = true
30 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Sirula
2 |
3 | Sirula (simple rust launcher) is an app launcher for wayland.
4 | Currently, the only feature is launching apps from `.desktop` files.
5 | Feel free to submit pull requests for any feature you like.
6 |
7 | I wrote sirula partially to learn rust, so do not expect perfect rust code.
8 | I'd be happy to hear any criticism of my code.
9 |
10 | ## Examples
11 |
12 | `sample-config/a`:
13 |
14 | 
15 | [open](https://raw.githubusercontent.com/DorianRudolph/sirula/master/sample-config/sirula.gif)
16 |
17 | `sample-config/b`: Overlay in the center of the screen.
18 |
19 | 
20 | ## Building
21 |
22 | - Dependency: [gtk-layer-shell](https://github.com/wmww/gtk-layer-shell)
23 | - Build: `cargo build --release`
24 | - Optionally, `strip` the binary to reduce size
25 | - Alternatively, install with `cargo install --path .`
26 | - There is also an unofficial [AUR package](https://aur.archlinux.org/packages/sirula-git/)
27 |
28 | ## Configuration
29 |
30 | Use `config.toml` and `style.css` in your `.config/sirula` directory.
31 | See `sample-config` for documentation.
--------------------------------------------------------------------------------
/sample-config/a/config.toml:
--------------------------------------------------------------------------------
1 | markup_highlight = 'foreground="#dc69ff" underline="double"'
--------------------------------------------------------------------------------
/sample-config/a/readme.md:
--------------------------------------------------------------------------------
1 | # Config A
2 |
3 | 
4 |
--------------------------------------------------------------------------------
/sample-config/a/sirula.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DorianRudolph/sirula/83efe28847060c30be311f6861e71bef6a407718/sample-config/a/sirula.gif
--------------------------------------------------------------------------------
/sample-config/a/style.css:
--------------------------------------------------------------------------------
1 | /*
2 | Sirula uses GTK and can be themed with CSS (https://developer.gnome.org/gtk3/stable/chap-css-overview.html)
3 | This theme was tested on top of Adwaita-Dark.
4 | See consts.rs for a list of defined classes and names.
5 |
6 | The style.css can be omitted but sirula will not look very nice since there are no hardcoded margins.
7 |
8 | To remove the global theme completely, use
9 | * { all: unset; }
10 | */
11 |
12 | * {
13 | font-family: Iosevka;
14 | font-size: 16px;
15 | }
16 |
17 | .background {
18 | background: transparent;
19 | }
20 |
21 | #root-box, .background, #app-list, .overlay-indicator {
22 | background: transparent;
23 | }
24 |
25 | .app-row {
26 | transition: unset;
27 | border-radius: 4px;
28 | padding: 5px;
29 | margin: 0 3px;
30 | background-clip: padding-box;
31 | }
32 |
33 | .app-row:focus {
34 | outline: unset;
35 | }
36 |
37 | .app-row:hover:selected {
38 | background-color: alpha(white, 0.1);
39 | }
40 |
41 | .app-row:hover {
42 | background-color: alpha(white, 0.035);
43 | }
44 |
45 | .app-row:selected {
46 | background-color: alpha(white, 0.05);
47 | }
48 |
49 |
50 | .app-row:hover.selected {
51 | background-color: alpha(white, 0.1);
52 | }
53 |
54 | .app-label {
55 | margin-left: 10px;
56 | }
57 |
58 | #app-list {
59 | padding: 0 5px;
60 | }
61 |
62 |
63 | #root-box {
64 | min-width: 300px;
65 | }
66 |
67 | scrollbar.vertical slider {
68 | background-color: alpha(white, 0.15);
69 | }
70 |
71 | #search {
72 | background: transparent;
73 | border: unset;
74 | outline: unset;
75 | box-shadow: inset 0px 0px 0px 1px alpha(#dc69ff, 0.5);
76 | margin: 10px 5px 10px 5px;
77 | font-size: 18px;
78 | padding: 2px 8px;
79 | }
80 |
81 | selection {
82 | background-color: alpha(#dc69ff, 0.5);
83 | }
84 |
--------------------------------------------------------------------------------
/sample-config/b/config.toml:
--------------------------------------------------------------------------------
1 | markup_highlight = 'underline="low"'
2 | exclusive = true
3 | lines = 1
4 | icon_size = 32
5 | anchor_left = false
6 | anchor_right = false
7 | anchor_top = false
8 | anchor_bottom = false
9 | margin_top = 1
10 | margin_bottom = 0
11 | margin_left = 0
12 | margin_right = 0
13 | width = 400
14 | height = 800
15 | command_prefix = ":"
--------------------------------------------------------------------------------
/sample-config/b/readme.md:
--------------------------------------------------------------------------------
1 | # Config E
2 |
3 | 
4 |
--------------------------------------------------------------------------------
/sample-config/b/sirula.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DorianRudolph/sirula/83efe28847060c30be311f6861e71bef6a407718/sample-config/b/sirula.png
--------------------------------------------------------------------------------
/sample-config/b/style.css:
--------------------------------------------------------------------------------
1 | .app-row {
2 | transition: unset;
3 | padding: 5px 0 5px 10px;
4 | }
5 |
6 | .app-label {
7 | margin-left: 10px;
8 | font-family: Iosevka;
9 | font-size: 16px;
10 | }
11 |
12 | #root-box {
13 | border: 1px solid black;
14 | }
15 |
16 | #search {
17 | font-size: 18px;
18 | padding: 2px 8px;
19 | margin: 5px;
20 | }
--------------------------------------------------------------------------------
/sample-config/c/README.md:
--------------------------------------------------------------------------------
1 | # config-c
2 |
3 | 
4 |
--------------------------------------------------------------------------------
/sample-config/c/config.toml:
--------------------------------------------------------------------------------
1 | markup_highlight = 'underline="low" weight="bold"'
2 | #markup_extra = 'foreground="blue"'
3 | #markup_default = 'foreground="yellow"'
4 | exclusive = true
5 | lines = 1
6 | icon_size = 20
7 | anchor_left = false
8 | anchor_right = false
9 | anchor_top = false
10 | anchor_bottom = false
11 | margin_top = 1
12 | margin_bottom = 0
13 | margin_left = 0
14 | margin_right = 0
15 | width = 750
16 | height = 450
17 |
--------------------------------------------------------------------------------
/sample-config/c/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DorianRudolph/sirula/83efe28847060c30be311f6861e71bef6a407718/sample-config/c/screenshot.png
--------------------------------------------------------------------------------
/sample-config/c/style.css:
--------------------------------------------------------------------------------
1 | .app-row {
2 | transition: unset;
3 | padding: 5px 0 5px 10px;
4 | background-color: #263238;
5 | }
6 |
7 | .app-row:selected {
8 | background-color: #37474F;
9 | }
10 |
11 | .app-label {
12 | margin-left: 10px;
13 | font-family: Roboto;
14 | font-size: 14px;
15 | font-weight: 300;
16 | }
17 |
18 | .app-list {
19 | background-color: #f00;
20 | }
21 |
22 | #root-box {
23 | border: 3px solid #263238;
24 | border-radius: 5px 5px 5px 5px;
25 | box-shadow: 0 19px 38px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22);
26 | margin: 100px;
27 | background-color: #263238;
28 | }
29 |
30 | #search {
31 | font-family: Roboto;
32 | font-size: 14px;
33 | padding: 2px 8px;
34 | margin: 5px;
35 | }
--------------------------------------------------------------------------------
/sample-config/d/config.toml:
--------------------------------------------------------------------------------
1 | markup_highlight = 'underline="low"'
2 | exclusive = true
3 | lines = 10
4 | icon_size = 48
5 | anchor_left = false
6 | anchor_right = false
7 | anchor_top = false
8 | anchor_bottom = false
9 | margin_top = 0
10 | margin_bottom = 0
11 | margin_left = 0
12 | margin_right = 0
13 | width = 600
14 | height = 400
15 |
--------------------------------------------------------------------------------
/sample-config/d/readme.md:
--------------------------------------------------------------------------------
1 | # Config D
2 |
3 | 
4 |
--------------------------------------------------------------------------------
/sample-config/d/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DorianRudolph/sirula/83efe28847060c30be311f6861e71bef6a407718/sample-config/d/screenshot.png
--------------------------------------------------------------------------------
/sample-config/d/style.css:
--------------------------------------------------------------------------------
1 | * {
2 | background-clip: padding-box;
3 | border-radius: 8px;
4 | }
5 |
6 | /* GtkApplicationWindow */
7 | .background {
8 | opacity: 1;
9 | background: transparent;
10 | font-family: Rubik, sans-serif;
11 | color: @fg_color;
12 | }
13 |
14 | #root-box {
15 | /* Seems like this isn't really the root */
16 | background: transparent;
17 | }
18 |
19 | #search {
20 | font-size: 1.5em;
21 | font-weight: 500;
22 | padding: 8px 11px;
23 | margin-bottom: 6px;
24 |
25 | color: inherit;
26 | /*box-shadow: red 3px 3px 3px; */ /* We'd need a way to set the z index */
27 | }
28 |
29 | #scroll { /*background: transparent;*/ /* It never actually turns transparent */ }
30 |
31 | .app-list { /*background: transparent;*/ }
32 |
33 | .frame {
34 | /*opacity: 0.5;*/
35 | /*border-radius: 40px; *//* We'd need clipping to be effective */
36 | background: transparent;
37 | }
38 |
39 | .app-row {
40 | transition: unset;
41 | padding: 6px 0;
42 | /*background-color: transparent;*/
43 | /*border-radius: 1rem;*/ /*Clipping works kind of here*/
44 | box-shadow: lightgray 0 4px 4px;
45 | }
46 |
47 | .app-label {
48 | padding-left: 1em;
49 | font-size: 16px;
50 | border: none;
51 | }
52 |
53 | .app-icon {
54 | border-radius: 1rem;
55 | margin: 0 8px;
56 | }
57 |
--------------------------------------------------------------------------------
/sample-config/default-config.toml:
--------------------------------------------------------------------------------
1 | # This config file serves as documentation and contains the default values. You are free to omit all values.
2 |
3 | exclusive = true # push all windows aside or appear above existing windows
4 | icon_size = 64 # icon size in pixels
5 | lines = 2 # maximum number of lines of app labels
6 |
7 | # markup for app labels
8 | # it seems impossible to theme only parts of a label with CSS
9 | # therefore, we need to use pango directly
10 | # you can use all attributes of the tag (https://developer.gnome.org/pygtk/stable/pango-markup-language.html)
11 | markup_default = ''
12 | # an extra field is appended to the app name (e.g., evince calls itself just "Document Viewer")
13 | markup_extra = 'font_style="italic" font_size="smaller"'
14 | markup_highlight = 'foreground="red" underline="double"' # highlight matched characters
15 |
16 | # anchor window to screen edge
17 | anchor_left = false
18 | anchor_right = true
19 | anchor_top = true
20 | anchor_bottom = true
21 |
22 | # margin of window to screen edge
23 | margin_top = 0
24 | margin_bottom = 0
25 | margin_left = 0
26 | margin_right = 0
27 |
28 | # set width or height (-1 is unset)
29 | width = -1
30 | height = -1
31 |
32 | # close window on unfocus
33 | close_on_unfocus = true
34 |
35 | # specify extra field to be displayed alongside the name (may be empty)
36 | extra_field = ["id_suffix"] # variants: id, id_suffix, executable, command_line
37 | extra_field_newline = false # show extra field under name and not alongside
38 | hide_extra_if_contained = true # hide extra field if it is already contained in the app name
39 |
40 | hidden_fields = [] # list of fields considered for search but hidden
41 |
42 | exclude = [] # list of regexes for excluded app ids (name of the .desktop file)
43 |
44 | # launch apps in cgroups via systemd for better app management and detection
45 | cgroups = true
46 |
47 | # prefix for running commands instead of launching an app (e.g., `:xeyes` to launch xeyes)
48 | # use "" to disable launching commands
49 | command_prefix = ":"
50 |
51 | frequent_first = false # sort matches of equal quality by most frequently used
52 | recent_first = true # sort matches of equal quality by most recently used
53 | # when both frequent_first and recent_first are set,
54 | # sorting is by frequency first, and recency is used to break ties in frequency
55 |
56 | # if history item is older than this many days, drop it from the history (0 is unset)
57 | prune_history = 0
58 |
59 | # term_command = "alacritty -e {}" # command for applications run in terminal (default uses "$TERMINAL -e")
60 |
61 | # specify name overrides (id is the name of the desktop file)
62 | [name_overrides]
63 | # id = "name\rextra"
64 |
--------------------------------------------------------------------------------
/sample-config/e/config.toml:
--------------------------------------------------------------------------------
1 | markup_highlight = 'underline="low"'
2 | command_prefix = ":"
3 | lines = 2
4 | icon_size = 48
5 |
6 | extra_field = ["comment"]
7 | extra_field_newline = true
8 | hidden_fields = ["commandline", "executable"]
9 | markup_extra = 'font_size="smaller"'
10 |
11 | frequent_first = true
12 | recent_first = true
13 | cgroups = true
14 | term_command = "footclient {}"
15 | close_on_unfocus = true
16 | prune_history = 360
17 |
18 | exclusive = false
19 | anchor_left = false
20 | anchor_right = false
21 | anchor_top = true
22 | anchor_bottom = false
23 | margin_top = 300
24 | margin_bottom = 0
25 | margin_left = 0
26 | margin_right = 0
27 | width = 400
28 | height = 550
29 |
--------------------------------------------------------------------------------
/sample-config/e/readme.md:
--------------------------------------------------------------------------------
1 | # Config E
2 |
3 | 
4 |
--------------------------------------------------------------------------------
/sample-config/e/sirula.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DorianRudolph/sirula/83efe28847060c30be311f6861e71bef6a407718/sample-config/e/sirula.gif
--------------------------------------------------------------------------------
/sample-config/e/style.css:
--------------------------------------------------------------------------------
1 | * {
2 | background-clip: padding-box;
3 | border-radius: 10px;
4 | text-shadow: none;
5 | outline: none;
6 | box-shadow: none;
7 | color: white;
8 | background: transparent;
9 | }
10 |
11 | /* GtkApplicationWindow */
12 | .background {
13 | opacity: 1;
14 | font-family: Rubik, sans-serif;
15 | }
16 |
17 | #root-box {}
18 |
19 | #app-list, #search {
20 | background: alpha(#04232A, 0.8);
21 | }
22 |
23 | #search {
24 | font-size: 1.5em;
25 | font-weight: 500;
26 | padding: 8px 11px;
27 | margin-bottom: 6px;
28 | border: 3px solid #8000ff;
29 | }
30 |
31 | .app-row {
32 | border-radius: 10px;
33 | transition: 0.2s;
34 | padding: 6px 16px 6px 0;
35 | opacity: 0.95;
36 | }
37 |
38 | .app-row:selected, .app-row:hover {
39 | padding-left: 8px;
40 | padding-right: 8px;
41 | opacity: 1;
42 | background-color: alpha(#8000ff, 0.8);
43 | outline: none;
44 | }
45 |
46 | .app-label {
47 | padding-left: 1em;
48 | font-size: 16px;
49 | border: none;
50 | }
51 |
52 | .app-icon {
53 | border-radius: 1rem;
54 | margin: 0 8px;
55 | }
56 |
--------------------------------------------------------------------------------
/src/app_entry.rs:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of sirula.
3 |
4 | Copyright (C) 2020 Dorian Rudolph
5 |
6 | sirula is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | sirula is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with sirula. If not, see .
18 | */
19 |
20 | use crate::locale::string_collate;
21 | use fuzzy_matcher::{skim::SkimMatcherV2, FuzzyMatcher};
22 | use gio::AppInfo;
23 | use glib::shell_unquote;
24 | use gtk::{
25 | builders::{BoxBuilder, ImageBuilder, LabelBuilder},
26 | prelude::*,
27 | IconLookupFlags, IconTheme, Label, ListBoxRow, Orientation,
28 | };
29 | use pango::{AttrList, Attribute, EllipsizeMode};
30 | use std::cmp::Ordering;
31 | use std::collections::HashMap;
32 |
33 | use super::{consts::*, Config, Field, HistoryData};
34 | use regex::RegexSet;
35 |
36 | #[derive(Eq)]
37 | pub struct AppEntry {
38 | pub display_string: String,
39 | pub search_string: String,
40 | pub extra_range: Option<(u32, u32)>,
41 | pub info: AppInfo,
42 | pub label: Label,
43 | pub score: i64,
44 | pub history: HistoryData,
45 | }
46 |
47 | impl AppEntry {
48 | pub fn update_match(&mut self, pattern: &str, matcher: &SkimMatcherV2, config: &Config) {
49 | self.set_markup(config);
50 |
51 | let attr_list = self.label.attributes().unwrap_or_default();
52 | self.score = if pattern.is_empty() {
53 | self.label.set_attributes(None);
54 | 100
55 | } else if let Some((score, indices)) = matcher.fuzzy_indices(&self.search_string, pattern) {
56 | let mut chars = vec![];
57 | for cur in self.search_string.as_str().char_indices() {
58 | chars.push(cur);
59 | }
60 | chars.push((self.search_string.len(), ' '));
61 |
62 | for i in indices {
63 | if i < self.display_string.len() {
64 | let i = i as usize;
65 | add_attrs(
66 | &attr_list,
67 | &config.markup_highlight,
68 | chars[i].0 as u32,
69 | chars[i + 1].0 as u32,
70 | );
71 | }
72 | }
73 | score
74 | } else {
75 | 0
76 | };
77 |
78 | self.label.set_attributes(Some(&attr_list));
79 | }
80 |
81 | pub fn hide(&mut self) {
82 | self.score = 0;
83 | }
84 |
85 | pub fn hidden(&self) -> bool {
86 | 0 == self.score
87 | }
88 |
89 | fn set_markup(&self, config: &Config) {
90 | let attr_list = AttrList::new();
91 |
92 | add_attrs(
93 | &attr_list,
94 | &config.markup_default,
95 | 0,
96 | self.display_string.len() as u32,
97 | );
98 | if let Some((lo, hi)) = self.extra_range {
99 | add_attrs(&attr_list, &config.markup_extra, lo, hi);
100 | }
101 | self.label.set_attributes(Some(&attr_list));
102 | }
103 | }
104 |
105 | impl PartialEq for AppEntry {
106 | fn eq(&self, other: &Self) -> bool {
107 | self.score.eq(&other.score) && self.history.eq(&other.history)
108 | }
109 | }
110 |
111 | impl Ord for AppEntry {
112 | fn cmp(&self, other: &Self) -> Ordering {
113 | match self.score.cmp(&other.score) {
114 | Ordering::Equal => match self.history.usage_count.cmp(&other.history.usage_count) {
115 | Ordering::Equal => match self.history.last_used.cmp(&other.history.last_used) {
116 | Ordering::Equal => string_collate(&self.display_string, &other.display_string),
117 | ord => ord.reverse(),
118 | },
119 | ord => ord.reverse(),
120 | },
121 | ord => ord.reverse(),
122 | }
123 | }
124 | }
125 |
126 | impl PartialOrd for AppEntry {
127 | fn partial_cmp(&self, other: &Self) -> Option {
128 | Some(self.cmp(other))
129 | }
130 | }
131 |
132 | fn get_app_field(app: &AppInfo, field: Field) -> Option {
133 | match field {
134 | Field::Comment => app.description().map(Into::into),
135 | Field::Id => app
136 | .id()
137 | .and_then(|s| s.to_string().strip_suffix(".desktop").map(Into::into)),
138 | Field::IdSuffix => app.id().and_then(|id| {
139 | let id = id.to_string();
140 | let parts: Vec<&str> = id.split('.').collect();
141 | parts.get(parts.len() - 2).map(|s| s.to_string())
142 | }),
143 | Field::Executable => app
144 | .executable()
145 | .file_name()
146 | .and_then(|e| shell_unquote(e).ok())
147 | .map(|s| s.to_string_lossy().to_string()),
148 | //TODO: clean up command line from % for all what is not done in launch_app() in src/util.rx
149 | Field::Commandline => app.commandline().map(|s| s.to_string_lossy().to_string()),
150 | }
151 | }
152 |
153 | fn add_attrs(list: &AttrList, attrs: &Vec, start: u32, end: u32) {
154 | for attr in attrs {
155 | let mut attr = attr.clone();
156 | attr.set_start_index(start);
157 | attr.set_end_index(end);
158 | list.insert(attr);
159 | }
160 | }
161 |
162 | pub fn load_entries(
163 | config: &Config,
164 | history: &HashMap,
165 | ) -> HashMap {
166 | let mut entries = HashMap::new();
167 | let icon_theme = IconTheme::default().unwrap();
168 | let apps = gio::AppInfo::all();
169 | let exclude = RegexSet::new(&config.exclude).expect("Invalid regex");
170 |
171 | for app in apps {
172 | if !app.should_show() {
173 | continue;
174 | }
175 |
176 | let name = app.display_name().to_string();
177 |
178 | let id = match app.id() {
179 | Some(id) => id.to_string(),
180 | _ => continue,
181 | };
182 |
183 | if exclude.is_match(&id) {
184 | continue;
185 | }
186 |
187 | let (display_string, extra_range) = if let Some(name) =
188 | get_app_field(&app, Field::Id).and_then(|id| config.name_overrides.get(&id))
189 | {
190 | let i = name.find('\r');
191 | (
192 | name.replace('\r', " "),
193 | i.map(|i| (i as u32 + 1, name.len() as u32)),
194 | )
195 | } else {
196 | let extra = config
197 | .extra_field
198 | .get(0)
199 | .and_then(|f| get_app_field(&app, *f));
200 | match extra {
201 | Some(e)
202 | if (!config.hide_extra_if_contained
203 | || !name.to_lowercase().contains(&e.to_lowercase())) =>
204 | {
205 | (
206 | format!("{}{}{}",
207 | name,
208 | if config.extra_field_newline {"\n"} else {" "},
209 | e
210 | ),
211 | Some((
212 | name.len() as u32 + 1,
213 | name.len() as u32 + 1 + e.len() as u32,
214 | )),
215 | )
216 | }
217 | _ => (name, None),
218 | }
219 | };
220 |
221 | let hidden = config
222 | .hidden_fields
223 | .iter()
224 | .map(|f| get_app_field(&app, *f).unwrap_or_default())
225 | .collect::>()
226 | .join(" ");
227 |
228 | let search_string = if hidden.is_empty() {
229 | display_string.clone()
230 | } else {
231 | format!("{} {}", display_string, hidden)
232 | };
233 |
234 | let label = LabelBuilder::new()
235 | .xalign(0.0f32)
236 | .label(&display_string)
237 | .wrap(true)
238 | .ellipsize(EllipsizeMode::End)
239 | .lines(config.lines)
240 | .build();
241 | label.style_context().add_class(APP_LABEL_CLASS);
242 |
243 | let image = ImageBuilder::new().pixel_size(config.icon_size).build();
244 | if let Some(icon) = app.icon() {
245 | // Don't set the icon if it'd give us an ugly fallback icon
246 | if icon_theme
247 | .lookup_by_gicon(&icon, config.icon_size, IconLookupFlags::FORCE_SIZE)
248 | .is_some()
249 | {
250 | image.set_from_gicon(&icon, gtk::IconSize::Menu);
251 | }
252 | }
253 | image.style_context().add_class(APP_ICON_CLASS);
254 |
255 | let hbox = BoxBuilder::new()
256 | .orientation(Orientation::Horizontal)
257 | .build();
258 | hbox.pack_start(&image, false, false, 0);
259 | hbox.pack_end(&label, true, true, 0);
260 |
261 | let row = ListBoxRow::new();
262 | row.add(&hbox);
263 | row.style_context().add_class(APP_ROW_CLASS);
264 |
265 | let history_data = history.get(&id).copied().unwrap_or_default();
266 | let last_used = if config.recent_first {
267 | history_data.last_used
268 | } else {
269 | 0
270 | };
271 | let usage_count = if config.frequent_first {
272 | history_data.usage_count
273 | } else {
274 | 0
275 | };
276 |
277 | let app_entry = AppEntry {
278 | display_string,
279 | search_string,
280 | extra_range,
281 | info: app,
282 | label,
283 | score: 100,
284 | history: HistoryData {
285 | last_used,
286 | usage_count,
287 | },
288 | };
289 | app_entry.set_markup(config);
290 | entries.insert(row, app_entry);
291 | }
292 | entries
293 | }
294 |
--------------------------------------------------------------------------------
/src/config.rs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2020 Dorian Rudolph
3 |
4 | sirula is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 |
9 | sirula is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with sirula. If not, see .
16 | */
17 |
18 | use super::consts::*;
19 | use super::util::get_config_file;
20 | use pango::Attribute;
21 | use serde::{de::Error, Deserializer};
22 | use serde_derive::Deserialize;
23 | use std::collections::HashMap;
24 |
25 | macro_rules! make_config {
26 | ($name:ident { $($field:ident : $type:ty $( = ($default:expr) $field_str:literal )? $( [$serde_opts:expr])? ),* }) => {
27 | #[derive(Deserialize, Debug)]
28 | pub struct $name { $(
29 | #[serde( $(default = $field_str )? )]
30 | $(#[serde($serde_opts)])?
31 | pub $field: $type,
32 | )* }
33 | $( $( fn $field() -> $type { $default } )? )*
34 | };
35 | }
36 |
37 | #[derive(Deserialize, Debug, Copy, Clone)]
38 | #[serde(rename_all = "snake_case")]
39 | pub enum Field {
40 | Comment,
41 | Id,
42 | IdSuffix,
43 | Executable,
44 | Commandline,
45 | }
46 |
47 | // not sure how to avoid having to specify the name twice
48 | make_config!(Config {
49 | markup_default: Vec = (Vec::new()) "markup_default" [deserialize_with = "deserialize_markup"],
50 | markup_highlight: Vec = (parse_attributes("foreground=\"red\" underline=\"double\"").unwrap()) "markup_highlight" [deserialize_with = "deserialize_markup"],
51 | markup_extra: Vec = (parse_attributes("font_style=\"italic\" font_size=\"smaller\"").unwrap()) "markup_extra" [deserialize_with = "deserialize_markup"],
52 | exclusive: bool = (true) "exclusive",
53 | frequent_first: bool = (false) "frequent_first",
54 | recent_first: bool = (true) "recent_first",
55 | prune_history: u32 = (0) "prune_history",
56 | icon_size: i32 = (64) "icon_size",
57 | lines: i32 = (2) "lines",
58 | margin_left: i32 = (0) "margin_left",
59 | margin_right: i32 = (0) "margin_right",
60 | margin_top: i32 = (0) "margin_top",
61 | margin_bottom: i32 = (0) "margin_bottom",
62 | anchor_left: bool = (false) "anchor_left",
63 | anchor_right: bool = (true) "anchor_right",
64 | anchor_top: bool = (true) "anchor_top",
65 | anchor_bottom: bool = (true) "anchor_bottom",
66 | width: i32 = (-1) "width",
67 | height: i32 = (-1) "height",
68 | extra_field: Vec = (vec![Field::IdSuffix]) "extra_field",
69 | extra_field_newline: bool = (false) "extra_field_newline",
70 | hidden_fields: Vec = (Vec::new()) "hidden_fields",
71 | name_overrides: HashMap = (HashMap::new()) "name_overrides",
72 | hide_extra_if_contained: bool = (true) "hide_extra_if_contained",
73 | cgroups: bool = (true) "cgroups",
74 | command_prefix: String = (":".into()) "command_prefix",
75 | exclude: Vec = (Vec::new()) "exclude",
76 | term_command: Option = (None) "term_command",
77 | close_on_unfocus: bool = (true) "close_on_unfocus"
78 | });
79 |
80 | fn deserialize_markup<'de, D>(deserializer: D) -> Result, D::Error>
81 | where
82 | D: Deserializer<'de>,
83 | {
84 | let s: &str = serde::Deserialize::deserialize(deserializer)?;
85 | parse_attributes(s).map_err(D::Error::custom)
86 | }
87 |
88 | impl Config {
89 | pub fn load() -> Config {
90 | let config_str = match get_config_file(CONFIG_FILE) {
91 | Some(file) => std::fs::read_to_string(file).expect("Cannot read config"),
92 | _ => "".to_owned(),
93 | };
94 | let config: Config = toml::from_str(&config_str).expect("Cannot parse config: {}");
95 | config
96 | }
97 | }
98 |
99 | fn parse_attributes(markup: &str) -> Result, String> {
100 | let (attributes, _, _) = pango::parse_markup(&format!("X", markup), '\0')
101 | .map_err(|err| format!("Failed to parse markup: {}", err))?;
102 | let mut iter = attributes.iterator().ok_or("Failed to parse markup")?;
103 | Ok(iter.attrs())
104 | }
105 |
--------------------------------------------------------------------------------
/src/consts.rs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2020 Dorian Rudolph
3 |
4 | sirula is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 |
9 | sirula is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with sirula. If not, see .
16 | */
17 |
18 | pub const APP_ID: &str = "com.dorian.sirula";
19 | pub const APP_NAME: &str = "sirula";
20 |
21 | pub const STYLE_FILE: &str = "style.css";
22 | pub const CONFIG_FILE: &str = "config.toml";
23 | pub const HISTORY_FILE: &str = "history";
24 |
25 | pub const APP_LABEL_CLASS: &str = "app-label";
26 | pub const APP_ICON_CLASS: &str = "app-icon";
27 | pub const APP_ROW_CLASS: &str = "app-row";
28 | pub const ROOT_BOX_NAME: &str = "root-box";
29 | pub const LISTBOX_NAME: &str = "app-list";
30 | pub const SEARCH_ENTRY_NAME: &str = "search";
31 | pub const SCROLL_NAME: &str = "scroll";
32 |
--------------------------------------------------------------------------------
/src/history.rs:
--------------------------------------------------------------------------------
1 | use super::util::get_history_file;
2 | use serde_derive::{Deserialize, Serialize};
3 | use std::collections::HashMap;
4 | use std::fs::File;
5 | use std::io::Write;
6 | use std::time::{SystemTime, UNIX_EPOCH};
7 |
8 | #[derive(Copy, Clone, Default, Eq, Deserialize, Serialize)]
9 | pub struct HistoryData {
10 | pub last_used: u64,
11 | pub usage_count: u32,
12 | }
13 |
14 | impl PartialEq for HistoryData {
15 | fn eq(&self, other: &Self) -> bool {
16 | self.last_used.eq(&other.last_used) && self.usage_count.eq(&other.usage_count)
17 | }
18 | }
19 |
20 | pub fn load_history(days: u32) -> HashMap {
21 | match get_history_file(false) {
22 | Some(file) => {
23 | let history_str = std::fs::read_to_string(file).expect("Cannot read history file");
24 | let epoch = SystemTime::now()
25 | .duration_since(UNIX_EPOCH)
26 | .expect("Time went backwards");
27 | let cutoff = epoch.as_secs() - (days as u64) * 86400;
28 | let mut history = toml::from_str(&history_str)
29 | .unwrap_or_else(|err| {
30 | eprintln!("Cannot parse history file: {}", err);
31 | HashMap::new()
32 | });
33 | history.retain(|_, data : &mut HistoryData| {
34 | days == 0 || data.last_used >= cutoff
35 | });
36 | return history;
37 | }
38 | _ => HashMap::new(),
39 | }
40 | }
41 |
42 | pub fn save_history(history: &HashMap) {
43 | let file = get_history_file(true).expect("Cannot create history file or cache directory");
44 | let mut file = File::create(file).expect("Cannot open history file for writing");
45 | let s = toml::to_string(history).unwrap();
46 | file.write_all(s.as_bytes())
47 | .expect("Cannot write to history file");
48 | }
49 |
50 | pub fn update_history(history: &mut HashMap, id: &str) {
51 | let epoch = SystemTime::now()
52 | .duration_since(UNIX_EPOCH)
53 | .expect("Time went backwards");
54 | let usage_count = history.get(&id.to_string()).map_or(0, |h| h.usage_count) + 1;
55 |
56 | history.insert(
57 | id.to_string(),
58 | HistoryData {
59 | last_used: epoch.as_secs(),
60 | usage_count,
61 | },
62 | );
63 | }
64 |
--------------------------------------------------------------------------------
/src/locale.rs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2020 Dorian Rudolph
3 |
4 | sirula is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 |
9 | sirula is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with sirula. If not, see .
16 | */
17 |
18 | use libc::{setlocale, strcoll};
19 | pub use locale_types::{LocaleIdentifier};
20 | use std::{
21 | cmp::{Ord, Ordering},
22 | ffi::{CStr, CString},
23 | os::raw::c_char,
24 | ptr,
25 | };
26 |
27 | pub fn string_collate(a: &str, b: &str) -> Ordering {
28 | // Note: Only works properly if locale is set to UTF-8
29 | let ord = unsafe {
30 | let c_a = CString::new(a).unwrap();
31 | let c_b = CString::new(b).unwrap();
32 | strcoll(c_a.as_ptr(), c_b.as_ptr())
33 | };
34 | ord.cmp(&0)
35 | }
36 |
37 | unsafe fn setlocale_wrapper(category: i32, locale: *const c_char) -> Option {
38 | let ret = setlocale(category, locale);
39 | if ret.is_null() {
40 | None
41 | } else {
42 | Some(CStr::from_ptr(ret).to_str().unwrap().to_owned())
43 | }
44 | }
45 |
46 | pub fn set_locale(category: i32, locale: &str) -> Option {
47 | unsafe {
48 | let c_locale = CString::new(locale).unwrap();
49 | setlocale_wrapper(category, c_locale.as_ptr())
50 | }
51 | }
52 |
53 | #[allow(unused)]
54 | pub fn get_locale(category: i32) -> Option {
55 | unsafe { setlocale_wrapper(category, ptr::null()) }
56 | }
57 |
--------------------------------------------------------------------------------
/src/main.rs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2020 Dorian Rudolph
3 |
4 | sirula is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 |
9 | sirula is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with sirula. If not, see .
16 | */
17 |
18 | use fuzzy_matcher::skim::SkimMatcherV2;
19 | use gdk::keys::constants;
20 | use gio::prelude::*;
21 | use gtk::{
22 | builders::{BoxBuilder, EntryBuilder, ListBoxBuilder, ScrolledWindowBuilder},
23 | prelude::*,
24 | ListBoxRow,
25 | };
26 | use libc::LC_ALL;
27 | use std::env::args;
28 | use std::{cell::RefCell, collections::HashMap, rc::Rc};
29 |
30 | mod consts;
31 | use consts::*;
32 |
33 | mod config;
34 | use config::*;
35 |
36 | mod util;
37 | use util::*;
38 |
39 | mod app_entry;
40 | use app_entry::*;
41 |
42 | mod locale;
43 | use locale::*;
44 |
45 | mod history;
46 | use history::*;
47 |
48 | fn app_startup(application: >k::Application) {
49 | let config = Config::load();
50 | let launch_cgroups = config.cgroups;
51 | let cmd_prefix = config.command_prefix.clone();
52 |
53 | let window = gtk::ApplicationWindow::new(application);
54 | window.set_size_request(config.width, config.height);
55 |
56 | gtk_layer_shell::init_for_window(&window);
57 | gtk_layer_shell::set_keyboard_interactivity(&window, true);
58 | gtk_layer_shell::set_layer(&window, gtk_layer_shell::Layer::Overlay);
59 | gtk_layer_shell::set_namespace(&window, "sirula");
60 |
61 | if config.exclusive {
62 | gtk_layer_shell::auto_exclusive_zone_enable(&window);
63 | }
64 |
65 | gtk_layer_shell::set_margin(&window, gtk_layer_shell::Edge::Left, config.margin_left);
66 | gtk_layer_shell::set_margin(&window, gtk_layer_shell::Edge::Right, config.margin_right);
67 | gtk_layer_shell::set_margin(&window, gtk_layer_shell::Edge::Top, config.margin_top);
68 | gtk_layer_shell::set_margin(&window, gtk_layer_shell::Edge::Bottom, config.margin_bottom);
69 |
70 | gtk_layer_shell::set_anchor(&window, gtk_layer_shell::Edge::Left, config.anchor_left);
71 | gtk_layer_shell::set_anchor(&window, gtk_layer_shell::Edge::Right, config.anchor_right);
72 | gtk_layer_shell::set_anchor(&window, gtk_layer_shell::Edge::Top, config.anchor_top);
73 | gtk_layer_shell::set_anchor(&window, gtk_layer_shell::Edge::Bottom, config.anchor_bottom);
74 |
75 | window.set_decorated(false);
76 | window.set_app_paintable(true);
77 |
78 | let vbox = BoxBuilder::new()
79 | .name(ROOT_BOX_NAME)
80 | .orientation(gtk::Orientation::Vertical)
81 | .build();
82 | let entry = EntryBuilder::new().name(SEARCH_ENTRY_NAME).build(); // .width_request(300)
83 | vbox.pack_start(&entry, false, false, 0);
84 |
85 | let scroll = ScrolledWindowBuilder::new()
86 | .name(SCROLL_NAME)
87 | .hscrollbar_policy(gtk::PolicyType::Never)
88 | .build();
89 | vbox.pack_end(&scroll, true, true, 0);
90 |
91 | let listbox = ListBoxBuilder::new().name(LISTBOX_NAME).build();
92 | scroll.add(&listbox);
93 |
94 | let history = Rc::new(RefCell::new(load_history(config.prune_history)));
95 | let entries = Rc::new(RefCell::new(load_entries(&config, &history.borrow())));
96 |
97 | for row in (&entries.borrow() as &HashMap).keys() {
98 | listbox.add(row);
99 | }
100 |
101 | window.connect_key_press_event(clone!(entry, listbox, entries => move |window, event| {
102 | use constants::*;
103 | #[allow(non_upper_case_globals)]
104 | Inhibit(match event.keyval() {
105 | Escape => {
106 | window.close();
107 | true
108 | },
109 | Down | KP_Down | Tab if entry.has_focus() => {
110 | if let Some(r0) = listbox.row_at_index(0) {
111 | let es = entries.borrow();
112 | if r0.is_selected() {
113 | if let Some(r1) = listbox.row_at_index(1) {
114 | if let Some(app_entry) = es.get(&r1) {
115 | if !app_entry.hidden() {
116 | listbox.select_row(Some(&r1));
117 | }
118 | }
119 | }
120 | } else if let Some(app_entry) = es.get(&r0) {
121 | if !app_entry.hidden() {
122 | listbox.select_row(Some(&r0));
123 | }
124 | }
125 | }
126 | false
127 | },
128 | Up | Down | KP_Up | KP_Down | Page_Up | Page_Down | KP_Page_Up | KP_Page_Down | Tab
129 | | Shift_L | Shift_R | Control_L | Control_R | Alt_L | Alt_R | ISO_Left_Tab | Return
130 | | KP_Enter => false,
131 | _ => {
132 | if !event.is_modifier() && !entry.has_focus() {
133 | entry.grab_focus_without_selecting();
134 | }
135 | false
136 | }
137 | })
138 | }));
139 |
140 | if config.close_on_unfocus {
141 | window.connect_focus_out_event(|window, _| {
142 | window.close();
143 | Inhibit(false)
144 | });
145 | }
146 |
147 | let matcher = SkimMatcherV2::default();
148 | let term_command = config.term_command.clone();
149 | entry.connect_changed(clone!(entries, listbox, cmd_prefix => move |e| {
150 | let text = e.text();
151 | let is_cmd = is_cmd(&text, &cmd_prefix);
152 | {
153 | let mut entries = entries.borrow_mut();
154 | for entry in entries.values_mut() {
155 | if is_cmd {
156 | entry.hide(); // hide entries in command mode
157 | } else {
158 | entry.update_match(&text, &matcher, &config);
159 | }
160 | }
161 | }
162 | listbox.invalidate_filter();
163 | listbox.invalidate_sort();
164 | listbox.select_row(listbox.row_at_index(0).as_ref());
165 | }));
166 |
167 | entry.connect_activate(clone!(listbox, window => move |e| {
168 | let text = e.text();
169 | if is_cmd(&text, &cmd_prefix) { // command execution direct
170 | let cmd_line = &text[cmd_prefix.len()..].trim();
171 | launch_cmd(cmd_line);
172 | window.close();
173 | } else if let Some(row) = listbox.row_at_index(0) {
174 | row.activate();
175 | }
176 | }));
177 |
178 | listbox.connect_row_activated(clone!(entries, window, history => move |_, r| {
179 | let es = entries.borrow();
180 | let e = &es[r];
181 | if !e.hidden() {
182 | launch_app(&e.info, term_command.as_deref(), launch_cgroups);
183 |
184 | let mut history = history.borrow_mut();
185 | update_history(&mut history, e.info.id().unwrap().as_str());
186 | save_history(&history);
187 |
188 | window.close();
189 | }
190 | }));
191 |
192 | listbox.set_filter_func(Some(Box::new(clone!(entries => move |r| {
193 | let e = entries.borrow();
194 | !e[r].hidden()
195 | }))));
196 |
197 | listbox.set_sort_func(Some(Box::new(clone!(entries => move |a, b| {
198 | let e = entries.borrow();
199 | e[a].cmp(&e[b]) as i32
200 | }))));
201 |
202 | listbox.select_row(listbox.row_at_index(0).as_ref());
203 |
204 | window.add(&vbox);
205 | window.show_all()
206 | }
207 |
208 | fn main() {
209 | set_locale(LC_ALL, "");
210 |
211 | let application = gtk::Application::new(Some(APP_ID), Default::default());
212 |
213 | application.connect_startup(|app| {
214 | load_css();
215 | app_startup(app);
216 | });
217 |
218 | application.connect_activate(|_| {
219 | //do nothing
220 | });
221 |
222 | application.run_with_args(&args().collect::>());
223 | }
224 |
--------------------------------------------------------------------------------
/src/util.rs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2020 Dorian Rudolph
3 |
4 | sirula is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 |
9 | sirula is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with sirula. If not, see .
16 | */
17 |
18 | use crate::consts::*;
19 | use freedesktop_entry_parser::parse_entry;
20 | use gio::{prelude::AppInfoExt, AppInfo};
21 | use glib::{shell_parse_argv, GString, ObjectExt};
22 | use gtk::{prelude::CssProviderExt, CssProvider};
23 | use std::path::PathBuf;
24 | use std::process::{id, Command};
25 | use shlex::Shlex;
26 |
27 | pub fn get_xdg_dirs() -> xdg::BaseDirectories {
28 | xdg::BaseDirectories::with_prefix(APP_NAME).unwrap()
29 | }
30 |
31 | pub fn get_config_file(file: &str) -> Option {
32 | get_xdg_dirs().find_config_file(file)
33 | }
34 |
35 | pub fn get_history_file(place: bool) -> Option {
36 | let xdg = get_xdg_dirs();
37 | if place {
38 | xdg.place_cache_file(HISTORY_FILE).ok()
39 | } else {
40 | xdg.find_cache_file(HISTORY_FILE)
41 | }
42 | }
43 |
44 | pub fn load_css() {
45 | if let Some(file) = get_config_file(STYLE_FILE) {
46 | let provider = CssProvider::new();
47 | if let Err(err) = provider.load_from_path(file.to_str().unwrap()) {
48 | eprintln!("Failed to load CSS: {}", err);
49 | }
50 | gtk::StyleContext::add_provider_for_screen(
51 | &gdk::Screen::default().expect("Error initializing gtk css provider."),
52 | &provider,
53 | gtk::STYLE_PROVIDER_PRIORITY_APPLICATION,
54 | );
55 | }
56 | }
57 |
58 | pub fn is_cmd(text: &str, cmd_prefix: &str) -> bool {
59 | !cmd_prefix.is_empty() && text.starts_with(cmd_prefix)
60 | }
61 |
62 | pub fn launch_cmd(cmd_line: &str) {
63 | let mut parts = shell_parse_argv(cmd_line).expect("Error parsing command line");
64 | let mut parts_iter = parts.iter_mut();
65 |
66 | let cmd = parts_iter.next().expect("Expected command");
67 |
68 | let mut child = Command::new(cmd);
69 | child.args(parts_iter);
70 | child.spawn().expect("Error spawning command");
71 | }
72 |
73 | pub fn launch_app(info: &AppInfo, term_command: Option<&str>, launch_cgroups: bool) {
74 | let command_string = info
75 | .commandline()
76 | .unwrap_or_else(|| info.executable())
77 | .to_str()
78 | .unwrap()
79 | .to_string()
80 | .replace("%U", "")
81 | .replace("%F", "")
82 | .replace("%u", "")
83 | .replace("%f", "");
84 | let mut command: Vec = Shlex::new(&command_string).collect();
85 |
86 | if info
87 | .try_property::("filename")
88 | .ok()
89 | .and_then(|s| parse_entry(&s).ok())
90 | .and_then(|e| {
91 | e.section("Desktop Entry")
92 | .attr("Terminal")
93 | .map(|t| t == "1" || t == "true")
94 | })
95 | .unwrap_or_default()
96 | {
97 | if let Some(term) = term_command {
98 | let command_string = term.to_string().replace("{}", &command_string);
99 | command = Shlex::new(&command_string).collect();
100 | } else if let Some(term) = std::env::var_os("TERMINAL") {
101 | let term = term.into_string().expect("couldn't convert to string");
102 | let mut command_new = vec![term, "-e".into()];
103 | command_new.extend(command);
104 | command = command_new;
105 | } else {
106 | return;
107 | };
108 | }
109 | if launch_cgroups {
110 | let mut name = info.id().unwrap().to_string();
111 | name.truncate(name.len() - 8); // remove .desktop extension
112 | let parsed = Command::new("systemd-escape")
113 | .arg(name)
114 | .output()
115 | .unwrap()
116 | .stdout;
117 | let unit = format!(
118 | "--unit=app-sirula-{}-{}",
119 | String::from_utf8_lossy(&parsed).trim(),
120 | id()
121 | );
122 | let mut command_new: Vec = vec!["systemd-run".into(), "--scope".into(), "--user".into(), unit];
123 | command_new.extend(command);
124 | command = command_new;
125 | }
126 |
127 | Command::new(&command[0])
128 | .args(&command[1..])
129 | .spawn()
130 | .expect("Error launching app");
131 | }
132 |
133 | #[macro_export]
134 | macro_rules! clone {
135 | (@param _) => ( _ );
136 | (@param $x:ident) => ( $x );
137 | ($($n:ident),+ => move || $body:expr) => (
138 | {
139 | $( let $n = $n.clone(); )+
140 | move || $body
141 | }
142 | );
143 | ($($n:ident),+ => move |$($p:tt),+| $body:expr) => (
144 | {
145 | $( let $n = $n.clone(); )+
146 | move |$(clone!(@param $p),)+| $body
147 | }
148 | );
149 | }
150 |
--------------------------------------------------------------------------------