How to access launch arguments of application shortcut in OSjs?


#1

hi

as you know you can create shortcut for your application in OSjs. and you can edit its properties including “Label”,“launch”, “launch arguments”. now the question is how to access “launch arguments” in application filese(ex. main.js)?

thanks in advance


#2

Hi,

You can use https://os.js.org/doc/client/OSjs.Core.Application.html#_getArgument for that :slight_smile:

For example if your shortcut has the argument(s) {foo: "bar"}

// Application
this._getArgument('foo'); // = "bar"

// Window
this._app._getArgument('foo'); // = "bar"

#3

The second argument (args) in the Application constructor also has these arguments

Ref: https://os.js.org/doc/client/OSjs.Core.Application.html