Compare commits

..

14 Commits
0.6.0 ... 0.6.1

Author SHA1 Message Date
82bed9dd5e chore: v0.6.1 2019-05-02 14:31:02 +02:00
d027243a19 fix: json thread safe 2019-05-02 14:24:54 +02:00
e6d59f05cc fix s/hidded/hidden/ typo (#295)
fix s/hidded/hidden/ typo
2019-05-02 13:59:57 +02:00
4d4562aade fix s/hidded/hidden/ typo 2019-05-01 12:40:12 +01:00
e8f31a0c4f revert: infinite seconds for once custom modules 2019-04-26 21:57:15 +02:00
f8c06b27ae Revert "feat(Cpu): dynamic fmt args"
This reverts commit 2d9bcb1a2d.
2019-04-26 21:49:16 +02:00
717a07d584 refactor(Window): simpler conditions 2019-04-26 15:29:54 +02:00
2d9bcb1a2d feat(Cpu): dynamic fmt args 2019-04-26 14:07:31 +02:00
4dd36890c1 style: background color transition 2019-04-26 12:37:35 +02:00
66acaeca7f style: workspaces button color for chromium class 2019-04-26 12:01:42 +02:00
20cf7592aa Merge pull request #287 from jonvaldes/master
Allow rotating label contents by specifying a new "rotate" property
2019-04-26 09:39:52 +02:00
9fe29c37b4 Fix indentation 2019-04-25 22:56:14 +02:00
f8ae1534db Allow rotating label contents by specifying a new "rotate" property in the label config 2019-04-25 22:47:58 +02:00
46c91a26ac style: workspaces button color for chromium class 2019-04-25 17:14:16 +02:00
7 changed files with 27 additions and 11 deletions

View File

@ -44,6 +44,7 @@ class Ipc {
int fd_event_; int fd_event_;
std::mutex mutex_; std::mutex mutex_;
std::mutex mutex_event_; std::mutex mutex_event_;
std::mutex mutex_parser_;
util::JsonParser parser_; util::JsonParser parser_;
}; };

View File

@ -1,6 +1,6 @@
project( project(
'waybar', 'cpp', 'c', 'waybar', 'cpp', 'c',
version: '0.6.0', version: '0.6.1',
license: 'MIT', license: 'MIT',
default_options : [ default_options : [
'cpp_std=c++17', 'cpp_std=c++17',

View File

@ -10,9 +10,11 @@ window#waybar {
background: rgba(43, 48, 59, 0.5); background: rgba(43, 48, 59, 0.5);
border-bottom: 3px solid rgba(100, 114, 125, 0.5); border-bottom: 3px solid rgba(100, 114, 125, 0.5);
color: #ffffff; color: #ffffff;
transition-property: background, background-color;
transition-duration: .5s;
} }
window#waybar.hidded { window#waybar.hidden {
opacity: 0.2; opacity: 0.2;
} }
@ -32,6 +34,7 @@ window#waybar.termite {
window#waybar.chromium { window#waybar.chromium {
background-color: #DEE1E6; background-color: #DEE1E6;
color: #000000; color: #000000;
border: none;
} }
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ /* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
@ -42,11 +45,19 @@ window#waybar.chromium {
border-bottom: 3px solid transparent; border-bottom: 3px solid transparent;
} }
window#waybar.chromium #workspaces button {
color: #3F3F3F;
}
#workspaces button.focused { #workspaces button.focused {
background: #64727D; background: #64727D;
border-bottom: 3px solid #ffffff; border-bottom: 3px solid #ffffff;
} }
window#waybar.chromium #workspaces button.focused {
color: #ffffff;
}
#workspaces button.urgent { #workspaces button.urgent {
background-color: #eb4d4b; background-color: #eb4d4b;
} }

View File

@ -7,7 +7,7 @@ waybar::ALabel::ALabel(const Json::Value& config, const std::string& format, uin
: config_(config), : config_(config),
format_(config_["format"].isString() ? config_["format"].asString() : format), format_(config_["format"].isString() ? config_["format"].asString() : format),
interval_(config_["interval"] == "once" interval_(config_["interval"] == "once"
? std::chrono::seconds(std::numeric_limits<int>::infinity()) ? std::chrono::seconds(100000000)
: std::chrono::seconds( : std::chrono::seconds(
config_["interval"].isUInt() ? config_["interval"].asUInt() : interval)), config_["interval"].isUInt() ? config_["interval"].asUInt() : interval)),
default_format_(format_) { default_format_(format_) {
@ -16,6 +16,11 @@ waybar::ALabel::ALabel(const Json::Value& config, const std::string& format, uin
label_.set_max_width_chars(config_["max-length"].asUInt()); label_.set_max_width_chars(config_["max-length"].asUInt());
label_.set_ellipsize(Pango::EllipsizeMode::ELLIPSIZE_END); label_.set_ellipsize(Pango::EllipsizeMode::ELLIPSIZE_END);
} }
if (config_["rotate"].isUInt()) {
label_.set_angle(config["rotate"].asUInt());
}
if (config_["format-alt"].isString()) { if (config_["format-alt"].isString()) {
event_box_.add_events(Gdk::BUTTON_PRESS_MASK); event_box_.add_events(Gdk::BUTTON_PRESS_MASK);
event_box_.signal_button_press_event().connect(sigc::mem_fun(*this, &ALabel::handleToggle)); event_box_.signal_button_press_event().connect(sigc::mem_fun(*this, &ALabel::handleToggle));

View File

@ -198,9 +198,9 @@ auto waybar::Bar::toggle() -> void {
visible = !visible; visible = !visible;
auto zone = visible ? height_ : 0; auto zone = visible ? height_ : 0;
if (!visible) { if (!visible) {
window.get_style_context()->add_class("hidded"); window.get_style_context()->add_class("hidden");
} else { } else {
window.get_style_context()->remove_class("hidded"); window.get_style_context()->remove_class("hidden");
} }
zwlr_layer_surface_v1_set_exclusive_zone(layer_surface, zone); zwlr_layer_surface_v1_set_exclusive_zone(layer_surface, zone);
wl_surface_commit(surface); wl_surface_commit(surface);

View File

@ -104,6 +104,7 @@ struct Ipc::ipc_response Ipc::recv(int fd) {
} }
total += res; total += res;
} }
std::lock_guard<std::mutex> lock(mutex_parser_);
auto parsed = parser_.parse(&payload.front()); auto parsed = parser_.parse(&payload.front());
return {data32[0], data32[1], parsed}; return {data32[0], data32[1], parsed};
} }

View File

@ -43,21 +43,19 @@ void Window::onEvent(const struct Ipc::ipc_response& res) {
void Window::onCmd(const struct Ipc::ipc_response& res) { void Window::onCmd(const struct Ipc::ipc_response& res) {
auto [nb, id, name, app_id] = getFocusedNode(res.payload); auto [nb, id, name, app_id] = getFocusedNode(res.payload);
if (nb == 0) {
bar_.window.get_style_context()->add_class("empty");
} else {
bar_.window.get_style_context()->remove_class("empty");
}
if (!app_id_.empty()) { if (!app_id_.empty()) {
bar_.window.get_style_context()->remove_class(app_id_); bar_.window.get_style_context()->remove_class(app_id_);
} }
if (nb == 1) { if (nb == 0) {
bar_.window.get_style_context()->add_class("empty");
} else if (nb == 1) {
bar_.window.get_style_context()->add_class("solo"); bar_.window.get_style_context()->add_class("solo");
if (!app_id.empty()) { if (!app_id.empty()) {
bar_.window.get_style_context()->add_class(app_id); bar_.window.get_style_context()->add_class(app_id);
} }
} else { } else {
bar_.window.get_style_context()->remove_class("solo"); bar_.window.get_style_context()->remove_class("solo");
bar_.window.get_style_context()->remove_class("empty");
} }
app_id_ = app_id; app_id_ = app_id;
if (windowId_ != id || window_ != name) { if (windowId_ != id || window_ != name) {