You can save the entire page, but it is not always necessary, often you want to save a few lines of text.
Previously, manually created text file and copied it right, but it is exhausting.
Then it was decided to automate this process was written a small script to create notes that I would like to share with you.
The principle of operation of a script.
Let's say I want to save the information to disk. Select the text, run the script (I run on a combination of hotkeys). The selected text itself is copied into the opened window:
It can be edited as desired. Press OK.
A window opens to enter the name of the file that will be saved note:
If you leave this field blank, the title will be "Note [random number].txt".
Press OK. All selected text will be saved into the text file.
Guide - "How to do?".
Must be installed packages zenity, xclip:
sudo apt-get install -y zenity xclip
Create the script file:
You can create a file in a text editor, where you want. Paste into this file this code:
#!/bin/bash # Adds the selected text to the note at the specified location # Must be installed: zenity, xclip # $ sudo apt-get install zenity xclip out="/tmp/notes.$$" dir="$HOME/Downloads" # folder where will be stored the notes xclip -o | zenity --width=600 --height=300 --title "Text of the note" --text-info --editable > "$out" if [ $? -eq 0 -a "`cat "$out"`" != "" ]; then name=$(zenity --title "Title of the note" --entry --text "Enter the title") if [ $? -eq 0 ]; then if [ "`echo $name`" = "" ] then name="Note $$" fi cp "$out" "$dir/$name.txt" fi fi rm "$out" exit 0
Folder where will be saved the notes is specified in the variable dir. You can change on your own.
Save and close the editor.
Make the script executable:
chmod +x notes
Check the correct work of the script
Add in your system hot key to run a script or hot corner of the screen.
There is a small "glitch" - if you select text and then click elsewhere, for example, to open any menu, the text is not automatically inserted, a window opens empty.
It is therefore desirable to run a script with hotkeys.
I hope someone will find it interesting.