Bash, the Clipboard and Popup menus

Today I’ll be briefly touching upon ways to send text to clipboard from Bash, and to Open Popup windows.

Bash and the Clipboard

To copy to clipboard, you may use xclip (Or xsel).

The format is:

To send to primary clipboard (Middle click pastes this content)

echo "Something" | xclip[/code]

To send to secondary clipboard (Rightclick and Choose Paste to paste)

echo "Something else" | xclip -selection clipboard[/code]

Bash and Popups

Install zenity

sudo apt-get install zenity[/code]

Informational popups:

zenity --info --text 'Hello World!'[/code]


Dialog options

Display calendar dialog

Display text entry dialog

Display error dialog

Display file selection dialog

--info Display info dialog

--list Display list dialog

Display notification

Display progress indication dialog

Display question dialog

Display text information dialog

Display warning dialog

Display scale dialog

Display color selection dialog

General options

Set the dialog title

Set the window icon with the path to an image. Alternatively, one of the four stock icons can be used: 'error', 'info', 'question' or 'warning'

You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.