Deliantra MORPG |
Last change: 2007-10-15
You can download the latest version here. Source:
--- CUT ---
Xcb has two modes of operation. Normally xcb provides an array of windows on your display, one per cut buffer, tiled horizontally, vertically, or in some user specified layout. Each window displays the contents of its respective cut buffer. Data can be cut from and pasted to the windows in a similar manner to xterm. The buffers can also be rotated.
In task mode, xcb lets you access the cut buffers from the command line. Cut buffers can be loaded from stdin, copied or concatenated to stdout, loaded using the current PRIMARY selection, or rotated an arbitrary number of positions. In this mode of operation, xcb performs the requested task and then exits. It does not create any windows and has no interaction with the mouse or keyboard.
The names of the buffer widgets are "buffer0", "buffer1", "buffer2", .... etc., and their class name is "Buffer". Each buffer widget supports all the standard core widget resources, plus the .foreground and .fontSet resources.
Application wide resources are as
follows:
.bufferCount (default value 8) This is the number of buffer widgets to create. Any number of widgets (greater than zero) can be created. .layout (default value "h") Only the first character of the resource value is significant. This is the geometry arrangement to apply in the container widget. The layout can be "h" (horizontal), "v" (vertical), or some other value to disable the inbuilt geometry code and specify the layout via your X resources. An example is provided in the application default resources file.
cut() causes the contents of the chosen cut buffer to become the PRIMARY selection. The window contents, if any, are highlighted, and can then be pasted into other cut buffers or applications. paste() causes the value of the PRIMARY selection to be converted into text and pasted into the chosen cut buffer, overwriting any previous buffer contents. If no PRIMARY selection is present, xcb pastes the contents of cut buffer zero into the chosen buffer. clear() clears the chosen cut buffer. rotate(NN) rotates the cut buffers by NN positions. NN may be any positive or negative number. refresh() causes the cut buffer window to be cleared and redrawn. selreq() this action function handles paste requests from other clients, or other xcb windows. It should always be bound to SelectionRequest events. selclear() this action function responds to the loss of ownership of the PRIMARY selection property. It should always be bound to SelectionClear events. quit() causes xcb to terminate.
The default bindings are as follows:-
<Btn1Down>: cut() \n\ Shift <Btn2Down>: clear() \n\ <Btn2Down>: paste() \n\ Shift <Btn3Down>: rotate(-1) \n\ <Btn3Down>: rotate(1) \n\ <Key>Left: rotate(-1) \n\ <Key>Right: rotate(1) \n\ <Key>Up: rotate(-1) \n\ <Key>Down: rotate(1) \n\ <Key>q: quit() \n\ <SelReq>: selreq() \n\ <SelClr>: selclear()
Examples
xcb -s 0-7
< /dev/null
This clears the first 8 cut buffers in your server.
echo "G'day." | xcb -display
bigears:0.0 -s 1,3,5,7
This loads the string "G'day." into four of the cut buffers on the display
"bigears".
xsendevent -win buffer5 '<Btn1Down>'
This uses the program xsendevent to send a synthetic mouse click event
to an xcb subwindow, thereby making that window the owner of the PRIMARY
selection.
ls `xcb -p 2,3`
This produces a listing of all the files named in cut buffers 2 and 3.
xcb -p 0-7 | xcb -s 0
This concatenates the values in the first 8 cut buffers, and places the
result back in cut buffer zero.
xcb -S 0 && xcb -p 0
The first command copies the current PRIMARY selection into the first cut
buffer. If the copy succeeds, then the second command prints that data
on stdout.
for i in 0 1 2 3 4 5 6 7 do xcb -p $i > $HOME/.xcb/$i done for i in 0 1 2 3 4 5 6 7 do xcb -s $i < $HOME/.xcb/$i doneThis first loop saves the contents of each of the cut buffers in a separate file under your home directory. The second loop restores the cut buffer contents from those files. When placed in your .logout and .login scripts respectively, the commands are a simple method of preserving your cut buffers across login sessions.
function g echo "$1\\c" | xcb -s 7 grep "$@" function vg vi +/`xcb -p 7` "$@"These two shell functions exemplify a simple mechanism for saving and reusing regular expressions. The first function saves the regex used for grep-ing into cut buffer 7. The second function reuses the most recent grep regex as a search command in vi. There is considerable scope for expanding and improving these ideas.
Original Author
Farrell McKay
E-mail: Farrell.McKay@mpx.com.au
XView modifications provided by Danny Vanderryn
E-mail: dvanderr@us.oracle.com
Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appears in all copies and that both that copyright notice and this permission notice appear in supporting documentation. This software is provided "as is" without express or implied warranty.
Any questions/hints/critics? Contact the author of this page!