obynio / anki-japanese-furigana

Anki add-on providing support for adding furigana on Japanese text
https://ankiweb.net/shared/info/678316993
GNU General Public License v3.0
17 stars 5 forks source link

Add shortcuts to generate furiganas #5

Closed obynio closed 5 months ago

obynio commented 3 years ago

This can be handy, add keyboard shortcuts to generate furiganas !

meguminnet commented 1 year ago

Is it possible to add this relatively easily on the new versions of Anki?

I used to have an add-on that used the "keys" on the editor.addButton but it seems like it's not longer supported in current versions of Anki.

obynio commented 1 year ago

It might be, but working on supporting recently released version of Anki already took me a lot of time. Once I got free time, I can work on this. Meanwhile, I'm still open to contributions.

obynio commented 5 months ago

@meguminnet this feature is now merged and released in 1.4.3, enjoy 🙂

yangmillstheory commented 5 months ago

Hi, is this feature known to be working in production?

I'm running macOS Ventura, and this doesn't seem to work for me. For example, Command+F in the card editor takes me to the search bar, while Ctrl+F does nothing.

FTR I'm running Anki Version ⁨23.12.1 (1a1d4d54)⁩, Python 3.9.15 Qt 5.14.2 PyQt 5.14.1, and

┌─ [~/jp]
└─➤  cat ~/Library/Application\ Support/Anki2/addons21/678316993/meta.json | bat                                                                        [10:16:28 AM]
{"name": "JapaneseFurigana", "mod": 1706538831, "min_point_version": 0, "max_point_version": 231201, "branch_index": 0, "disabled": false, "config": {"ignoreNumbers": true, "keyboardShortcut": {"add_furigana": "Ctrl+F", "del_furigana": "Ctrl+Alt+F"}, "useRubyTags": true}, "conflicts": [], "update_enabled": true}%
┌─ [~/jp]
└─➤  cat ~/Library/Application\ Support/Anki2/addons21/678316993/config.json |jq                                                                       [10:16:33 AM]
{
    "useRubyTags": false,
    "ignoreNumbers": true,
    "keyboardShortcut": {
        "add_furigana": "Ctrl+F",
        "del_furigana": "Ctrl+Alt+F"
    }
}
obynio commented 5 months ago

Hello, yes it is in production, I tested it on the latest Anki version on macOS Sonoma on a MacBook Pro M3. Command+F works. Of course you need to have the focus on the text box for it to work. This is a limitation from Anki.

yangmillstheory commented 5 months ago

Here's what I see when I press Command+F when I'm focused in a text box:

https://github.com/obynio/anki-japanese-furigana/assets/2729079/d271d622-a872-431a-ad77-7a42f5e3116b

My editor config is as shown in https://github.com/obynio/anki-japanese-furigana/issues/5#issuecomment-1923389923. The default seems to be Ctrl-F for adding furigana, have you changed it somehow? I'm not sure how we can expect Command+F to work since according to https://keycombiner.com/collections/anki/, Command+F maps to "Find" in the Browser view, which has always been the case for me. What's your addon config?

obynio commented 5 months ago

Ah yes I changed it. Well I guess it need to restore it to Alt+F.

obynio commented 5 months ago

Done, released in 1.4.4. New shortcut is ⌥F or Alt+F.

obynio commented 5 months ago

Well it appears that ⌥⌘F or Ctrl+Alt+F still triggers the search in the browse menu... @yangmillstheory do you have a suggestion of a shortcut combinaison we could use to replace it ?

yangmillstheory commented 5 months ago

Using https://keycombiner.com/collections/anki/ as a reference, what do you think about $Modifier+K ("K" for "Kana")? Using $Modifier+R might work too, though it appears Command+R is taken.

yangmillstheory commented 5 months ago

BTW

obynio commented 5 months ago

Alright I made the choice to set the default shortcut to ⌘R or Ctrl+R since it is easier to reach on a keyboard with one hand and does not conflicts with any Anki shortcuts. A release was just published. If you have anything to say about this change feel free to tag me here.

yangmillstheory commented 5 months ago

Looks like that worked, thanks. I never got an answer to https://github.com/obynio/anki-japanese-furigana/issues/5#issuecomment-1925236368 btw.

obynio commented 5 months ago

How exactly did you make the keybinding work with Command+F on your setup?

I didn't. I forgot to verify the shortcut on the Anki's browse card window. I only verified it on the add card window.

Does editing the keybindings config.json on the user side have any effect?

You can edit it manually if you want to modify the bindings, but you need to restart Anki after every change.

yangmillstheory commented 5 months ago

Thank you!

On Sat, Feb 10, 2024, 18:40 Yohann Leon @.***> wrote:

How exactly did you make the keybinding work with Command+F on your setup? I didn't. I forgot to verify the shortcut on the Anki's browse card window. I only verified it on the add card window.

Does editing the keybindings config.json on the user side have any effect? You can edit it manually if you want to modify the bindings, but you need to restart Anki after every change.

— Reply to this email directly, view it on GitHub https://github.com/obynio/anki-japanese-furigana/issues/5#issuecomment-1937079952, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAU2I5ZJEAL3DQLKQQSY34TYS6WKFAVCNFSM437Z5JPKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJTG4YDOOJZGUZA . You are receiving this because you were mentioned.Message ID: @.***>