Controlling the clipboard via Zenity and Xclip
|
Shortcuts
You can easily set up helpful keyboard shortcuts to use your clipboard, and then you won't have to remember the parameters or input them by hand.
To do this in Unity, you can look for System Settings under the gear menu (in the upper right-hand corner of your screen), select Keyboard and open the Shortcuts tab.
In Gnome, the process is virtually the same: Go to System settings | Keyboard | Keyboard shortcuts . Do the same in KDE. When using other window managers, you can typically find the appropriate settings under the keyboard entry in the desktop configuration app.
You will then have to enter the path to the script together with one of the following parameters: retrieve , save , delete , or edit . The commands used to create four shortcuts (Figure 1) are shown in Listing 2. After defining the commands, you can fill in the key combination that will trigger the shortcut.
Listing 2
Create Keyboard Shortcuts
/home/MyDirectory/clipboard.sh save /home/MyDirectory/clipboard.sh retrieve /home/MyDirectory/clipboard.sh delete /home/MyDirectory/clipboard.sh edit
Conclusion
Now, you have a clipboard (Figure 2) that you can extend and customize as you wish. For example, you could add additional memory locations and have the current date, contact information, or other frequently used content ready to copy and paste wherever you need it. Zenity and Xclip lets you get up and running easily, and the clipboard can be used in most window managers. You only need to create the corresponding keyboard shortcuts.
Infos
- Xclip: http://xclip.sourceforge.net
- Zenity: http://live.gnome.org/Zenity
- "Automating tasks with SSH, Zenity, Yad, KDialog, PuTTY, WinSCP, and Rex Secure Agent" by Tim Schürmann, Linux Magazine , 146: http://www.linux-magazine.com/Issues/2013/146/Script-Dialogs/%28language%29/eng-US
« Previous 1 2 3 Next »
Buy this article as PDF
Pages: 3
(incl. VAT)