Jump to content

Workflow to Search through Alfred's Query History


Recommended Posts

Alfred History Search


An Alfred workflow to search through query history, and execute queries from history.

Note: This post might be out-of-date.
Here's the up-to-date README.

 

Usage


Download the latest release


Searching Through Query History

  • Assign hotkey trigger (⌃R recommended)
  • While using Alfred, press the hotkey. Alfred's query history will show up:
    screenshot.png
  • Start typing to search through the query history.
    screenshot-2.png
  • Actioning any of the history entries makes Alfred search that query.
    screenshot-3.png


Deleting Query History


Type .clear-afred-query-history in Alfred.


Icon Credits


Icon created by combining icons form flaticon made by Freepik and Pixel Perfect

Link to post
2 hours ago, chris said:

can you conceptually explain your approach to this workflow?

 

It has a Script Filter for every letter, and every time you type something it appends it to a text file. Then it reads it back when you use the Hotkey.

 

The smaller Script Filters are self-contained and simple, so you can easily inspect the code.

 

2 hours ago, chris said:

I've never seen something like this

 

There’s an older Workflow on the forum (I don’t recall its name) which (as far as I know) was the first to use this technique. But it only does it for numbers (which I find more reasonable) because it’s a converter.

Link to post
3 hours ago, Mr Pennyworth said:

The "Calculate Anything" workflow does this. Ingenious and brilliant, isn't it!

 

Thought the same when I saw it. So clever. I was wondering if you'd got the idea from that workflow or come up with it independently.

Link to post
Quote

Thought the same when I saw it. So clever. I was wondering if you'd got the idea from that workflow or come up with it independently.

OMG!! dayum!
my bad at creating that impression!

 

I so didn't come up with it independently! Learnt from that workflow and all credit belongs to them.

I had mentioned it here

but should've mentioned in our discussion the other day too!
(which I just edited to reflect the origin of the idea)

Edited by Mr Pennyworth
Link to post

Hey @chris,

I'm not saying you've formed such an impression, but in case that you have, I want to clarify, if my understanding of how Alfred works is correct, that number of script filters in itself shouldn't be a performance concern. The calculator workflow needs to deal with numbers, so it has 10 script filters. This one needs to deal with all strings, so it has more than 40. That no way makes it 4 times worse. Imagine, instead of 40, I had added one script filter each for all the letters in extended ascii, or, for that matter, all the unicode code points that I want (that would mean hundreds, even thousand script filters). The important point is, all these filters are mutually exclusive. At any time, at most one of them is active. So, 40 or 400 or 4000 filters, performance implications are almost same (except for how much RAM alfred uses) as long as they remain super cheap in terms of individual filter performance (which is the case here), and as long as they don't overlap (which, again, is the case here).

 

@Andrew, I'm curious...

Am I totally off the mark here?
Or it makes sense but not entirely?
Or it makes a lot of sense?

Link to post

@Mr Pennyworth While it's clever in concept, I'd personally discourage using the multi-Script Filter method you're using, even though it's unlikely to, in isolation, cause any performance issues with Alfred. If somebody installed multiple workflows which used the same method, then Alfred will be running multiple scripts on every keypress.

 

There is definite scope for an enhanced native command history built in to Alfred. This would take some thought and design, and would be configurable and user opt-in. I would also think about a easy-on temporary private mode, much like a browser, to prevent typed queries being stored, and also allow for expiry. The history would be likely stored in an sqlite db so it could also be accessed by workflows where necessary.

 

Further to this, one thing on my future plan is to allow users to specify specific workflow objects to be included in the default results. Again, this will require some thought as it should be a user who decides this, and not a workflow developer. This would facilitate workflows like this one, and Calculate Anything, to work without needing multiple script filters. At the point that this happens, Alfred may start profiling script tasks and warning if they are taking too long or consuming too much CPU.

 

Cheers,

Andrew

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