From 74df0fcda9d9a60e32d4bcc240564854e49731fe Mon Sep 17 00:00:00 2001
From: Mark Tiefenbruck <mark@fluxbox.org>
Date: Wed, 20 Aug 2008 03:22:51 -0700
Subject: add SetDecor key command

---
 ChangeLog                     |  3 +++
 doc/asciidoc/fluxbox-keys.txt | 17 +++++++++++------
 doc/fluxbox-keys.5            | 35 +++++++++++++++++++----------------
 src/CurrentWindowCmd.cc       |  9 +++++++++
 src/CurrentWindowCmd.hh       |  9 +++++++++
 5 files changed, 51 insertions(+), 22 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e7ce292..be9f9db 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
  (Format: Year/Month/Day)
 Changes for 1.1
+*08/08/20:
+   * Added SetDecor key command (Mark)
+     CurrentWindowCmd.cc/hh
 *08/08/19:
    * Add new [transient] tag to apps file to match transient windows (Mark)
      ClientPattern.cc/hh Remember.cc
diff --git a/doc/asciidoc/fluxbox-keys.txt b/doc/asciidoc/fluxbox-keys.txt
index 771621d..b3b458a 100644
--- a/doc/asciidoc/fluxbox-keys.txt
+++ b/doc/asciidoc/fluxbox-keys.txt
@@ -166,11 +166,6 @@ Window Commands
 These commands ordinarily affect only the currently focused window. The
 *OnWindow* modifier and *ForEach* command may affect the window that is used.
 
-*Activate* ['pattern'] | *Focus* ['pattern']::
-	Set the focus to the window matching the argument. If 'pattern' is
-	omitted, this may be used with the *OnWindow* modifier to set the
-	focus. See *CLIENT PATTERNS* for more about the 'pattern' arguments.
-
 *Minimize* | *MinimizeWindow* | *Iconify*::
 	Minimize the current window, equivalent to the window button.
 
@@ -211,6 +206,11 @@ These commands ordinarily affect only the currently focused window. The
 	Toggle the *sticky* state of the current window, equivalent to the
 	window button. A *sticky* window is visible on all workspaces.
 
+*SetDecor* 'decor'::
+	Sets which window decorations will be shown. 'decor' has the same format
+	as the `[Deco]' parameter in the apps file. See man fluxbox section
+	APPLICATION SETTINGS for more info.
+
 *ToggleDecor*::
 	Toggles the presence of the window decorations (title bar, window
 	buttons, and resize bar).
@@ -310,7 +310,7 @@ called).
 	Jumps to the given workspace 'number'. The first workspace is *1*.
 
 *NextWindow* [{'options'}] ['pattern'] / *PrevWindow* [{'options'}] ['pattern']::
-Focuses and activates the next / previous window in the focus list.
+Focuses the next / previous window in the focus list.
 +
 'options' is one or more of the following, space delimited:;;
 +
@@ -344,6 +344,11 @@ doing so.
 	list. The 'options' and 'pattern' arguments have the same meaning as
 	*NextWindow* above.
 
+*Activate* ['pattern'] | *Focus* ['pattern']::
+	With 'pattern', this is an alias for *GoToWindow* 1 'pattern'. Without,
+	this behaves like a window command, so that OnWindow events can change
+	the focused window.
+
 *Attach* 'pattern'::
 	Combines all windows that match the 'pattern' into a single tab group.
 	See *CLIENT PATTERNS* for more about the 'pattern' arguments.
diff --git a/doc/fluxbox-keys.5 b/doc/fluxbox-keys.5
index e3e3ade..6509712 100644
--- a/doc/fluxbox-keys.5
+++ b/doc/fluxbox-keys.5
@@ -1,11 +1,11 @@
 .\"     Title: fluxbox-keys
 .\"    Author: 
 .\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 08/18/2008
+.\"      Date: 08/20/2008
 .\"    Manual: 
 .\"    Source: 
 .\"
-.TH "FLUXBOX\-KEYS" "5" "08/18/2008" "" ""
+.TH "FLUXBOX\-KEYS" "5" "08/20/2008" "" ""
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
@@ -167,19 +167,6 @@ Start dragging to add this window to another\'s tabgroup\.
 .SS "Window Commands"
 These commands ordinarily affect only the currently focused window\. The \fBOnWindow\fR modifier and \fBForEach\fR command may affect the window that is used\.
 .PP
-\fBActivate\fR [\fIpattern\fR] | \fBFocus\fR [\fIpattern\fR]
-.RS 4
-Set the focus to the window matching the argument\. If
-\fIpattern\fR
-is omitted, this may be used with the
-\fBOnWindow\fR
-modifier to set the focus\. See
-\fBCLIENT PATTERNS\fR
-for more about the
-\fIpattern\fR
-arguments\.
-.RE
-.PP
 \fBMinimize\fR | \fBMinimizeWindow\fR | \fBIconify\fR
 .RS 4
 Minimize the current window, equivalent to the window button\.
@@ -261,6 +248,13 @@ state of the current window, equivalent to the window button\. A
 window is visible on all workspaces\.
 .RE
 .PP
+\fBSetDecor\fR \fIdecor\fR
+.RS 4
+Sets which window decorations will be shown\.
+\fIdecor\fR
+has the same format as the `[Deco]\' parameter in the apps file\. See man fluxbox section APPLICATION SETTINGS for more info\.
+.RE
+.PP
 \fBToggleDecor\fR
 .RS 4
 Toggles the presence of the window decorations (title bar, window buttons, and resize bar)\.
@@ -411,7 +405,7 @@ Jumps to the given workspace
 .PP
 \fBNextWindow\fR [{\fIoptions\fR}] [\fIpattern\fR] / \fBPrevWindow\fR [{\fIoptions\fR}] [\fIpattern\fR]
 .RS 4
-Focuses and activates the next / previous window in the focus list\.
+Focuses the next / previous window in the focus list\.
 .PP
 \fIoptions\fR is one or more of the following, space delimited:
 .RS 4
@@ -456,6 +450,15 @@ arguments have the same meaning as
 above\.
 .RE
 .PP
+\fBActivate\fR [\fIpattern\fR] | \fBFocus\fR [\fIpattern\fR]
+.RS 4
+With
+\fIpattern\fR, this is an alias for
+\fBGoToWindow\fR
+1
+\fIpattern\fR\. Without, this behaves like a window command, so that OnWindow events can change the focused window\.
+.RE
+.PP
 \fBAttach\fR \fIpattern\fR
 .RS 4
 Combines all windows that match the
diff --git a/src/CurrentWindowCmd.cc b/src/CurrentWindowCmd.cc
index bfccbdc..6918db9 100644
--- a/src/CurrentWindowCmd.cc
+++ b/src/CurrentWindowCmd.cc
@@ -509,6 +509,15 @@ void SetTitleCmd::real_execute() {
     fbwindow().winClient().setTitle(title);
 }
 
+REGISTER_COMMAND_WITH_ARGS(setdecor, SetDecorCmd, void);
+
+SetDecorCmd::SetDecorCmd(const std::string &args):
+    m_mask(FbWinFrame::getDecoMaskFromString(args)) { }
+
+void SetDecorCmd::real_execute() {
+    fbwindow().setDecorationMask(m_mask);
+}
+
 FbTk::Command<void> *SetAlphaCmd::parse(const string &command, const string &args,
                                   bool trusted) {
     typedef std::vector<string> StringTokens;
diff --git a/src/CurrentWindowCmd.hh b/src/CurrentWindowCmd.hh
index 8371204..9b7d181 100644
--- a/src/CurrentWindowCmd.hh
+++ b/src/CurrentWindowCmd.hh
@@ -247,6 +247,15 @@ private:
     std::string title;
 };
 
+class SetDecorCmd: public WindowHelperCmd {
+public:
+    explicit SetDecorCmd(const std::string &args);
+protected:
+    void real_execute();
+private:
+    unsigned int m_mask;
+};
+
 class SetAlphaCmd: public WindowHelperCmd {
 public:
     SetAlphaCmd(int focus, bool rel, int unfocus, bool unrel);
-- 
cgit v0.11.2