mirror of https://github.com/aristocratos/btop.git
Merge branch 'aristocratos:main' into main
This commit is contained in:
commit
8c8139bd1d
10
CHANGELOG.md
10
CHANGELOG.md
|
@ -1,3 +1,13 @@
|
||||||
|
## v1.0.11
|
||||||
|
|
||||||
|
* Changed: atomic_wait to use while loop instead of wait() because of rare stall when a signal handler is triggered while waiting
|
||||||
|
|
||||||
|
* Fixed: Get real / mountpoint when running inside snap
|
||||||
|
|
||||||
|
* Fixed: UTF8 set LANG and LC_ALL to empty before UTF8 search and fixed empty error msg on exit before signal handler init
|
||||||
|
|
||||||
|
* Changed: Init will continue with a warning if UTF-8 locale are detected and it fails to set the locale
|
||||||
|
|
||||||
## v1.0.10
|
## v1.0.10
|
||||||
|
|
||||||
* Added: Wait for terminal size properties to be available at start
|
* Added: Wait for terminal size properties to be available at start
|
||||||
|
|
27
src/btop.cpp
27
src/btop.cpp
|
@ -55,7 +55,7 @@ namespace Global {
|
||||||
{"#801414", "██████╔╝ ██║ ╚██████╔╝██║ ╚═╝ ╚═╝"},
|
{"#801414", "██████╔╝ ██║ ╚██████╔╝██║ ╚═╝ ╚═╝"},
|
||||||
{"#000000", "╚═════╝ ╚═╝ ╚═════╝ ╚═╝"},
|
{"#000000", "╚═════╝ ╚═╝ ╚═════╝ ╚═╝"},
|
||||||
};
|
};
|
||||||
const string Version = "1.0.10";
|
const string Version = "1.0.11";
|
||||||
|
|
||||||
int coreCount;
|
int coreCount;
|
||||||
string overlay;
|
string overlay;
|
||||||
|
@ -716,20 +716,21 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//? Try to find and set a UTF-8 locale
|
//? Try to find and set a UTF-8 locale
|
||||||
if (std::setlocale(LC_ALL, "") != NULL and str_to_upper(s_replace((string)std::setlocale(LC_ALL, ""), "-", "")).ends_with("UTF8")) {
|
if (std::setlocale(LC_ALL, "") != NULL and not s_contains((string)std::setlocale(LC_ALL, ""), ";")
|
||||||
|
and str_to_upper(s_replace((string)std::setlocale(LC_ALL, ""), "-", "")).ends_with("UTF8")) {
|
||||||
Logger::debug("Using locale " + (string)std::setlocale(LC_ALL, ""));
|
Logger::debug("Using locale " + (string)std::setlocale(LC_ALL, ""));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
string found;
|
string found;
|
||||||
if (std::getenv("LANG") != NULL and str_to_upper(s_replace((string)std::getenv("LANG"), "-", "")).ends_with("UTF8")) {
|
bool set_failure = false;
|
||||||
found = std::getenv("LANG");
|
for (const auto loc_env : array{"LANG", "LC_ALL"}) {
|
||||||
if (std::setlocale(LC_ALL, std::getenv("LANG")) == NULL)
|
if (std::getenv(loc_env) != NULL and str_to_upper(s_replace((string)std::getenv(loc_env), "-", "")).ends_with("UTF8")) {
|
||||||
Logger::warning("Failed to set locale " + (string)std::getenv("LANG") + " continuing anyway.");
|
found = std::getenv(loc_env);
|
||||||
|
if (std::setlocale(LC_ALL, found.c_str()) == NULL) {
|
||||||
|
set_failure = true;
|
||||||
|
Logger::warning("Failed to set locale " + found + " continuing anyway.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (found.empty() and std::getenv("LC_ALL") != NULL and str_to_upper(s_replace((string)std::getenv("LC_ALL"), "-", "")).ends_with("UTF8")) {
|
|
||||||
found = std::getenv("LC_ALL");
|
|
||||||
if (std::setlocale(LC_ALL, std::getenv("LC_ALL")) == NULL)
|
|
||||||
Logger::warning("Failed to set locale " + (string)std::getenv("LC_ALL") + " continuing anyway.");
|
|
||||||
}
|
}
|
||||||
if (found.empty()) {
|
if (found.empty()) {
|
||||||
if (setenv("LC_ALL", "", 1) == 0 and setenv("LANG", "", 1) == 0) {
|
if (setenv("LC_ALL", "", 1) == 0 and setenv("LANG", "", 1) == 0) {
|
||||||
|
@ -737,8 +738,8 @@ int main(int argc, char **argv) {
|
||||||
if (const auto loc = std::locale("").name(); not loc.empty() and loc != "*") {
|
if (const auto loc = std::locale("").name(); not loc.empty() and loc != "*") {
|
||||||
for (auto& l : ssplit(loc, ';')) {
|
for (auto& l : ssplit(loc, ';')) {
|
||||||
if (str_to_upper(s_replace(l, "-", "")).ends_with("UTF8")) {
|
if (str_to_upper(s_replace(l, "-", "")).ends_with("UTF8")) {
|
||||||
if (std::setlocale(LC_ALL, l.substr(l.find('=') + 1).c_str()) != NULL) {
|
found = l.substr(l.find('=') + 1);
|
||||||
found = l;
|
if (std::setlocale(LC_ALL, found.c_str()) != NULL) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -755,7 +756,7 @@ int main(int argc, char **argv) {
|
||||||
Global::exit_error_msg = "No UTF-8 locale detected!\nUse --utf-force argument to force start if you're sure your terminal can handle it.";
|
Global::exit_error_msg = "No UTF-8 locale detected!\nUse --utf-force argument to force start if you're sure your terminal can handle it.";
|
||||||
clean_quit(1);
|
clean_quit(1);
|
||||||
}
|
}
|
||||||
else
|
else if (not set_failure)
|
||||||
Logger::debug("Setting LC_ALL=" + found);
|
Logger::debug("Setting LC_ALL=" + found);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -329,7 +329,6 @@ namespace Tools {
|
||||||
atomic_lock::~atomic_lock() {
|
atomic_lock::~atomic_lock() {
|
||||||
active_locks--;
|
active_locks--;
|
||||||
this->atom.store(false);
|
this->atom.store(false);
|
||||||
atomic_notify(this->atom);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string readfile(const std::filesystem::path& path, const string& fallback) {
|
string readfile(const std::filesystem::path& path, const string& fallback) {
|
||||||
|
|
|
@ -276,15 +276,9 @@ namespace Tools {
|
||||||
string hostname();
|
string hostname();
|
||||||
string username();
|
string username();
|
||||||
|
|
||||||
// #if __GNUC__ < 11
|
|
||||||
inline void atomic_wait(const atomic<bool>& atom, const bool old=true) noexcept { while (atom.load() == old) sleep_ms(1); }
|
inline void atomic_wait(const atomic<bool>& atom, const bool old=true) noexcept { while (atom.load() == old) sleep_ms(1); }
|
||||||
inline void atomic_notify(const atomic<bool>& atom) noexcept { (void)atom; }
|
|
||||||
// #else
|
|
||||||
// inline void atomic_wait(const atomic<bool>& atom, const bool old=true) noexcept { if (atom == old) atom.wait(old); }
|
|
||||||
// inline void atomic_notify(const atomic<bool>& atom) noexcept { atom.notify_all(); }
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
//* Waits for atomic<bool> to be false and sets it to true on construct, sets to false and notifies on destruct
|
//* Waits for atomic<bool> to be false and sets it to true on construct, sets to false on destruct
|
||||||
class atomic_lock {
|
class atomic_lock {
|
||||||
atomic<bool>& atom;
|
atomic<bool>& atom;
|
||||||
bool not_true = false;
|
bool not_true = false;
|
||||||
|
|
|
@ -0,0 +1,92 @@
|
||||||
|
#Bashtop theme with night-owl colors
|
||||||
|
#by zkourouma
|
||||||
|
|
||||||
|
# Colors should be in 6 or 2 character hexadecimal or single spaced rgb decimal: "#RRGGBB", "#BW" or "0-255 0-255 0-255"
|
||||||
|
# example for white: "#ffffff", "#ff" or "255 255 255".
|
||||||
|
|
||||||
|
# All graphs and meters can be gradients
|
||||||
|
# For single color graphs leave "mid" and "end" variable empty.
|
||||||
|
# Use "start" and "end" variables for two color gradient
|
||||||
|
# Use "start", "mid" and "end" for three color gradient
|
||||||
|
|
||||||
|
# Main background, empty for terminal default, need to be empty if you want transparent background
|
||||||
|
theme[main_bg]="#011627"
|
||||||
|
|
||||||
|
# Main text color
|
||||||
|
theme[main_fg]="#d6deeb"
|
||||||
|
|
||||||
|
# Title color for boxes
|
||||||
|
theme[title]="#ffffff"
|
||||||
|
|
||||||
|
# Higlight color for keyboard shortcuts
|
||||||
|
theme[hi_fg]="#addb67"
|
||||||
|
|
||||||
|
# Background color of selected items
|
||||||
|
theme[selected_bg]="#000000"
|
||||||
|
|
||||||
|
# Foreground color of selected items
|
||||||
|
theme[selected_fg]="#ffeb95"
|
||||||
|
|
||||||
|
# Color of inactive/disabled text
|
||||||
|
theme[inactive_fg]="#575656"
|
||||||
|
|
||||||
|
# Color of text appearing on top of graphs, i.e uptime and current network graph scaling
|
||||||
|
theme[graph_text]="#585858"
|
||||||
|
|
||||||
|
# Misc colors for processes box including mini cpu graphs, details memory graph and details status text
|
||||||
|
theme[proc_misc]="#22da6e"
|
||||||
|
|
||||||
|
# Cpu box outline color
|
||||||
|
theme[cpu_box]="#ffffff"
|
||||||
|
|
||||||
|
# Memory/disks box outline color
|
||||||
|
theme[mem_box]="#ffffff"
|
||||||
|
|
||||||
|
# Net up/down box outline color
|
||||||
|
theme[net_box]="#ffffff"
|
||||||
|
|
||||||
|
# Processes box outline color
|
||||||
|
theme[proc_box]="#ffffff"
|
||||||
|
|
||||||
|
# Box divider line and small boxes line color
|
||||||
|
theme[div_line]="#ffffff"
|
||||||
|
|
||||||
|
# Temperature graph colors
|
||||||
|
theme[temp_start]="#82aaff"
|
||||||
|
theme[temp_mid]="#c792ea"
|
||||||
|
theme[temp_end]="#fb4394"
|
||||||
|
|
||||||
|
# CPU graph colors
|
||||||
|
theme[cpu_start]="#22da6e"
|
||||||
|
theme[cpu_mid]="#addb67"
|
||||||
|
theme[cpu_end]="#ef5350"
|
||||||
|
|
||||||
|
# Mem/Disk free meter
|
||||||
|
theme[free_start]="#4e5900"
|
||||||
|
theme[free_mid]=""
|
||||||
|
theme[free_end]="#22da6e"
|
||||||
|
|
||||||
|
# Mem/Disk cached meter
|
||||||
|
theme[cached_start]="#82aaff"
|
||||||
|
theme[cached_mid]=""
|
||||||
|
theme[cached_end]="#82aaff"
|
||||||
|
|
||||||
|
# Mem/Disk available meter
|
||||||
|
theme[available_start]="#addb67"
|
||||||
|
theme[available_mid]=""
|
||||||
|
theme[available_end]="#ffeb95"
|
||||||
|
|
||||||
|
# Mem/Disk used meter
|
||||||
|
theme[used_start]="#ef5350"
|
||||||
|
theme[used_mid]=""
|
||||||
|
theme[used_end]="#ef5350"
|
||||||
|
|
||||||
|
# Download graph colors
|
||||||
|
theme[download_start]="#3d4070"
|
||||||
|
theme[download_mid]="#6c71c4"
|
||||||
|
theme[download_end]="#a3a8f7"
|
||||||
|
|
||||||
|
# Upload graph colors
|
||||||
|
theme[upload_start]="#701c45"
|
||||||
|
theme[upload_mid]="#c792ea"
|
||||||
|
theme[upload_end]="#c792ea"
|
Loading…
Reference in New Issue