Skip to content

Added calculator functionnality#217

Open
F-4Dev wants to merge 10 commits intophilj56:masterfrom
F-4Dev:master
Open

Added calculator functionnality#217
F-4Dev wants to merge 10 commits intophilj56:masterfrom
F-4Dev:master

Conversation

@F-4Dev
Copy link
Copy Markdown

@F-4Dev F-4Dev commented Feb 7, 2025

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 or libqalculate 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:

  • Documentation about this feature
  • Also add this modules functionality to non drun
  • Maybe add a way to have a better module prefix system (TBD)
  • Tofi seams to not end its process when executing the math module
    (A temporary fix for that is adding && wl-copy "" behind your key bind)
  • Entering " breaks the calculation module
  • Tofi seams to crash when trying to remove the last existing character
  • Add extended configuration for the search module (change search engine or browser) and find a way to utilize the default browser

Sadly ^ 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

@flloschy
Copy link
Copy Markdown

@F-4Dev I think you can check the documentation box :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature] Tofi as fast calculator

2 participants