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

--calendar
Display calendar dialog

--entry
Display text entry dialog

--error
Display error dialog

--file-selection
Display file selection dialog

--info Display info dialog

--list Display list dialog

--notification
Display notification

--progress
Display progress indication dialog

--question
Display question dialog

--text-info
Display text information dialog

--warning
Display warning dialog

--scale
Display scale dialog

--color-selection
Display color selection dialog

General options

--title=TITLE
Set the dialog title

--window-icon=ICONPATH
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'