all repos — fluxbox @ 24bea22035e79c17fa6b6fdcd60f88e4eac467d8

custom fork of the fluxbox windowmanager

add SetLayer key command
Mark Tiefenbruck mark@fluxbox.org
commit

24bea22035e79c17fa6b6fdcd60f88e4eac467d8

parent

9d71ad9c1477875001ecd19eb4cbbe1c4ba4eb40

M ChangeLogChangeLog

@@ -1,6 +1,8 @@

(Format: Year/Month/Day) Changes for 1.1 *08/08/05: + * Added new SetLayer key command (Mark) + CurrentWindowCmd.cc/hh * Make ShowDesktop command toggle between showing windows and desktop (Mark) WorkspaceCmd.cc * Created new `fluxbox-keys' man page (thanks Jim Ramsay)
M doc/asciidoc/fluxbox-keys.txtdoc/asciidoc/fluxbox-keys.txt

@@ -186,6 +186,11 @@ *RaiseLayer* / *LowerLayer*::

Raise the window up to the layer above, or lower it to the layer below. See 'fluxbox(1)' for a discussion of layers. +*SetLayer* 'layer':: + Move the window to the specified layer. 'layer' should be one of + *AboveDock*, *Dock*, *Top*, *Normal*, *Bottom*, *Desktop*. See + 'fluxbox(1)' for a discussion of layers. + *Close*:: Close the current window, equivalent to the window button.

@@ -599,7 +604,7 @@ may match this against the special value *[mouse]* which refers to the

head where the mouse pointer currently resides. *Layer*;; The string name of the window's layer, which is one of - *Above Dock*, *Dock*, *Top*, *Normal*, *Bottom*, *Desktop* + *AboveDock*, *Dock*, *Top*, *Normal*, *Bottom*, *Desktop* .Matches any windows with the CLASSNAME of "xterm" ..........
M doc/fluxbox-keys.5doc/fluxbox-keys.5

@@ -1,11 +1,11 @@

.\" Title: fluxbox-keys .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/> -.\" Date: 08/04/2008 +.\" Date: 08/05/2008 .\" Manual: .\" Source: .\" -.TH "FLUXBOX\-KEYS" "5" "08/04/2008" "" "" +.TH "FLUXBOX\-KEYS" "5" "08/05/2008" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only)

@@ -197,6 +197,21 @@ .PP

\fBRaiseLayer\fR / \fBLowerLayer\fR .RS 4 Raise the window up to the layer above, or lower it to the layer below\. See +\fIfluxbox(1)\fR +for a discussion of layers\. +.RE +.PP +\fBSetLayer\fR \fIlayer\fR +.RS 4 +Move the window to the specified layer\. +\fIlayer\fR +should be one of +\fBAboveDock\fR, +\fBDock\fR, +\fBTop\fR, +\fBNormal\fR, +\fBBottom\fR, +\fBDesktop\fR\. See \fIfluxbox(1)\fR for a discussion of layers\. .RE

@@ -863,7 +878,7 @@ .PP

\fBLayer\fR .RS 4 The string name of the window\'s layer, which is one of -\fBAbove Dock\fR, +\fBAboveDock\fR, \fBDock\fR, \fBTop\fR, \fBNormal\fR,
M src/CurrentWindowCmd.ccsrc/CurrentWindowCmd.cc

@@ -23,6 +23,7 @@

#include "CurrentWindowCmd.hh" #include "fluxbox.hh" +#include "Layer.hh" #include "Window.hh" #include "WindowCmd.hh" #include "Screen.hh"

@@ -477,6 +478,18 @@

FullscreenCmd::FullscreenCmd() { } void FullscreenCmd::real_execute() { fbwindow().setFullscreen(!fbwindow().isFullscreen()); +} + +FbTk::Command<void> *SetLayerCmd::parse(const string &command, + const string &args, bool trusted) { + int l = Layer::getNumFromString(args); + return (l == -1) ? 0 : new SetLayerCmd(l); +} + +REGISTER_COMMAND_PARSER(setlayer, SetLayerCmd::parse, void); + +void SetLayerCmd::real_execute() { + fbwindow().moveToLayer(m_layer); } FbTk::Command<void> *SetAlphaCmd::parse(const string &command, const string &args,
M src/CurrentWindowCmd.hhsrc/CurrentWindowCmd.hh

@@ -247,6 +247,17 @@ int m_focus, m_unfocus;

int m_relative, m_un_relative; }; +class SetLayerCmd: public WindowHelperCmd { +public: + explicit SetLayerCmd(int layer): m_layer(layer) { } + static FbTk::Command<void> *parse(const std::string &command, + const std::string &args, bool trusted); +protected: + void real_execute(); +private: + int m_layer; +}; + class MatchCmd: public WindowHelperBoolCmd { public: MatchCmd(const std::string &pat): m_pat(pat.c_str()) { };
M src/Layer.hhsrc/Layer.hh

@@ -54,7 +54,7 @@ };

explicit Layer(int i) : m_num(i) {}; - static int getNumFromString(string &str) { + static int getNumFromString(const string &str) { int tempnum = 0; if (sscanf(str.c_str(), "%d", &tempnum) == 1) return tempnum;
M src/Remember.ccsrc/Remember.cc

@@ -411,24 +411,8 @@ app.rememberHead(h);

else had_error = true; } else if (strcasecmp(str_key.c_str(), "Layer") == 0) { - unsigned int l; - if (strcasecmp(str_label.c_str(), "DESKTOP") == 0) { - l = Layer::DESKTOP; - } else if (strcasecmp(str_label.c_str(), "BOTTOM") == 0) { - l = Layer::BOTTOM; - } else if (strcasecmp(str_label.c_str(), "NORMAL") == 0) { - l = Layer::NORMAL; - } else if (strcasecmp(str_label.c_str(), "TOP") == 0) { - l = Layer::TOP; - } else if (strcasecmp(str_label.c_str(), "DOCK") == 0) { - l = Layer::DOCK; - } else if (strcasecmp(str_label.c_str(), "ABOVEDOCK") == 0) { - l = Layer::ABOVE_DOCK; - } else if (strcasecmp(str_label.c_str(), "MENU") == 0) { - l = Layer::MENU; - } else if (!getuint(str_label.c_str(), l)) { - had_error = true; - } + int l = Layer::getNumFromString(str_label); + had_error = (l == -1); if (!had_error) app.rememberLayer(l); } else if (strcasecmp(str_key.c_str(), "Dimensions") == 0) {