Python 2.7中的以下代码不起作用:
import os
def dockSuck():
os.system("echo Switching to suck effect.")
os.system("defaults write com.apple.dock mineffect suck")
os.system("killall dock")
dockSuck()
打印出Switching to suck effect.
和No matching processes belonging to you were found
。 应该将最小化效果(在Mac上)切换到隐藏的吸吮效果(然后通过killall
重置停靠),但它会返回错误。
答案 0 :(得分:4)
osx上的停靠进程名为Dock - 请注意大写。
$ ps -ef |grep dock -i
501 359 1 0 17Oct14 ?? 0:57.16 /System/Library/CoreServices/Dock.app/Contents/MacOS/Dock
501 423 1 0 17Oct14 ?? 0:03.09 /System/Library/CoreServices/Dock.app/Contents/XPCServices/com.apple.dock.extra.xpc/Contents/MacOS/com.apple.dock.extra
501 2259 359 0 17Oct14 ?? 0:37.98 /System/Library/CoreServices/Dock.app/Contents/Resources/DashboardClient.app/Contents/MacOS/DashboardClient
将您的killall语句修改为os.system("killall Dock")