aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/FbCommands.cc50
-rw-r--r--src/FbCommands.hh16
2 files changed, 60 insertions, 6 deletions
diff --git a/src/FbCommands.cc b/src/FbCommands.cc
index 1bec59a..1a1c74d 100644
--- a/src/FbCommands.cc
+++ b/src/FbCommands.cc
@@ -19,14 +19,16 @@
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: FbCommands.cc,v 1.19 2003/12/19 00:47:30 fluxgen Exp $ 22// $Id: FbCommands.cc,v 1.20 2003/12/19 03:56:51 fluxgen Exp $
23 23
24#include "FbCommands.hh" 24#include "FbCommands.hh"
25#include "fluxbox.hh" 25#include "fluxbox.hh"
26#include "FbTk/Theme.hh"
27#include "Screen.hh" 26#include "Screen.hh"
28#include "Menu.hh" 27#include "CommandDialog.hh"
29#include "SetWorkspaceName.hh" 28#include "Workspace.hh"
29
30#include "FbTk/Theme.hh"
31#include "FbTk/Menu.hh"
30 32
31#include <sys/types.h> 33#include <sys/types.h>
32#include <unistd.h> 34#include <unistd.h>
@@ -163,13 +165,51 @@ void ShowWorkspaceMenuCmd::execute() {
163 165
164} 166}
165 167
168
169
170SetWorkspaceNameCmd::SetWorkspaceNameCmd(const std::string &name, int spaceid):
171 m_name(name), m_workspace(spaceid) { }
172
166void SetWorkspaceNameCmd::execute() { 173void SetWorkspaceNameCmd::execute() {
174 BScreen *screen = Fluxbox::instance()->mouseScreen();
175 if (screen == 0) {
176 screen = Fluxbox::instance()->keyScreen();
177 if (screen == 0) {
178 cerr<<"Screen == 0!"<<endl;
179 return;
180 }
181 }
182
183 if (m_workspace < 0) {
184 screen->currentWorkspace()->setName(m_name);
185 } else {
186 Workspace *space = screen->getWorkspace(m_workspace);
187 if (space == 0)
188 return;
189 space->setName(m_name);
190 }
191
192 screen->updateWorkspaceNamesAtom();
193 Fluxbox::instance()->save_rc();
194}
195
196void WorkspaceNameDialogCmd::execute() {
197
198 BScreen *screen = Fluxbox::instance()->mouseScreen();
199 if (screen == 0)
200 return;
201
202 CommandDialog *win = new CommandDialog(*screen, "Set Workspace Name:", "SetWorkspaceName ");
203 win->setText(screen->currentWorkspace()->name());
204 win->show();
205}
167 206
207void CommandDialogCmd::execute() {
168 BScreen *screen = Fluxbox::instance()->mouseScreen(); 208 BScreen *screen = Fluxbox::instance()->mouseScreen();
169 if (screen == 0) 209 if (screen == 0)
170 return; 210 return;
171 211
172 SetWorkspaceName *win = new SetWorkspaceName(*screen); 212 FbTk::FbWindow *win = new CommandDialog(*screen, "Fluxbox Command");
173 win->show(); 213 win->show();
174} 214}
175 215
diff --git a/src/FbCommands.hh b/src/FbCommands.hh
index fc97791..9c61259 100644
--- a/src/FbCommands.hh
+++ b/src/FbCommands.hh
@@ -19,7 +19,7 @@
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: FbCommands.hh,v 1.14 2003/12/16 23:35:00 fluxgen Exp $ 22// $Id: FbCommands.hh,v 1.15 2003/12/19 03:56:51 fluxgen Exp $
23 23
24// \file contains basic commands to restart, reconfigure, execute command and exit fluxbox 24// \file contains basic commands to restart, reconfigure, execute command and exit fluxbox
25 25
@@ -95,6 +95,20 @@ public:
95 95
96class SetWorkspaceNameCmd: public FbTk::Command { 96class SetWorkspaceNameCmd: public FbTk::Command {
97public: 97public:
98 SetWorkspaceNameCmd(const std::string &name, int spaceid = -1);
99 void execute();
100private:
101 std::string m_name;
102 int m_workspace;
103};
104
105class WorkspaceNameDialogCmd: public FbTk::Command {
106public:
107 void execute();
108};
109
110class CommandDialogCmd: public FbTk::Command {
111public:
98 void execute(); 112 void execute();
99}; 113};
100 114