all repos — fluxbox @ 3058861f8977374dff1ed6401bbdac9cce92bc99

custom fork of the fluxbox windowmanager

indicate iconified windows in iconbar
Thomas Lübking thomas.luebking@gmail.com
commit

3058861f8977374dff1ed6401bbdac9cce92bc99

parent

e99d940f407d37f31ecda0f4878a161bfc479a46

3 files changed, 33 insertions(+), 1 deletions(-)

jump to
M src/IconButton.ccsrc/IconButton.cc

@@ -25,6 +25,7 @@ #include "IconbarTool.hh"

#include "IconbarTheme.hh" #include "Screen.hh" +#include "Window.hh" #include "FbTk/App.hh" #include "FbTk/Command.hh"

@@ -57,6 +58,10 @@ FbTk::RefCount<FbTk::Command<void> > ets(new FbTk::SimpleCommand<IconButton>(*this, &IconButton::clientTitleChanged));

m_title_update_timer.setCommand(ets); m_signals.join(m_win.titleSig(), MemFunIgnoreArgs(m_title_update_timer, &FbTk::Timer::start)); + + if (m_win.fbwindow()) + m_signals.join(m_win.fbwindow()->stateSig(), + MemFunIgnoreArgs(*this, &IconButton::clientTitleChanged)); m_signals.join(m_win.focusSig(), MemFunIgnoreArgs(*this, &IconButton::reconfigAndClear));

@@ -250,7 +255,10 @@ }

void IconButton::setupWindow() { m_icon_window.clear(); - setText(m_win.title()); + FbTk::FbString title = m_win.title().logical(); + if (m_win.fbwindow() && m_win.fbwindow()->isIconic()) + title = IconbarTool::iconifiedPrefix() + title + IconbarTool::iconifiedSuffix(); + setText(title); FbTk::TextButton::clear(); }
M src/IconbarTool.ccsrc/IconbarTool.cc

@@ -225,6 +225,8 @@ };

} // end anonymous namespace +std::string IconbarTool::s_iconifiedDecoration[2]; + IconbarTool::IconbarTool(const FbTk::FbWindow &parent, IconbarTheme &theme, FbTk::ThemeProxy<IconbarTheme> &focused_theme, FbTk::ThemeProxy<IconbarTheme> &unfocused_theme,

@@ -252,6 +254,8 @@ m_menu(screen.menuTheme(), screen.imageControl(),

*screen.layerManager().getLayer(ResourceLayer::MENU)), m_alpha(255) { + updateIconifiedPattern(); + // setup mode menu setupModeMenu(m_menu, *this); _FB_USES_NLS;

@@ -279,6 +283,8 @@ m_tracker.join(focused_theme.reconfigSig(),

FbTk::MemFun(*this, &IconbarTool::themeReconfigured)); m_tracker.join(unfocused_theme.reconfigSig(), FbTk::MemFun(*this, &IconbarTool::themeReconfigured)); + m_tracker.join(screen.reconfigureSig(), + FbTk::MemFunIgnoreArgs(*this, &IconbarTool::updateIconifiedPattern)); themeReconfigured(); }

@@ -437,6 +443,19 @@ // a new IconButton doesn't get resized properly until the

// m_icon_container.update() above; then, it never runs drawText() again, // so text can end up behind program icons renderTheme(); +} + +void IconbarTool::updateIconifiedPattern() { + FbTk::Resource<std::string> p(m_screen.resourceManager(), "( %t )", + m_screen.name() + ".iconbar.iconifiedPattern", + m_screen.altName() + ".Iconbar.IconifiedPattern"); + size_t tidx = p->find("%t"); + s_iconifiedDecoration[0].clear(); + s_iconifiedDecoration[1].clear(); + if (tidx != std::string::npos) { + s_iconifiedDecoration[0] = p->substr(0, tidx); + s_iconifiedDecoration[1] = p->substr(tidx+2); + } } void IconbarTool::insertWindow(Focusable &win, int pos) {
M src/IconbarTool.hhsrc/IconbarTool.hh

@@ -68,6 +68,8 @@ std::string mode() const { return *m_rc_mode; }

void setOrientation(FbTk::Orientation orient); FbTk::Container::Alignment alignment() const { return m_icon_container.alignment(); } + static std::string &iconifiedPrefix() { return s_iconifiedDecoration[0]; } + static std::string &iconifiedSuffix() { return s_iconifiedDecoration[1]; } const BScreen &screen() const { return m_screen; } private:

@@ -98,6 +100,8 @@

/// called when the list emits a signal void update(UpdateReason reason, Focusable *win); + void updateIconifiedPattern(); + void themeReconfigured(); BScreen &m_screen;

@@ -118,6 +122,7 @@ FbTk::Resource<unsigned int> m_rc_client_padding; ///< padding of the text

FbTk::Resource<bool> m_rc_use_pixmap; ///< if iconbar should use win pixmap or not FbMenu m_menu; int m_alpha; + static std::string s_iconifiedDecoration[2]; }; #endif // ICONBARTOOL_HH