aboutsummaryrefslogtreecommitdiff
path: root/util/fbrun/main.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-11-12 19:20:31 (GMT)
committerfluxgen <fluxgen>2002-11-12 19:20:31 (GMT)
commit4897fc22888c52ba28af48e9bc57465a86ea3d2e (patch)
treea20ea83cc7768ac187299bddb729d6d9a873fdbd /util/fbrun/main.cc
parentd1292fc5999ec46c2bab9645675bdda11b2d9b04 (diff)
downloadfluxbox_pavel-4897fc22888c52ba28af48e9bc57465a86ea3d2e.zip
fluxbox_pavel-4897fc22888c52ba28af48e9bc57465a86ea3d2e.tar.bz2
added history
Diffstat (limited to 'util/fbrun/main.cc')
-rw-r--r--util/fbrun/main.cc13
1 files changed, 11 insertions, 2 deletions
diff --git a/util/fbrun/main.cc b/util/fbrun/main.cc
index 2237340..574dd76 100644
--- a/util/fbrun/main.cc
+++ b/util/fbrun/main.cc
@@ -19,10 +19,11 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: main.cc,v 1.2 2002/11/12 16:46:17 fluxgen Exp $ 22// $Id: main.cc,v 1.3 2002/11/12 19:16:26 fluxgen Exp $
23 23
24#include "FbRun.hh" 24#include "FbRun.hh"
25#include "BaseDisplay.hh" 25#include "BaseDisplay.hh"
26#include "StringUtil.hh"
26 27
27#include <string> 28#include <string>
28#include <iostream> 29#include <iostream>
@@ -57,6 +58,7 @@ void showUsage(const char *progname) {
57 " -fg [color name] Foreground text color"<<endl<< 58 " -fg [color name] Foreground text color"<<endl<<
58 " -bg [color name] Background color"<<endl<< 59 " -bg [color name] Background color"<<endl<<
59 " -a Antialias"<<endl<< 60 " -a Antialias"<<endl<<
61 " -hf [history file] History file to load (default ~/.fluxbox/history)"<<endl<<
60 " -help Show this help"<<endl<<endl<< 62 " -help Show this help"<<endl<<endl<<
61 "Example: fbrun -fg black -bg white -text xterm -title \"run xterm\""<<endl; 63 "Example: fbrun -fg black -bg white -text xterm -title \"run xterm\""<<endl;
62} 64}
@@ -73,7 +75,7 @@ int main(int argc, char **argv) {
73 string foreground("black"); // text color 75 string foreground("black"); // text color
74 string background("white"); // text background color 76 string background("white"); // text background color
75 string display_name; // name of the display connection 77 string display_name; // name of the display connection
76 78 string history_file("~/.fluxbox/fbrun_history"); // command history file
77 // parse arguments 79 // parse arguments
78 for (int i=1; i<argc; i++) { 80 for (int i=1; i<argc; i++) {
79 if (strcmp(argv[i], "-font") == 0 && i+1 < argc) { 81 if (strcmp(argv[i], "-font") == 0 && i+1 < argc) {
@@ -109,6 +111,8 @@ int main(int argc, char **argv) {
109 background = argv[i]; 111 background = argv[i];
110 } else if (strcmp(argv[i], "-a") == 0) { 112 } else if (strcmp(argv[i], "-a") == 0) {
111 antialias = true; 113 antialias = true;
114 } else if (strcmp(argv[i], "-hf") == 0 && i+1 < argc) {
115 history_file = argv[++i];
112 } else if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "-help") == 0) { 116 } else if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "-help") == 0) {
113 showUsage(argv[0]); 117 showUsage(argv[0]);
114 exit(0); 118 exit(0);
@@ -159,6 +163,11 @@ int main(int argc, char **argv) {
159 fbrun.resize(width, height); 163 fbrun.resize(width, height);
160 if (antialias) 164 if (antialias)
161 fbrun.setAntialias(antialias); 165 fbrun.setAntialias(antialias);
166 // expand and load command history
167 string expanded_filename = StringUtil::expandFilename(history_file);
168 if (!fbrun.loadHistory(expanded_filename.c_str()))
169 cerr<<"FbRun Warning: Failed to load history file: "<<expanded_filename<<endl;
170
162 fbrun.setTitle(title); 171 fbrun.setTitle(title);
163 fbrun.setText(text); 172 fbrun.setText(text);
164 fbrun.show(); 173 fbrun.show();