companion icon indicating copy to clipboard operation
companion copied to clipboard

pass an initial url to the app through cli

Open leonaaraujo opened this issue 4 years ago • 0 comments

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:

FNMYWtzXEAExxFw

Solution:

Pass an argument as input to be the priority URL address.
Priority order:

  1. Command line argument URL
  2. Cached last accessed URL
  3. 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);

leonaaraujo avatar Mar 08 '22 03:03 leonaaraujo