aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Tiefenbruck <mark@fluxbox.org>2008-08-05 07:05:21 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2008-08-05 07:05:21 (GMT)
commit24bea22035e79c17fa6b6fdcd60f88e4eac467d8 (patch)
treee0cae9682c279558cbaa106d0572118ee76652db
parent9d71ad9c1477875001ecd19eb4cbbe1c4ba4eb40 (diff)
downloadfluxbox-24bea22035e79c17fa6b6fdcd60f88e4eac467d8.zip
fluxbox-24bea22035e79c17fa6b6fdcd60f88e4eac467d8.tar.bz2
add SetLayer key command
-rw-r--r--ChangeLog2
-rw-r--r--doc/asciidoc/fluxbox-keys.txt7
-rw-r--r--doc/fluxbox-keys.521
-rw-r--r--src/CurrentWindowCmd.cc13
-rw-r--r--src/CurrentWindowCmd.hh11
-rw-r--r--src/Layer.hh2
-rw-r--r--src/Remember.cc20
7 files changed, 53 insertions, 23 deletions
diff --git a/ChangeLog b/ChangeLog
index 6a76aea..af47839 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,8 @@
1 (Format: Year/Month/Day) 1 (Format: Year/Month/Day)
2Changes for 1.1 2Changes for 1.1
3*08/08/05: 3*08/08/05:
4 * Added new SetLayer key command (Mark)
5 CurrentWindowCmd.cc/hh
4 * Make ShowDesktop command toggle between showing windows and desktop (Mark) 6 * Make ShowDesktop command toggle between showing windows and desktop (Mark)
5 WorkspaceCmd.cc 7 WorkspaceCmd.cc
6 * Created new `fluxbox-keys' man page (thanks Jim Ramsay) 8 * Created new `fluxbox-keys' man page (thanks Jim Ramsay)
diff --git a/doc/asciidoc/fluxbox-keys.txt b/doc/asciidoc/fluxbox-keys.txt
index 197e175..70f3b66 100644
--- a/doc/asciidoc/fluxbox-keys.txt
+++ b/doc/asciidoc/fluxbox-keys.txt
@@ -186,6 +186,11 @@ These commands affect only the currently focused window.
186 Raise the window up to the layer above, or lower it to the layer 186 Raise the window up to the layer above, or lower it to the layer
187 below. See 'fluxbox(1)' for a discussion of layers. 187 below. See 'fluxbox(1)' for a discussion of layers.
188 188
189*SetLayer* 'layer'::
190 Move the window to the specified layer. 'layer' should be one of
191 *AboveDock*, *Dock*, *Top*, *Normal*, *Bottom*, *Desktop*. See
192 'fluxbox(1)' for a discussion of layers.
193
189*Close*:: 194*Close*::
190 Close the current window, equivalent to the window button. 195 Close the current window, equivalent to the window button.
191 196
@@ -599,7 +604,7 @@ The following values are accepted for 'propertyname':::
599 head where the mouse pointer currently resides. 604 head where the mouse pointer currently resides.
600*Layer*;; 605*Layer*;;
601 The string name of the window's layer, which is one of 606 The string name of the window's layer, which is one of
602 *Above Dock*, *Dock*, *Top*, *Normal*, *Bottom*, *Desktop* 607 *AboveDock*, *Dock*, *Top*, *Normal*, *Bottom*, *Desktop*
603 608
604.Matches any windows with the CLASSNAME of "xterm" 609.Matches any windows with the CLASSNAME of "xterm"
605.......... 610..........
diff --git a/doc/fluxbox-keys.5 b/doc/fluxbox-keys.5
index 01bbd05..aa0523a 100644
--- a/doc/fluxbox-keys.5
+++ b/doc/fluxbox-keys.5
@@ -1,11 +1,11 @@
1.\" Title: fluxbox-keys 1.\" Title: fluxbox-keys
2.\" Author: 2.\" Author:
3.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/> 3.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
4.\" Date: 08/04/2008 4.\" Date: 08/05/2008
5.\" Manual: 5.\" Manual:
6.\" Source: 6.\" Source:
7.\" 7.\"
8.TH "FLUXBOX\-KEYS" "5" "08/04/2008" "" "" 8.TH "FLUXBOX\-KEYS" "5" "08/05/2008" "" ""
9.\" disable hyphenation 9.\" disable hyphenation
10.nh 10.nh
11.\" disable justification (adjust text to left margin only) 11.\" disable justification (adjust text to left margin only)
@@ -201,6 +201,21 @@ Raise the window up to the layer above, or lower it to the layer below\. See
201for a discussion of layers\. 201for a discussion of layers\.
202.RE 202.RE
203.PP 203.PP
204\fBSetLayer\fR \fIlayer\fR
205.RS 4
206Move the window to the specified layer\.
207\fIlayer\fR
208should be one of
209\fBAboveDock\fR,
210\fBDock\fR,
211\fBTop\fR,
212\fBNormal\fR,
213\fBBottom\fR,
214\fBDesktop\fR\. See
215\fIfluxbox(1)\fR
216for a discussion of layers\.
217.RE
218.PP
204\fBClose\fR 219\fBClose\fR
205.RS 4 220.RS 4
206Close the current window, equivalent to the window button\. 221Close the current window, equivalent to the window button\.
@@ -863,7 +878,7 @@ which refers to the head where the mouse pointer currently resides\.
863\fBLayer\fR 878\fBLayer\fR
864.RS 4 879.RS 4
865The string name of the window\'s layer, which is one of 880The string name of the window\'s layer, which is one of
866\fBAbove Dock\fR, 881\fBAboveDock\fR,
867\fBDock\fR, 882\fBDock\fR,
868\fBTop\fR, 883\fBTop\fR,
869\fBNormal\fR, 884\fBNormal\fR,
diff --git a/src/CurrentWindowCmd.cc b/src/CurrentWindowCmd.cc
index 4c027d9..42ee69c 100644
--- a/src/CurrentWindowCmd.cc
+++ b/src/CurrentWindowCmd.cc
@@ -23,6 +23,7 @@
23#include "CurrentWindowCmd.hh" 23#include "CurrentWindowCmd.hh"
24 24
25#include "fluxbox.hh" 25#include "fluxbox.hh"
26#include "Layer.hh"
26#include "Window.hh" 27#include "Window.hh"
27#include "WindowCmd.hh" 28#include "WindowCmd.hh"
28#include "Screen.hh" 29#include "Screen.hh"
@@ -479,6 +480,18 @@ void FullscreenCmd::real_execute() {
479 fbwindow().setFullscreen(!fbwindow().isFullscreen()); 480 fbwindow().setFullscreen(!fbwindow().isFullscreen());
480} 481}
481 482
483FbTk::Command<void> *SetLayerCmd::parse(const string &command,
484 const string &args, bool trusted) {
485 int l = Layer::getNumFromString(args);
486 return (l == -1) ? 0 : new SetLayerCmd(l);
487}
488
489REGISTER_COMMAND_PARSER(setlayer, SetLayerCmd::parse, void);
490
491void SetLayerCmd::real_execute() {
492 fbwindow().moveToLayer(m_layer);
493}
494
482FbTk::Command<void> *SetAlphaCmd::parse(const string &command, const string &args, 495FbTk::Command<void> *SetAlphaCmd::parse(const string &command, const string &args,
483 bool trusted) { 496 bool trusted) {
484 typedef std::vector<string> StringTokens; 497 typedef std::vector<string> StringTokens;
diff --git a/src/CurrentWindowCmd.hh b/src/CurrentWindowCmd.hh
index 157855c..5d381a2 100644
--- a/src/CurrentWindowCmd.hh
+++ b/src/CurrentWindowCmd.hh
@@ -247,6 +247,17 @@ private:
247 int m_relative, m_un_relative; 247 int m_relative, m_un_relative;
248}; 248};
249 249
250class SetLayerCmd: public WindowHelperCmd {
251public:
252 explicit SetLayerCmd(int layer): m_layer(layer) { }
253 static FbTk::Command<void> *parse(const std::string &command,
254 const std::string &args, bool trusted);
255protected:
256 void real_execute();
257private:
258 int m_layer;
259};
260
250class MatchCmd: public WindowHelperBoolCmd { 261class MatchCmd: public WindowHelperBoolCmd {
251public: 262public:
252 MatchCmd(const std::string &pat): m_pat(pat.c_str()) { }; 263 MatchCmd(const std::string &pat): m_pat(pat.c_str()) { };
diff --git a/src/Layer.hh b/src/Layer.hh
index 58fb5b6..da8f04c 100644
--- a/src/Layer.hh
+++ b/src/Layer.hh
@@ -54,7 +54,7 @@ public:
54 54
55 explicit Layer(int i) : m_num(i) {}; 55 explicit Layer(int i) : m_num(i) {};
56 56
57 static int getNumFromString(string &str) { 57 static int getNumFromString(const string &str) {
58 int tempnum = 0; 58 int tempnum = 0;
59 if (sscanf(str.c_str(), "%d", &tempnum) == 1) 59 if (sscanf(str.c_str(), "%d", &tempnum) == 1)
60 return tempnum; 60 return tempnum;
diff --git a/src/Remember.cc b/src/Remember.cc
index ff0094c..f76fe9b 100644
--- a/src/Remember.cc
+++ b/src/Remember.cc
@@ -411,24 +411,8 @@ int Remember::parseApp(ifstream &file, Application &app, string *first_line) {
411 else 411 else
412 had_error = true; 412 had_error = true;
413 } else if (strcasecmp(str_key.c_str(), "Layer") == 0) { 413 } else if (strcasecmp(str_key.c_str(), "Layer") == 0) {
414 unsigned int l; 414 int l = Layer::getNumFromString(str_label);
415 if (strcasecmp(str_label.c_str(), "DESKTOP") == 0) { 415 had_error = (l == -1);
416 l = Layer::DESKTOP;
417 } else if (strcasecmp(str_label.c_str(), "BOTTOM") == 0) {
418 l = Layer::BOTTOM;
419 } else if (strcasecmp(str_label.c_str(), "NORMAL") == 0) {
420 l = Layer::NORMAL;
421 } else if (strcasecmp(str_label.c_str(), "TOP") == 0) {
422 l = Layer::TOP;
423 } else if (strcasecmp(str_label.c_str(), "DOCK") == 0) {
424 l = Layer::DOCK;
425 } else if (strcasecmp(str_label.c_str(), "ABOVEDOCK") == 0) {
426 l = Layer::ABOVE_DOCK;
427 } else if (strcasecmp(str_label.c_str(), "MENU") == 0) {
428 l = Layer::MENU;
429 } else if (!getuint(str_label.c_str(), l)) {
430 had_error = true;
431 }
432 if (!had_error) 416 if (!had_error)
433 app.rememberLayer(l); 417 app.rememberLayer(l);
434 } else if (strcasecmp(str_key.c_str(), "Dimensions") == 0) { 418 } else if (strcasecmp(str_key.c_str(), "Dimensions") == 0) {