Saturday, December 29, 2012

Linux ClipIt for easy word definition save

I have started using Ubuntu (12.04 LTS 64-bit) for the past some time. Also I am an avid reader of web based articles and other textual material. However, while reading text, I come across many words whose meaning I don't know. I like to keep a track of all such words and their meanings so that I can later on review the words and try to boost my vocabulary.
For this purpose, I have started using a combination of 2 tools and some config settings to ease the process. I would like to share the set-up with you guys as I feel many of you might be interested in something similar. There might be many other options present to save your word-meanings but I tried to automate it somewhat myway.
Using this you can add/append the word and its meaning to a designated file in your Ubuntu system by using some hotkeys.

First one is the Google Dictionary plugin for Chrome. You can easily install this from the Google Chrome Extensions Online Market. Once installed you can double click any word in the browser window and a small popup will appear with the selected word and its meaning.


Second tool is a system level tool for Ubuntu named ClipIt which is a default clipboard replacement tool. You can easily install it through the 'Ubuntu Software Center'.
ClipIt HomePage:- http://clipit.rspwn.com/

Once installed you can click on Dash Home in Unity and type 'clipit' to search for the app and run it. Or you can goto terminal and type 'clipit' and press Enter.

A small icon will appear in the taskbar. When you click on it, goto the Preferences and go to Actions.
In Actions, click on the Add... Button in the bottom which adds a new row with 'Action' & 'Command' values being Blank and %s respectively.
'Action' corresponds to any name you want to give the task, 'Command' is the command to run.
Now I wanted to add the Selected Word and Definition in a file in the system while using some hotkeys.

In the 'Action' column, enter
Add Word
as the value which acts as a name for this action. You can use any other name too.

The 'Command' column contains
echo '%s\n\n'|cat>>~/words.txt
as the value. The %s is the copied text which ClipIt will use to use in the 'echo' command and pipe to 'cat' command and append to 'words.txt' file in the home directory with 2 newline chars after every save.

Note: Make sure when you enter values for Action/Command, you press Enter so that the values are saved for the new Action you just created.

Also you can go in hotkeys and change the 'Actions hotkey' to <Ctrl><Shift><A> from the default one which doesn't work for me due to some reason, I guess may be due to clash. You will have to type the key combination.

Steps for Final Working Demo:
  • Open some article or some text in Chrome browser.
  • Double click any word, select the text in the small popup which appears for Word and Definition and press Control+C to copy it. 
  • Then press Hotkey used above Control+Shift+A which opens ClipIt context Menu.
  • Choose 'Add Word' from the Actions Context Menu. If everything is fine, the word will be added to the file in your system.

Some tips and notes:
  • This can work with other linux GNOME distros too which can support ClipIt.
  • I use the file as a Google Drive sync file so that the word list is always updated to my Google cloud storage.




No comments:

Post a Comment