From 6c0565c482b496b7d34e3731415829e7c4872535 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Fri, 12 Aug 2016 17:29:50 +0200 Subject: add commands to toggle toolbar and slit layer toggle(Toolbar|Slit)Above toggles the resp. item between its regular and the AboveDock layer (ie. above everything, even visible on active fullscreen windows) Also required step for autoraising. REQUEST: 222 --- doc/asciidoc/fluxbox-keys.txt | 6 ++++++ src/Screen.hh | 5 +++++ src/Slit.cc | 7 +++++++ src/Slit.hh | 1 + src/Toolbar.cc | 7 +++++++ src/Toolbar.hh | 1 + src/WorkspaceCmd.cc | 22 ++++++++++++++++++++++ src/WorkspaceCmd.hh | 10 ++++++++++ 8 files changed, 59 insertions(+) diff --git a/doc/asciidoc/fluxbox-keys.txt b/doc/asciidoc/fluxbox-keys.txt index 4360c5f..560e94d 100644 --- a/doc/asciidoc/fluxbox-keys.txt +++ b/doc/asciidoc/fluxbox-keys.txt @@ -438,6 +438,12 @@ doing so. Minimizes all windows on the current workspace. If they are already all minimized, then it restores them. +*ToggleSlitAbove*:: + Toggles the slit between its regular and the AboveDock layer + +*ToggleToolbarAbove*:: + Toggles the toolbar between its regular and the AboveDock layer + *Deiconify* 'mode' 'destination':: Deiconifies windows (or, restores from a minimized state). + diff --git a/src/Screen.hh b/src/Screen.hh index 32a7f7a..a6aa9fb 100644 --- a/src/Screen.hh +++ b/src/Screen.hh @@ -126,6 +126,11 @@ public: Slit *slit() { return m_slit.get(); } /// @return the slit, @see Slit const Slit *slit() const { return m_slit.get(); } + + /// @return the toolbar, @see Toolbar + Toolbar *toolbar() { return m_toolbar.get(); } + /// @return the toolbar, @see Toolbar + const Toolbar *toolbar() const { return m_toolbar.get(); } /** * @param w the workspace number * @return workspace for the given workspace number diff --git a/src/Slit.cc b/src/Slit.cc index 57de638..d03f61b 100644 --- a/src/Slit.cc +++ b/src/Slit.cc @@ -1064,6 +1064,13 @@ void Slit::toggleHidden() { } } +void Slit::toggleAboveDock() { + if (m_layeritem->getLayerNum() == m_rc_layernum->getNum()) + m_layeritem->moveToLayer(ResourceLayer::ABOVE_DOCK); + else + m_layeritem->moveToLayer(m_rc_layernum->getNum()); +} + void Slit::loadClientList(const char *filename) { if (filename == 0 || filename[0] == '\0') return; diff --git a/src/Slit.hh b/src/Slit.hh index 7d643d6..cffc087 100644 --- a/src/Slit.hh +++ b/src/Slit.hh @@ -103,6 +103,7 @@ public: void moveToLayer(int layernum); void toggleHidden(); + void toggleAboveDock(); BScreen &screen() { return m_screen; } const BScreen &screen() const { return m_screen; } diff --git a/src/Toolbar.cc b/src/Toolbar.cc index 1bd3fb5..cb52066 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc @@ -719,6 +719,13 @@ void Toolbar::toggleHidden() { } +void Toolbar::toggleAboveDock() { + if (m_layeritem.getLayerNum() == m_rc_layernum->getNum()) + m_layeritem.moveToLayer(ResourceLayer::ABOVE_DOCK); + else + m_layeritem.moveToLayer(m_rc_layernum->getNum()); +} + void Toolbar::moveToLayer(int layernum) { m_layeritem.moveToLayer(layernum); *m_rc_layernum = layernum; diff --git a/src/Toolbar.hh b/src/Toolbar.hh index 9f737b4..a1631bd 100644 --- a/src/Toolbar.hh +++ b/src/Toolbar.hh @@ -83,6 +83,7 @@ public: void updateVisibleState(); void toggleHidden(); + void toggleAboveDock(); void moveToLayer(int layernum); diff --git a/src/WorkspaceCmd.cc b/src/WorkspaceCmd.cc index 4598568..c2a2f8d 100644 --- a/src/WorkspaceCmd.cc +++ b/src/WorkspaceCmd.cc @@ -26,6 +26,8 @@ #include "Workspace.hh" #include "Window.hh" #include "Screen.hh" +#include "Slit.hh" +#include "Toolbar.hh" #include "fluxbox.hh" #include "WinClient.hh" #include "FocusControl.hh" @@ -622,6 +624,26 @@ void ShowDesktopCmd::execute() { } +REGISTER_COMMAND(toggleslitbarabove, ToggleSlitAboveCmd, void); +void ToggleSlitAboveCmd::execute() { +#if USE_SLIT + if (BScreen *screen = Fluxbox::instance()->mouseScreen()) { + screen->slit()->toggleAboveDock(); + const_cast(screen->slit()->window()).raise(); + } +#endif +} + +REGISTER_COMMAND(toggletoolbarabove, ToggleToolbarAboveCmd, void); +void ToggleToolbarAboveCmd::execute() { +#if USE_TOOLBAR + if (BScreen *screen = Fluxbox::instance()->mouseScreen()) { + screen->toolbar()->toggleAboveDock(); + const_cast(screen->toolbar()->window()).raise(); + } +#endif +} + REGISTER_COMMAND(closeallwindows, CloseAllWindowsCmd, void); void CloseAllWindowsCmd::execute() { diff --git a/src/WorkspaceCmd.hh b/src/WorkspaceCmd.hh index f4609b6..1766b3a 100644 --- a/src/WorkspaceCmd.hh +++ b/src/WorkspaceCmd.hh @@ -192,6 +192,16 @@ public: void execute(); }; +class ToggleSlitAboveCmd: public FbTk::Command { +public: + void execute(); +}; + +class ToggleToolbarAboveCmd: public FbTk::Command { +public: + void execute(); +}; + class CloseAllWindowsCmd: public FbTk::Command { public: void execute(); -- cgit v0.11.2