diff options
Diffstat (limited to 'util/fbrun/main.cc')
-rw-r--r-- | util/fbrun/main.cc | 13 |
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(); |