Browse Source

default to an xgeometry compliant format

naelstrof 7 years ago
parent
commit
f119dc80d7
1 changed files with 4 additions and 9 deletions
  1. 4
    9
      src/main.cpp

+ 4
- 9
src/main.cpp View File

117
 	std::cout << "                                  (default=`simple')\n";
117
 	std::cout << "                                  (default=`simple')\n";
118
 	std::cout << "  -f, --format=STRING           Set the output format string. Format specifiers\n";
118
 	std::cout << "  -f, --format=STRING           Set the output format string. Format specifiers\n";
119
 	std::cout << "                                  are %x, %y, %w, %h, %i, %g, and %c.\n";
119
 	std::cout << "                                  are %x, %y, %w, %h, %i, %g, and %c.\n";
120
-	std::cout << "                                  (default=`X=%x\nY=%y\nW=%w\nH=%h\nG=%g\nID=%i\nCancel=%c\n')\n";
120
+	std::cout << "                                  (default=`%g\n')\n";
121
 	std::cout << "Examples\n";
121
 	std::cout << "Examples\n";
122
 	std::cout << "    $ # Gray, thick, transparent border for maximum visiblity.\n";
122
 	std::cout << "    $ # Gray, thick, transparent border for maximum visiblity.\n";
123
 	std::cout << "    $ slop -b 20 -c 0.5,0.5,0.5,0.8\n";
123
 	std::cout << "    $ slop -b 20 -c 0.5,0.5,0.5,0.8\n";
131
 	std::cout << "    $ # Classic Windows XP selection.\n";
131
 	std::cout << "    $ # Classic Windows XP selection.\n";
132
 	std::cout << "    $ slop -l -c 0.3,0.4,0.6,0.4\n";
132
 	std::cout << "    $ slop -l -c 0.3,0.4,0.6,0.4\n";
133
 	std::cout << "\n";
133
 	std::cout << "\n";
134
-	std::cout << "    $ # Change output format to use safer parsing\n";
135
-	std::cout << "    $ slopoutput=$(slop -f \"%x %y %w %h\")\n";
136
-	std::cout << "    $ X=$(echo $slopoutput | awk '{print $1}')\n";
137
-	std::cout << "    $ Y=$(echo $slopoutput | awk '{print $2}')\n";
138
-	std::cout << "    $ W=$(echo $slopoutput | awk '{print $3}')\n";
139
-	std::cout << "    $ H=$(echo $slopoutput | awk '{print $4}')\n";
134
+	std::cout << "    $ # Read slop output for use in scripts.\n";
135
+	std::cout << "    $ read -r X Y W H G ID < <(slop -f '%x %y %w %h %g %i')\n";
140
 	std::cout << "\n";
136
 	std::cout << "\n";
141
 	std::cout << "Tips\n";
137
 	std::cout << "Tips\n";
142
 	std::cout << "    * If you don't like a selection: you can cancel it by right-clicking\n";
138
 	std::cout << "    * If you don't like a selection: you can cancel it by right-clicking\n";
186
         std::cout << formatOutput( format, selection );
182
         std::cout << formatOutput( format, selection );
187
         return 0;
183
         return 0;
188
     }
184
     }
189
-    // Otherwise we default to an `eval` compatible format.
190
-    std::cout << formatOutput( "X=%x\nY=%y\nW=%w\nH=%h\nG=%g\nID=%i\n", selection );
185
+    std::cout << formatOutput( "%g\n", selection );
191
     return 0;
186
     return 0;
192
 }
187
 }
193
 
188