refactor from 4 space tabs to 2
This commit is contained in:
parent
81503793b9
commit
f46ab5cf14
3 changed files with 60 additions and 61 deletions
2
eww.yuck
2
eww.yuck
|
@ -5,8 +5,6 @@
|
|||
;; left
|
||||
|
||||
|
||||
;; Test
|
||||
|
||||
(defwidget time []
|
||||
(eventbox
|
||||
:onclick ``
|
||||
|
|
|
@ -22,32 +22,31 @@ std::map<std::string, std::string> iconMap;
|
|||
std::map<int, std::string> monitorMap;
|
||||
|
||||
const std::map<std::string, int> specialWorkspaceMap = {
|
||||
{"special:super", 0},
|
||||
{"special:ctrl", 1},
|
||||
{"special:super", 0},
|
||||
{"special:ctrl", 1},
|
||||
{"special:alt", 2},
|
||||
{"special:gr", 3}
|
||||
};
|
||||
|
||||
|
||||
/*json workspacesOutput = json::parse(R"(
|
||||
{
|
||||
"normal": [
|
||||
{
|
||||
"activeOn": str
|
||||
"icon": str
|
||||
"id": int
|
||||
"occupied": int
|
||||
}
|
||||
],
|
||||
"special": [
|
||||
{
|
||||
"activeOn": str
|
||||
"icon": str
|
||||
"id": str
|
||||
"occupied": int
|
||||
}
|
||||
]
|
||||
}
|
||||
[
|
||||
"normal":
|
||||
{
|
||||
"activeOn": str
|
||||
"icon": str
|
||||
"id": int
|
||||
"occupied": int
|
||||
},
|
||||
"special":
|
||||
{
|
||||
"activeOn": str
|
||||
"icon": str
|
||||
"id": str
|
||||
"occupied": int
|
||||
}
|
||||
]
|
||||
|
||||
)");*/
|
||||
|
||||
|
||||
|
@ -97,6 +96,8 @@ void generateIconMap()
|
|||
initClass = "aguiienagi";
|
||||
}
|
||||
|
||||
//TODO unjank
|
||||
|
||||
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;
|
||||
|
||||
|
@ -149,7 +150,7 @@ json getWorkspace(json workspaceInput)
|
|||
return workspaceOutput;
|
||||
}
|
||||
|
||||
|
||||
//TODO fix special workspaces
|
||||
void getAllWorkspaces()
|
||||
{
|
||||
json workspacesInput = json::parse(command("hyprctl workspaces -j"));
|
||||
|
@ -179,7 +180,7 @@ void getAllWorkspaces()
|
|||
}
|
||||
|
||||
|
||||
|
||||
//TODO optimize whatever
|
||||
|
||||
|
||||
void handle(std::string message)
|
||||
|
@ -236,47 +237,47 @@ int main(int argc, char const *argv[])
|
|||
|
||||
|
||||
// Create a socket
|
||||
int sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
if (sockfd == -1) {
|
||||
std::cerr << "Error: Failed to create socket\n";
|
||||
return 1;
|
||||
}
|
||||
int sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
if (sockfd == -1) {
|
||||
std::cerr << "Error: Failed to create socket\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Define the address of the IPC socket
|
||||
struct sockaddr_un addr;
|
||||
addr.sun_family = AF_UNIX;
|
||||
strncpy(addr.sun_path, socketPath.c_str(), sizeof(addr.sun_path) - 1);
|
||||
// Define the address of the IPC socket
|
||||
struct sockaddr_un addr;
|
||||
addr.sun_family = AF_UNIX;
|
||||
strncpy(addr.sun_path, socketPath.c_str(), sizeof(addr.sun_path) - 1);
|
||||
|
||||
// Connect to the IPC socket
|
||||
if (connect(sockfd, (struct sockaddr*)&addr, sizeof(addr)) == -1) {
|
||||
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
|
||||
// Connect to the IPC socket
|
||||
if (connect(sockfd, (struct sockaddr*)&addr, sizeof(addr)) == -1) {
|
||||
std::cerr << "Error: Failed to connect to IPC socket\n";
|
||||
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.
Loading…
Add table
Reference in a new issue