TIL: Chrome allows you to define a Custom Search Engine (CSE) by which you can search sites. The cool part is that you’re not really limited to search only, and that you can abuse these CSEs to become more productive. In this post I’ll show you how to tweet from the Chrome Address Bar.
🦊 Firefox User? You can achieve the same result by adding a bookmark.
~
TIL: Custom Search Engine
The idea was sparked by this tweet by Rowan Merewood. Rowan created a CSE to quickly go to a Zoom meeting by simply typing zoom meeting-id
in the Chrome Address Bar.
Don’t mind the word “Search”: Upon hitting ENTER the browser won’t search Zoom but will directly go to the Zoom meeting with ID 123456789.
A Custom Search Engine (CSE) is defined by three parameters:
- Search Engine: The name that will be shown in the Chrome Address Bar when typing in
keyword
- Keyword: The keyword that needs to trigger the Search Engine
- URL: The URL that will be visited once you press enter. Use
%s
where you want your “search term” to appear.
Here’s how Rowan has define his Zoom CSE:
~
DuckDuckGo’s !tw
command
Earlier today I saw Šime Vidas tweet about using DuckDuckGo’s !tw
command interpretation to quickly compose a new tweet.
Blog post → Twitter post
1. Ctrl/Cmd + L
2. Arrow Left
3. Type “!tw ” (incl. space)
4. Return(requires @DuckDuckGo as default search engine)
I do this when I want to quickly acknowledge someone’s article by liking it on Twitter.
— Šime Vidas (@simevidas) March 24, 2020
As he uses DuckDuckGo as his default search engine, the trick works fine from the address bar:
- The Address Bar will pass the entered term to search DuckDuckGo
- DuckDuckGo will interpret the
!tw
prefix and redirect to Twitter’s Compose Dialog
For users like me, who don’t use DuckDuckGo as their search engine, that won’t work.
~
1 + 1 = 2
Combining both ideas, I came to create a Custom Search Engine for Chrome that will allow me to quickly tweet from the Address Bar:
I’ve define a CSE so that the tw
keyword will directly go to Twitter’s Compose Dialog. To define this CSE yourself, go to chrome://settings/searchEngines
and add a new CSE with the following details:
- Search Engine:
Compose Tweet
- Keyword:
tw
- URL:
https://twitter.com/compose/tweet?text=%s
From now on you can compose a tweet by simply typing tw This is a tweet
in the Chrome Address Bar.
Combine that with CMD+L
, just like Šime did, and you can quickly tweet out links:
- Visit URL
- Hit
CMD+L
to focus the Address Bar - Hit
CMD+←
to put the cursor before the URL - Type in
tw
(with space) and hit enter
Cool!
~
Call to developers
I see lots of uses for this. You could create these kind of productivity shortcuts to go quickly to Twitter profile pages, visit NPM packages, auto-archive URLS on The Wayback Machine, etc. (Ab)using CSEs like this once again underlines the importance of bookmarkable URLs and the ability to precompose data along with that.
Do note that many sites (such as the mentioned Twitter, GitHub, NPMJS, etc.) already provide CSEs to actually search them. Same goes for WordPress blogs, such as this one right here: simply enter bram.us searchterm
in the Chrome Address Bar and after hitting ENTER it’ll search this blog for the given searchterm
.
~
Thank me with a coffee.
I don\'t do this for profit but a small one-time donation would surely put a smile on my face. Thanks!
To stay in the loop you can follow @bramus or follow @bramusblog on Twitter.
Leave a comment