Browse Source

changed around option flags to not conflict with maim

naelstrof 7 years ago
parent
commit
3721a5e3bf
5 changed files with 13 additions and 12 deletions
  1. 6
    6
      slop.1
  2. BIN
      slop.1.gz
  3. 3
    3
      src/main.cpp
  4. 1
    1
      src/options.hpp
  5. 3
    2
      src/slop.cpp

+ 6
- 6
slop.1 View File

4
 .SH NAME
4
 .SH NAME
5
 slop \- select operation
5
 slop \- select operation
6
 .SH SYNOPSIS
6
 .SH SYNOPSIS
7
-slop [OPTIONS]
7
+slop [-klqn] [OPTIONS]
8
 .SH DESCRIPTION
8
 .SH DESCRIPTION
9
 slop is an application that queries for a selection from the user and prints the region to stdout. It grabs the mouse and turns it into a crosshair, lets the user click and drag to make a selection (or click on a window) while drawing a pretty box around it, then finally prints the selection's dimensions to stdout.
9
 slop is an application that queries for a selection from the user and prints the region to stdout. It grabs the mouse and turns it into a crosshair, lets the user click and drag to make a selection (or click on a window) while drawing a pretty box around it, then finally prints the selection's dimensions to stdout.
10
 .SH OPTIONS
10
 .SH OPTIONS
15
 .BR \-v ", " \-\-version
15
 .BR \-v ", " \-\-version
16
 Print version and exit.
16
 Print version and exit.
17
 .TP
17
 .TP
18
-.BR \-x ", " \-\-xdisplay=\fIhostname:number.screen_number\fR
18
+.BR \-d ", " \-\-xdisplay=\fIhostname:number.screen_number\fR
19
 Sets the xdisplay to use.
19
 Sets the xdisplay to use.
20
 .TP
20
 .TP
21
-.BR \-k ", " \-\-nokeyboard
22
-Disables the ability to cancel selections with the keyboard.
23
-.TP
24
 .BR \-b ", " \-\-bordersize=\fIFLOAT\fR
21
 .BR \-b ", " \-\-bordersize=\fIFLOAT\fR
25
 Sets the selection rectangle's thickness.
22
 Sets the selection rectangle's thickness.
26
 .TP
23
 .TP
33
 .BR \-c ", " \-\-color=\fIFLOAT,FLOAT,FLOAT,FLOAT\fR
30
 .BR \-c ", " \-\-color=\fIFLOAT,FLOAT,FLOAT,FLOAT\fR
34
 Sets the selection rectangle's color. Supports RGB or RGBA input. Depending on the system's window manager/OpenGL support, the opacity may be ignored.
31
 Sets the selection rectangle's color. Supports RGB or RGBA input. Depending on the system's window manager/OpenGL support, the opacity may be ignored.
35
 .TP
32
 .TP
36
-.BR \-s ", " \-\-shader=\fISTRING\fR
33
+.BR \-r ", " \-\-shader=\fISTRING\fR
37
 This sets the vertex shader, and fragment shader combo to use when drawing the final framebuffer to the screen. This obviously only works when OpenGL is enabled. The shaders are loaded from ~/.config/slop. See https://github.com/naelstrof/slop for more information on how to create your own shaders.
34
 This sets the vertex shader, and fragment shader combo to use when drawing the final framebuffer to the screen. This obviously only works when OpenGL is enabled. The shaders are loaded from ~/.config/slop. See https://github.com/naelstrof/slop for more information on how to create your own shaders.
38
 .TP
35
 .TP
39
 .BR \-f ", " \-\-format=\fISTRING\fR
36
 .BR \-f ", " \-\-format=\fISTRING\fR
47
 .TP
44
 .TP
48
 .BR \-q ", " \-\-quiet
45
 .BR \-q ", " \-\-quiet
49
 Disable any unnecessary cerr output. Any warnings simply won't print.
46
 Disable any unnecessary cerr output. Any warnings simply won't print.
47
+.TP
48
+.BR \-k ", " \-\-nokeyboard
49
+Disables the ability to cancel selections with the keyboard.
50
 .SH EXAMPLES
50
 .SH EXAMPLES
51
 To emulate a windows XP selection, you can use something like this:
51
 To emulate a windows XP selection, you can use something like this:
52
 .PP
52
 .PP

BIN
slop.1.gz View File


+ 3
- 3
src/main.cpp View File

31
     glm::vec4 color = glm::vec4( foo->r, foo->g, foo->b, foo->a );
31
     glm::vec4 color = glm::vec4( foo->r, foo->g, foo->b, foo->a );
32
     options.getColor("color", 'c', color);
32
     options.getColor("color", 'c', color);
33
     options.getBool("nokeyboard", 'k', foo->nokeyboard);
33
     options.getBool("nokeyboard", 'k', foo->nokeyboard);
34
+    std::cout << foo->nokeyboard << "\n";
34
     options.getString( "xdisplay", 'x', foo->xdisplay );
35
     options.getString( "xdisplay", 'x', foo->xdisplay );
35
     options.getString( "shader", 's', foo->shader );
36
     options.getString( "shader", 's', foo->shader );
36
     foo->r = color.r;
37
     foo->r = color.r;
89
     std::cout << "-h, --help                    Print help and exit\n";
90
     std::cout << "-h, --help                    Print help and exit\n";
90
     std::cout << "-v, --version                 Print version and exit\n";
91
     std::cout << "-v, --version                 Print version and exit\n";
91
     std::cout << "Options\n";
92
     std::cout << "Options\n";
92
-    std::cout << "  -x, --xdisplay=hostname:number.screen_number\n";
93
+    std::cout << "  -d, --xdisplay=hostname:number.screen_number\n";
93
     std::cout << "                                Sets the x display.\n";
94
     std::cout << "                                Sets the x display.\n";
94
 	std::cout << "  -k, --nokeyboard              Disables the ability to cancel selections with\n";
95
 	std::cout << "  -k, --nokeyboard              Disables the ability to cancel selections with\n";
95
 	std::cout << "                                  the keyboard.  (default=off)\n";
96
 	std::cout << "                                  the keyboard.  (default=off)\n";
120
 	std::cout << "                                  highlights it. This is only useful when\n";
121
 	std::cout << "                                  highlights it. This is only useful when\n";
121
 	std::cout << "                                  --color is set to a transparent color.\n";
122
 	std::cout << "                                  --color is set to a transparent color.\n";
122
 	std::cout << "                                  (default=off)\n";
123
 	std::cout << "                                  (default=off)\n";
123
-	std::cout << "      --shader=STRING           Sets the shader to load and use from\n";
124
+	std::cout << "  -r, --shader=STRING           Sets the shader to load and use from\n";
124
 	std::cout << "                                  ~/.config/slop/\n";
125
 	std::cout << "                                  ~/.config/slop/\n";
125
-	std::cout << "                                  (default=`simple')\n";
126
 	std::cout << "  -f, --format=STRING           Set the output format string. Format specifiers\n";
126
 	std::cout << "  -f, --format=STRING           Set the output format string. Format specifiers\n";
127
 	std::cout << "                                  are %x, %y, %w, %h, %i, %g, and %c.\n";
127
 	std::cout << "                                  are %x, %y, %w, %h, %i, %g, and %c.\n";
128
 	std::cout << "                                  (default=`%g\n')\n";
128
 	std::cout << "                                  (default=`%g\n')\n";

+ 1
- 1
src/options.hpp View File

29
 #include <glm/glm.hpp>
29
 #include <glm/glm.hpp>
30
 
30
 
31
 static std::string validStringArguments[] = { "bordersize", "padding", "color", "shader", "highlight", "format", "tolerance", "nodecorations", "nokeyboard", "help", "xdisplay", "version", "quiet" };
31
 static std::string validStringArguments[] = { "bordersize", "padding", "color", "shader", "highlight", "format", "tolerance", "nodecorations", "nokeyboard", "help", "xdisplay", "version", "quiet" };
32
-static char validCharArguments[] = { 'b', 'p', 'c', 's', 'l', 'f', 't', 'n', 'k', 'h', 'x', 'v', 'q' };
32
+static char validCharArguments[] = { 'b', 'p', 'c', 'r', 'l', 'f', 't', 'n', 'k', 'h', 'd', 'v', 'q' };
33
 static unsigned int isFlagArgument[] = { false, false, false, false, true, false, false, false, true, true, false, true, true };
33
 static unsigned int isFlagArgument[] = { false, false, false, false, true, false, false, false, true, true, false, true, true };
34
 static unsigned int validArgumentCount = 13;
34
 static unsigned int validArgumentCount = 13;
35
 static unsigned int maxFloatingValues = 0;
35
 static unsigned int maxFloatingValues = 0;

+ 3
- 2
src/slop.cpp View File

21
 // Defaults!
21
 // Defaults!
22
 SlopOptions::SlopOptions() {
22
 SlopOptions::SlopOptions() {
23
     borderSize = 1;
23
     borderSize = 1;
24
+    nokeyboard = false;
24
     nodecorations = false;
25
     nodecorations = false;
25
     tolerance = 2;
26
     tolerance = 2;
26
     padding = 0;
27
     padding = 0;
115
         std::this_thread::sleep_for(std::chrono::milliseconds(10));
116
         std::this_thread::sleep_for(std::chrono::milliseconds(10));
116
 
117
 
117
         // Then we draw the framebuffer to the screen
118
         // Then we draw the framebuffer to the screen
118
-        if ( keyboard->anyKeyDown() || mouse->getButton( 3 ) ) {
119
+        if ( (keyboard->anyKeyDown() && !options->nokeyboard) || mouse->getButton( 3 ) ) {
119
             memory.running = false;
120
             memory.running = false;
120
             if ( cancelled ) {
121
             if ( cancelled ) {
121
                 *cancelled = true;
122
                 *cancelled = true;
167
         if ( err != GL_NO_ERROR ) {
168
         if ( err != GL_NO_ERROR ) {
168
             throw err;
169
             throw err;
169
         }
170
         }
170
-        if ( keyboard->anyKeyDown() || mouse->getButton( 3 ) ) {
171
+        if ( (keyboard->anyKeyDown() && !options->nokeyboard) || mouse->getButton( 3 ) ) {
171
             memory.running = false;
172
             memory.running = false;
172
             if ( cancelled ) {
173
             if ( cancelled ) {
173
                 *cancelled = true;
174
                 *cancelled = true;