Add Swaylock support

This commit is contained in:
Vyn 2024-06-05 14:18:45 +02:00
parent 90ac4001e7
commit fe4e18f3b5
7 changed files with 61 additions and 20 deletions

35
src/Process.h Normal file
View file

@ -0,0 +1,35 @@
#pragma once
#include <iostream>
#include <sched.h>
#include <string>
#include <unistd.h>
#include <sys/wait.h>
#include <vector>
#define SWAYBGPROCESS_BUFFER_SIZE 4094
class Process {
public:
Process(const std::string& execPath, const std::vector<const char*>& args);
~Process();
void exec();
void kill();
int wait();
private:
std::string execPath;
std::vector<const char*> args;
pid_t pid;
bool killed = true;
int fds[2]; // file descriptors for pipe
char buf[SWAYBGPROCESS_BUFFER_SIZE];
ssize_t nbytes;
};