mirror of
https://github.com/polybar/polybar.git
synced 2026-03-01 04:35:45 +00:00
feat(backlight): Add enable-scroll (#1957)
* backlight: enable changing via scroll * squash! feedback * Update src/modules/backlight.cpp Co-Authored-By: Jérôme BOULMIER <jerome.boulmier@outlook.fr> Co-authored-by: Jérôme BOULMIER <jerome.boulmier@outlook.fr>
This commit is contained in:
committed by
Patrick Ziegler
parent
0dbcb28a2c
commit
068bf5a311
@ -1,6 +1,9 @@
|
||||
#include "utils/file.hpp"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <glob.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <fstream>
|
||||
@ -8,7 +11,6 @@
|
||||
|
||||
#include "errors.hpp"
|
||||
#include "utils/env.hpp"
|
||||
#include "utils/file.hpp"
|
||||
#include "utils/string.hpp"
|
||||
|
||||
POLYBAR_NS
|
||||
@ -202,6 +204,16 @@ namespace file_util {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the contents of the given file
|
||||
*/
|
||||
void write_contents(const string& filename, const string& contents) {
|
||||
std::ofstream out(filename, std::ofstream::out);
|
||||
if (!(out << contents)) {
|
||||
throw std::system_error(errno, std::system_category(), "failed to write to " + filename);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given file is a named pipe
|
||||
*/
|
||||
@ -246,7 +258,7 @@ namespace file_util {
|
||||
bool is_absolute = path.size() > 0 && path.at(0) == '/';
|
||||
vector<string> p_exploded = string_util::split(path, '/');
|
||||
for (auto& section : p_exploded) {
|
||||
switch(section[0]) {
|
||||
switch (section[0]) {
|
||||
case '$':
|
||||
section = env_util::get(section.substr(1));
|
||||
break;
|
||||
@ -262,6 +274,6 @@ namespace file_util {
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
} // namespace file_util
|
||||
|
||||
POLYBAR_NS_END
|
||||
|
||||
Reference in New Issue
Block a user