Use Automator to create an application that in effect launches Chrome with command line arguments.
Start Automator and select to create an Application. Double-click Run Shell Script in the Library/Utilities folder and replace the text content — cat — with the following:
1
open -a "Google Chrome.app" --args -pinned-tab-count=4
keep the .app suffix or will break with Parallels
Save anywhere you like.
更换图标
To replace this application’s icon, Get Info on your real Google Chrome, click on the icon on the top left, press Cmd-C, Get Info on your Chrome Automator app, click the icon, and press Cmd-V.
Since it’s a different application, the Dock will display two Chrome applications when it’s running: Chrome, and your Chrome launcher.
方法 2
直接修改默认的启动项目
Edit your application bundle to launch a script instead. This script will start the actual application, adding the command line argument.
Right-click Google Chrome.app and select Show Package Contents. Go to Contents/ and open Info.plist in Property List Editor/Xcode (Apple’s developer tools), or a third party plist editor.
Look for the entry CFBundleExecutable or Executable File. Remember its value (e.g. firefox-bin for Firefox). Replace it with parameterized-app.sh.
Open Terminal and enter the following:
touch /Applications/Firefox.app/Contents/MacOS/parameterized-app.sh open /Applications/Firefox.app/Contents/MacOS/parameterized-app.sh An editor for the .sh file will open. Set the contents of the file to:
(using the actual executable’s name you removed from Info.plist, adding the desired command-line arguments)
Save and close. In Terminal, enter the following:
chmod +x /Applications/Firefox.app/Contents/MacOS/parameterized-app.sh Now, close Terminal and move your application (which must not be running right now) to a different folder and back again. This will update Launch Services, otherwise your changes will be ignored and irritate you immensely.
Now, when you open your application, it will actually execute the .sh file, which will in turn launch the actual executable file, sending the command line args along.
It will look and behave like you expect it to, but you will need to repeat this whenever you update your application, as this will generally replace the application bundle and all the changes you made.
<!-- template for the polygraph component. --> <script type="text/x-template" id="polygraph-template"> <g> <polygon :points="points"></polygon> <circle cx="100" cy="100" r="80"></circle> <axis-label v-for="(stat, index) in stats" :stat="stat" :index="index" :total="stats.length">2222 </axis-label> </g> </script>
<!-- template for the axis label component. --> <script type="text/x-template" id="axis-label-template"> <text :x="point.x" :y="point.y">{{stat.label}}</text> </script> </head> <body> <!-- demo root element --> <div id="demo"> <!-- Use the component --> <svg width="200" height="200"> <polygraph :stats="stats"></polygraph> </svg> <!-- controls --> <div v-for="stat in stats"> <label>{{stat.label}}</label> <input type="range" v-model="stat.value" min="0" max="100" /> <span>{{stat.value}}</span> <button @click="remove(stat)" class="remove">X</button> </div> <form id="add"> <input name="newlabel" v-model="newLabel" /> <button @click="add">Add a Stat</button> </form> <pre id="raw">{{ stats }}</pre> </div>
<p style="font-size:12px">* input[type="range"] requires IE10 or above.</p>
<script> // The raw data to observe var stats = [ { label: "A", value: 100 }, { label: "B", value: 100 }, { label: "C", value: 100 }, { label: "D", value: 100 }, { label: "E", value: 100 }, { label: "F", value: 100 } ];
// A resusable polygon graph component Vue.component("polygraph", { props: ["stats"], template: "#polygraph-template", computed: { // a computed property for the polygon's points points: function() { var total = this.stats.length; return this.stats .map(function(stat, i) { var point = valueToPoint(stat.value, i, total); return point.x + "," + point.y; }) .join(" "); } }, components: { // a sub component for the labels "axis-label": { props: { stat: Object, index: Number, total: Number }, template: "#axis-label-template", computed: { point: function() { return valueToPoint( +this.stat.value + 10, this.index, this.total ); } } } } });
// math helper... function valueToPoint(value, index, total) { var x = 0; var y = -value * 0.8; var angle = ((Math.PI * 2) / total) * index; var cos = Math.cos(angle); var sin = Math.sin(angle); var tx = x * cos - y * sin + 100; var ty = x * sin + y * cos + 100; return { x: tx, y: ty }; }
function func(a, b, c) { console.log(a, b, c); } var func1 = func.bind(null,'linxin');
func('A', 'B', 'C'); // A B C func1('A', 'B', 'C'); // linxin A B func1('B', 'C'); // linxin B C func.call(null, 'linxin'); // linxin undefined undefined