diff options
author | Thomas Lübking <thomas.luebking@gmail.com> | 2016-06-29 15:27:28 (GMT) |
---|---|---|
committer | Mathias Gumz <akira@fluxbox.org> | 2016-08-26 06:18:48 (GMT) |
commit | fbb2d16639491fdb0c49e388278fabcc4b0800f3 (patch) | |
tree | b216515b1265dd6164722ebd77ff580738dfc9a0 /src/WorkspaceCmd.cc | |
parent | 393ba45f91480bb10f510248837c6051b7ff6a03 (diff) | |
download | fluxbox-fbb2d16639491fdb0c49e388278fabcc4b0800f3.zip fluxbox-fbb2d16639491fdb0c49e388278fabcc4b0800f3.tar.bz2 |
allow to alter button labels via fluxbox-remote
Command is "RelabelButton button.foo $LABEL"
This is useful to eg. hint the amount of unread mails in a
button to start your MUA, reflect the $USER in a session menu button
etc.
Diffstat (limited to 'src/WorkspaceCmd.cc')
-rw-r--r-- | src/WorkspaceCmd.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/WorkspaceCmd.cc b/src/WorkspaceCmd.cc index bdba96c..a642008 100644 --- a/src/WorkspaceCmd.cc +++ b/src/WorkspaceCmd.cc | |||
@@ -686,3 +686,28 @@ void CloseAllWindowsCmd::execute() { | |||
686 | windows.end(), std::mem_fun(&FluxboxWindow::close)); | 686 | windows.end(), std::mem_fun(&FluxboxWindow::close)); |
687 | 687 | ||
688 | } | 688 | } |
689 | |||
690 | void RelabelButtonCmd::execute() { | ||
691 | #if USE_TOOLBAR | ||
692 | if (BScreen *screen = Fluxbox::instance()->mouseScreen()) | ||
693 | screen->relabelToolButton(m_button, m_label); | ||
694 | #endif | ||
695 | } | ||
696 | |||
697 | FbTk::Command<void> *RelabelButtonCmd::parse(const std::string &command, | ||
698 | const std::string &args, bool trusted) { | ||
699 | std::string button, label; | ||
700 | std::size_t ws = args.find_first_of(" \t\n"); | ||
701 | if (ws != std::string::npos) { | ||
702 | button = args.substr(0, ws); | ||
703 | if (button.find("button.") == 0) { | ||
704 | label = args.substr(ws + 1, std::string::npos); | ||
705 | } else { | ||
706 | button.clear(); | ||
707 | } | ||
708 | } | ||
709 | return new RelabelButtonCmd(button, label); | ||
710 | } | ||
711 | |||
712 | REGISTER_COMMAND_PARSER(relabelbutton, RelabelButtonCmd::parse, void); | ||
713 | |||