deiconify cmd, patch from Mathias Gumz
This commit is contained in:
parent
1b38322d99
commit
c5fb252a6f
3 changed files with 110 additions and 4 deletions
|
@ -20,7 +20,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// $Id: FbCommandFactory.cc,v 1.28 2004/03/08 12:23:16 rathnor Exp $
|
// $Id: FbCommandFactory.cc,v 1.29 2004/04/22 21:12:34 fluxgen Exp $
|
||||||
|
|
||||||
#include "FbCommandFactory.hh"
|
#include "FbCommandFactory.hh"
|
||||||
|
|
||||||
|
@ -64,6 +64,7 @@ FbCommandFactory::FbCommandFactory() {
|
||||||
"bindkey",
|
"bindkey",
|
||||||
"close",
|
"close",
|
||||||
"commanddialog",
|
"commanddialog",
|
||||||
|
"deiconify",
|
||||||
"detachclient",
|
"detachclient",
|
||||||
"exec",
|
"exec",
|
||||||
"execcommand",
|
"execcommand",
|
||||||
|
@ -298,7 +299,39 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
|
||||||
//
|
//
|
||||||
// special commands
|
// special commands
|
||||||
//
|
//
|
||||||
else if (command == "macrocmd") {
|
else if (command == "deiconify") {
|
||||||
|
|
||||||
|
FB_istringstream iss(arguments);
|
||||||
|
string mode;
|
||||||
|
string d;
|
||||||
|
DeiconifyCmd::Destination dest;
|
||||||
|
|
||||||
|
iss >> mode;
|
||||||
|
if (iss.fail())
|
||||||
|
mode="lastworkspace";
|
||||||
|
mode= FbTk::StringUtil::toLower(mode);
|
||||||
|
|
||||||
|
iss >> d;
|
||||||
|
if (iss.fail())
|
||||||
|
d="current";
|
||||||
|
d= FbTk::StringUtil::toLower(d);
|
||||||
|
if (d == "origin" )
|
||||||
|
dest= DeiconifyCmd::ORIGIN;
|
||||||
|
else if (d == "originquiet")
|
||||||
|
dest= DeiconifyCmd::ORIGINQUIET;
|
||||||
|
else
|
||||||
|
dest= DeiconifyCmd::CURRENT;
|
||||||
|
|
||||||
|
if ( mode == "all" )
|
||||||
|
return new DeiconifyCmd(DeiconifyCmd::ALL, dest);
|
||||||
|
else if ( mode == "allworkspace" )
|
||||||
|
return new DeiconifyCmd(DeiconifyCmd::ALLWORKSPACE, dest);
|
||||||
|
else if ( mode == "last" )
|
||||||
|
return new DeiconifyCmd(DeiconifyCmd::LAST, dest);
|
||||||
|
else // lastworkspace, default
|
||||||
|
return new DeiconifyCmd(DeiconifyCmd::LASTWORKSPACE, dest);
|
||||||
|
|
||||||
|
} else if (command == "macrocmd") {
|
||||||
std::string cmd;
|
std::string cmd;
|
||||||
int err= 0;
|
int err= 0;
|
||||||
int parse_pos= 0;
|
int parse_pos= 0;
|
||||||
|
|
|
@ -19,13 +19,14 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// $Id: FbCommands.cc,v 1.23 2004/01/21 14:11:15 fluxgen Exp $
|
// $Id: FbCommands.cc,v 1.24 2004/04/22 21:12:32 fluxgen Exp $
|
||||||
|
|
||||||
#include "FbCommands.hh"
|
#include "FbCommands.hh"
|
||||||
#include "fluxbox.hh"
|
#include "fluxbox.hh"
|
||||||
#include "Screen.hh"
|
#include "Screen.hh"
|
||||||
#include "CommandDialog.hh"
|
#include "CommandDialog.hh"
|
||||||
#include "Workspace.hh"
|
#include "Workspace.hh"
|
||||||
|
#include "Window.hh"
|
||||||
#include "Keys.hh"
|
#include "Keys.hh"
|
||||||
|
|
||||||
#include "FbTk/Theme.hh"
|
#include "FbTk/Theme.hh"
|
||||||
|
@ -249,4 +250,52 @@ void BindKeyCmd::execute() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DeiconifyCmd::DeiconifyCmd(const Mode mode,
|
||||||
|
const Destination dest) : m_mode(mode), m_dest(dest) { }
|
||||||
|
|
||||||
|
void DeiconifyCmd::execute() {
|
||||||
|
BScreen *screen = Fluxbox::instance()->mouseScreen();
|
||||||
|
if (screen == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
BScreen::Icons::reverse_iterator it= screen->getIconList().rbegin();
|
||||||
|
BScreen::Icons::reverse_iterator itend= screen->getIconList().rend();
|
||||||
|
unsigned int workspace_num= screen->currentWorkspaceID();
|
||||||
|
unsigned int old_workspace_num;
|
||||||
|
|
||||||
|
const bool change_ws= m_dest == ORIGIN;
|
||||||
|
|
||||||
|
switch(m_mode) {
|
||||||
|
|
||||||
|
case ALL:
|
||||||
|
case ALLWORKSPACE:
|
||||||
|
for(; it != itend; it++) {
|
||||||
|
old_workspace_num= (*it)->workspaceNumber();
|
||||||
|
if (m_mode == ALL || old_workspace_num == workspace_num) {
|
||||||
|
if (m_dest == ORIGIN || m_dest == ORIGINQUIET)
|
||||||
|
screen->sendToWorkspace(old_workspace_num, (*it), change_ws);
|
||||||
|
else
|
||||||
|
(*it)->deiconify(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LAST:
|
||||||
|
case LASTWORKSPACE:
|
||||||
|
default:
|
||||||
|
for (; it != itend; it++) {
|
||||||
|
old_workspace_num= (*it)->workspaceNumber();
|
||||||
|
if(m_mode == LAST || old_workspace_num == workspace_num) {
|
||||||
|
if ((m_dest == ORIGIN || m_dest == ORIGINQUIET) &&
|
||||||
|
m_mode != LASTWORKSPACE)
|
||||||
|
screen->sendToWorkspace(old_workspace_num, (*it), change_ws);
|
||||||
|
else
|
||||||
|
(*it)->deiconify(false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
}; // end namespace FbCommands
|
}; // end namespace FbCommands
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// $Id: FbCommands.hh,v 1.18 2004/03/16 18:44:40 fluxgen Exp $
|
// $Id: FbCommands.hh,v 1.19 2004/04/22 21:12:33 fluxgen Exp $
|
||||||
|
|
||||||
// \file contains basic commands to restart, reconfigure, execute command and exit fluxbox
|
// \file contains basic commands to restart, reconfigure, execute command and exit fluxbox
|
||||||
|
|
||||||
|
@ -135,4 +135,28 @@ private:
|
||||||
const std::string m_keybind;
|
const std::string m_keybind;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// deiconifies iconified windows
|
||||||
|
class DeiconifyCmd: public FbTk::Command {
|
||||||
|
public:
|
||||||
|
enum Mode {
|
||||||
|
LAST,
|
||||||
|
LASTWORKSPACE,
|
||||||
|
ALL,
|
||||||
|
ALLWORKSPACE
|
||||||
|
};
|
||||||
|
|
||||||
|
enum Destination {
|
||||||
|
CURRENT, /// deiconification on current workspace
|
||||||
|
ORIGIN, /// deiconification on origin workspace, change to that ws
|
||||||
|
ORIGINQUIET /// deiconification on origin workspace, dont change ws
|
||||||
|
};
|
||||||
|
|
||||||
|
DeiconifyCmd(const Mode mode= LASTWORKSPACE,
|
||||||
|
const Destination dest= CURRENT);
|
||||||
|
void execute();
|
||||||
|
private:
|
||||||
|
Mode m_mode;
|
||||||
|
Destination m_dest;
|
||||||
|
};
|
||||||
|
|
||||||
#endif // FBCOMMANDS_HH
|
#endif // FBCOMMANDS_HH
|
||||||
|
|
Loading…
Reference in a new issue