Quellcode durchsuchen

changed around option flags to not conflict with maim

naelstrof vor 7 Jahren
Ursprung
Commit
3721a5e3bf
5 geänderte Dateien mit 13 neuen und 12 gelöschten Zeilen
  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 Datei anzeigen

@@ -4,7 +4,7 @@
4 4
 .SH NAME
5 5
 slop \- select operation
6 6
 .SH SYNOPSIS
7
-slop [OPTIONS]
7
+slop [-klqn] [OPTIONS]
8 8
 .SH DESCRIPTION
9 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 10
 .SH OPTIONS
@@ -15,12 +15,9 @@ Print help and exit.
15 15
 .BR \-v ", " \-\-version
16 16
 Print version and exit.
17 17
 .TP
18
-.BR \-x ", " \-\-xdisplay=\fIhostname:number.screen_number\fR
18
+.BR \-d ", " \-\-xdisplay=\fIhostname:number.screen_number\fR
19 19
 Sets the xdisplay to use.
20 20
 .TP
21
-.BR \-k ", " \-\-nokeyboard
22
-Disables the ability to cancel selections with the keyboard.
23
-.TP
24 21
 .BR \-b ", " \-\-bordersize=\fIFLOAT\fR
25 22
 Sets the selection rectangle's thickness.
26 23
 .TP
@@ -33,7 +30,7 @@ How far in pixels the mouse can move after clicking, and still be detected as a
33 30
 .BR \-c ", " \-\-color=\fIFLOAT,FLOAT,FLOAT,FLOAT\fR
34 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 32
 .TP
36
-.BR \-s ", " \-\-shader=\fISTRING\fR
33
+.BR \-r ", " \-\-shader=\fISTRING\fR
37 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 35
 .TP
39 36
 .BR \-f ", " \-\-format=\fISTRING\fR
@@ -47,6 +44,9 @@ Instead of outlining a selection, slop will highlight it instead. This is partic
47 44
 .TP
48 45
 .BR \-q ", " \-\-quiet
49 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 50
 .SH EXAMPLES
51 51
 To emulate a windows XP selection, you can use something like this:
52 52
 .PP

BIN
slop.1.gz Datei anzeigen


+ 3
- 3
src/main.cpp Datei anzeigen

@@ -31,6 +31,7 @@ SlopOptions* getOptions( Options& options ) {
31 31
     glm::vec4 color = glm::vec4( foo->r, foo->g, foo->b, foo->a );
32 32
     options.getColor("color", 'c', color);
33 33
     options.getBool("nokeyboard", 'k', foo->nokeyboard);
34
+    std::cout << foo->nokeyboard << "\n";
34 35
     options.getString( "xdisplay", 'x', foo->xdisplay );
35 36
     options.getString( "shader", 's', foo->shader );
36 37
     foo->r = color.r;
@@ -89,7 +90,7 @@ void printHelp() {
89 90
     std::cout << "-h, --help                    Print help and exit\n";
90 91
     std::cout << "-v, --version                 Print version and exit\n";
91 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 94
     std::cout << "                                Sets the x display.\n";
94 95
 	std::cout << "  -k, --nokeyboard              Disables the ability to cancel selections with\n";
95 96
 	std::cout << "                                  the keyboard.  (default=off)\n";
@@ -120,9 +121,8 @@ void printHelp() {
120 121
 	std::cout << "                                  highlights it. This is only useful when\n";
121 122
 	std::cout << "                                  --color is set to a transparent color.\n";
122 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 125
 	std::cout << "                                  ~/.config/slop/\n";
125
-	std::cout << "                                  (default=`simple')\n";
126 126
 	std::cout << "  -f, --format=STRING           Set the output format string. Format specifiers\n";
127 127
 	std::cout << "                                  are %x, %y, %w, %h, %i, %g, and %c.\n";
128 128
 	std::cout << "                                  (default=`%g\n')\n";

+ 1
- 1
src/options.hpp Datei anzeigen

@@ -29,7 +29,7 @@
29 29
 #include <glm/glm.hpp>
30 30
 
31 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 33
 static unsigned int isFlagArgument[] = { false, false, false, false, true, false, false, false, true, true, false, true, true };
34 34
 static unsigned int validArgumentCount = 13;
35 35
 static unsigned int maxFloatingValues = 0;

+ 3
- 2
src/slop.cpp Datei anzeigen

@@ -21,6 +21,7 @@ Resource* resource;
21 21
 // Defaults!
22 22
 SlopOptions::SlopOptions() {
23 23
     borderSize = 1;
24
+    nokeyboard = false;
24 25
     nodecorations = false;
25 26
     tolerance = 2;
26 27
     padding = 0;
@@ -115,7 +116,7 @@ SlopSelection XShapeSlopSelect( SlopOptions* options, bool* cancelled ) {
115 116
         std::this_thread::sleep_for(std::chrono::milliseconds(10));
116 117
 
117 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 120
             memory.running = false;
120 121
             if ( cancelled ) {
121 122
                 *cancelled = true;
@@ -167,7 +168,7 @@ SlopSelection GLSlopSelect( SlopOptions* options, bool* cancelled, SlopWindow* w
167 168
         if ( err != GL_NO_ERROR ) {
168 169
             throw err;
169 170
         }
170
-        if ( keyboard->anyKeyDown() || mouse->getButton( 3 ) ) {
171
+        if ( (keyboard->anyKeyDown() && !options->nokeyboard) || mouse->getButton( 3 ) ) {
171 172
             memory.running = false;
172 173
             if ( cancelled ) {
173 174
                 *cancelled = true;