Moving stuff around

This commit is contained in:
aristocratos 2021-08-23 22:52:52 +02:00
parent 03f64c22de
commit 214d8962e0
6 changed files with 34 additions and 52 deletions

View file

@ -2,18 +2,18 @@
BANNER = \n \033[38;5;196m██████\033[38;5;240m╗ \033[38;5;196m████████\033[38;5;240m╗ \033[38;5;196m██████\033[38;5;240m╗ \033[38;5;196m██████\033[38;5;240m╗\n \033[38;5;160m██\033[38;5;239m╔══\033[38;5;160m██\033[38;5;239m╗╚══\033[38;5;160m██\033[38;5;239m╔══╝\033[38;5;160m██\033[38;5;239m╔═══\033[38;5;160m██\033[38;5;239m╗\033[38;5;160m██\033[38;5;239m╔══\033[38;5;160m██\033[38;5;239m╗ \033[38;5;160m██\033[38;5;239m╗ \033[38;5;160m██\033[38;5;239m╗\n \033[38;5;124m██████\033[38;5;238m╔╝ \033[38;5;124m██\033[38;5;238m║ \033[38;5;124m██\033[38;5;238m║ \033[38;5;124m██\033[38;5;238m║\033[38;5;124m██████\033[38;5;238m╔╝ \033[38;5;124m██████\033[38;5;238m╗\033[38;5;124m██████\033[38;5;238m╗\n \033[38;5;88m██\033[38;5;237m╔══\033[38;5;88m██\033[38;5;237m╗ \033[38;5;88m██\033[38;5;237m║ \033[38;5;88m██\033[38;5;237m║ \033[38;5;88m██\033[38;5;237m║\033[38;5;88m██\033[38;5;237m╔═══╝ ╚═\033[38;5;88m██\033[38;5;237m╔═╝╚═\033[38;5;88m██\033[38;5;237m╔═╝\n \033[38;5;52m██████\033[38;5;236m╔╝ \033[38;5;52m██\033[38;5;236m║ ╚\033[38;5;52m██████\033[38;5;236m╔╝\033[38;5;52m██\033[38;5;236m║ ╚═╝ ╚═╝\n \033[38;5;235m╚═════╝ ╚═╝ ╚═════╝ ╚═╝ \033[1;3;38;5;240mMakefile v1.0\033[0m
BTOP_VERSION = $(shell head -n100 src/btop.cpp 2>/dev/null | grep "Version =" | cut -f2 -d"\"" || echo " unknown")
TIMESTAMP = $(shell date +%s 2>/dev/null || echo "0")
BTOP_VERSION := $(shell head -n100 src/btop.cpp 2>/dev/null | grep "Version =" | cut -f2 -d"\"" || echo " unknown")
TIMESTAMP := $(shell date +%s 2>/dev/null || echo "0")
PREFIX ?= /usr/local
#? Compiler and Linker
CXX ?= g++
CXX_VERSION = $(shell $(CXX) -dumpfullversion -dumpversion || echo 0)
CXX_VERSION := $(shell $(CXX) -dumpfullversion -dumpversion || echo 0)
#? Try to make sure we are using GCC/G++ version 11 or later if not instructed to use g++-10
ifneq ($(CXX),g++-10)
V_MAJOR = $(shell echo $(CXX_VERSION) | cut -f1 -d"." || echo 0)
V_MAJOR = $(shell echo $(CXX_VERSION) | cut -f1 -d".")
ifneq ($(shell test $(V_MAJOR) -ge 11; echo $$?),0)
ifeq ($(shell command -v g++-11 >/dev/null; echo $$?),0)
override CXX = g++-11
@ -22,14 +22,16 @@ ifneq ($(CXX),g++-10)
endif
#? Only enable fcf-protection if on x86_64
ARCH = $(shell uname -p || echo unknown)
ARCH := $(shell uname -p || echo unknown)
ifeq ($(ARCH),unknown)
ARCH := $(shell uname -m || echo unknown)
endif
ifeq ($(ARCH),x86_64)
ADDFLAGS = -fcf-protection
endif
ifeq ($(ARCH),unknown)
ARCH = $(shell uname -m || echo unknown)
endif
PLATFORM = $(shell uname -s || echo unknown)
#? Manually set this to (Linux|FreeBSD|Darwin) if not building for host platform
PLATFORM ?= $(shell uname -s || echo unknown)
#? Use all CPU cores (will only be set if using Make 4.3+)
MAKEFLAGS := --jobs=$(shell getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1)
@ -54,8 +56,19 @@ INC := -I$(INCDIR) -I$(SRCDIR)
SU_USER := root
SU_GROUP := root
SOURCES := $(shell find $(SRCDIR) -type f -name *.$(SRCEXT))
OBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.$(OBJEXT)))
SOURCES := $(shell find $(SRCDIR) -maxdepth 1 -type f -name *.$(SRCEXT))
ifeq ($(PLATFORM),Linux)
SOURCES += $(shell find $(SRCDIR)/linux -type f -name *.$(SRCEXT))
endif
ifeq ($(PLATFORM),FreeBSD)
SOURCES += $(shell find $(SRCDIR)/freebsd -type f -name *.$(SRCEXT))
endif
ifeq ($(PLATFORM),Darwin)
SOURCES += $(shell find $(SRCDIR)/osx -type f -name *.$(SRCEXT))
endif
OBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.$(OBJEXT)))
#? Default Make
all: msg directories btop
@ -67,7 +80,7 @@ msg:
@printf "\033[1;97mWARNFLAGS : \033[0m$(WARNFLAGS)\n"
@printf "\033[1;97mOPTFLAGS : \033[0m$(OPTFLAGS)\n"
@printf "\033[1;97mLDCXXFLAGS : \033[0m$(LDCXXFLAGS)\n"
@printf "\n\033[1;92mBuilding btop++ v$(BTOP_VERSION) on $(PLATFORM) ($(ARCH))\033[0m\n"
@printf "\n\033[1;92mBuilding \033[1;91mbtop++ \033[1;93mv$(BTOP_VERSION) \033[0;37mfor \033[1;97m$(PLATFORM) \033[1;96m($(ARCH))\033[0m\n"
help:
@printf "\033[1;97mbtop++ makefile\033[0m\n"
@ -84,6 +97,9 @@ help:
directories:
@mkdir -p $(TARGETDIR)
@mkdir -p $(BUILDDIR)
@mkdir -p $(BUILDDIR)/linux
@mkdir -p $(BUILDDIR)/freebsd
@mkdir -p $(BUILDDIR)/osx
#? Clean only Objects
clean:

View file

@ -616,7 +616,7 @@ namespace Mem {
+ 'i' + Theme::c("title") + 'o' + Fx::ub + Theme::c("mem_box") + Symbols::title_right;
Input::mouse_mappings["i"] = {y, x + width - 5, 1, 2};
}
}
//? Mem and swap
@ -810,7 +810,7 @@ namespace Net {
}
//? IP or device address
if (not ip_addr.empty() and width - i_size - 35 - ip_addr.size() > 0) {
if (not ip_addr.empty() and cmp_greater(width - i_size - 36, ip_addr.size())) {
out += Mv::to(y, x + 8) + title_left + Theme::c("title") + Fx::b + ip_addr + title_right;
}
@ -1418,6 +1418,7 @@ namespace Draw {
box = createBox(x, y, width, height, Theme::c("mem_box"), true, "mem", "", 2);
box += Mv::to(y, (show_disks ? divider + 2 : x + width - 9)) + Theme::c("mem_box") + Symbols::title_left + (show_disks ? Fx::b : "")
+ Theme::c("hi_fg") + 'd' + Theme::c("title") + "isks" + Fx::ub + Theme::c("mem_box") + Symbols::title_right;
Input::mouse_mappings["d"] = {y, (show_disks ? divider + 3 : x + width - 8), 1, 5};
if (show_disks) {
box += Mv::to(y, divider) + Symbols::div_up + Mv::to(y + height - 1, divider) + Symbols::div_down + Theme::c("div_line");
for (auto i : iota(1, height - 1))

View file

@ -391,7 +391,7 @@ namespace Input {
if (key == "i") {
Config::flip("io_mode");
}
if (key == "d") {
else if (key == "d") {
Config::flip("show_disks");
no_update = false;
Draw::calcSizes();

View file

@ -1,36 +0,0 @@
/* Copyright 2021 Aristocratos (jakob@qvantnet.com)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
indent = tab
tab-size = 4
*/
#if defined(__linux__)
#include <btop_linux.hpp>
#elif defined(__unix__) or not defined(__APPLE__) and defined(__MACH__)
#include <sys/param.h>
#if defined(__FreeBSD__)
#error FreeBSD support not yet implemented!
//#include <btop_freebsd.hpp>
#endif
#elif defined(__APPLE__) and defined(__MACH__)
#include <TargetConditionals.h>
#if TARGET_OS_MAC == 1
#error OSX support not yet implemented!
//#include <btop_osx.hpp>
#endif
#else
#error Platform not supported!
#endif

View file

@ -353,7 +353,7 @@ namespace Tools {
string username() {
auto user = getenv("LOGNAME");
if (user == NULL or strcmp(user, "")) user = getenv("USER");
if (user == NULL or strlen(user) == 0) user = getenv("USER");
return (user != NULL ? user : "");
}

View file

@ -1004,6 +1004,7 @@ namespace Proc {
cur_depth = 0;
}
}
else if (cur_proc.filtered) cur_proc.filtered = false;
//? Set tree index position for process if not filtered out or currently in a collapsed sub-tree
if (not collapsed and not filtering) {