#include "options.hpp" slop::Options* options = new slop::Options(); slop::Options::Options() { m_borderSize = 10; m_padding = 0; m_xdisplay = ":0"; m_tolerance = 4; m_red = 0; m_green = 0; m_blue = 0; m_gracetime = 0.1; m_keyboard = true; } void slop::Options::printHelp() { printf( "Usage: slop [options]\n" ); printf( "Print user selected region to stdout. Pressing keys or right-clicking cancels selection.\n" ); printf( "\n" ); printf( "options\n" ); printf( " -h, --help show this message.\n" ); printf( " -nkb, --nokeyboard don't try to grab the keyboard. This may fix problems with certain window managers.\n" ); printf( " -b=INT, --bordersize=INT set selection rectangle border size.\n" ); printf( " -p=INT, --padding=INT set padding size for selection.\n" ); printf( " -t=INT, --tolerance=INT if you have a shaky mouse, increasing this value will make slop detect single clicks better. Rather than interpreting your shaky clicks as region selections.\n" ); printf( " -x=STRING, --xdisplay=STRING set x display (STRING must be hostname:number.screen_number format)\n" ); printf( " -c=COLOR, --color=COLOR set selection rectangle color, COLOR is in format FLOAT,FLOAT,FLOAT\n" ); printf( " -g=FLOAT, --gracetime=FLOAT set the amount of time before slop will check for keyboard cancellations in seconds.\n" ); printf( "examples\n" ); printf( " slop -b=10 -x=:0 -p=-30 -t=4 -c=0.5,0.5,0.5 -g=.2\n" ); } int slop::Options::parseOptions( int argc, char** argv ) { // Simple command parsing. Just uses sscanf to read each argument. // It looks complicated because you have to have spaces for delimiters for sscanf. for ( int i=0; i