Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Option to launch a service via the terminal #79

Open
zefir-git opened this issue Nov 22, 2020 · 2 comments
Open

Feature Request: Option to launch a service via the terminal #79

zefir-git opened this issue Nov 22, 2020 · 2 comments

Comments

@zefir-git
Copy link

Feature Request

It would be nice to be able to pass arguments like electronplayer --service netflix that would launch the specified service.
This would allow people who have downloaded the app specifically for one of the services to be able to create a separate .desktop file with its icon, etc.
I currently have set Netflix as the default service, but I would like to be able to create a separate file with the service icon and name entirely for aesthetical purposes.

@zefir-git zefir-git changed the title Option to launch a service via the terminal Feature Request: Option to launch a service via the terminal Nov 22, 2020
@zefir-git
Copy link
Author

zefir-git commented Nov 22, 2020

https://www.electronjs.org/docs/api/command-line

Having found this, I might create a pull request with it implemented.

@zefir-git
Copy link
Author

zefir-git commented Nov 22, 2020

I can't really understand exactly how the application works, but this should be the code:

if (app.commandLine.hasSwitch('service') {
	const { app } = require('electron');
	//find service by name
	let service = services.filter(service => {
	  //both to lowercase to make it case insensitive
	  return service.name.toLowerCase() === app.commandLine.getSwitchValue("service").toLowerCase()
	})[0]; //get 1st result

	//client side
	animateLoader(service, createElement('img', null, service.style));
	console.log(
	  `Switching to service ${service.name}} at the URL ${service.url}...`
	);
	ipc.send('open-url', service);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant