Add Swaylock support
This commit is contained in:
parent
90ac4001e7
commit
fe4e18f3b5
7 changed files with 61 additions and 20 deletions
35
src/Process.h
Normal file
35
src/Process.h
Normal 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;
|
||||
};
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue