Merge branch 'master' into sway-language-module

This commit is contained in:
nikto_b 2020-10-12 13:31:39 +03:00 committed by GitHub
commit 8349316fcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 16 deletions

View File

@ -70,7 +70,7 @@ class Task
std::string title_; std::string title_;
std::string app_id_; std::string app_id_;
uint32_t state_; uint32_t state_ = 0;
private: private:
std::string repr() const; std::string repr() const;

View File

@ -41,19 +41,19 @@ window#waybar.chromium {
padding: 0 5px; padding: 0 5px;
background-color: transparent; background-color: transparent;
color: #ffffff; color: #ffffff;
border-bottom: 3px solid transparent; /* Use box-shadow instead of border so the text isn't offset */
box-shadow: inset 0 -3px transparent;
} }
/* 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 */
#workspaces button:hover { #workspaces button:hover {
background: rgba(0, 0, 0, 0.2); background: rgba(0, 0, 0, 0.2);
box-shadow: inherit; box-shadow: inset 0 -3px #ffffff;
border-bottom: 3px solid #ffffff;
} }
#workspaces button.focused { #workspaces button.focused {
background-color: #64727D; background-color: #64727D;
border-bottom: 3px solid #ffffff; box-shadow: inset 0 -3px #ffffff;
} }
#workspaces button.urgent { #workspaces button.urgent {

View File

@ -24,6 +24,9 @@ waybar::Bar::Bar(struct waybar_output* w_output, const Json::Value& w_config)
window.get_style_context()->add_class(output->name); window.get_style_context()->add_class(output->name);
window.get_style_context()->add_class(config["name"].asString()); window.get_style_context()->add_class(config["name"].asString());
window.get_style_context()->add_class(config["position"].asString()); window.get_style_context()->add_class(config["position"].asString());
left_.get_style_context()->add_class("modules-left");
center_.get_style_context()->add_class("modules-center");
right_.get_style_context()->add_class("modules-right");
if (config["position"] == "right" || config["position"] == "left") { if (config["position"] == "right" || config["position"] == "left") {
height_ = 0; height_ = 0;

View File

@ -283,6 +283,8 @@ std::string Workspaces::getIcon(const std::string &name, const Json::Value &node
return config_["format-icons"]["persistent"].asString(); return config_["format-icons"]["persistent"].asString();
} else if (config_["format-icons"][key].isString()) { } else if (config_["format-icons"][key].isString()) {
return config_["format-icons"][key].asString(); return config_["format-icons"][key].asString();
} else if (config_["format-icons"][trimWorkspaceName(key)].isString()) {
return config_["format-icons"][trimWorkspaceName(key)].asString();
} }
} }
return name; return name;

View File

@ -49,8 +49,8 @@ static std::vector<std::string> search_prefix()
auto xdg_data_dirs = std::getenv("XDG_DATA_DIRS"); auto xdg_data_dirs = std::getenv("XDG_DATA_DIRS");
if (!xdg_data_dirs) { if (!xdg_data_dirs) {
prefixes.push_back("/usr/share/"); prefixes.emplace_back("/usr/share/");
prefixes.push_back("/usr/local/share/"); prefixes.emplace_back("/usr/local/share/");
} else { } else {
std::string xdg_data_dirs_str(xdg_data_dirs); std::string xdg_data_dirs_str(xdg_data_dirs);
size_t start = 0, end = 0; size_t start = 0, end = 0;
@ -102,7 +102,7 @@ static std::string get_from_desktop_app_info(const std::string &app_id)
} }
/* Method 2 - use the app_id and check whether there is an icon with this name in the icon theme */ /* Method 2 - use the app_id and check whether there is an icon with this name in the icon theme */
static std::string get_from_icon_theme(Glib::RefPtr<Gtk::IconTheme> icon_theme, static std::string get_from_icon_theme(const Glib::RefPtr<Gtk::IconTheme>& icon_theme,
const std::string &app_id) { const std::string &app_id) {
if (icon_theme->lookup_icon(app_id, 24)) if (icon_theme->lookup_icon(app_id, 24))
@ -111,7 +111,7 @@ static std::string get_from_icon_theme(Glib::RefPtr<Gtk::IconTheme> icon_theme,
return ""; return "";
} }
static bool image_load_icon(Gtk::Image& image, Glib::RefPtr<Gtk::IconTheme> icon_theme, static bool image_load_icon(Gtk::Image& image, const Glib::RefPtr<Gtk::IconTheme>& icon_theme,
const std::string &app_id_list, int size) const std::string &app_id_list, int size)
{ {
std::string app_id; std::string app_id;
@ -231,13 +231,13 @@ Task::Task(const waybar::Bar &bar, const Json::Value &config, Taskbar *tbar,
auto icon_pos = format.find("{icon}"); auto icon_pos = format.find("{icon}");
if (icon_pos == 0) { if (icon_pos == 0) {
with_icon_ = true; with_icon_ = true;
format_after_ = trim(format.substr(6)); format_after_ = format.substr(6);
} else if (icon_pos == std::string::npos) { } else if (icon_pos == std::string::npos) {
format_before_ = format; format_before_ = format;
} else { } else {
with_icon_ = true; with_icon_ = true;
format_before_ = trim(format.substr(0, icon_pos)); format_before_ = format.substr(0, icon_pos);
format_after_ = trim(format.substr(icon_pos + 6)); format_after_ = format.substr(icon_pos + 6);
} }
} else { } else {
/* The default is to only show the icon */ /* The default is to only show the icon */
@ -360,7 +360,7 @@ void Task::handle_output_leave(struct wl_output *output)
void Task::handle_state(struct wl_array *state) void Task::handle_state(struct wl_array *state)
{ {
state_ = 0; state_ = 0;
for (uint32_t* entry = static_cast<uint32_t*>(state->data); for (auto* entry = static_cast<uint32_t*>(state->data);
entry < static_cast<uint32_t*>(state->data) + state->size; entry < static_cast<uint32_t*>(state->data) + state->size;
entry++) { entry++) {
if (*entry == ZWLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_MAXIMIZED) if (*entry == ZWLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_MAXIMIZED)
@ -722,9 +722,7 @@ bool Taskbar::show_output(struct wl_output *output) const
bool Taskbar::all_outputs() const bool Taskbar::all_outputs() const
{ {
static bool result = config_["all-outputs"].isBool() ? config_["all-outputs"].asBool() : false; return config_["all-outputs"].isBool() && config_["all-outputs"].asBool();
return result;
} }
std::vector<Glib::RefPtr<Gtk::IconTheme>> Taskbar::icon_themes() const std::vector<Glib::RefPtr<Gtk::IconTheme>> Taskbar::icon_themes() const