-
Posts
175 -
Joined
-
Last visited
-
Days Won
10
Content Type
Blogs
Gallery
Downloads
Events
Profiles
Forums
Articles
Media Demo
Posts posted by Mr Pennyworth
-
-
@c099 you could try this workflow: https://github.com/BenziAhamed/Menu-Bar-Search/
-
-
34 minutes ago, deanishe said:
Can't you make the links clickable?
I would assume so!
Just haven't found the need for it yet, and hence haven't tried to figure it out.
49 minutes ago, deanishe said:Ah I'm so sorry for my sloppy framing of the question!
QuoteIs there a way to access the URL the web-searches are building?
By that I meant, when I type "<keyword> <search phrase>", Alfred shows a result corresponding to it like this:
When I press enter, the url opens in the browser. So, I assume, Alfred has internally built that URL, ready to be opened in a browser. My question (I guess, that should've been more of a feature request) was "how about making that URL accessible through quicklookurl or something similar?" (That way, with zero additional efforts/programming, the extra pane could pick it up)
56 minutes ago, deanishe said:Also, is there a programmatic way of accessing the web-searches?
Sorry for the poor phrasing... I meant including the ones that come pre-installed.
Alfred.alfredpreferences/preferences/features/websearch/prefs.plist, very understandably, has only user-defined ones.
-
3 minutes ago, Florian said:
Damn, google in France looks like this now...
Damn!
@Florian See if you can figure out the css selector of that dialog?
Then you can add that selector to this list here: https://github.com/mr-pennyworth/alfred-google/blob/main/google-viewer/AlfredGoogleViewer/main.swift#L13
and then recompile the app with ./build-scripts/mkapp.sh
-
3 hours ago, Chris Messina said:
Have you taken a look at the just-updated Algolia Autocomplete experience. Go here and hit ⌘-K.
These docs might be relevant?
Cool stuff!!
But looks like unrelated to what I meant by "search google as you type"...
Unless of course, I'm missing something...How do you envision algolia autocomplete to be used to search google for quick answers?
-
10 hours ago, vitor said:
Did any of you try the Spotlight Privacy panel route and decided it didn’t work / was too much trouble, or did you start with the comment solution?
I started with the comment solution because I wanted to use spotlight as a junk drawer.
10 hours ago, vitor said:I’ll see if I can make it into JXA.
Have you written your process down somewhere?
Would love to read a detailed "how to convert applescript to JXA" -
1 hour ago, Andrew said:
there may be a different valid: state which could be treated differently.
By "result" I mean "item" in the following.
I'm not sure what's the correct term 😝"everything is a result" is an interesting philosophy.
Reminds me of "everything is a file" philosophy of Unix.
The universality brings simplicity and elegance too, no doubt!However, the discussion of a third "valid:" state made me wonder...
(consideration of complexity and elegance aside)- What if everything is not a result?
- If a result isn't valid, is it really a result? After all, nothing could be done with it.
-
Alfred already has specialized UIs, they are just not exposed to the workflows:
- Snippet and Clipboard History Viewer
- Mini Music Player
- The tiny "update available" notice
- What if Alfred exposed more UI elements for workflow authors? Given how elegantly crafted the whole workflow editor is, there's no doubt @Andrew could make a few well-designed, judiciously-crafted UI elements that fit into Alfred beautifully.
To my naive eye, it looks like Alfred could benefit from a "notice" element.
The notice could be used as- a status indicator
- a progress monitor
- an error flag
Someone could even go ahead and build a breadcrumbs UI using the notice.
(would be cool for multi-level-menus (I gather @deanishe would love better support for building multi-level-menus))An example from Raycast (By a "notice element", I mean something like "Clipboard History" at the top left):
I understand that it's possible that this could be a stretch.
Also, it could be seen as "beginning of cluttering of UI".It's just that I keep having this feeling that "valid: false" results don't belong with the main results, philosophically.
So throwing this out here for discussion -
2 hours ago, Florian said:
would you mind sharing this last google workflow?
[pre-release] There you go: https://github.com/mr-pennyworth/alfred-google/releases
Note: The reason the workflow doesn't directly visit a google search url each time, but instead loads a google search page and fills input values and submits forms is because the former led to captchas pretty soon, I guess the latter is more "human like"...
The app in the workflow is basically the app in https://github.com/mr-pennyworth/alfred-gif with large chunks of code deleted.
2 hours ago, Florian said:I'm mainly a web dev and having a web window responding to alfred is really tickling my fancy.
The Google workflow has a one-way flow, btw. That is, the webview responds to alfred.
For a back-and-forth interaction, you can take a look at the GIF workflow.
It has file drag and drop, keyboard and mouse navigation etc.
My apologies, the GIF workflow code is damn messy and convoluted though.2 hours ago, Florian said:do you have a way to know the full list of available results?
or is it just the current one through the new "press secretary"?
Just the current one through the new press secretary.
However, if the results are coming from a script filter, you could independently capture and process those.That's what the extra pane did pre-press-secretary.
Take a look at the tech QA: https://github.com/mr-pennyworth/alfred-extra-pane#technical-qa
(I haven't pushed the press-secretary code to alfred-extra-pane yet.)
2 hours ago, Florian said:in their display order
2 hours ago, Florian said:I'd love to have a web preview that's not entirely refreshed on every selection change, and a local server behind it to speed up things.
Excited to see what you build!
-
Thanks @Alfred0!
My most favorite use-case is actually something that I hadn't originally thought about:
"Search Google as You Type"Google has become more and more of a question-answering-machine.
So many times, I just want a quick answer and am not looking at reading articles/blogs etc.
For those cases, the mode of operation is "search google -> look at result -> move on".The extra pane fits so well for them!
And ofc, pressing enter would open the same page in browser if I want to interact with that page further.@Andrew The above involved writing this script filter:
I would agree that writing such a script filter is a minimal-effort, no-hassle thing.
It does feel like a teeny-tiny duplication-of-function though, given that Alfred already has awesome web-searches.
Is there a way to access the URL the web-searches are building?
Or, would it be possible to expose those URLs through press-secretary?
Or, is that not desirable due to privacy concerns?Also, is there a programmatic way of accessing the web-searches? cc: @deanishe @vitor
(that way, someone could programmatically build a workflow mirroring the web-searches and their keywords if they want)
I scoured through various plists and alfdbs, but couldn't find where they are stored...
Are they stored in some proprietary format / right inside the binary?
Or did I miss something obvious?Having said all this, I must agree I don't really foresee much value in doing this for all web-searches because with the exception of google and wolframalpha, I would assume most of the searches are such that they require further interactions with results (like clicking a link, copying some text etc).
Aside:
Here's a different (vertical) configuration I've been toying with:
- Chris Messina, allonli, JJJJ and 1 other
- 4
-
5 hours ago, vitor said:
Tangentially, before I spend the time researching, does anyone have a preferred method to ignore stuff from Alfred via the command line? Be it the equivalent to adding to Spotlight’s Privacy panel or adding alfred:ignore as a comment, or something else.
@vitor I use this command:
# A file action (that allows multiple files) # The file action writes the files to /tmp/alfred-ignorelist, then calls the script cat /tmp/alfred-ignorelist | /usr/local/opt/findutils/libexec/gnubin/xargs -d'\n' -i -n1 osascript -e 'on run {f, c}' -e 'tell app "Finder" to set comment of (POSIX file f as alias) to c' -e end "{}" "alfred:ignore" rm /tmp/alfred-ignorelist # for recursively ignoring everything inside a folder find -L /path/to/folder | /usr/local/opt/findutils/libexec/gnubin/xargs -d'\n' -i -n1 osascript -e 'on run {f, c}' -e 'tell app "Finder" to set comment of (POSIX file f as alias) to c' -e end "{}" "alfred:ignore"
-
@evanfuchs aha! got it!
That's such a bad bug!!
Thanks so much for reporting itI fixed it in v0.0.5, download it and give it a go
-
@evanfuchs sorry, I'm confused...
Can you give me a step-by-step detailed explanation of what you expect to happen and what actually happens?
From your description, it seems like it is working correctly...
you hit ⌘C, then go about doing something
then, when you want to paste the GIF, you hit ⌘V
the gif should be pasted. Is it not being pasted?BTW, the workflow doesn't put image data onto the clipboard, it simply puts a file onto the clipboard.
That's the file you are seeing in clipboard viewer.14 minutes ago, evanfuchs said:but killall AlfredGifBrowser restores the expected behavior until
Can you elaborate what the expected behavior is?
-
47 minutes ago, luckman212 said:
Not sure if that's intentional, a bug, or just a shortcoming.
Sounds like a bug to me.
Not because the way it behaves, but because the way it inconsistently behaves.This what's happening with @luckman212:
17 hours ago, luckman212 said:I just nuked my entire knowledge db to test this, and tried a few rounds of typing "ocr" followed by ⌘2. No effect, TextSniper.app is still ranked in the #1 spot even after 30-40 rounds of banging on my keyboard.
This is what's happening with me:
- Start with deleting all "ocr" related rows from both "knowledge" and "latching" tables
- TextSniper.app shows at top
- Type "ocr" an then ⌘2 to latch something other than the text sniper app
- Now on, text sniper app is no longer at the top when typed "ocr"
Both of us are on build# 1205
I'm on Catalina
@luckman212 is on BigSurGoing by luckman212's report there seem to be two possibilities: on their machine:
-
either the row in latching table is not being created/updated (even after many ⌘2's) (SQlite connection / adapter bug?)
-
What about the knowledge table, you ask?
-> it shouldn't matter because both of us have cleared it before the experiment
-
What about the knowledge table, you ask?
- or Alfred's behavior somehow diverges between Catalina and BigSur
- or, of course, a third thing that I completely missed 😝
@Andrew @deanishe do you guys think it makes more sense to move this to "bugs" category?
-
11 minutes ago, luckman212 said:
No effect, TextSniper.app is still ranked in the #1 spot even after 30-40 rounds of banging on my keyboard.
Ouch.
Sorry for the useless instructions!
Seems like a headscratcher! Would've been fun to debug, but can't reproduce the buggy behavior3 hours ago, Mr Pennyworth said:What is not immediately clear from the DBs is how any particular latching becomes "strong" and stops being "strong".
@Andrew is this part of Alfred's secret-sauce or is it something you don't mind shedding more light on?Shouldn't have asked Andrew to chime in for such a simple thing!
Turns out, latching starts out with "strong" == 0 and one more invocation makes "strong" == 1 and it remains that way.
If a competing latching is about to occur, if strong is 1, it simply becomes 0 and the competing latching doesn't materialize.
Seems like a cool way of being forgiving for one-off mistakes when made infrequently! -
1 minute ago, luckman212 said:
and I use the "ocr" keyword quite a lot
@luckman212 Good point!
There's a caveat though: If you want to tell Alfred to rank "select screen area" above "TextSnip.app" when you type "ocr" (just the keyword, and no extra argument) the only way to do that is "cmd+2" after "ocr" (without any extra argument) (as opposed to typing additional letters, getting "select screen area" to top, and then pressing enter)I'm not saying you don't know this already.
You probably know this, or this might be new; I can't be certain either way.
So, for clarity and written reference, here goes:A user might type "ocr s", get "select screen area" as first option, and press enter.
The user might do that again and again and again, say, 100 times.
It would surely create a feeling that the user is using the keyword "ocr" a lot, and hence, training Alfred to go for "select screen area" for "ocr". But technically, all that training gets superseded (as far as just "ocr" is concerned) by a single instance of the following:- user types "ocr" (without space or arguments)
- assume, "TextSnip.app" is the 4th result
- presses cmd+4
- TextSnip.app is launched
now on, when the user types "ocr" (without space or arguments), TextSnip.app ranks at the top.
For exact keywords, entries in latching table outrank entries in the knowledge table
Hence one usage of "ocr" -> "TextSnip.app" outranks hundreds of usages of "ocr se" -> "select screen area"
@luckman212, out of curiosity, when you said you use the "ocr" keyword a lot, did you mean-
the exact letters "ocr", followed by ⌘+<number> to choose from results
OR - "ocr" followed by an optional space, and then some letter, so that the desired result comes to top, then press enter?
-
6 minutes ago, luckman212 said:
@Mr Pennyworth Thanks but this isn't about Alfred's knowledge/latching. It's simply that Alfred currently puts matching applications above all other results, regardless of their implied or learned order.
This is a claim that could be experimentally verified, no?
This is the list filter I used for the experiment:
After running those two SQL queries, and following step (1) and (2) from my previous answer, here's what I get:
@luckman212 are you certain that on your machine (both our builds are same 1205)
Alfred *always* ranks app results above list filter results?Did you delete those "ocr" related DB rows, then follow (2) and still end up with textsniper.app ranking above your list filter results?
That sounds like a very strange bug to me...
-
3 hours ago, luckman212 said:
Alfred doesn't seem to learn this like it does in other areas—it always puts matching keywords/Apps above keyword trigger matches.
Looking at the "knowledge" and "latching" databases, this doesn't seem to be the case. Alfred always keeps learning...
What is not immediately clear from the DBs is how any particular latching becomes "strong" and stops being "strong".
@Andrew is this part of Alfred's secret-sauce or is it something you don't mind shedding more light on? -
1 hour ago, deanishe said:
I don't think there's much you can do to move the app to the bottom because Alfred only has a mechanism for moving results up the list.
I guess once something gets strongly latched, it becomes very difficult to unlatch it(?)
So instead of trying to move the app down, let's try simply removing the latching?
@luckman212 @deanishe Here's what worked for me:
-
Clear Alfred's knowledge
➡ sqlite3 ~/Library/Application\ Support/Alfred/Databases/knowledge.alfdb SQLite version 3.28.0 2019-04-16 19:49:53 Enter ".help" for usage hints. sqlite> DELETE FROM latching WHERE keyword == "ocr"; sqlite> DELETE FROM knowledge WHERE keyword == "ocr";
- Type "ocr" in Alfred, press "⌘-2" (to select "select screen area"). Now on, after typing "ocr", "select screen area" is the first result, not "TextSniper.app"
Note that this doesn't really do exactly what @luckman212 asked, it just effectively pushed the app down by one, and moved "select screen area" up to the top. To push the app all the way down (after clearing the latching and knowledge rows), you gotta repeat step 2 above for all the options in your list filter
-
Clear Alfred's knowledge
-
Deleting a bunch of code is so satisfying!
- no more mouse tracking
- no more keypress monitoring
- no more accessibility hoops to get window events and sizes
- no more guessing "how does Alfred rank results?"
- Andrew, nikivi, Chris Messina and 2 others
- 5
-
-
Getting them all now! 🎉
Getting selection.changed only on keypresses though, not on mouse-hover...
-
@Andrew I'm so sorry this is likely such a n00b question!
I'm only seeing window.hidden notifs.
I don't seem to be able to catch the others...
The extra-pane was the first time I'm writing swift, (or any mac-related programming for that matter)
So likely it is something really dumb that I'm doing...DistributedNotificationCenter.default().addObserver( forName: NSNotification.Name(rawValue: "alfred.presssecretary"), object: nil, queue: nil, using: { notification in NSLog("\(notification)") } )
I just wanted to confirm that the notifications are posted with DistributedNotificationCenter.Options.deliverImmediately
I'm not really sure whether it is the poster's responsibility or the observer's...
Assuming the observer can ensure immediate delivery irrespective of how the poster posted the notifications, I tried this code:
#import <Foundation/Foundation.h> static void callback( CFNotificationCenterRef center, void *observer, CFStringRef name_cf, const void *object, CFDictionaryRef userInfo ) { NSLog(@"event: %@", (__bridge NSString*)name_cf); NSLog(@"user info: %@", userInfo); NSLog(@"object: %@", (__bridge id)object); return; } int main(int argc, const char * argv[]) { NSString* name = @"alfred.presssecretary"; CFNotificationCenterAddObserver( CFNotificationCenterGetDistributedCenter(), nil, callback, (CFStringRef) name, nil, CFNotificationSuspensionBehaviorDeliverImmediately); [[NSRunLoop currentRunLoop] run]; return 0; }
The results are still the same, I only get the "window.hidden" notifs and none of the other types...
-
Love the name!
This is so cool!! ☺️ -
How long have you been using Alfred?
in Discussion & Help
Posted · Edited by Mr Pennyworth
In May 2020, a friend saw me using spotlight and claimed "I'm going to pull you out of stone age". And she told me to get Alfred. I had been using it as "just another spotlight" since then.
Beginning of November, I got curious "what is this powerpack thing?".
Searched online, found packal, and this forum, downloaded a bunch of workflows.
It hit me so hard!! "HOLY SHIT! ALFRED IS SO POWERFUL!!"
"It's not an app, it's a platform!" 🤩💕
I was up all night for a couple of days building stupid workflows and playing around.
In a day or two, I became a mega supporter.