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 post

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 post

@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 post

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 post

@tbrown

 

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 post

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...