mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
Compare commits
14 Commits
Author | SHA1 | Date | |
---|---|---|---|
82bed9dd5e | |||
d027243a19 | |||
e6d59f05cc | |||
4d4562aade | |||
e8f31a0c4f | |||
f8c06b27ae | |||
717a07d584 | |||
2d9bcb1a2d | |||
4dd36890c1 | |||
66acaeca7f | |||
20cf7592aa | |||
9fe29c37b4 | |||
f8ae1534db | |||
46c91a26ac |
@ -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_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -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',
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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));
|
||||||
|
@ -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);
|
||||||
|
@ -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};
|
||||||
}
|
}
|
||||||
|
@ -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) {
|
||||||
|
Reference in New Issue
Block a user