clean up client.cpp

pull/2470/head
Calvin Lee 2023-09-07 13:43:59 +00:00
parent 09873f0ed9
commit 9bb2c01a44
2 changed files with 3 additions and 4 deletions

View File

@ -47,7 +47,6 @@ class Client {
static void handleOutputDone(void *, struct zxdg_output_v1 *); static void handleOutputDone(void *, struct zxdg_output_v1 *);
static void handleOutputName(void *, struct zxdg_output_v1 *, const char *); static void handleOutputName(void *, struct zxdg_output_v1 *, const char *);
static void handleOutputDescription(void *, struct zxdg_output_v1 *, const char *); static void handleOutputDescription(void *, struct zxdg_output_v1 *, const char *);
void handleAppearanceChanged(waybar::Appearance appearance);
void handleMonitorAdded(Glib::RefPtr<Gdk::Monitor> monitor); void handleMonitorAdded(Glib::RefPtr<Gdk::Monitor> monitor);
void handleMonitorRemoved(Glib::RefPtr<Gdk::Monitor> monitor); void handleMonitorRemoved(Glib::RefPtr<Gdk::Monitor> monitor);
void handleDeferredMonitorRemoval(Glib::RefPtr<Gdk::Monitor> monitor); void handleDeferredMonitorRemoval(Glib::RefPtr<Gdk::Monitor> monitor);

View File

@ -154,9 +154,7 @@ void waybar::Client::handleDeferredMonitorRemoval(Glib::RefPtr<Gdk::Monitor> mon
const std::string waybar::Client::getStyle(const std::string &style, const std::string waybar::Client::getStyle(const std::string &style,
std::optional<Appearance> appearance = std::nullopt) { std::optional<Appearance> appearance = std::nullopt) {
std::optional<std::string> css_file; std::optional<std::string> css_file;
if (!style.empty()) { if (style.empty()) {
css_file = style;
} else {
std::vector<std::string> search_files; std::vector<std::string> search_files;
switch (appearance.value_or(portal->getAppearance())) { switch (appearance.value_or(portal->getAppearance())) {
case waybar::Appearance::LIGHT: case waybar::Appearance::LIGHT:
@ -170,6 +168,8 @@ const std::string waybar::Client::getStyle(const std::string &style,
} }
search_files.push_back("style.css"); search_files.push_back("style.css");
css_file = Config::findConfigPath(search_files); css_file = Config::findConfigPath(search_files);
} else {
css_file = style;
} }
if (!css_file) { if (!css_file) {
throw std::runtime_error("Missing required resource files"); throw std::runtime_error("Missing required resource files");