emoji icon indicating copy to clipboard operation
emoji copied to clipboard

idea: support custom keywords and output

Open JobLeonard opened this issue 1 year ago • 3 comments

First of all, thanks for a great extension! It's been very useful to me.

So my main thought is that this extension is made out of two very nice things:

  • the searchable "keyword to possible emojis" dictionary (did you know that most emoji pickers don't have search results for :)? Isn't that ridiculous? Your extension does it right!)
  • the search interface for that dictionary

... and I think that the search interface is general and nice enough to be useful for other "keyword to whatever" macros, and that that's worth exploring. Let me explain.

I just had a situation where I wanted to use a Δ (the Greek letter delta) and had to go to its Wikipedia page and copy paste it from there. And I thought "it would be so nice if I could just do the same thing I do with the emoji add-on: ctrl+,, search for a math symbol name, insert math symbol!"

Of course math symbols are outside of the purpose of this add-on. And if you were to add the Greek alphabet then where does it stop, right? Everyone will want to add some special set of symbols in, bloating the extension, creating more work for you.

But then I figured: if the user can provide their own dictionary that works in addition to the built-in emoji dictionary, then your extension could let anyone add these features for themselves, without bloating the extension or putting a maintenance burden on you, no?

Looking at the code in js/emoji.js, it looks like it would conceptually "almost" be as "simple" letting the user provide a list in the same format as is used there, and then adding the following line to the end of the file:

// custom keywords
if (Object.keys(validated_custom_dictionary).length > 0) {
    emojis_language[lang][14] = validated_custom_dictionary;
}

... and of course adding all the machinery to filter out invalid user entries from a provided dictionary object. Probably also excluding it from the i18n code (didn't look closely at that). Adding a "⚙️" tab if (but only if) there is a custom dictionary, and... ok there's still quite a bit of work involved.

But if you'd be open to the concept then I might even try adding myself and submit a PR. Let me know what you think of the idea.

(PS: for example, in my case the extra dictionary would be this object)
{
  "α": ["Alpha"],
  "Α": ["Alpha"],
  "ν": ["Nu"],
  "Ν": ["Nu"],
  "β": ["Beta"],
  "Β": ["Beta"],
  "ξ": ["Xi"],
  "Ξ": ["Xi"],
  "γ": ["Gamma"],
  "Γ": ["Gamma"],
  "ο": ["Omicron"],
  "Ο": ["Omicron"],
  "δ": ["Delta"],
  "Δ": ["Delta"],
  "π": ["Pi"],
  "Π": ["Pi"],
  "ε": ["Epsilon"],
  "Ε": ["Epsilon"],
  "ρ": ["Rho"],
  "Ρ": ["Rho"],
  "ζ": ["Zeta"],
  "Ζ": ["Zeta"],
  "σ": ["Sigma"],
  "Σ": ["Sigma"],
  "η": ["Eta"],
  "Η": ["Eta"],
  "τ": ["Tau"],
  "Τ": ["Tau"],
  "θ": ["Theta"],
  "Θ": ["Theta"],
  "υ": ["Upsilon"],
  "Υ": ["Upsilon"],
  "ι": ["Iota"],
  "Ι": ["Iota"],
  "φ": ["Phi"],
  "Φ": ["Phi"],
  "κ": ["Kappa"],
  "Κ": ["Kappa"],
  "χ": ["Chi"],
  "Χ": ["Chi"],
  "λ": ["Lambda"],
  "Λ": ["Lambda"],
  "ψ": ["Psi"],
  "Ψ": ["Psi"],
  "μ": ["Mu"],
  "Μ": ["Mu"],
  "ω": ["Omega"],
  "Ω": ["Omega"]
}

JobLeonard avatar Oct 23 '24 13:10 JobLeonard

@JobLeonard Actually, I never thought about this feature... and I think this is amazing, really!

Unluckily, recently I don't have so many free time (I am a full-time worker and a full-time student as well), so probably I will add this feature in many months... I hope you'll remain with this addon, in the meanwhile, and I'm very sorry... so, if you want to add this feature, well... it would be very nice! (I care about this project, so I would review also the UI/UX side... I hope it will not be a problem, in case)

Just to know, I would like to add the feature with this behaviour:

  • Enable/Disable the "Custom section" in Settings
  • Once enabled, it will appear a new section in the popup "⚙️" is a good idea!
  • If there are some symbols, then in the section will appears those || If there aren't symbols yet, it would showing a message "No customs symbols added yet 👀 \n To add them, go to the Settings"
  • In Settings, if enabled the "custom section" would appear also the "Custom section customisation", where it will be available to add one at a time symbols (and remove inserted yet) OR import them (as json) OR export them (as json)
    • The add feature will permits user to add symbols one at a time (guided way): [symbols || keywords, separated by semicolon]
  • The global "Export settings" feature will include also the section "custom-section" with the customised symbols

What do you think about the behaviour?

Really thanks again to the amazing idea!

Sav22999 avatar Oct 23 '24 13:10 Sav22999

Just one think, if you want to work to the feature: don't use the "main" branch to clone, use the "beta" one (and also the PR, use it as destination please)

Sav22999 avatar Oct 23 '24 13:10 Sav22999

Glad to hear you like the idea too! Unfortunately I'm also a full-time programmer (and dad) without a lot of spare time, so I guess that makes two of us. I'll try to find some time to get started with this anyway. The interface you proposed looks good to me, so that's figured out at least, and the code seems pretty cleanly organized and is straightforward to read, that's probably going to help. So the main issue will be time... Let's see who makes progress first 😉

JobLeonard avatar Oct 23 '24 14:10 JobLeonard