refactor from 4 space tabs to 2

This commit is contained in:
willifan 2024-04-02 23:35:00 +02:00
parent 81503793b9
commit f46ab5cf14
3 changed files with 60 additions and 61 deletions

View file

@ -5,8 +5,6 @@
;; left ;; left
;; Test
(defwidget time [] (defwidget time []
(eventbox (eventbox
:onclick `` :onclick ``

View file

@ -22,32 +22,31 @@ std::map<std::string, std::string> iconMap;
std::map<int, std::string> monitorMap; std::map<int, std::string> monitorMap;
const std::map<std::string, int> specialWorkspaceMap = { const std::map<std::string, int> specialWorkspaceMap = {
{"special:super", 0}, {"special:super", 0},
{"special:ctrl", 1}, {"special:ctrl", 1},
{"special:alt", 2}, {"special:alt", 2},
{"special:gr", 3} {"special:gr", 3}
}; };
/*json workspacesOutput = json::parse(R"( /*json workspacesOutput = json::parse(R"(
{ [
"normal": [ "normal":
{ {
"activeOn": str "activeOn": str
"icon": str "icon": str
"id": int "id": int
"occupied": int "occupied": int
} },
], "special":
"special": [ {
{ "activeOn": str
"activeOn": str "icon": str
"icon": str "id": str
"id": str "occupied": int
"occupied": int }
} ]
]
}
)");*/ )");*/
@ -97,6 +96,8 @@ void generateIconMap()
initClass = "aguiienagi"; initClass = "aguiienagi";
} }
//TODO unjank
std::string cmd ="cd /home/willifan/.config/eww/scripts/ && ./test.sh "; std::string cmd ="cd /home/willifan/.config/eww/scripts/ && ./test.sh ";
std::string test = std::string("cd /home/willifan/.config/eww/scripts/ && ./test.sh ") + initClass + " " + pid; std::string test = std::string("cd /home/willifan/.config/eww/scripts/ && ./test.sh ") + initClass + " " + pid;
@ -149,7 +150,7 @@ json getWorkspace(json workspaceInput)
return workspaceOutput; return workspaceOutput;
} }
//TODO fix special workspaces
void getAllWorkspaces() void getAllWorkspaces()
{ {
json workspacesInput = json::parse(command("hyprctl workspaces -j")); json workspacesInput = json::parse(command("hyprctl workspaces -j"));
@ -179,7 +180,7 @@ void getAllWorkspaces()
} }
//TODO optimize whatever
void handle(std::string message) void handle(std::string message)
@ -236,47 +237,47 @@ int main(int argc, char const *argv[])
// Create a socket // Create a socket
int sockfd = socket(AF_UNIX, SOCK_STREAM, 0); int sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
if (sockfd == -1) { if (sockfd == -1) {
std::cerr << "Error: Failed to create socket\n"; std::cerr << "Error: Failed to create socket\n";
return 1; return 1;
} }
// Define the address of the IPC socket // Define the address of the IPC socket
struct sockaddr_un addr; struct sockaddr_un addr;
addr.sun_family = AF_UNIX; addr.sun_family = AF_UNIX;
strncpy(addr.sun_path, socketPath.c_str(), sizeof(addr.sun_path) - 1); strncpy(addr.sun_path, socketPath.c_str(), sizeof(addr.sun_path) - 1);
// Connect to the IPC socket // Connect to the IPC socket
if (connect(sockfd, (struct sockaddr*)&addr, sizeof(addr)) == -1) { if (connect(sockfd, (struct sockaddr*)&addr, sizeof(addr)) == -1) {
std::cerr << "Error: Failed to connect to IPC socket\n"; std::cerr << "Error: Failed to connect to IPC socket\n";
close(sockfd);
return 1;
}
// Receive and print messages from the IPC socket
char buffer[1024];
ssize_t bytes_received;
while ((bytes_received = recv(sockfd, buffer, sizeof(buffer), 0)) > 0) {
std::string message = std::string(buffer, bytes_received);
std::istringstream iss(message);
std::string messageLine;
while(std::getline(iss, messageLine)){
handle(messageLine);
}
}
if (bytes_received == -1) {
std::cerr << "Error: Failed to receive message\n";
}
// Close the socket
close(sockfd); close(sockfd);
return 1;
}
return 0; // Receive and print messages from the IPC socket
char buffer[1024];
ssize_t bytes_received;
while ((bytes_received = recv(sockfd, buffer, sizeof(buffer), 0)) > 0) {
std::string message = std::string(buffer, bytes_received);
std::istringstream iss(message);
std::string messageLine;
while(std::getline(iss, messageLine)){
handle(messageLine);
}
}
if (bytes_received == -1) {
std::cerr << "Error: Failed to receive message\n";
}
// Close the socket
close(sockfd);
return 0;
} }

Binary file not shown.