mirror of
https://github.com/kunkundi/crossdesk.git
synced 2026-11-03 04:22:43 +08:00
[feat] add live FPS to CLI status bar
This commit is contained in:
@@ -86,7 +86,7 @@ inline constexpr char kKittyDelete[] =
|
||||
"\033_Ga=d,d=I,i=31,q=2\033\\\033_Ga=d,d=I,i=32,q=2\033\\";
|
||||
bool KittyReply(const std::string &response);
|
||||
struct StatusBar {
|
||||
std::string progress, compact_progress, error, view, network;
|
||||
std::string progress, compact_progress, error, view, network, fps;
|
||||
bool control = false, command_mode = false;
|
||||
};
|
||||
// Three padded ASCII rows. Shortcuts are compacted as whole groups to fit.
|
||||
|
||||
@@ -59,11 +59,16 @@ std::vector<std::string> StatusLines(const StatusBar &bar, int columns) {
|
||||
const auto progress =
|
||||
bar.error.empty() ? bar.progress : "Error: " + bar.error;
|
||||
auto left = mode + " | " + progress;
|
||||
auto right = bar.view + (bar.network.empty() ? "" : " | " + bar.network);
|
||||
auto metrics = bar.fps;
|
||||
if (!bar.network.empty())
|
||||
metrics += (metrics.empty() ? "" : " | ") + bar.network;
|
||||
auto right = bar.view + (metrics.empty() ? "" : " | " + metrics);
|
||||
if (left.size() + right.size() + 2 > inner)
|
||||
right = bar.network;
|
||||
right = metrics;
|
||||
if (left.size() + right.size() + 2 > inner && bar.error.empty())
|
||||
left = mode + " | " + bar.compact_progress;
|
||||
if (left.size() + right.size() + 2 > inner)
|
||||
right = bar.fps;
|
||||
if (left.size() + right.size() + 2 > inner)
|
||||
right.clear();
|
||||
std::string status = Clip(left, inner);
|
||||
|
||||
Reference in New Issue
Block a user