#pragma once #include "components/config.hpp" #include "modules/meta/timer_module.hpp" #include "settings.hpp" POLYBAR_NS namespace modules { /** * Filesystem structure */ struct fs_mount { string mountpoint; bool mounted = false; string type; string fsname; uint64_t bytes_free{0ULL}; uint64_t bytes_used{0ULL}; uint64_t bytes_avail{0ULL}; uint64_t bytes_total{0ULL}; int percentage_free{0}; int percentage_used{0}; explicit fs_mount(const string& mountpoint, bool mounted = false) : mountpoint(mountpoint), mounted(mounted) {} }; using fs_mount_t = unique_ptr; /** * Module used to display filesystem stats. */ class fs_module : public timer_module { public: explicit fs_module(const bar_settings&, string); bool update(); string get_format() const; string get_output(); bool build(builder* builder, const string& tag) const; static constexpr auto TYPE = "internal/fs"; private: static constexpr auto FORMAT_MOUNTED = "format-mounted"; static constexpr auto FORMAT_UNMOUNTED = "format-unmounted"; static constexpr auto TAG_LABEL_MOUNTED = ""; static constexpr auto TAG_LABEL_UNMOUNTED = ""; static constexpr auto TAG_BAR_USED = ""; static constexpr auto TAG_BAR_FREE = ""; static constexpr auto TAG_RAMP_CAPACITY = ""; label_t m_labelmounted; label_t m_labelunmounted; progressbar_t m_barused; progressbar_t m_barfree; ramp_t m_rampcapacity; vector m_mountpoints; vector m_mounts; bool m_fixed{false}; bool m_remove_unmounted{false}; int m_spacing{2}; // used while formatting output size_t m_index{0_z}; }; } // namespace modules POLYBAR_NS_END