Bash 和 Mac OS X,在 Space N 中打开应用程序

Ope*_*way 5 macos bash

我想知道 OSX 是否可以在 bash 中创建一个脚本,我们将应用程序名称和数字 N 作为输入,以便该应用程序在 Space 的空间编号 N 中打开。

我想用这个创建一个元脚本,所以当计算机启动和登录后,在每个空间上我都会得到不同的应用程序,重要的是,我可以在脚本文件中更改它,而不是通过 mac os x Space 的首选项

谢谢

Ned*_*ily 1

#!/bin/sh
APPNAME=$1
SPACE=$2
APPID=$(osascript - <<EOF1 | tr '[:upper:]' '[:lower:]'
tell application "Finder"
    get id of application file "$APPNAME" of folder "Applications" of startup disk
end tell
EOF1
)
osascript - <<EOF2
tell application "System Events"
    set x to application bindings of spaces preferences of expose preferences
    set x to {|$APPID|:$SPACE} & x
    set application bindings of spaces preferences of expose preferences to x
end tell
EOF2
Run Code Online (Sandbox Code Playgroud)