companion
companion copied to clipboard
pass an initial url to the app through cli
After talking with @spydenFPS in this Twitter thread https://twitter.com/spydenFPS/status/1500570157881692162 this issue was defined.
The problem:
Is not possible to input a URL on the moment the application is starting, here one example of a call using Microsoft Edge:

Solution:
Pass an argument as input to be the priority URL address.
Priority order:
- Command line argument URL
- Cached last accessed URL
- Default fallback: https://m.youtube.com
Usage example:
# Linux example
./Companion.AppImage "https://google.com"
# Windows example
Companion.exe "https://google.com"
Electron issue:
For the builded application use the node process.argv in the renderer process is necessary to get it from the electron remote at the preload script.
How to access the argv:
import { remote } from 'electron';
console.log(remote.process.argv);