Jump to content

SoulverCore - Advanced natural calculations on Alfred

Recommended Posts

This workflow uses SoulverCore (already included, no dependencies!) to parse whatever you throw at it, and replies with the result. Apart from arithmetic, it can do calculations with money, measurements, conversions, ratios, times, dates, time zones, etc. It's an amazing replacement for Alfred's integrated calculator.


Download at https://github.com/cprecioso/alfred-soulvercore/releases/latest


I saw that recently the folks behind Soulver had made their calculation engine open-source. I immediately thought that it would be an awesome project to integrate into Alfred, as I'm usually frustrated by the built-in calculator. I also took it as a nice experiment for actually publishing an Alfred workflow, and how to automate Swift builds and Alfred workflow bundling with GitHub Actions.


The workflow includes a Swift binary with the SoulverCore library integrated (it is unsigned - this might trip up Gatekeeper in your computer). The source code for this binary is at https://github.com/cprecioso/alfred-soulvercore. Workflow files are at https://github.com/cprecioso/alfred-soulvercore/releases/latest - they get automatically built every time I tag a version (see the workflow).


Credits: SoulverCore (https://github.com/soulverteam/SoulverCore) from Soulver (https://soulver.app). SoulverCore icon from Matthew Skiles (http://matthewskiles.com/).

Captura de pantalla 2020-10-25 a las 18.46.01.png

Captura de pantalla 2020-10-25 a las 18.45.36.png

Captura de pantalla 2020-10-25 a las 18.42.26.png

Edited by cprecioso
Fix link
Link to comment

Sweet. I used to have a workflow with similar functionality a long time ago in my engineering degree that was SUPER useful. Like... black magic useful. I could enter complex equations which mixed notations left/right and have extra confidence in my results as if the units didn't work out I'd know something was wrong immediately (like if the answer didn't come out to joules).


Anyway, couple of notes.


1. Having c as the keyword trigger, though it works, feels a little too short/generic to me. May sc or something else with a little more personality would be better. Plus it helps with branding.


2. There is a code signing issue for both the alfred-soulvercore executable and the framework. I could fix the "alfred-soulvercore" by launching it manually and clicking open in the security dialog (you don't get this option from alfred... OS X just block it altogether) but the framework has no such luck and just crashes.  This is what I get in the console:


Crashed Thread:        0

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    DYLD, [0x5] Code Signature

Application Specific Information:
dyld: launch, loading dependent libraries

Dyld Error Message:
  Library not loaded: @rpath/SoulverCore.framework/Versions/A/SoulverCore
  Referenced from: /Users/USER/Library/Application Support/Alfred/*/alfred-soulvercore
  Reason: no suitable image found.  Did find:
	/Users/halopend/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.0DDDC4E2-F655-4093-81DC-FD396CFC9585/SoulverCore.framework/Versions/A/SoulverCore: code signature in (/Users/halopend/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.0DDDC4E2-F655-4093-81DC-FD396CFC9585/SoulverCore.framework/Versions/A/SoulverCore) not valid for use in process using Library Validation: library load disallowed by system policy

Binary Images:
       0x108178000 -        0x108187fff +alfred-soulvercore (0) <42BAB712-1AA5-3FB4-BA39-D081C2B1B56D> /Users/USER/Library/Application Support/Alfred/*/alfred-soulvercore
       0x10f70b000 -        0x10f7a2fff  dyld (832.2.1) <89B0D57A-546A-3F6C-9BFB-D5179B29D542> /usr/lib/dyld
    0x7fff201e6000 -     0x7fff2021efff  libobjc.A.dylib (818) <502CF9CD-5B59-387F-BD61-2CABEBD5F673> /usr/lib/libobjc.A.dylib
    0x7fff2a9bc000 -     0x7fff2a9bdfff  libSystem.B.dylib (1292) <AEE1824E-1AAC-356E-8EDE-704ED282BCA7> /usr/lib/libSystem.B.dylib


Edited by Halopend
Link to comment

@Halopend @Acidham

macOS doesn't like it when executables are downloaded from the internet. The framework is definitely codesigned (it's provided from Soulver).

It's a matter of macOS quarantining these files because they come from a download.

To solve that, once you import it, you can go into the workflow folder, open it in the Terminal, and run


xattr -r -d com.apple.quarantine .


That should let it work.


I've also added instructions on how to work around this to the release on GitHub.

Edited by cprecioso
Add info on workaround to GitHub
Link to comment

Nice workflow, thanks. A couple of comments:


Some functions, like factorial (5!) for example, don't work.


Any way to change trig functions to use degrees, not radians?


Any way to set variables for calculations?


I realize the last two are probably not trivial, but hey, you have whetted my appetite.

Link to comment



I can't really do anything about the factorials, SoulverCore doesn't allow adding custom operators. I'd suggest you make a feature request for factorials at https://soulver.canny.io/. I don't know how likely it is that they will accept it, as Soulver is more focused on general day-to-day calculations rather than technical ones.


For using degrees, it should work same as any other unit, e.g.: "sin(90 degrees)". It seems a bit fiddly though, and finetuning this through the EngineCustomization entrypoint doesn't seem to work. I'll make an issue about that myself.


About variables, what would your use-case be / how would you like to interact with it? I don't know how you want to use that in a single line quick calculation stuff, probably better off opening actual full Soulver for that. I'm willing to look into it though, but I first need to understand how you'd like to set and use these variables.

Link to comment
  • 8 months later...

Thanks for the nice work cprecioso.

Just wanna make a feature suggest about currency rates updating, currently it seems to be static.

From the readme of soulvercore GitHub page, soulvercore would use a static list by default, but dev could choose to integrate APIs to get update.


Currency Rates

The .standard EngineCustomization includes rates for 170 real-world currencies (that were accurate at the time the framework was last compiled).

You can (and should) update these currencies to the latest rates by setting valid API key credentials for CurrencyLayer (for fiat currencies) and Nomics (for crypto currencies) on the shared CurrencyList.

Alternatively use the .popular currency set to pull 33 common fiat currency rates from the European Central Bank, no API key required.

To fetch the latest rates, use SoulverCore's shared CurrencyList:

/// 33 popular currencies from the ECB, updated every weekday. CurrencyList.shared.defaultCurrencySet = .popular CurrencyList.shared.refreshRates { (success) in if success { /// The standard customization will now have the latest currency rates applied let calculator = Calculator(customization: .standard) let result = calculator.calculate("10 USD in EUR") } }

So I was wondering if this can be integrated into the workflow, where users could put in API toke in the Alfred workflow environment variables section?




Link to comment

Hi Jay,

I just made a new release with auto-refreshing for the .popular set of currencies (https://github.com/cprecioso/alfred-soulvercore/releases/tag/v1.2.0). I understand your use case but this is outside of what I wanted to try out with the workflow -- setting preferences and reading them would make code quite complicated. I hope the .popular set is enough!

If not, feel free to fork the code or just modify it on your own machine. I will accept a PR for the preferences if I get one!


Link to comment
  • 4 weeks later...
  • 3 months later...

Hey, great Workflow, just so nice to use.

I just installed it on my new machine but can't get it to work. Typing c brings up the Soulvercore icon, but typing anything more makes the icon go away again. Then it falls back to googling.

Running this on the M1 Pro. Tried all the quarantine fixes and opening the scripts manually.

Looking forward to any help!


EDIT: Didn't install Rosetta yet. Now it works.




Edited by MatteoEtzer
Link to comment
  • 7 months later...

It doesn't work for me either. The error from the debugger is as follows:


[16:08:04.475] Logging Started...
[16:08:16.870] SoulverCore[Script Filter] Queuing argument '1'
[16:08:16.897] SoulverCore[Script Filter] Script with argv '1' finished
[16:08:16.900] ERROR: SoulverCore[Script Filter] Code 11: Exited with error code but no message


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...