Disable the Gemini Button in Google Docs
Recently I came across a question on Reddit in which a user asked how to disable the Gemini button in Google Docs. I’m sure there are existing browser extensions that can do this sort of thing, but why use someone else’s extension when you can write your own!
Making browser extensions is quite straightforward. In general, you will need to know a little bit of Javascript, HTML and/or CSS.
This demonstration is so simple it only uses only a few lines of Javascript and the only tool you’ll need is a text editor. Windows Notepad is sufficient, but feel free to use any text editor.
All the code is included so you can recreate this example yourself.
The steps in Part 2 are specific to Google Chrome, but it should be easy to adapt to other browsers. Amend the steps as appropriate.
Part 1 — Write the code
- Create a folder on your computer (I called my folder GemiNone)
- Open notepad (or your favorite text editor)
- Copy code block #1 below and paste it into your text editor
- Save the file as manifest.json in the folder you created
- Open a new text editor or create a new blank text file
- Copy code block #2 below and paste it into your new text editor window
- Save the second file as main.js in the folder you created
You should now have a folder with two files:
GemiNone\
manifest.json
main.js
Code block #1 (save as “manifest.json”)
{
"manifest_version": 3,
"name": "GemiNone",
"version": "1.0",
"description": "Hide the Gemini icon in Google Docs",
"content_scripts":
[
{
"js": ["main.js"],
"matches": ["https://docs.google.com/document/*"]
}
]
}
Code block #2 (save as “main.js”)
const geminiButton = document.querySelector('#docs-sidekick-button-container');
if (geminiButton)
{
geminiButton.style.display = 'None';
}
Part 2 — Load the extension into Chrome
The following steps are specific to Chrome. Adapting these steps to other browsers should be straightforward but I have not tested this extension on anything except Chrome.
- From Chrome, click on the three stacked dots in the upper right (“Customize and control Google Chrome”)
- Select Extensions then Manage Extensions
- Click the Load Unpacked button in the upper left
- Select the folder you created
- Click the Select Folder button
- Observe a confirmation popup appears briefly
- Observe the new extension is listed as GemiNone
- Open Google Docs in a new browser tab (or refresh the tab if it’s already open)
- Observe the Gemini button is gone
Theory of Operation
How does this work?
manifest.json
Take a look at the contents of the manifest.json file. Every extension must have a file with this name. This is a JSON file, so its formatting is very specific with the curly braces and square brackets.
This file sets some properties of the extension including its name, version, etc. More importantly, it lists all the files that make up the extension. In this case there is only one file called “main.js”.
Notice that “main.js” is listed in the “content_scripts” section. This tells the browser to load the script file and begin executing it. Also notice the script will only be in effect when you are browsing the Google Docs website due to the matches declaration. Because of this, the script will not be loaded when you visit any other website.
main.js
Now look at the contents of the main.js file. This is where the real work is done. This file contains a few lines of Javascript code.
The first line finds the Gemini button. The only magic here is the ID of the div that contains the button in question. I found the value for the ID by using the Inspector in the Developer Tools in my browser.
If the Gemini button was found, then the script sets its display property to “none” which effectively hides the button.
That’s all there is to it.
Caveats
This demonstration is not intended to be a general purpose browser extension tutorial. Rather, it’s a specific demonstration prompted by a question I saw on Reddit. If you want to learn more about making browser extensions, I’ve included some links below.
I wouldn’t call this extension “production ready”. It was intended as a demonstration of how easy it is to make browser extensions.
The technique used for removing the button is fragile. At the time of writing this, the button is contained in a div tag with a specfic ID. Google might change that at any time without notice. If that thappens this extension will stop working, but it should fail gracefully.
Although the Gemini button will be hidden, Gemini itself will not be removed or disabled by this extension. The AI assistant is deeply integrated into Google Docs and this extension makes no attempt to change that. Technically, the button isn’t “removed” as the OP in Reddit requested; it’s only hidden.
In hindsight, “GemiGone” would have been a better name.
If you choose to use this extension, feel free to alter it to suit your needs.
More Information
MDN Web Docs is the definitive resource for browser extentions. If you want to learn more, this should be your first stop.
Chrome also maintains documentation. For tutorials, reference information, and samples of Chrome browser extensions, see the Chrome Extensions documentation.
MDN Web Docs has more information about JSON files (like our manifest.json file) if you want to learn more about them.
MDN Web Docs also has information about Browser Developer Tools like the Inspector that I used to find the ID of the Gemini button.