My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members

Description

When run without any argument, xgetc will run forever and will respond to mouse click by printing the pixel color (in hexadecimal notation) and position to stdout. When a selection is made, xgetc will print the geometry of the selection instead (widthXheight+x+y).

Command line options can be specified to limit the output to any of selection geometry, mouse position and pixel color.

Sample Usage

1) Emulate twm-esque behavior on your Gnome/KDE supercharged desktop:

  xclock -geometry `xgetc -g`
Select a rectangular area on your screen and xclock window will be limited to that area, plus some offset for the window manager title bar. twm, anyone?

2) Getting the color of some random pixel on your screen from inside vim (if you click it, they will come):

In somefile.css:
.blue {
    background-color:
xgetc -c         <-- hit !!sh on this line in vim, then click anywhere on your screen
                     and voila!, the pixel color will be there.
;}

3) Use your imagination.

Related tools

See these other tools for automating your X session:

wmctrl - http://www.sweb.cz/tripie/utils/wmctrl/

xdotool - http://www.semicomplete.com/projects/xdotool/

xwit, and the set of tools in xautomation.

Similar tool (prior art :) - grabc: http://muquit.com/muquit/software/grabc/grabc.html. grabc shows the pixel color of the clicked position and prints the color both in hex (to stdout) and rgb (to stderr).

Powered by Google Project Hosting