Merge pull request #2457 from khaneliman/hyprland-cleanup

Hyprland linting cleanup
This commit is contained in:
Alexis Rouillard 2023-09-04 22:00:44 +02:00 committed by GitHub
commit a77ccf4bd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 32 additions and 10 deletions

View File

@ -1,10 +1,12 @@
#pragma once
#include <functional>
#include <list>
#include <memory>
#include <mutex>
#include <string>
#include <thread>
#include <utility>
#include "util/json.hpp"

View File

@ -1,5 +1,9 @@
#pragma once
#include <fmt/format.h>
#include <string>
#include "ALabel.hpp"
#include "bar.hpp"
#include "modules/hyprland/backend.hpp"

View File

@ -1,5 +1,9 @@
#pragma once
#include <fmt/format.h>
#include <string>
#include "ALabel.hpp"
#include "bar.hpp"
#include "modules/hyprland/backend.hpp"

View File

@ -1,5 +1,9 @@
#pragma once
#include <fmt/format.h>
#include <string>
#include "AAppIconLabel.hpp"
#include "bar.hpp"
#include "modules/hyprland/backend.hpp"

View File

@ -1,7 +1,12 @@
#pragma once
#include <gtkmm/button.h>
#include <gtkmm/label.h>
#include <map>
#include <memory>
#include <string>
#include <vector>
#include "AModule.hpp"
#include "bar.hpp"
@ -11,7 +16,7 @@ namespace waybar::modules::hyprland {
class Workspace {
public:
Workspace(const Json::Value& workspace_data);
explicit Workspace(const Json::Value& workspace_data);
std::string& select_icon(std::map<std::string, std::string>& icons_map);
Gtk::Button& button() { return button_; };

View File

@ -166,9 +166,15 @@ std::string IPC::getSocket1Reply(const std::string& rq) {
std::string socketPath = "/tmp/hypr/" + instanceSigStr + "/.socket.sock";
strcpy(serverAddress.sun_path, socketPath.c_str());
// Use snprintf to copy the socketPath string into serverAddress.sun_path
if (snprintf(serverAddress.sun_path, sizeof(serverAddress.sun_path), "%s", socketPath.c_str()) <
0) {
spdlog::error("Hyprland IPC: Couldn't copy socket path (6)");
return "";
}
if (connect(SERVERSOCKET, (sockaddr*)&serverAddress, SUN_LEN(&serverAddress)) < 0) {
if (connect(SERVERSOCKET, reinterpret_cast<sockaddr*>(&serverAddress), sizeof(serverAddress)) <
0) {
spdlog::error("Hyprland IPC: Couldn't connect to " + socketPath + ". (3)");
return "";
}

View File

@ -4,8 +4,7 @@
#include <xkbcommon/xkbcommon.h>
#include <xkbcommon/xkbregistry.h>
#include <util/sanitize_str.hpp>
#include "util/sanitize_str.hpp"
#include "util/string.hpp"
namespace waybar::modules::hyprland {
@ -97,7 +96,6 @@ void Language::initLanguage() {
spdlog::debug("hyprland language initLanguage found {}", layout_.full_name);
dp.emit();
} catch (std::exception& e) {
spdlog::error("hyprland language initLanguage failed with {}", e.what());
}

View File

@ -2,7 +2,7 @@
#include <spdlog/spdlog.h>
#include <util/sanitize_str.hpp>
#include "util/sanitize_str.hpp"
namespace waybar::modules::hyprland {

View File

@ -6,12 +6,11 @@
#include <spdlog/spdlog.h>
#include <algorithm>
#include <regex>
#include <util/sanitize_str.hpp>
#include <vector>
#include "modules/hyprland/backend.hpp"
#include "util/rewrite_string.hpp"
#include "util/sanitize_str.hpp"
namespace waybar::modules::hyprland {

View File

@ -327,7 +327,7 @@ Workspace::Workspace(const Json::Value &workspace_data)
button_.set_relief(Gtk::RELIEF_NONE);
content_.set_center_widget(label_);
button_.add(content_);
};
}
void add_or_remove_class(const Glib::RefPtr<Gtk::StyleContext> &context, bool condition,
const std::string &class_name) {