添加终端以使用外语macOS默认写入来停靠持久性应用程序 [英] Add Terminal to dock persistent-apps with default write with foreign language macOS

查看:59
本文介绍了添加终端以使用外语macOS默认写入来停靠持久性应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将Google添加到扩展坞的过程如下:

Adding Google to the dock works like this:

    defaults write com.apple.dock persistent-apps -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Google Chrome.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>'

但是将Terminal添加到扩展坞不适用于以下情况:

But adding Terminal to the dock does not work with these:

    defaults write com.apple.dock persistent-apps -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Utilities/Terminal.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>'

    defaults write com.apple.dock persistent-apps -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Lisäohjelmat/Terminal.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>'

    defaults write com.apple.dock persistent-apps -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Lisäohjelmat/Pääte</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>'

我希望保持我的计算机语言为芬兰语,同时仍然能够通过我的Dotfiles建立自定义的扩展坞.对于MacOS默认应用程序(例如终端和日历等),同样的问题仍然存在.

I would love to keep my computers language as Finnish, while still being able to have a customised dock through my Dotfiles. And this same issue is persistent with the MacOS default apps, such as terminal and calendar etc.

推荐答案

我认为我和您有类似的问题,但是,我认为这不是本地化问题.在我看来,这些应用程序并不是真正看起来像的一样.

I believe I have a similar problem to you, however, I do not think it‘s a localisation issue. Digging deeper it looks to me that these apps aren‘t really where they seem.

尝试转到Finder中的/Applications/Lisäohjelmat.现在打开终端并执行 ls/Applications/Lisäohjelmat.有区别吗?在我的英语版本的macOS上,当我 ls /Applications/Utilities 目录时,我看到一个空文件夹!

Try going to /Applications/Lisäohjelmat in the Finder. Now open up Terminal and do ls /Applications/Lisäohjelmat. Notice a difference? On my English language version of macOS, when I ls the /Applications/Utilities directory I see an empty folder!

据我所知,现在大多数系统应用程序都驻留在/System/Applications/中,我认为也许您也是这种情况.

As far as I can gather most of the System applications now reside in /System/Applications/ and I would assume that perhaps this is the case for you too.

将所有内容组合在一起,我的首次运行Dock设置如下(在确认应用程序的位置后根据您的需要进行调整):

Bringing it all together, my first-run Dock setup looks like (adjust for your needs after confirming where the applications are):

#!/bin/sh

set -e

__dock_item() {
    printf '%s%s%s%s%s' \
           '<dict><key>tile-data</key><dict><key>file-data</key><dict>' \
           '<key>_CFURLString</key><string>' \
           "$1" \
           '</string><key>_CFURLStringType</key><integer>0</integer>' \
           '</dict></dict></dict>'
}

printf '%s' 'Setting up Dock icons...'
defaults write com.apple.dock \
               persistent-apps -array "$(__dock_item /Applications/Safari.app)" \
                                      "$(__dock_item /System/Applications/Utilities/Terminal.app)"
killall Dock
printf '%s\n' ' done.'

注意:我使用的是 -array 而不是 -array-add ,它会完全清除数组并将其设置为我提供的值.

Note: I have used -array instead of -array-add which just completely clears the array and sets it to what I give.

希望有帮助,祝你好运!

Hope that helps and good luck!

这篇关于添加终端以使用外语macOS默认写入来停靠持久性应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆