Jump to content

deanishe

Member
  • Posts

    8,759
  • Joined

  • Last visited

  • Days Won

    522

Reputation Activity

  1. Thanks
    deanishe got a reaction from giovanni in Script Filter Icon from URL   
    https://git.deanishe.net/deanishe/alfred-unwatched-videos/src/branch/master/src/thumbnails.py
     
    I thought I had that redirected. Hmm.
  2. Like
    deanishe got a reaction from Terminal in night mode setup   
    No, it's not at all clear what's going on. Some kind of indicator to show which theme(s) you have selected for light/dark modes would be very helpful (e.g. a sun/moon icon to the right of the theme's name). And a way to set both themes regardless of current OS mode (right-click > "Set as Dark Theme" for example).
  3. Like
    deanishe got a reaction from godbout in Alfred KAT   
    I save them for the RTFMs
     
     
    Well, yeah. They're basically real-time data. But something like a weather forecast or KAT search results won't really suffer from being 5 minutes old.
     
     
    Cached results are keyed by search query. So if you search for "buster", but accidentally grab the ARM ISO, you can very quickly go back and grab the AMD64 one instead because the workflow loads the results for "buster" from the cache. It's basically for the case where you re-open Alfred and hit ↑ specifically to repeat a previous search.
     
    I dunno. Perhaps I just select the wrong thing an awful lot, and nobody else actually cares about that.
  4. Haha
    deanishe got a reaction from godbout in Alfred KAT   
    Yeah, I don't like that either, but it's essentially unavoidable given its simple, bolt-on nature. My updaters are arguably more user-friendly (depends on how the workflow dev uses them), but they need to be properly integrated into a workflow and aren't as flexible as OneUpdater.
     
     
    The Go one works the same way. The update example shows how it works.
     
     
    The caching API is the most important part of my libraries, imo. Any data retrieved from a server or app gets cached (even if only as long as the user is using the workflow) for speed. I think that's actually more important when you're using a language like Swift or Go because you're throwing away near-native performance by not caching data that take a while to retrieve.
     
    I'd cache any KAT responses for 5–10 minutes, so when you re-open Alfred to go back to try a different Linux ISO, the results are available instantly.
  5. Thanks
    deanishe got a reaction from shmulvad in TinyPNG   
    Good luck with the exams!
  6. Like
    deanishe got a reaction from shmulvad in TinyPNG   
    A better solution is to run /usr/bin/python -m pip install --user --upgrade requests
     
    That installs it in your user directory, so it won't be deleted by OS upgrades and you won't need elevated privileges to install it.
     
    The proper solution is for @shmulvad to bundle it with the workflow, however. You can do that with pip’s --target flag: /usr/bin/python -m pip install --target . requests
     
  7. Like
    deanishe got a reaction from kt22 in Permissions and setting up alfred   
    System Preferences > Keyboard > Shortcuts > Spotlight
  8. Like
    deanishe got a reaction from srb1961 in Save Calendar .ics Workflow?   
    This isn't really something a workflow is suited for: Alfred only runs things when you tell it to, and backups should happen entirely automatically. Alfred also doesn't provide any tools that would actually help with what you're trying to do.
     
    A script to back up your calendar run daily via a Launch Agent would be a better solution.
     
    Forum users could probably help you write a script, but you'd have to provide a more detailed description (where you're getting the ICS file from, which directory it should be saved to etc.).
  9. Like
    deanishe got a reaction from kornel45 in [HOW TO] Pass results from script to Alfred, then run another script and return it's value to Alfred as well   
    It does work like that when you connect a second Script Filter to the first one. The arg field of each item in the JSON feedback is what’s passed to the next Script Filter (or any element) when that item is actioned.
     
    You need to connect two Script Filters together: the first one searches for the show and passes the show's ID (or title or whatever the API wants) to the second Script Filter, which lists the episodes.
     
    You can either write two Python scripts or make your single script a command-line program that works like:
     
    script.py <query> script.py --episodes <title>
    Then you set the second Script Filter to use Language = /bin/zsh and put /usr/bin/python3 script.py --episodes "$1" in the Script box.

    --
     
    If you really want to have only one Script Filter so you can easily start a new search, then you will need to do some query parsing. The best way to do that is usually to use a delimiter in the query. If you set valid to false on each item, Alfred expands the search query to the value of arg and calls the same Script Filter again, instead of passing control to the next workflow element.
     
    Here's a Python workflow I wrote that works that way. Here's a demo of another workflow that works the same way:
     

     
     
     
  10. Like
    deanishe reacted to giovanni in [HOW TO] Pass results from script to Alfred, then run another script and return it's value to Alfred as well   
    I am not sure I follow the whole logic (i.e. are you querying a single table or 2?), but if you want two distinct outputs, you need two inputs. you can either split your python script and have each script filter call one python script, or (better I think) call it twice with different arguments... or, if your initial list is fixed, you can use a list filter... if you can describe the logic in a bit more detail I am sure somebody on here will be able to help. 
  11. Like
    deanishe reacted to giovanni in [HOW TO] Pass results from script to Alfred, then run another script and return it's value to Alfred as well   
    welcome to the forum! it is possible to chain script filters, so that the output of one is the input for another.
    you might want to review these threads below
    hope this helps
  12. Like
    deanishe got a reaction from jopemachine in What is your workflow for developing these workflows?   
    Create a new directory for your project with a "src" subdirectory. Create a new, empty workflow in Alfred. Configure the workflow's name, bundle ID, icon etc. in Alfred's UI. Reveal the workflow in Finder. Move everything to the "src" subdirectory of your new project. Delete the workflow from Alfred. Symlink your workflow from the project directory: workflow-install -s src workflow-install script.
  13. Thanks
    deanishe got a reaction from Lcop in Anyone available to collaborate on a Workflow?   
    Try this.
  14. Thanks
    deanishe reacted to godbout in AlfredWorkflowScriptFilter (Swift)   
    actually it's pretty straightforward. there's two ways to do it. one is by using the Accessibility API and gather inputs' contents. that should allow for a more precise experience, but i haven't explored this yet. the way i did it is by creating a tap event. basically you insert a tap in the event stream and grab and redirect some of them (keyboard ones in my case). it was not hard to do, but (at the time at least) hard to test. haven't gone back to it yet. to enter the global command mode, it's just a keyboard shortcut. (personally i tried to use something related to escape, like a long press for command mode and normal press for normal escape or the opposite, but nothing felt right. so i use cmd+escape now (although it's more cmd+capslock; capslock mapped to escape)). probably the final app will be a mix of both methods. for text, it'll use the Accessibility API, to move in dropdowns, menus, etc..., a remapping of the keyboard.
  15. Like
    deanishe reacted to bubblicious in Microsoft Edge   
    IMO, this discussion has become quite silly. Bottom line is that Alfred is probably not going to support Edge, so it's pointless to snipe at each other about browser-usage stats. On the bright side, Alfred does have that wonderful workflow capability, and I've found many built by others to fill various needs. chrome-bookmarks-alfred-workflow | Chrome/Canary/Chromium/Microsoft Edge bookmarks search workflow for Alfred (mdreizin.github.io) is the one I found to customize bookmarks search. I altered the shortcuts so that I get results from Edge with the shortcut-combo I'm used to. I highly recommend it.
     
    Beyond that, though I would have liked native support for Edge, I appreciate the cautiousness of the Alfred team in what they add or don't. One thing I have found over the 5+ years of using it is that has rarely ever become unresponsive or slow. It's quite amazing, considering what it does and how it does it. And compared to many other mainstream software packages (I'm looking at you MS Office; and you, too, Mac Mail), it seems to maintain this stability year after year.
     
    So, I'm now sorry that I originally contributed to this discuss, and I'll be un-following the topic.
     
    Best to all.
  16. Haha
    deanishe got a reaction from godbout in AlfredWorkflowScriptFilter (Swift)   
    Searching on Google.
     
     
    It doesn't suck. It's just not designed or suited for what I was trying to do with it.
     
     
    That's a big part of why I haven't used Swift more seriously. I've written a few things in Swift over the years, and it seems that every time I open an old project, the whole bloody language has changed and the small edit I wanted to make turns into a significant rewrite.
     
    Do you think Swift 5 is going to be any more stable?
     
     
    What does that do? (I only know word/line-navigation bindings, which I presume are not the bindings you're talking about.)
     
  17. Like
    deanishe reacted to vitor in Microsoft Edge   
    With corrected stats filters, Edge is fourth with barely half a percent.
  18. Like
    deanishe got a reaction from vitor in Microsoft Edge   
    No, it isn't. Safari is the second most popular browser. The stats you posted include Windows, so they're completely wrong as far as Alfred users go.
  19. Like
    deanishe reacted to godbout in AlfredWorkflowScriptFilter (Swift)   
    makes sense.
     
     
    i do like this. it's just i think a matter of habit and of not knowing the language well enough yet. i like to have methods with only a few lines of code in them, but with Swift it's usually hard to do. might improve, or i might get used to it.
     
     
    do you think it's still the case with Swift 5? i thought `struct`s were there especially to handle performance issues. also there's stuff like `Substring`s that are a special type rather than `String`s themselves so that they get copied only when necessary. 
     
    well it's always the same compromise right? or you stick to low level and it's performant but the APIs are usually hardcore, or you get a nice abstraction where you almost just type English but it comes with performance issues. personally when i build something (for other developers) i like to put priority on a nice API. then, for the performance, i can always figure things out later and refactor the internal organs. (hence the need for me of a good test suite.)
  20. Thanks
    deanishe reacted to godbout in AlfredWorkflowScriptFilter (Swift)   
    if i remember/understood correctly i think they're getting copied only when necessary. so it's supposed to be Ultra Performant™. but of course as usual i might be completely wrong.
     
     
    at first i was dafuq, i want some part of a string and i can't even use that shit as a string itself??? but you actually just need to init a String with the substring like String(yourSubtring). the idea is as long as you don't need the substring, it takes no space. it's just a reference to the lower and upper bounds. after the initial dafuq i was like, nice, pretty smart. (as you can see by now i don't need much to find something smart.)
     
     
    nice. looking forward to see where this is gonna lead you. should be quite interesting.
  21. Like
    deanishe got a reaction from godbout in AlfredWorkflowScriptFilter (Swift)   
    I wanted more practice with the language. Go is awful for GUIs or interacting with macOS native APIs.
     
     
    I didn't even get as far as building the workflow bits. The workflow needs to parse a 1.5MB text file, and Swift is very poor at string processing. Swift’s String is a massive, slow object, while Go’s strings are just sequences of bytes.
     
  22. Thanks
    deanishe got a reaction from godbout in AlfredWorkflowScriptFilter (Swift)   
    You can do that in ObjC/Swift, too (the object system is based on Smalltalk, after all). It’s just generally bad practice. When you start messing around with runtime introspection or using id to circumvent the type system, you destroy the performance and safety a statically-typed, compiled language gives you.
     
     
    That's the nature of static typing, tbh. You have to spell everything out for the compiler, and in return, it eliminates an entire class of runtime errors for you. When you change the type of a variable, it's impossible to forget to update your code in one place or another (a super-common error in dynamically-typed languages) because your code won't compile. That's why it's considered poor practice to circumvent type checking with runtime shenanigans unless absolutely necessary.
     
     
    I make so many mistakes I can learn from…
     
     
    It is and it isn't. It's a fairly standard statically-typed, compiled language, but with Smalltalk's extremely dynamic object model and messaging system grafted on top. That adds a lot of overhead and idiomatic Swift makes pretty heavy use of it. Big classes, lots of copying, dynamic dispatch.
     
    To get good performance, you need to do non-obvious things. To get really good performance, you have to basically treat Swift like C and use UnsafePointer and pals and primitive types (e.g. a  UInt8 instead of large objects like Character).
  23. Like
    deanishe got a reaction from godbout in AlfredWorkflowScriptFilter (Swift)   
    They're immutable and not subclassable, so they aren't dragging all that machinery around with them, but on the other hand, structs are always passed by value, not reference, so a lot of copying goes on.
     
     
    I don't really understand how substrings, ranges, indexes work in Swift yet.
     
     
    Absolutely. Idiomatic Swift is pretty high level. That convenience always has a performance cost, AFAIK.
     
     
    This is the way.
     
     
    Swift is a far more interesting language than Go. I plan to use it more in future, just not for serious string processing.
     
  24. Haha
    deanishe reacted to godbout in AlfredWorkflowScriptFilter (Swift)   
    ok i'm depressed now. i'm gonna give up Swift and will start developing my Workflows with this library: https://github.com/deanishe/awgo
  25. Thanks
    deanishe got a reaction from leonseled in How to open current url in Safari as incognito in Google Chrome?   
    Unfortunately, you can't attach workflow files to forum posts (only images).
     
     
    Doesn't really make any difference: brains aren't very good at parsing code.
     
    Also, if you do have a syntax error, there's usually an error message in Alfred's debugger telling you precisely where it is.
×
×
  • Create New...