XSELEDIT(1) User Manuals XSELEDIT(1) NAME xseledit - open a editor with content from different clipboards SYNOPSIS xseledit [ --help | primary | secondary | clipboard ] DESCRIPTION xseledit open a editor with content from primary-, secondary selection, or clipboard. You need a editor and xsel on your system. EDITOR must be defined in the config section of the script. Primary selection is the content you selected with your mouse, mostly spit out by middle mouse click in X environment. Clipboard is the content you imbibe by copy or ctrl-c in X environment. So typically, you'll select the content of an input field by press ctrl-a, then you copy it to your clipboard. Now you can use xseledit to edit the content. After you've edit and closed your editor, you'll find the edited content in your clipboard again, and its easy to paste it back in the input field. It is a good idea, to use it in combination with an key-config of your x-window-system, or with something like xbindkeys. A .xbindkeysrc may look like: "xseledit primary" Control + 1 "xseledit secondary" Control + 2 "xseledit clipboard" Control + 3 "xseledit primary copy" Control + Shift + 1 "xseledit secondary copy" Control + Shift + 2 "xseledit clipboard copy" Control + Shift + 3 OPTIONS -h print this help AUTHOR this script is based on an idea of mm Wulf Coulmann <scripts at gpl.coulmann dot de> SEE ALSO xsel(1), xbindkeys(5) Linux Last change: July 2006
#!/bin/bash # copyright Wulf Coulmann <scripts at gpl.coulmann dot de> # based on an idea from mm # GNU GPL # http://www.gnu.org/licenses/gpl.html # # Download me here: http://gpl.coulmann.de/xseledit # config EDITOR='/usr/bin/xterm -title vi -u8 -ls -fn 10x20 -geometry 50x50 -e vim' # ------------------------------------------------------------------------ FILE=$(mktemp) case $1 in primary) ARG="-p" ;; secondary) ARG="-s" ;; clipboard) ARG="-b" ;; -h | --help | -help) cat | less << 'EOD' XSELEDIT(1) User Manuals XSELEDIT(1) NAME xseledit - open a editor with content from different clipboards SYNOPSIS xseledit [ --help | primary | secondary | clipboard ] DESCRIPTION xseledit open a editor with content from primary-, secondary selection, or clipboard. You need a editor and xsel on your system. EDITOR must be defined in the config section of the script. Primary selection is the content you selected with your mouse, mostly spit out by middle mouse click in X environment. Clipboard is the content you imbibe by copy or ctrl-c in X environment. So typically, you'll select the content of an input field by press ctrl-a, then you copy it to your clipboard. Now you can use xseledit to edit the content. After you've edit and closed your editor, you'll find the edited content in your clipboard again, and its easy to paste it back in the input field. It is a good idea, to use it in combination with an key-config of your x-window-system, or with something like xbindkeys. A .xbindkeysrc may look like: "xseledit primary" Control + 1 "xseledit secondary" Control + 2 "xseledit clipboard" Control + 3 "xseledit primary copy" Control + Shift + 1 "xseledit secondary copy" Control + Shift + 2 "xseledit clipboard copy" Control + Shift + 3 OPTIONS -h print this help AUTHOR this script is based on an idea of mm Wulf Coulmann <scripts at gpl.coulmann dot dei> SEE ALSO xsel(1), xbindkeys(5) Linux Last change: July 2006 EOD exit 0 ;; *) ARG="-p" ;; esac XSEL=`which xsel 2> /dev/null` || XSEL="xsel" [ -x "$XSEL" ] || { echo -e "'$XSEL' not found - exiting \n run xseledit --help"; exit 5; } xsel $ARG >$FILE $EDITOR $FILE if [ "$2" == "copy" ] ; then xsel -i -p <$FILE xsel -i -s <$FILE xsel -i -b <$FILE else xsel -i $ARG <$FILE fi rm -f $FILE