或许可以使用 Hammerspoon 写个菜单栏插件来替代掉 ventura 丑陋的输入法图标 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
eairjhioaegnh
V2EX    macOS

或许可以使用 Hammerspoon 写个菜单栏插件来替代掉 ventura 丑陋的输入法图标

  •  
  •   eairjhioaegnh 2023-05-19 12:26:35 +08:00 2302 次点击
    这是一个创建于 959 天前的主题,其中的信息可能已经有所发展或是发生改变。
    待我去把 lua 入个门!
    第 1 条附言    2023-05-19 14:28:59 +08:00

    来了来了

    第 2 条附言    2023-05-19 14:30:30 +08:00
    -- ~/.hammerspoon -- ├── Spoons -- │ └── CurrentInputSource.spoon -- │ └── init.lua -- └── init.lua local CurrentInputSource = hs.loadSpoon('CurrentInputSource') CurrentInputSource:start() 
    第 3 条附言    2023-05-19 14:33:31 +08:00
    -- ~/.hammerspoon -- ├── Spoons -- │ └── CurrentInputSource.spoon -- │ └── init.lua -- └── init.lua local obj = {} local abcImage = hs.image.imageFromPath("/System/Library/Input Methods/JapaneseIM-RomajiTyping.app/Contents/PlugIns/JapaneseIM-RomajiTyping.appex/Contents/Resources/Roman.tiff"):template(true) local pinyinImage = hs.image.imageFromPath("/System/Library/Input Methods/SCIM.app/Contents/PlugIns/SCIM_Extension.appex/Contents/Resources/pinyin.tiff"):template(true) function isCurrentInputSource(sourceName, isMethod) if isMethod then return sourceName == hs.keycodes.currentMethod() else return sourceName == hs.keycodes.currentLayout() end end function currentInputSourceIcon() if isCurrentInputSource("ABC", false) then return abcImage elseif isCurrentInputSource("Pinyin - Simplified", true) then return pinyinImage end return nil end 
    第 4 条附言    2023-05-19 14:34:31 +08:00
    -- ~/.hammerspoon -- ├── Spoons -- │ └── CurrentInputSource.spoon -- │ └── init.lua -- └── init.lua function obj:init() self.menubar = hs.menubar.new(true, "CurrentInputSource") self.abc = { title = "ABC", image = abcImage, fn = function() if not isCurrentInputSource("ABC", false) then hs.keycodes.setLayout("ABC") end end, checked = isCurrentInputSource("ABC", false) } self.pinyin = { title = "简体拼音", image = pinyinImage, fn = function() if not isCurrentInputSource("Pinyin - Simplified", true) then hs.keycodes.setMethod("Pinyin - Simplified") end end, checked = isCurrentInputSource("Pinyin - Simplified", true) } self.menuItems = {} self.menuItems[1] = self.abc self.menuItems[2] = self.pinyin self.menubar:setMenu(function() return self.menuItems end) self.menubar:setIcon(currentInputSourceIcon()) end function obj:start() hs.keycodes.inputSourceChanged(function() if isCurrentInputSource("ABC", false) then self.menubar:setIcon(abcImage) self.abc.checked = true self.pinyin.checked = false elseif isCurrentInputSource("Pinyin - Simplified", true) then self.menubar:setIcon(pinyinImage) self.abc.checked = false self.pinyin.checked = true end end) end function obj:stop() hs.keycodes.inputSourceChanged(nil) end return obj 
    10 条回复    2023-05-24 03:01:23 +08:00
    K2
        1
    K2  
    PRO
       2023-05-19 13:06:57 +08:00
    不想看到也可以隐藏掉
    eairjhioaegnh
        2
    eairjhioaegnh  
    OP
       2023-05-19 13:10:39 +08:00
    @K2 但是还是想看到当前状态
    Dream4U
        3
    Dream4U  
       2023-05-19 13:15:34 +08:00
    习惯一下就可以了,现在看高的输入法图标反而不适应了
    Hooluu
        4
    Hooluu  
       2023-05-22 17:57:58 +08:00
    留个名,请问如何更改啊?非程序员,看的云里雾里,T T
    eairjhioaegnh
        5
    eairjhioaegnh  
    OP
       2023-05-22 18:56:16 +08:00
    @Hooluu 没法更改,是关掉系统本身的,自己用系统图标文件新建一个菜单栏图标
    Hooluu
        6
    Hooluu  
       2023-05-22 20:25:55 +08:00
    @eairjhioaegnh 完全听不懂,T T
    eairjhioaegnh
        7
    eairjhioaegnh  
    OP
       2023-05-22 20:39:32 +08:00
    @Hooluu 1. 下载安装 Hammerspoon ,https://github.com/Hammerspoon/hammerspoon/releases/latest
    2. 下载 Spoon 插件,https://wwcg.lanzouy.com/i07ur0wyl46d ,解压后将 CurrentInputSource.spoon 移动到 /Users/用户名 /.hammerspoon/Spoons/,将 init.lua 移动到 /Users/用户名 /.hammerspoon/
    3. 打开 Hammerspoon ,点击菜单栏图标(锤子模样),点击”Reload Config"
    Hooluu
        8
    Hooluu  
       2023-05-22 21:29:12 +08:00
    @eairjhioaegnh 按照你的步骤操作,木有效果,不折腾了,我直接干脆把搜狗输入法图标自己 PS 修改变宽,反向让图标和系统默认丑陋的输入法图标一样的宽度,顺眼多了,doge
    eairjhioaegnh
        9
    eairjhioaegnh  
    OP
       2023-05-22 21:47:26 +08:00
    @Hooluu 咱们强迫症太难了
    Hooluu
        10
    Hooluu  
       2023-05-24 03:01:23 +08:00
    @eairjhioaegnh 只能说苹果现在越来越不尊重自己立下的设计规范了。ε=(ο`*)))唉
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     2524 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 22ms UTC 12:15 PVG 20:15 LAX 04:15 JFK 07:15
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86