add SendToNextHead/SendToPrevHead commands, plus some cleanup in CurrentWindowCmd
This commit is contained in:
parent
9dec17611f
commit
0116a83aa6
5 changed files with 67 additions and 83 deletions
|
@ -1,5 +1,8 @@
|
|||
(Format: Year/Month/Day)
|
||||
Changes for 1.1
|
||||
*08/08/21:
|
||||
* Added SendToNextHead and SendToPrevHead commands (Mark)
|
||||
CurrentWindowCmd.cc/hh
|
||||
*08/08/20:
|
||||
* Added SetDecor key command (Mark)
|
||||
CurrentWindowCmd.cc/hh
|
||||
|
|
|
@ -292,6 +292,12 @@ two arguments;;
|
|||
Moves the window to the given display head. Only available when fluxbox
|
||||
has been compiled with Xinerama support.
|
||||
|
||||
*SendToNextHead* ['offset'] / *SendToPrevHead* ['offset']::
|
||||
Sends the current window to the next/previous display head. If you
|
||||
specify an 'offset' greater than *1*, it will move the window that many
|
||||
heads. If this takes the window beyond the total number of heads, it
|
||||
will wrap around to the beginning.
|
||||
|
||||
Workspace Commands
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
These commands affect the entire workspace (or "desktop" as it is sometimes
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
.\" Title: fluxbox-keys
|
||||
.\" Author:
|
||||
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
|
||||
.\" Date: 08/20/2008
|
||||
.\" Date: 08/21/2008
|
||||
.\" Manual:
|
||||
.\" Source:
|
||||
.\"
|
||||
.TH "FLUXBOX\-KEYS" "5" "08/20/2008" "" ""
|
||||
.TH "FLUXBOX\-KEYS" "5" "08/21/2008" "" ""
|
||||
.\" disable hyphenation
|
||||
.nh
|
||||
.\" disable justification (adjust text to left margin only)
|
||||
|
@ -381,6 +381,14 @@ First value becomes the focused alpha, second becomes the unfocused alpha value\
|
|||
.RS 4
|
||||
Moves the window to the given display head\. Only available when fluxbox has been compiled with Xinerama support\.
|
||||
.RE
|
||||
.PP
|
||||
\fBSendToNextHead\fR [\fIoffset\fR] / \fBSendToPrevHead\fR [\fIoffset\fR]
|
||||
.RS 4
|
||||
Sends the current window to the next/previous display head\. If you specify an
|
||||
\fIoffset\fR
|
||||
greater than
|
||||
\fB1\fR, it will move the window that many heads\. If this takes the window beyond the total number of heads, it will wrap around to the beginning\.
|
||||
.RE
|
||||
.SS "Workspace Commands"
|
||||
These commands affect the entire workspace (or "desktop" as it is sometimes called)\.
|
||||
.PP
|
||||
|
|
|
@ -157,7 +157,7 @@ namespace {
|
|||
|
||||
FbTk::Command<void> *parseIntCmd(const string &command, const string &args,
|
||||
bool trusted) {
|
||||
int num = (command == "sethead" ? 0 : 1);
|
||||
int num = 1;
|
||||
FbTk_istringstream iss(args.c_str());
|
||||
iss >> num;
|
||||
if (command == "sethead")
|
||||
|
@ -167,16 +167,19 @@ FbTk::Command<void> *parseIntCmd(const string &command, const string &args,
|
|||
else if (command == "sendtonextworkspace")
|
||||
return new SendToNextWorkspaceCmd(num);
|
||||
else if (command == "sendtoprevworkspace")
|
||||
return new SendToPrevWorkspaceCmd(num);
|
||||
return new SendToNextWorkspaceCmd(-num);
|
||||
else if (command == "taketonextworkspace")
|
||||
return new TakeToNextWorkspaceCmd(num);
|
||||
return new SendToNextWorkspaceCmd(num, true);
|
||||
else if (command == "taketoprevworkspace")
|
||||
return new TakeToPrevWorkspaceCmd(num);
|
||||
return new SendToNextWorkspaceCmd(-num, true);
|
||||
else if (command == "sendtoworkspace")
|
||||
// workspaces appear 1-indexed to the user, hence the minus 1
|
||||
return new SendToWorkspaceCmd(num-1);
|
||||
return new SendToWorkspaceCmd(num);
|
||||
else if (command == "taketoworkspace")
|
||||
return new TakeToWorkspaceCmd(num-1);
|
||||
return new SendToWorkspaceCmd(num, true);
|
||||
else if (command == "sendtonexthead")
|
||||
return new SendToNextHeadCmd(num);
|
||||
else if (command == "sendtoprevhead")
|
||||
return new SendToNextHeadCmd(-num);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -188,6 +191,8 @@ REGISTER_COMMAND_PARSER(taketonextworkspace, parseIntCmd, void);
|
|||
REGISTER_COMMAND_PARSER(taketoprevworkspace, parseIntCmd, void);
|
||||
REGISTER_COMMAND_PARSER(sendtoworkspace, parseIntCmd, void);
|
||||
REGISTER_COMMAND_PARSER(taketoworkspace, parseIntCmd, void);
|
||||
REGISTER_COMMAND_PARSER(sendtonexthead, parseIntCmd, void);
|
||||
REGISTER_COMMAND_PARSER(sendtoprevhead, parseIntCmd, void);
|
||||
|
||||
FbTk::Command<void> *parseFocusCmd(const string &command, const string &args,
|
||||
bool trusted) {
|
||||
|
@ -205,49 +210,35 @@ REGISTER_COMMAND_PARSER(focus, parseFocusCmd, void);
|
|||
}; // end anonymous namespace
|
||||
|
||||
void SetHeadCmd::real_execute() {
|
||||
fbwindow().setOnHead(m_head);
|
||||
int num = m_head;
|
||||
int total = fbwindow().screen().numHeads();
|
||||
if (num < 0) num += total + 1;
|
||||
if (num < 1) num = 1;
|
||||
if (num > total) num = total;
|
||||
fbwindow().setOnHead(num);
|
||||
}
|
||||
|
||||
void SendToWorkspaceCmd::real_execute() {
|
||||
fbwindow().screen().sendToWorkspace(m_workspace_num, &fbwindow(), false);
|
||||
int num = m_workspace_num;
|
||||
int total = fbwindow().screen().numberOfWorkspaces();
|
||||
if (num < 0) num += total + 1;
|
||||
if (num < 1) num = 1;
|
||||
if (num > total) num = total;
|
||||
fbwindow().screen().sendToWorkspace(num-1, &fbwindow(), m_take);
|
||||
}
|
||||
|
||||
void SendToNextWorkspaceCmd::real_execute() {
|
||||
const int ws_nr =
|
||||
( fbwindow().workspaceNumber() + m_delta ) %
|
||||
fbwindow().screen().numberOfWorkspaces();
|
||||
fbwindow().screen().sendToWorkspace(ws_nr, &fbwindow(), false);
|
||||
int total = fbwindow().screen().numberOfWorkspaces();
|
||||
const int ws_nr = (total + (fbwindow().workspaceNumber() + m_delta % total)) % total;
|
||||
fbwindow().screen().sendToWorkspace(ws_nr, &fbwindow(), m_take);
|
||||
}
|
||||
|
||||
void SendToPrevWorkspaceCmd::real_execute() {
|
||||
int ws_nr = (fbwindow().workspaceNumber() - m_delta );
|
||||
if ( ws_nr < 0 )
|
||||
ws_nr += fbwindow().screen().numberOfWorkspaces();
|
||||
|
||||
ws_nr = ws_nr % fbwindow().screen().numberOfWorkspaces();
|
||||
|
||||
fbwindow().screen().sendToWorkspace(ws_nr, &fbwindow(), false);
|
||||
}
|
||||
|
||||
void TakeToWorkspaceCmd::real_execute() {
|
||||
fbwindow().screen().sendToWorkspace(m_workspace_num, &fbwindow());
|
||||
}
|
||||
|
||||
void TakeToNextWorkspaceCmd::real_execute() {
|
||||
unsigned int ws_nr =
|
||||
( fbwindow().workspaceNumber() + m_delta) %
|
||||
fbwindow().screen().numberOfWorkspaces();
|
||||
fbwindow().screen().sendToWorkspace(ws_nr, &fbwindow());
|
||||
}
|
||||
|
||||
void TakeToPrevWorkspaceCmd::real_execute() {
|
||||
int ws_nr = (fbwindow().workspaceNumber() - m_delta);
|
||||
if ( ws_nr < 0 )
|
||||
ws_nr += fbwindow().screen().numberOfWorkspaces();
|
||||
|
||||
ws_nr = ws_nr % fbwindow().screen().numberOfWorkspaces();
|
||||
|
||||
fbwindow().screen().sendToWorkspace(ws_nr, &fbwindow());
|
||||
void SendToNextHeadCmd::real_execute() {
|
||||
int total = fbwindow().screen().numHeads();
|
||||
if (total < 2)
|
||||
return;
|
||||
int num = (total + fbwindow().getOnHead() - 1 + (m_delta % total)) % total;
|
||||
fbwindow().setOnHead(1 + num);
|
||||
}
|
||||
|
||||
void GoToTabCmd::real_execute() {
|
||||
|
|
|
@ -74,59 +74,35 @@ private:
|
|||
|
||||
class SendToWorkspaceCmd: public WindowHelperCmd {
|
||||
public:
|
||||
explicit SendToWorkspaceCmd(int workspace_num):m_workspace_num(workspace_num) { }
|
||||
explicit SendToWorkspaceCmd(int workspace_num, bool take = false):
|
||||
m_workspace_num(workspace_num), m_take(take) { }
|
||||
protected:
|
||||
void real_execute();
|
||||
private:
|
||||
const int m_workspace_num;
|
||||
const bool m_take;
|
||||
};
|
||||
|
||||
class SendToNextWorkspaceCmd: public WindowHelperCmd {
|
||||
public:
|
||||
explicit SendToNextWorkspaceCmd(int delta):m_delta(delta) { }
|
||||
explicit SendToNextWorkspaceCmd(int delta, bool take = false):
|
||||
m_delta(delta), m_take(take) { }
|
||||
protected:
|
||||
void real_execute();
|
||||
private:
|
||||
const int m_delta;
|
||||
const bool m_take;
|
||||
};
|
||||
|
||||
class SendToNextHeadCmd: public WindowHelperCmd {
|
||||
public:
|
||||
explicit SendToNextHeadCmd(int delta): m_delta(delta) { }
|
||||
protected:
|
||||
void real_execute();
|
||||
private:
|
||||
const int m_delta;
|
||||
};
|
||||
|
||||
class SendToPrevWorkspaceCmd: public WindowHelperCmd {
|
||||
public:
|
||||
explicit SendToPrevWorkspaceCmd(int delta):m_delta(delta) { }
|
||||
protected:
|
||||
void real_execute();
|
||||
private:
|
||||
const int m_delta;
|
||||
};
|
||||
|
||||
class TakeToWorkspaceCmd : public WindowHelperCmd {
|
||||
public:
|
||||
explicit TakeToWorkspaceCmd(int workspace_num) : m_workspace_num(workspace_num) { }
|
||||
protected:
|
||||
void real_execute();
|
||||
private:
|
||||
const int m_workspace_num;
|
||||
};
|
||||
|
||||
class TakeToNextWorkspaceCmd : public WindowHelperCmd {
|
||||
public:
|
||||
explicit TakeToNextWorkspaceCmd(int delta) : m_delta(delta) { }
|
||||
protected:
|
||||
void real_execute();
|
||||
private:
|
||||
const int m_delta;
|
||||
};
|
||||
|
||||
class TakeToPrevWorkspaceCmd : public WindowHelperCmd {
|
||||
public:
|
||||
explicit TakeToPrevWorkspaceCmd(int delta) : m_delta(delta) { }
|
||||
protected:
|
||||
void real_execute();
|
||||
private:
|
||||
const int m_delta;
|
||||
};
|
||||
|
||||
|
||||
// goto tab
|
||||
class GoToTabCmd: public WindowHelperCmd {
|
||||
public:
|
||||
|
|
Loading…
Reference in a new issue