|
@@ -30,6 +30,7 @@ SlopOptions* getOptions( Options& options ) {
|
30
|
30
|
options.getFloat("tolerance", 't', foo->tolerance);
|
31
|
31
|
glm::vec4 color = glm::vec4( foo->r, foo->g, foo->b, foo->a );
|
32
|
32
|
options.getColor("color", 'c', color);
|
|
33
|
+ options.getString( "xdisplay", 'x', foo->xdisplay );
|
33
|
34
|
foo->r = color.r;
|
34
|
35
|
foo->g = color.g;
|
35
|
36
|
foo->b = color.b;
|
|
@@ -71,9 +72,89 @@ std::string formatOutput( std::string input, SlopSelection selection ) {
|
71
|
72
|
return output.str();
|
72
|
73
|
}
|
73
|
74
|
|
|
75
|
+void printHelp() {
|
|
76
|
+ std::cout << "slop v5.3.21\n";
|
|
77
|
+ std::cout << "\n";
|
|
78
|
+ std::cout << "Copyright (C) 2017 Dalton Nell, Slop Contributors\n";
|
|
79
|
+ std::cout << "(https://github.com/naelstrof/slop/graphs/contributors)\n";
|
|
80
|
+ std::cout << "Usage: slop [options]\n";
|
|
81
|
+ std::cout << "\n";
|
|
82
|
+ std::cout << "slop (Select Operation) is an application that queries for a selection from the\n";
|
|
83
|
+ std::cout << "user and prints the region to stdout.\n";
|
|
84
|
+ std::cout << "\n";
|
|
85
|
+ std::cout << "-h, --help Print help and exit\n";
|
|
86
|
+ std::cout << "-v, --version Print version and exit\n";
|
|
87
|
+ std::cout << "Options\n";
|
|
88
|
+ std::cout << " -x, --xdisplay=hostname:number.screen_number\n";
|
|
89
|
+ std::cout << " Sets the x display.\n";
|
|
90
|
+ std::cout << " -k, --nokeyboard Disables the ability to cancel selections with\n";
|
|
91
|
+ std::cout << " the keyboard. (default=off)\n";
|
|
92
|
+ std::cout << " -b, --bordersize=FLOAT Set the selection rectangle's thickness.\n";
|
|
93
|
+ std::cout << " (default=`1')\n";
|
|
94
|
+ std::cout << " -p, --padding=FLOAT Set the padding size of the selection. Can be\n";
|
|
95
|
+ std::cout << " negative. (default=`0')\n";
|
|
96
|
+ std::cout << " -t, --tolerance=FLOAT How far in pixels the mouse can move after\n";
|
|
97
|
+ std::cout << " clicking and still be detected as a normal\n";
|
|
98
|
+ std::cout << " click instead of a click and drag. Setting\n";
|
|
99
|
+ std::cout << " this to 0 will disable window selections.\n";
|
|
100
|
+ std::cout << " Alternatively setting it to 999999 would.\n";
|
|
101
|
+ std::cout << " only allow for window selections.\n";
|
|
102
|
+ std::cout << " (default=`2')\n";
|
|
103
|
+ std::cout << " -c, --color=FLOAT,FLOAT,FLOAT,FLOAT\n";
|
|
104
|
+ std::cout << " Set the selection rectangle's color. Supports\n";
|
|
105
|
+ std::cout << " RGB or RGBA values.\n";
|
|
106
|
+ std::cout << " (default=`0.5,0.5,0.5,1')\n";
|
|
107
|
+ std::cout << " -n, --nodecorations Attempt to select child windows in order to\n";
|
|
108
|
+ std::cout << " avoid window decorations. (default=off)\n";
|
|
109
|
+ std::cout << " -l, --highlight Instead of outlining selections, slop\n";
|
|
110
|
+ std::cout << " highlights it. This is only useful when\n";
|
|
111
|
+ std::cout << " --color is set to a transparent color.\n";
|
|
112
|
+ std::cout << " (default=off)\n";
|
|
113
|
+ std::cout << " --shader=STRING Sets the shader to load and use from\n";
|
|
114
|
+ std::cout << " ~/.config/slop/ or /usr/share/.\n";
|
|
115
|
+ std::cout << " (default=`simple')\n";
|
|
116
|
+ std::cout << " -f, --format=STRING Set the output format string. Format specifiers\n";
|
|
117
|
+ std::cout << " are %x, %y, %w, %h, %i, %g, and %c.\n";
|
|
118
|
+ std::cout << " (default=`X=%x\nY=%y\nW=%w\nH=%h\nG=%g\nID=%i\nCancel=%c\n')\n";
|
|
119
|
+ std::cout << "Examples\n";
|
|
120
|
+ std::cout << " $ # Gray, thick, transparent border for maximum visiblity.\n";
|
|
121
|
+ std::cout << " $ slop -b 20 -c 0.5,0.5,0.5,0.8\n";
|
|
122
|
+ std::cout << "\n";
|
|
123
|
+ std::cout << " $ # Remove window decorations.\n";
|
|
124
|
+ std::cout << " $ slop --nodecorations\n";
|
|
125
|
+ std::cout << "\n";
|
|
126
|
+ std::cout << " $ # Disable window selections. Useful for selecting individual pixels.\n";
|
|
127
|
+ std::cout << " $ slop -t 0\n";
|
|
128
|
+ std::cout << "\n";
|
|
129
|
+ std::cout << " $ # Classic Windows XP selection.\n";
|
|
130
|
+ std::cout << " $ slop -l -c 0.3,0.4,0.6,0.4\n";
|
|
131
|
+ std::cout << "\n";
|
|
132
|
+ std::cout << " $ # Wiggle wiggle!\n";
|
|
133
|
+ std::cout << " $ slop --opengl --shader wiggle\n";
|
|
134
|
+ std::cout << "\n";
|
|
135
|
+ std::cout << " $ # Change output format to use safer parsing\n";
|
|
136
|
+ std::cout << " $ slopoutput=$(slop -f \"%x %y %w %h\")\n";
|
|
137
|
+ std::cout << " $ X=$(echo $slopoutput | awk '{print $1}')\n";
|
|
138
|
+ std::cout << " $ Y=$(echo $slopoutput | awk '{print $2}')\n";
|
|
139
|
+ std::cout << " $ W=$(echo $slopoutput | awk '{print $3}')\n";
|
|
140
|
+ std::cout << " $ H=$(echo $slopoutput | awk '{print $4}')\n";
|
|
141
|
+ std::cout << "\n";
|
|
142
|
+ std::cout << "Tips\n";
|
|
143
|
+ std::cout << " * If you don't like a selection: you can cancel it by right-clicking\n";
|
|
144
|
+ std::cout << "regardless of which options are enabled or disabled for slop.\n";
|
|
145
|
+ std::cout << " * If slop doesn't seem to select a window accurately, the problem could be\n";
|
|
146
|
+ std::cout << "because of decorations getting in the way. Try enabling the --nodecorations\n";
|
|
147
|
+ std::cout << "flag.\n";
|
|
148
|
+}
|
|
149
|
+
|
74
|
150
|
int app( int argc, char** argv ) {
|
75
|
151
|
// Options just validates all of our input from argv
|
76
|
152
|
Options options( argc, argv );
|
|
153
|
+ bool help;
|
|
154
|
+ if ( options.getBool( "help", 'h', help ) ) {
|
|
155
|
+ printHelp();
|
|
156
|
+ return 0;
|
|
157
|
+ }
|
77
|
158
|
// We then parse the options into something slop can understand.
|
78
|
159
|
SlopOptions* parsedOptions = getOptions( options );
|
79
|
160
|
|