NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.58k stars 13.74k forks source link

WezTerm lost bunderIdentifier in macOS `InputMethodKit` #285466

Open Eliot00 opened 8 months ago

Eliot00 commented 8 months ago

Describe the bug

Input methods cannot work properly in the Nix packaged version of WezTerm due to missing application IdentifierId.

Steps To Reproduce

A simple input method code example

macOS input method kit doc

    override func inputText(_ string: String!, client sender: Any!) -> Bool {
        NSLog(string)
        // get client to insert
        guard let client = sender as? IMKTextInput else {
            return false
        }

        let iden = client.bundleIdentifier() ?? "none"
        NSLog(iden) // missing bundleIdentifier

        client.insertText(string, replacementRange: NSRange(location: NSNotFound, length: NSNotFound))
        return true
    }

Additional context

Chinese users need to use a software called input method that intercepts keyboard input and shows candidate words for Chinese characters. When I'm editing in Vim, I want the input method to be enabled in insert mode and disabled when pressing esc to go back to normal mode. My input method determines which applications to enable this feature in through the application IdentifierId provided in the handle method of the macOS input method protocol.

This behavior works correctly when downloading WezTerm from its github repo, but not in the Nix packaged version.

Notify maintainers

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"aarch64-darwin"`
 - host os: `Darwin 23.2.0, macOS 14.2.1`
 - multi-user?: `no`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - nixpkgs: `not found`

Add a :+1: reaction to issues you find important.

Eliot00 commented 8 months ago

https://github.com/rime/squirrel/issues/814

Reproduce with squirrel:

  1. install squirrel
  2. install wezterm from nix
  3. config squirrel with
    patch:
    app_options:
    com.github.wez.wezterm:
      ascii_mode: true
      vim_mode: true
  4. enable squirrel, open vim, edit, and press ESC, squirrel still enable