mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
Add a disk module
This commit is contained in:
@ -13,6 +13,7 @@
|
||||
#include "modules/cpu.hpp"
|
||||
#include "modules/idle_inhibitor.hpp"
|
||||
#include "modules/memory.hpp"
|
||||
#include "modules/disk.hpp"
|
||||
#if defined(HAVE_DBUSMENU) && !defined(NO_FILESYSTEM)
|
||||
#include "modules/sni/tray.hpp"
|
||||
#endif
|
||||
|
23
include/modules/disk.hpp
Normal file
23
include/modules/disk.hpp
Normal file
@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <fstream>
|
||||
#include <sys/statvfs.h>
|
||||
#include "ALabel.hpp"
|
||||
#include "util/sleeper_thread.hpp"
|
||||
#include "util/format.hpp"
|
||||
|
||||
namespace waybar::modules {
|
||||
|
||||
class Disk : public ALabel {
|
||||
public:
|
||||
Disk(const std::string&, const Json::Value&);
|
||||
~Disk() = default;
|
||||
auto update() -> void;
|
||||
|
||||
private:
|
||||
util::SleeperThread thread_;
|
||||
std::string path_;
|
||||
};
|
||||
|
||||
} // namespace waybar::modules
|
9
include/util/format.hpp
Normal file
9
include/util/format.hpp
Normal file
@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <sstream>
|
||||
|
||||
namespace waybar::util {
|
||||
|
||||
std::string pow_format(unsigned long long value, const std::string &unit, bool binary = false);
|
||||
|
||||
}
|
Reference in New Issue
Block a user