add manpage and make format option work
This commit is contained in:
parent
e2b676b800
commit
b900c01381
|
@ -0,0 +1,31 @@
|
||||||
|
waybar-river-window(5)
|
||||||
|
|
||||||
|
# NAME
|
||||||
|
|
||||||
|
waybar - river window module
|
||||||
|
|
||||||
|
# DESCRIPTION
|
||||||
|
|
||||||
|
The *window* module displays the title of the currently focused window in river
|
||||||
|
|
||||||
|
# CONFIGURATION
|
||||||
|
|
||||||
|
Addressed by *river/window*
|
||||||
|
|
||||||
|
*format*: ++
|
||||||
|
typeof: string ++
|
||||||
|
default: {} ++
|
||||||
|
The format, how information should be displayed. On {} data gets inserted.
|
||||||
|
|
||||||
|
# EXAMPLES
|
||||||
|
|
||||||
|
```
|
||||||
|
"river/window": {
|
||||||
|
"format": "{}"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
# STYLE
|
||||||
|
|
||||||
|
- *#window*
|
||||||
|
- *window#.focused* Applied when the output this module's bar belongs to is focused.
|
|
@ -1,14 +1,11 @@
|
||||||
#include "modules/river/window.hpp"
|
#include "modules/river/window.hpp"
|
||||||
|
|
||||||
#include <gtkmm/button.h>
|
|
||||||
#include <gtkmm/label.h>
|
|
||||||
#include <spdlog/spdlog.h>
|
#include <spdlog/spdlog.h>
|
||||||
#include <wayland-client.h>
|
#include <wayland-client.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include "client.hpp"
|
#include "client.hpp"
|
||||||
#include "xdg-output-unstable-v1-client-protocol.h"
|
|
||||||
|
|
||||||
namespace waybar::modules::river {
|
namespace waybar::modules::river {
|
||||||
|
|
||||||
|
@ -99,11 +96,11 @@ void Window::handle_focused_view(const char *title) {
|
||||||
// last focused view, and will get blank labels until they are brought into focus at least once.
|
// last focused view, and will get blank labels until they are brought into focus at least once.
|
||||||
if (focused_output_ != output_) return;
|
if (focused_output_ != output_) return;
|
||||||
|
|
||||||
if (std::strcmp(title, "") == 0) {
|
if (std::strcmp(title, "") == 0 || format_.empty()) {
|
||||||
label_.hide(); // hide empty labels
|
label_.hide(); // hide empty labels or labels with empty format
|
||||||
} else {
|
} else {
|
||||||
label_.show();
|
label_.show();
|
||||||
label_.set_markup(title);
|
label_.set_markup(fmt::format(format_, title));
|
||||||
}
|
}
|
||||||
|
|
||||||
ALabel::update();
|
ALabel::update();
|
||||||
|
|
Loading…
Reference in New Issue