laishulu / macism

Command line MacOS Input Source Manager
MIT License
142 stars 16 forks source link

Allow enabling com.apple.CharacterPaletteIM #10

Closed siikamiika closed 1 year ago

siikamiika commented 1 year ago

Kind of a niche use case, the Emoji & Symbols can also be edited through the usual menu based keyboard shortcuts, but since Apple has made it so difficult to save settings in text form I use macism with skhd instead since I already need it for some CJK IMEs.

https://github.com/laishulu/macism/blob/71f705be22e7b4aaa756cf1a2944a57cf1d05565/macism.swift#L56-L61

Removing the $0.category == TISInputSource.Category.keyboardInputSource condition allows using macism com.apple.CharacterPaletteIM, otherwise I get an error

siikamiika commented 1 year ago

@laishulu the latest commit still fails with Input source \(CommandLine.arguments[1]) does not exist!. I'm OK if you don't want to support this kind of feature but just confirming that I do have a keyboard shortcut for "Select the previous input source":

Screenshot 2023-01-19 at 17 27 37

Here's the content of inputSourceList before filtering by category (and isSelectable):

        let inputSourceList = inputSourceNSArray as! [TISInputSource]
        inputSourceList.forEach { src in
            print("\(src.id)\n\(src.category)\n\(src.isSelectable)\n")
        }
com.apple.keylayout.US
TISCategoryKeyboardInputSource
true

com.apple.CharacterPaletteIM
TISCategoryPaletteInputSource
true

com.apple.PressAndHold
TISCategoryPaletteInputSource
true

com.apple.inputmethod.SCIM
TISCategoryKeyboardInputSource
false

com.apple.inputmethod.SCIM.ITABC
TISCategoryKeyboardInputSource
true

com.apple.inputmethod.Kotoeri.RomajiTyping.Japanese
TISCategoryKeyboardInputSource
true

com.apple.inputmethod.Kotoeri.RomajiTyping
TISCategoryKeyboardInputSource
false

com.apple.50onPaletteIM
TISCategoryPaletteInputSource
true

So all TISCategoryPaletteInputSource are filtered out.

laishulu commented 1 year ago

sorry, I unintentionally reverted the codes to fix this issue. will commit in minutes.

laishulu commented 1 year ago

Please try the latest version.

siikamiika commented 1 year ago

Works, thank you 👍

laishulu commented 1 year ago

To fix imcompatibility with https://github.com/laishulu/macism/issues/11, In your use case, you should add an extra option --noKeyboardOnly in command line to disable the filter. see: https://github.com/laishulu/macism#usage