Every day we use Google Search dozens of times to seek information on various topics. Each time, we fire up our browser, visit Google Search’s page, and use our keyboard to enter our query. All this takes some time – not much, but enough to justify the existence of dozens of extensions for the most popular browsers that do one particular thing: they allow you to search for anything you select with a single click.
Wouldn’t it be great if we could have the same capability in any application running on our operating system? We can achieve this by combining the Clipman application with a specially formatted URL and a simple Regular Expression “recipe.”
The only necessary prerequisite for this is that the application we’ll be using at any given time should allow the selection of any text we want to look up. In other words, the method we see here cannot work with windows where the text displayed is not editable, allowing its selection and copy to the clipboard.
As with our topic on how to open YouTube videos in two clicks via the VLC media player, here, too, we will use the Clipman app. We will create a generic RegEx recipe that captures everything copied to the clipboard, then “adds it as the search term” to the standard Google Search address, then “opens that custom address” in our preferred browser.
Install and run Clipman
Clipman is usually included by default as part of the XFCE desktop environment. If it didn’t come with your flavor of Linux, you can add it. In Debian-based distributions, install it with the command:
sudo apt-get install xfce4-clipman
If it’s not already active, run it. Access its configuration options by right-clicking on its icon (a paperclip) on the taskbar and selecting Properties from the menu that pops up.
Add a new action
In the first tab, “General,” make sure that all options except “Show QR-code” are active. Continue to the Actions tab.
From here, you can create new actions and recipes, edit existing ones, or delete the ones you no longer want by using the corresponding three keys to the right of the list. Click on the first of them, with the “+” sign, to add an action to Clipman.
Set up the basics
Enter a name for your action in the “Name” field. Make sure the “Activate only on manual copy” option is active so that the application syncs with the “standard” clipboard, springing to action when anything has been copied there.
Detect anything ( … as long as it’s text)
The RegEx recipe we’ll use is the simplest one since it will not match a specific string of characters but anything copied to the clipboard as long as it is a string of characters. For that, enter the following in the “Pattern” field exactly as you see it:
The dot corresponds to a single character. The plus sign means “if there’s at least one of those,” referring to the dot. Combined, they mean “if there is at least one or more characters copied to the clipboard.”
We continue with the very command that will “act” on anything copied to the clipboard. Give it a name in the “Name” field, and, for the command itself, enter the following in the “Command” field:
Note that, obviously, if you don’t really like Firefox, you can swap it for your browser of choice.
With this “magic line,” we tell Firefox that we want to visit not the typical Google Search homepage from where we initiate a search but the results address that appears after entering a query.
The “q” in the address is this query, and it’s equal to whatever was copied to the clipboard. The result is the same as if we had visited Google Search’s homepage, manually entered the term we want to search for, and hit enter to see what would come up. We just skip the intermediate steps. Or, rather, all of them.
Notice that by enclosing the “\0” RegEx recipe in quotation marks in our crafted Google Search URL, we’ll be “passing” the whole phrase as a single query to our browser. If you don’t use quotation marks and select, copy to the clipboard and search for a phrase with more than one word, you’ll find it will be split into different queries, one for each word.
Press the “+” button to add the command to Clipman, then close the window by clicking on OK. Exit Clipman’s configuration window by clicking on Close to save and enable the new action.
Copy to: Google Search
From now on, all you need to complete a Google search for any word or phrase you want is to select it and copy it to the clipboard. And yes, that includes any application that supports selecting and copying any piece of text to the clipboard.
Search for anything
Whenever anything is copied to the clipboard, your new Clipman command will appear in a pop-up menu. Select it, and Firefox will load, if it’s not already running, with your query in a new tab.
Our latest tutorials delivered straight to your inbox