| 123 | } |
| 124 | |
| 125 | auto User::update() -> void { |
| 126 | std::string systemUser = this->get_user_login(); |
| 127 | std::transform(systemUser.cbegin(), systemUser.cend(), systemUser.begin(), |
| 128 | [](unsigned char c) { return std::toupper(c); }); |
| 129 | |
| 130 | long uptimeSeconds = this->uptime_as_seconds(); |
| 131 | auto workSystemTimeSeconds = std::chrono::seconds(uptimeSeconds); |
| 132 | auto currentSystemTime = std::chrono::system_clock::now(); |
| 133 | auto startSystemTime = currentSystemTime - workSystemTimeSeconds; |
| 134 | long workSystemDays = uptimeSeconds / 86400; |
| 135 | |
| 136 | auto label = fmt::format( |
| 137 | fmt::runtime(ALabel::format_), fmt::arg("up_H", fmt::format("{:%H}", startSystemTime)), |
| 138 | fmt::arg("up_M", fmt::format("{:%M}", startSystemTime)), |
| 139 | fmt::arg("up_d", fmt::format("{:%d}", startSystemTime)), |
| 140 | fmt::arg("up_m", fmt::format("{:%m}", startSystemTime)), |
| 141 | fmt::arg("up_Y", fmt::format("{:%Y}", startSystemTime)), fmt::arg("work_d", workSystemDays), |
| 142 | fmt::arg("work_H", fmt::format("{:%H}", workSystemTimeSeconds)), |
| 143 | fmt::arg("work_M", fmt::format("{:%M}", workSystemTimeSeconds)), |
| 144 | fmt::arg("work_S", fmt::format("{:%S}", workSystemTimeSeconds)), |
| 145 | fmt::arg("user", systemUser)); |
| 146 | ALabel::label_.set_markup(label); |
| 147 | AIconLabel::update(); |
| 148 | } |
| 149 | }; // namespace waybar::modules |
nothing calls this directly
no test coverage detected