Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

enabled/disabled google chrome extension with command line

There is a way to enable/disable google chrome extension with a command line ? I would like enabled un extension already installed by terminal.

like image 337
Andrea D Avatar asked Oct 29 '22 20:10

Andrea D


2 Answers

Launch Chrome with extension parameter may help you. Example: launch chrome with cmd "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" -no-first-run --load-extension="extension path"

like image 175
BurningFish Avatar answered Nov 16 '22 10:11

BurningFish


Here's an architecture example for what wOxxOm proposed in comments:

  • An extension can enable/disable other extensions with chrome.management API and "management" permission.
  • An extension can spawn a companion daemon process that communicates with the rest of OS using Native Messaging's chrome.runtime.connectNative().
  • Said daemon can create a named pipe that you can write to from the command line, and pass whatever commands are sent to the pipe to the extension using the Native Messaging protocol.

Note that Chrome cannot be contacted from "outside" directly: it must spawn a process on its own, and then you can communicate with the process.

Alternatively (if you don't want to use the Native Messaging protocol, or want the daemon to exist independent of Chrome), your daemon can open a local WebSockets server and your extension can communicate through that. However, it would be possible to impersonate your extension in that case.

like image 22
Xan Avatar answered Nov 16 '22 10:11

Xan