Merge pull request #8 from Alexays/master

Merge Alexays:master into marcplustwo:master
This commit is contained in:
Marc Radau
2020-04-05 16:13:56 +02:00
committed by GitHub
16 changed files with 108 additions and 42 deletions

View File

@ -17,8 +17,7 @@ class Memory : public ALabel {
static inline const std::string data_dir_ = "/proc/meminfo";
void parseMeminfo();
unsigned long memtotal_;
unsigned long memfree_;
std::unordered_map<std::string, unsigned long> meminfo_;
util::SleeperThread thread_;
};

View File

@ -37,12 +37,14 @@ class Pulseaudio : public ALabel {
std::string form_factor_;
std::string desc_;
std::string monitor_;
std::string default_sink_name_;
// SOURCE
uint32_t source_idx_{0};
uint16_t source_volume_;
bool source_muted_;
std::string source_port_name_;
std::string source_desc_;
std::string default_source_name_;
};
} // namespace waybar::modules

View File

@ -72,7 +72,10 @@ inline struct res exec(std::string cmd) {
if (!fp) return {-1, ""};
auto output = command::read(fp);
auto stat = command::close(fp, pid);
return {WEXITSTATUS(stat), output};
if (WIFEXITED(stat)) {
return {WEXITSTATUS(stat), output};
}
return {-1, output};
}
inline int32_t forkExec(std::string cmd) {
@ -88,6 +91,7 @@ inline int32_t forkExec(std::string cmd) {
// Child executes the command
if (!pid) {
setpgid(pid, pid);
signal(SIGCHLD, SIG_DFL);
execl("/bin/sh", "sh", "-c", cmd.c_str(), (char*)0);
exit(0);
} else {