Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Alfred version #16

Closed
wants to merge 3 commits into from
Closed

Conversation

lumaxis
Copy link

@lumaxis lumaxis commented Jul 12, 2016

No description provided.

@warpling warpling mentioned this pull request Jul 13, 2016
@warpling
Copy link
Owner

This is rad @lumaxis! I just pulled in a PR that added two phone emojis, mind running your magic script and pushing the update?

Also have any thoughts on how we can best handle updates/changes to the lists in the future? 😨

@lumaxis
Copy link
Author

lumaxis commented Jul 13, 2016

Just updated and also rebased to resolve the conflicts with master.

I unfortunately don't really have a good strategy for updates in the future either 🤔
Theoretically, it would be best to have one script that generates all variants from a master plist or similar.

@warpling
Copy link
Owner

Okay sorry to keep sending you back @lumaxis but @rael9 created a script/templating system!!

I tried to fix this up myself but am having trouble understanding how .alfredsnippet binary files are generated. How did you create the current Alfred snippet file? Is there a template we could feed into the new script that Alfred would accept as input?

@lumaxis
Copy link
Author

lumaxis commented Jul 15, 2016

Haha, no worries :) Noticed @rael9's latests comments to and will take a look at the templating system once I'm done with work or over the weekend the latest.

The .alfredsnippet file is basically a zip archive with all of the snippets in a separate JSON file.

@warpling
Copy link
Owner

Sounds great :) Thanks again for your patience and help.

@lumaxis
Copy link
Author

lumaxis commented Jul 19, 2016

So, the problem as I see it is that the .alfredsnippets format differs quite a bit from the Keyboard Maestro one.
For example is each snippet its own file and all of the files need to get added to a zip file at the end which is then renamed to .alfredsnippets.

I didn't have much time to look over @rael9's templating system but on first glance this system doesn't seem to fit very well.
@rael9: Do you think your system could accommodate something like this?

@rael9
Copy link
Contributor

rael9 commented Jul 19, 2016

@lumaxis, no it's not really set up for that right now. I wasn't familiar with how Alfred does snippets, so my code is set up more for list-style files, where all of the replacements are listed in one file. Mainly I did this as my sample size was 2, the original plist and the Keyboard Maestro macro 😄

The way I see it, we have 2 directions we could go in. It sounds like you already have a script to put together the .alfredsnippets file, so we could add that and have one script that calls both, or we could adapt one of our scripts to handle multiple types.

Also, I was thinking that perhaps the list of emojis should actually start in some sort of simple format (CSV or JSON or ?) and we could then build the plist from that as well. It would probably be easier to maintain the emoji list that way.

Thoughts @warpling, @lumaxis?

@warpling
Copy link
Owner

At least it's still a script-solvable problem! I definitely agree @rael9: we should move the substitutions into a csv. I'll go ahead and do that later unless you have already!

As for Keyboard Maestro, we should probably just special case it. It doesn't feel elegant at all but it's unclear how many more templates there really need to be and it should get the job done of keeping the lists up to date!

@warpling
Copy link
Owner

@rael9 could you help me write the script for this? You seem to have strong nix/python foo.
@lumaxis could you provide the Keyboard Maestro format here?

@rael9
Copy link
Contributor

rael9 commented Jul 22, 2016

@warpling I think you meant to ask @lumaxis for the Alfred Snippets format 😉

As to helping you write the script, I would be glad to. I'll probably have time this coming Sunday to start coding it up.

@lumaxis
Copy link
Author

lumaxis commented Jul 22, 2016

This is what a single file in the .alfredsnippets archive looks like:

{
  "alfredsnippet": {
    "snippet": "🚀",
    "uid": "dd2c19ca-4d17-4763-b5c7-d87b0169de19",
    "name": "rocket",
    "keyword": ":rocket:"
  }
}

The file name consists of $name [$uid]. You can just take a look yourself if you want by renaming the .alfredsnippets file to .zip, unpacking, and having a look around 🙂

@warpling
Copy link
Owner

That'd be great @rael9!
@lumaxis, thank you. Those UIDs seem random. Think we could generate random ones and have it still work? Do you mind trying to hand craft one and see if adding it works? I would test it myself but I only have Alfred 2.

@lumaxis
Copy link
Author

lumaxis commented Jul 23, 2016

Yes, I just used a UUID library to create random ones.

@warpling
Copy link
Owner

@rael9 are you still interested in giving this a shot? :) No pressure if not. I can always try to pull up my sleeves and brush up my scripting.

@warpling
Copy link
Owner

#37 fixes this! Thank you all!

@warpling warpling closed this Mar 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants