mirror of
https://github.com/aristocratos/btop.git
synced 2024-09-29 22:51:35 +02:00
Fixed: Get real / mountpoint when running inside snap
This commit is contained in:
parent
ff6d1d6eec
commit
06cac6756d
@ -34,6 +34,7 @@ apps:
|
|||||||
environment:
|
environment:
|
||||||
LC_ALL: C.UTF-8
|
LC_ALL: C.UTF-8
|
||||||
LANG: C.UTF-8
|
LANG: C.UTF-8
|
||||||
|
BTOP_SNAPPED: true
|
||||||
plugs:
|
plugs:
|
||||||
- mount-observe
|
- mount-observe
|
||||||
- process-control
|
- process-control
|
||||||
|
@ -679,6 +679,7 @@ namespace Mem {
|
|||||||
auto& swap_disk = Config::getB("swap_disk");
|
auto& swap_disk = Config::getB("swap_disk");
|
||||||
auto& show_disks = Config::getB("show_disks");
|
auto& show_disks = Config::getB("show_disks");
|
||||||
auto& mem = current_mem;
|
auto& mem = current_mem;
|
||||||
|
static const bool snapped = (getenv("BTOP_SNAPPED") != NULL);
|
||||||
|
|
||||||
mem.stats.at("swap_total") = 0;
|
mem.stats.at("swap_total") = 0;
|
||||||
|
|
||||||
@ -803,6 +804,14 @@ namespace Mem {
|
|||||||
std::error_code ec;
|
std::error_code ec;
|
||||||
diskread >> dev >> mountpoint >> fstype;
|
diskread >> dev >> mountpoint >> fstype;
|
||||||
|
|
||||||
|
//? If running snapped, remove internal / mountpoint and replace /mnt with / to get correct device
|
||||||
|
if (snapped) {
|
||||||
|
if (mountpoint == "/")
|
||||||
|
continue;
|
||||||
|
else if (mountpoint == "/mnt")
|
||||||
|
mountpoint = "/";
|
||||||
|
}
|
||||||
|
|
||||||
//? Match filter if not empty
|
//? Match filter if not empty
|
||||||
if (not filter.empty()) {
|
if (not filter.empty()) {
|
||||||
bool match = v_contains(filter, mountpoint);
|
bool match = v_contains(filter, mountpoint);
|
||||||
|
Loading…
Reference in New Issue
Block a user