diff --git a/ChangeLog b/ChangeLog index 72c45f35..d62889df 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ (Format: Year/Month/Day) Changes for 1.1.2 *08/10/04: + * Add -print option to fbrun that sends the result to stdout instead of + running it (Mark) + util/FbRun/main.cc FbRun.cc/hh * Fix CustomMenu and ClientMenu commands from fluxbox-remote (Mark) Screen.cc * Break emacs-style keychains after one invalid key has been pressed (Mark) diff --git a/util/fbrun/FbRun.cc b/util/fbrun/FbRun.cc index c3044136..f98a02ef 100644 --- a/util/fbrun/FbRun.cc +++ b/util/fbrun/FbRun.cc @@ -58,6 +58,7 @@ using std::ios; FbRun::FbRun(int x, int y, size_t width): FbTk::TextBox(DefaultScreen(FbTk::App::instance()->display()), m_font, ""), + m_print(false), m_font("fixed"), m_display(FbTk::App::instance()->display()), m_bevel(4), @@ -115,6 +116,12 @@ void FbRun::run(const std::string &command) { FbTk::App::instance()->end(); // end application m_end = true; // mark end of processing + if (m_print) { + std::cout << command; + hide(); + return; + } + // fork and execute program if (!fork()) { diff --git a/util/fbrun/FbRun.hh b/util/fbrun/FbRun.hh index 405ae3f8..6ddbad0f 100644 --- a/util/fbrun/FbRun.hh +++ b/util/fbrun/FbRun.hh @@ -42,6 +42,7 @@ public: void handleEvent(XEvent * const ev); void setTitle(const std::string &title); void resize(unsigned int width, unsigned int height); + void setPrint(bool print) { m_print = print; } /// load and reconfigure for new font bool loadFont(const std::string &fontname); @@ -83,6 +84,7 @@ private: void tabCompleteHistory(); void tabCompleteApps(); + bool m_print; ///< the input should be printed to stdout rather than run FbTk::Font m_font; ///< font used to draw command text Display *m_display; ///< display connection int m_bevel; diff --git a/util/fbrun/main.cc b/util/fbrun/main.cc index 6adfbe7b..f9875d3d 100644 --- a/util/fbrun/main.cc +++ b/util/fbrun/main.cc @@ -55,6 +55,7 @@ void showUsage(const char *progname) { " -font [font name] Text font"<