Added calculator functionnality #217
Open
+213
−14
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We've extended the codebase to allow for modules like doing math or doing a web search to be added fairly easily.
This pull request includes those two examples. Modules are asked to add their suggestion to the results array, importantly module suggestions must start with a prefix (e.g.
=
for calcuations?
for searches). Then when the user selects the result of an module, the module can process text-input and its own suggestion to do a task. All modules can be disabled in the config file.The Math modules uses
qalc
orlibqalculate
from the AUR as the "calculation backend" which is now a required dependency (at least we think so)The PR also includes functionality for the delete key to remove the next character :D
Still todo is:
"
breaks the calculation moduleSadly
^
cant be used for e.g. doing math, presumably it's a "dead key" and there doesn't seam to be any easy workaround. You can still use**
to do exponents though: e.g.3**4 = 3⁴
Should close #172 and #183