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

Chaging language in system does not affect input in search #716

Closed
2 tasks done
serjb9 opened this issue Jan 25, 2024 · 23 comments
Closed
2 tasks done

Chaging language in system does not affect input in search #716

serjb9 opened this issue Jan 25, 2024 · 23 comments
Labels
bug Something isn't working needs triaging Further information is requested nsmenu Limitation of NSMenu

Comments

@serjb9
Copy link

serjb9 commented Jan 25, 2024

Before Submitting Your Bug Report

  • I have verified that there isn't already an issue reporting the same bug to prevent duplication.
  • I have seen the FAQ.

Maccy Version (see 'About' window)

Version 0.29.4 (28)

macOS Version

14.2.1 (23C71)

Maccy Settings

➜  / defaults read org.p0deje.Maccy
{
    "KeyboardShortcuts_delete" = "{\\"carbonModifiers\\":2048,\\"carbonKeyCode\\":51}";
    "KeyboardShortcuts_pin" = "{\\"carbonModifiers\\":2048,\\"carbonKeyCode\\":35}";
    "KeyboardShortcuts_popup" = "{\\"carbonModifiers\\":2560,\\"carbonKeyCode\\":8}";
    "LaunchAtLogin__hasMigrated" = 1;
    "NSStatusItem Preferred Position Item-0" = 5649;
    "NSWindow Frame SUStatusFrame" = "664 724 400 134 0 0 1728 1079 ";
    "NSWindow Frame SUUpdateAlert" = "554 526 620 398 0 0 1728 1079 ";
    "NSWindow Frame com.sindresorhus.Preferences.FrameAutosaveName" = "593 379 542 435 0 0 1728 1079 ";
    "NSWindow Frame com.sindresorhus.Settings.FrameAutosaveName" = "643 596 442 322 0 0 1728 1079 ";
    SUEnableAutomaticChecks = 0;
    SUHasLaunchedBefore = 1;
    SULastCheckTime = "2024-01-25 10:43:50 +0000";
    WebKitDefaultFontSize = 13;
    WebKitJavaScriptEnabled = 0;
    WebKitPluginsEnabled = 0;
    WebKitStandardFont = "-apple-system-font";
    WebKitUserStyleSheetEnabledPreferenceKey = 1;
    WebKitUserStyleSheetLocationPreferenceKey = "/Applications/Maccy.app/Contents/Frameworks/Sparkle.framework/Resources/ReleaseNotesColorStyle.css";
    enabledPasteboardTypes =     (
        "public.file-url",
        "public.png",
        "public.tiff",
        "public.utf8-plain-text",
        "public.html",
        "public.rtf"
    );
    historySize = 500;
    ignoredPasteboardTypes =     (
        "com.typeit4me.clipping",
        "Pasteboard generator type",
        "de.petermaurer.TransientPasteboardType",
        "com.agilebits.onepassword",
        "net.antelle.keeweb"
    );
    maxMenuItemLength = 50;
    maxMenuItems = 20;
    menuIcon = maccy;
    migrations =     {
        "2020-04-25-allow-custom-ignored-types" = 1;
        "2020-06-19-use-keyboardshortcuts" = 1;
        "2020-09-01-ignore-keeweb" = 1;
        "2021-02-20-allow-to-customize-supported-types" = 1;
        "2021-06-28-add-title-to-history-item" = 1;
        "2021-10-16-remove-dynamic-pasteboard-types" = 1;
        "2022-08-01-rename-suppress-clear-alert" = 1;
        "2022-11-14-add-html-rtf-to-supported-types" = 1;
        "2023-01-22-add-regexp-search-mode" = 1;
    };
    popupPosition = center;
    popupScreen = 0;
    previewDelay = 500;
}

Description

Calling the Maccy input window and changing the language, does not affect the language itself in search input dialog.
I have RU and EN keyboard layout settings in the system only.

Steps to Reproduce

  1. Pre-define several keyboard settings in the OS (RU & EN for example)
  2. Run the app
  3. Open the Maccy using keyboard shortcut
  4. Start input something in search
  5. Ensure something is written
  6. Change the language in the system by shortcut (ensure that maccy search is still opened)
  7. Type somthing in focused search in other keyboard layout

Actual behaviour:
The changed system keyboard layout is not taken to the account in maccy search dialog.

I've noticed, that in macOS 13 it worked properly, but in macOS 14 is not.

Screen.Recording.2024-01-25.at.13.54.56.mov
@serjb9 serjb9 added the bug Something isn't working label Jan 25, 2024
@p0deje
Copy link
Owner

p0deje commented Jan 25, 2024

I cannot reproduce this by running macOS 14.3. Also using EN/RU layouts and changing is assigned to Caps Lock, which works just fine:

Screen.Recording.2024-01-25.at.07.36.08.mov

@serjb9
Copy link
Author

serjb9 commented Jan 25, 2024

Maybe it's because changing is assigned to one key? Mine is CMD+SPACE.
Anyway, I will try to update macOS soon, maybe it would work.

@p0deje
Copy link
Owner

p0deje commented Jan 26, 2024

I tried changing the hotkey to ⌥Space and it still worked.

@serjb9
Copy link
Author

serjb9 commented Jan 26, 2024

I tried the following:

  • Before creating a bug, on previous sonoma OS versions (14.0), I tried to reinstall Maccy from GH, and it didn't work.
  • Yesterday macOS was updated to 14.3 and it also didn't work for me.

Maybe I should do some force settings reset for Maccy anyhow?

Maybe the hotkey for Maccy somehow related - I have a setting to call it using SHIFT+⌥+C.

@p0deje
Copy link
Owner

p0deje commented Jan 26, 2024

Maybe I should do some force settings reset for Maccy anyhow?

I don't see anything suspicious in your settings.

Maybe the hotkey for Maccy somehow related - I have a setting to call it using SHIFT+⌥+C.

I also use the same shortcut.

Can you try playing around with different language change hotkeys and see if it helps?

@p0deje p0deje added the needs triaging Further information is requested label Jan 28, 2024
@knoajp
Copy link

knoajp commented Feb 26, 2024

Hi, I'm Japanese.
I can change the input language to Japanese with the [^⇧Z] key combination on Maccy. Still, we Japanese people normally use the dedicated [かな] key on Japanese keyboards, which is presented as {"key_code":"japanese_kana"} on a keyboard event viewer, and the [かな] key doesn't work on Maccy. Nothing happens on a key down.

Another problem is here.
When we type Japanese characters on the search form or anywhere else, it takes 3 steps.
Let me use English terms instead for convenient explanations for English speakers:

  1. Type phonetic characters directly from a keyboard, as if like "ˈflaʊə".
  2. Some possible options for the final literal expression appear, like "flower" and "flour".
  3. Select the correct word and press [Enter].

Then, the [Enter] key on step 3. should make just a selection of the word ideally, but it does close the Maccy window with an unintended clipboard item.
Maybe any keyboard events should be ignored during steps 1-3, or there might be some nice method of programming or some nice search field component or something.

I don't know the equivalent to Swift though, there is an "isComposing" property on JavaScript.
https://developer.mozilla.org/en-US/docs/Web/API/InputEvent/isComposing

I'm sorry for such a complicated issue there...😢

@p0deje
Copy link
Owner

p0deje commented Feb 26, 2024

Hi @knoajp, thank you for sharing the exact steps - I can reproduce the problem with arrow/selection + enter and I'll fix it. What about the special key to change input? I can't find it on a keyboard viewer in macOS, can you point me to it?

Screenshot 2024-02-26 at 06 22 50

@knoajp
Copy link

knoajp commented Feb 26, 2024

Hi, thank you for trying a Japanese keyboard!!
Here is my keyboard viewer, next to the spacebar, [英数] is for Latin letters, and [かな] is for Japanese letters.
Even some edge keys are slightly different, it could depend on what type of physical keyboard is connected.
We call such keyboard types as "US keyboard" and "JIS keyboard" respectively.
20240227-001322

@p0deje
Copy link
Owner

p0deje commented Feb 26, 2024

Can you please share your configuration of an input source in System Settings? It looks like this for me:

Screenshot 2024-02-26 at 07 52 50

@knoajp
Copy link

knoajp commented Feb 26, 2024

Here it is.
But I think it's not related to the appearance of [かな] key.
If you have a "Change Keyboard Type..." button on the very bottom of the keyboard preference, that is the door.
20240227-005832
keyboard-preference

@knoajp
Copy link

knoajp commented Feb 26, 2024

If you can install the "Karabiner-Elements" app, it'll help you to have emulated JIS keys instead of having an actual physical JIS keyboard.
20240227-011708

@p0deje
Copy link
Owner

p0deje commented Feb 26, 2024

I'll install Karabiner-Elements and see how to add support for changing input keys.

In regards to arrow/enter - it's quite tricky in the way macOS handles keyboard events when both autocomplete popup and Maccy menu is present. Every key is being sent to both of them and I can't yet find a way to prevent menu from receiving events while allowing autocomplete to still get them.

Is this a regular way for Japanese to use keyboard in macOS? I wonder why this issue has not been raised before given Maccy has some usage in Japan. I know that for example in Chinese the autocomplete looks a bit different and works better with Maccy because it allows selecting with 1-9 key.

Screenshot 2024-02-26 at 08 49 44

@knoajp
Copy link

knoajp commented Feb 28, 2024

That Chinese screenshot is interesting.
Japanese IME usually lists words vertically, although horizontally on mobile devices.

This could be another issue: when I use [^⇧Z] keys to activate Japanese IME on Maccy, I have to type some key at first to "make it ready for activation" or something. I suppose the caret has to be blinking when the [^⇧Z] keystrokes to be recognized.

I did some research on the "regular way" topic here:
(You can use some translation tools to read these Japanese articles)

https://softantenna.com/blog/maccy/
The blog says: (Maccy) can't filter histories by Japanese words.
(Original: 日本語を使った絞り込みには対応していないようです)
This is the only "searching in Japanese in Maccy" reference I could find on the entire internet!! I wonder why too!!

https://www.skri.gr.jp/2022/08/5945/
The blog says: 98% of educational/business users use the JIS keyboard!!
(Original: 学校教育や企業におけるキーレイアウトシェア98%!!)
This article doesn't provide any source though, it may include Windows users as well.

https://www.youtube.com/watch?v=qw3yuVdrZYw&t=1m12s (1:12)
The poll on the YouTube channel themed Apple product reviews: 65% use the JIS keyboard, and 24% use the US keyboard.
It should be considered as this poll is done in its channel subscribers.

https://corp.logly.co.jp/blog/3181
A tech company took a survey of its 16 engineers. 100% use Mac. 56% use the US keyboard, and 44% use the JIS keyboard.

And most Japanese people who use the US keyboard use Karabiner-Elements to convert [Left⌘]/[Right⌘] to [英数]/[かな].
(The original Karabiner, former name: KeyRemap4MacBook was made for this very purpose by its Japanese developer)
So I believe virtually no one uses [^⇧Z] keys to activate Japanese IME.
(Off-topic: The default key combination was [^⇧J]. I somehow got changed it to [^⇧Z].)

p0deje added a commit that referenced this issue Mar 1, 2024
@p0deje
Copy link
Owner

p0deje commented Mar 1, 2024

Just pushed a commit that hopefully fixes the issue with changing layouts on a JIS keyboard. The arrow/enter issue is still present.

@knoajp
Copy link

knoajp commented Mar 5, 2024

Thank you for the latest 0.30.0 update! 🎉
I updated it now.

Unfortunately,
[かな] key doesn't work at all. Even if I assigned [Right⌘] to [かな] by Karabiner-Elements to "emulate the US-JIS emulation".
[^⇧Z] keys do work only after some initial typing or clicking the search form to show caret.
The state of IME on the editing app would seamlessly apply to Maccy. It's convenient if you've noticed how it works. (I didn't try this method before the update)

And then I don't know if this is a related issue or not,
the [Backspace] key doesn't work on Maccy. Only [⇧Backspace] works.
the [⌘A] combination to select all doesn't work on Maccy.

(Off-topic: The window position jumping bug seems to be fixed after this update)

@p0deje
Copy link
Owner

p0deje commented Mar 10, 2024

Unfortunately,
[かな] key doesn't work at all. Even if I assigned [Right⌘] to [かな] by Karabiner-Elements to "emulate the US-JIS emulation".
[^⇧Z] keys do work only after some initial typing or clicking the search form to show caret.
The state of IME on the editing app would seamlessly apply to Maccy. It's convenient if you've noticed how it works. (I didn't try this method before the update)

Sorry, I could be missing something, but what's the expected behavior? I have set up Karabiner to the following

Screenshot 2024-03-10 at 15 53 45

Now I open Maccy and press F6 to switch to Japanese - I can see that input changes and I can type correctly. Then I remove all of that and press F5 to switch back to the US. Input is changed again and I can type in Maccy. See this in action below:

Screen.Recording.2024-03-10.at.15.56.30.mov

the [Backspace] key doesn't work on Maccy. Only [⇧Backspace] works.

This works perfectly fine for me both in the US and Japanese inputs (see my video above).

the [⌘A] combination to select all doesn't work on Maccy.

That's correct and expected because there could be a pinned item using "A" letter.

@p0deje
Copy link
Owner

p0deje commented Mar 10, 2024

In regards to arrow/enter - it's quite tricky in the way macOS handles keyboard events when both autocomplete popup and Maccy menu is present. Every key is being sent to both of them and I can't yet find a way to prevent menu from receiving events while allowing autocomplete to still get them.

Frankly, I feel like the only solution for this would be to completely rewrite Maccy so it no longer uses NSMenu. That's a massive effort and I'm not sure when I would be able to start working on that.

@p0deje p0deje added the nsmenu Limitation of NSMenu label Mar 11, 2024
@knoajp
Copy link

knoajp commented Mar 18, 2024

Okay, thank you for your kind support!!
Never mind just ignore or postpone forever if this takes a massive effort to solve!!

Sorry, I could be missing something, but what's the expected behavior? I have set up Karabiner to the following
Now I open Maccy and press F6 to switch to Japanese - I can see that input changes and I can type correctly. Then I remove all of that and press F5 to switch back to the US. Input is changed again and I can type in Maccy. See this in action below:

Wow, that's strange.
When I set Karabiner like that, it should behave exactly like your video.

But on my Mac:

  1. Launch Maccy. (Focus on the input form on Maccy)
  2. Press [F6]. (Does NOT activate Japanese input)
  3. Still all the keys are in Alphabet mode.

The [F6] key works as expected on other apps.
Even I tested on a plain user account on my Mac. Hmm... 🤔
Can it depend on a physical JIS keyboard...!?

And now the [Backspace] key works fine for me as well. I don't know why it didn't back then...

@p0deje
Copy link
Owner

p0deje commented Mar 18, 2024

I can probably prepare a build which will log all key presses and maybe we can debug if there is a different key being pressed.

@p0deje
Copy link
Owner

p0deje commented Aug 1, 2024

@knoajp If you are running Maccy 1.0.0, any chance you could also test 2.0.0.beta.7 and see if Japanese input is now handled correctly?

@knoajp
Copy link

knoajp commented Aug 3, 2024

It looks so good!! 🎉
If I find any issues with it, I'll report it. I hope there's nothing.

@p0deje
Copy link
Owner

p0deje commented Sep 16, 2024

Fixed in 2.0

@p0deje p0deje closed this as completed Sep 16, 2024
@serjb9
Copy link
Author

serjb9 commented Sep 24, 2024

Can confirm it fixed my problem also on maccy 2.0.1 + macos 15.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triaging Further information is requested nsmenu Limitation of NSMenu
Projects
None yet
Development

No branches or pull requests

3 participants