Skip to content

Instantly share code, notes, and snippets.

@lyrixx
Last active August 18, 2022 08:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lyrixx/75d115994b1d1181c5d46780f28177c6 to your computer and use it in GitHub Desktop.
Save lyrixx/75d115994b1d1181c5d46780f28177c6 to your computer and use it in GitHub Desktop.
How to "control" auto-completion in Google Chrome address bar?

How to "control" auto-completion in Google Chrome address bar?

For a while, when I type g in the address bar, it suggests me the following URL

https://github.com/foobar/hello/projects/9

But I don't want this URL at the first position. I don't even use this URL!

OK, let's try to fix this!

I suppose Chrome use my history to build this list, so I must find where it stores it.

pgrep chrome | xargs -l1 lsof -p |& grep -i history

Gives me something like this:

chrome  2005691 gregoire  mem-w     REG              253,1  22347776 54788999 /home/gregoire/.config/google-chrome/Default/History
chrome  2005691 gregoire   74uw     REG              253,1  22347776 54788999 /home/gregoire/.config/google-chrome/Default/History
chrome  2005691 gregoire  278u      REG              253,1         0 54802944 /home/gregoire/.config/google-chrome/Default History-journal

Nice, so there is something I need to hack in /home/gregoire/.config/google-chrome/Default/History. I'm pretty sure it's a sqlite database, but let's be sure!

$ file /home/gregoire/.config/google-chrome/Default/History

/home/gregoire/.config/google-chrome/Default/History: SQLite 3.x database, last written using SQLite version 3038005, file counter 6994, database pages 5449, 1st free page 70, free pages 705, cookie 0x28, schema 4, UTF-8, version-valid-for 6994

Chome has a lock on it, so I need to close it, and then I'm able to open it.

sqlite3 /home/gregoire/.config/google-chrome/Default/History

Let's see what's in there:

sqlite> .schema

[...]
CREATE TABLE urls(id INTEGER PRIMARY KEY AUTOINCREMENT,url LONGVARCHAR,title LONGVARCHAR,visit_count INTEGER DEFAULT 0 NOT NULL,typed_count INTEGER DEFAULT 0 NOT NULL,last_visit_time INTEGER NOT NULL,hidden INTEGER DEFAULT 0 NOT NULL);
[...]

Nice, there is a table with what I expect.

sqlite> select * from urls where url like 'https://github.com/%' order by typed_count DESC limit 10 ;

666|https://github.com/foobar/hello%7Cfoobar/hello: hello|97|61|13304678994657973|0
512|https://github.com/foobar/hello/pulls/lyrixx%7CPull requests · foobar/hello|132|58|13304631160249875|0
667|https://github.com/symfony/symfony%7Csymfony/symfony: The Symfony PHP framework|100|28|13305035994180814|0
4482|https://github.com/symfony/symfony/pulls/lyrixx%7CPull requests · symfony/symfony|73|26|13305112110851426|0
416|https://github.com/notifications?query=is%3Aunread%7CNotifications%7C436%7C15%7C13305113547223162%7C0
12179|https://github.com/foobar/hello/issues%7CIssues · foobar/hello|149|15|13304623376042574|0
19357|https://github.com/foobar/hello/projects/9%7CPriorités%7C175%7C14%7C13305113543549495%7C0
25740|https://github.com/foobar/someting%7Cfoobar/someting: :house_with_garden: refonte d'someting.com|72|14|13304706720837399|0
626|https://github.com/foobar/docker-starter%7Cfoobar/docker-starter: :building_construction: A skeleton to start a new web project with PHP, Docker and Invoke|75|13|13302709982635973|0
315|https://github.com/%7CGitHub%7C37%7C11%7C13304702586397658%7C0

Indeed, the URL I got is the first one.

So let's place the one I want (https://github.com/notifications?query=is%3Aunread) at the top position:

sqlite> update urls set typed_count = 100 where id = 416 ;

Finally, I can exit the database, re-launch Chrome, and the URL will be the one I want.

image

@alcohol
Copy link

alcohol commented Aug 17, 2022

Or just navigate to the suggestion and hit shift + delete combo on your keyboard..

@AllenJB
Copy link

AllenJB commented Aug 17, 2022

For at least some entries (in Chrome on Windows), if you hover over the entry you'll see an 'x' on the right side. Click that and it will no longer be suggested.

Additional options to control the sources of url bar suggestions are under Settings => You and Google => Sync and Google Services

@t-richard
Copy link

@alcohol @AllenJB but where's the fun?

@yoeunes
Copy link

yoeunes commented Aug 18, 2022

Thank you Grégoire

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment