Compare commits

...

44 commits
v1.3.2 ... main

Author SHA1 Message Date
Jakob P. Liljenberg 3d46dc6969
Merge pull request #838 from imwints/freebsd-static
Add missing linker flag for static links on FreeBSD
2024-05-13 23:05:12 +02:00
Steffen Winter b93206f038
Add missing linker flag for static links on FreeBSD
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=278551
2024-05-13 22:47:03 +02:00
Jakob P. Liljenberg ac62ba9de1
Merge pull request #840 from aristocratos/fix/zero_temp 2024-05-13 19:10:17 +02:00
Jakob P. Liljenberg 3f917c0412
Merge pull request #850 from acidghost/theme-comments 2024-05-13 19:08:45 +02:00
Andrea Jemmett 0127e8b3cd Fix comments in theme files 2024-05-12 16:09:09 +02:00
Jos Dehaes ebc86e9702 fix zero temp (#467) 2024-05-04 20:59:04 +02:00
aristocratos dd4ada7023 Fixed missing definition for ROCm static build 2024-05-01 20:43:46 +02:00
aristocratos b48bf6ae45 Add info text about regex filtering in help menu 2024-04-30 18:03:06 +02:00
Jakob P. Liljenberg 3b65b3a729
Merge pull request #806 from imwints/regex-search 2024-04-30 17:21:07 +02:00
Steffen 255b777563
Add regex filtering
Filters starting with '!' will try to match processes pid, name, cmd and
user with extended regex as defined by the C++ standard. A single '!'
will not filter.
2024-04-30 17:09:15 +02:00
Jakob P. Liljenberg 8c1a8ab4fa
Merge pull request #836 from vsey/Fix-Typo 2024-04-30 17:02:46 +02:00
Jakob P. Liljenberg f8cfa70dda
Merge branch 'main' into Fix-Typo 2024-04-30 17:02:16 +02:00
Jakob P. Liljenberg 3a6f816396
Merge pull request #835 from imwints/battery 2024-04-30 17:01:02 +02:00
vsey 14b388521d
Fix typo 2024-04-30 16:09:37 +02:00
Steffen Winter d200ce45ae
Show time in days when remaining battery exceeds an estimation of 24h 2024-04-30 15:32:41 +02:00
Jakob P. Liljenberg 924c3f3a72
Merge pull request #819 from kalkafox/rsmi-pwr-usage-fix
fix pwr_usage not being defined correctly during rsmi collection
2024-04-28 22:45:42 +02:00
Jakob P. Liljenberg 0e07debb7d
Merge pull request #831 from thecoder-001/main
macOS: fix crash if there exists a uid not associated with any user
2024-04-28 22:38:28 +02:00
Jakob P. Liljenberg b991e6898d
Merge pull request #832 from imwints/macos-ci
Fix brew not finding LLVM path after release of LLVM 18
2024-04-28 22:36:39 +02:00
Steffen Winter 5d7794019a
Fix brew not finding LLVM path after release of LLVM 18 2024-04-28 22:28:31 +02:00
thecoder-001 5ba45f7633
Remove logging for uid without username
Signed-off-by: thecoder-001 <ayush06feb@gmail.com>
2024-04-28 23:53:27 +05:30
thecoder-001 9a37395744
osx: show uid instead of 'unknown' if no user exists with the same
Signed-off-by: thecoder-001 <ayush06feb@gmail.com>
2024-04-28 02:53:50 +05:30
thecoder-001 08f90fb4f0
fix: crash on osx proc box
Signed-off-by: thecoder-001 <ayush06feb@gmail.com>
2024-04-28 02:41:20 +05:30
Kalka b06474136b fix pwr_usage not being defined correctly during rsmi collection 2024-04-11 22:50:58 -04:00
Jakob P. Liljenberg d1680735d9
Merge pull request #796 from davc0n/main 2024-03-23 01:42:17 +01:00
Jakob P. Liljenberg a535a6eb92
Merge pull request #797 from kz6fittycent/main 2024-03-23 01:37:59 +01:00
Jakob P. Liljenberg b1b8249d55
Merge pull request #807 from kk9uk/main 2024-03-23 01:35:52 +01:00
kk9uk 4a82105547 [FEATURE] Add gruvbox_light theme 2024-03-20 12:17:24 +08:00
kz6fittycent 8af8389bd0
Merge branch 'aristocratos:main' into main 2024-03-13 11:02:55 -05:00
kz6fittycent adaea59a2a
Update test-snap-can-build.yml 2024-03-13 10:50:29 -05:00
kz6fittycent 2aa2c90f41
Update snapcraft.yaml
core22 attempt
2024-03-13 10:49:38 -05:00
Davide Conti a60c969533 Fix rsmi device name buffer size
ref. issue #794
2024-03-13 10:12:28 +01:00
Jakob P. Liljenberg c767099d76
Merge pull request #724 from ottok/man-page 2024-03-04 18:03:27 +01:00
Otto Kekäläinen d8c054d92f Add 'lowdown' to build dependencies so GitHub actions actually runs it
Building the man page is optional and happens automatically if command
'lowdown' is present on the system. Add it to all possible GitHub CI files
so man page conversion will be tested and fully used.

Unfortunately 'lowdown' cannot be added to the musl jobs the program is
available only starting from Alpine v3.15, while the musl Docker images
run Alpine v3.14 (and haven't been updated in 2+ years).

Also, the Snap build used Ubuntu 20.04 "Focal" which equally is too old
to include Lowdown, which is available only from Ubuntu 22.04 "Jammy"
onward:
https://packages.ubuntu.com/search?suite=all&searchon=names&keywords=lowdown
2024-03-03 17:14:13 -08:00
Otto Kekäläinen ed68589af1 Create man page for btop in Markdown
Create a man page in Markdown format so that it can be read online on
GitHub etc and it can be edited much more easily than a raw troff/groff
file.

Compile it to proper man page format at build-time using 'lowdown' if
it is available on the system, otherwise just issue a warning in yellow.

Tested to work both with:

    export VERBOSE=1
    make
    make install
    make uninstall

    cmake -B build
    cmake --build build --verbose

While Lowdown is easy to manually install in all modern Linux distros
and also Homebrew for Mac, this commit does not add 'lowdown' in any
build dependencies or in the CI, that needs to be done separately.
2024-03-03 15:37:35 -08:00
Jakob P. Liljenberg c6fbfd1e27
Merge pull request #723 from ottok/fix-spelling 2024-03-01 07:58:12 +01:00
Otto Kekäläinen bfe8c20ebe Fix misc spelling 2024-02-29 22:11:39 -08:00
Jakob P. Liljenberg 6c66740290
Merge pull request #734 from imwints/build-info 2024-02-18 14:25:11 +01:00
Jakob P. Liljenberg 967ea1ab6f
Merge branch 'main' into build-info 2024-02-18 14:19:05 +01:00
Jakob P. Liljenberg cf609175fb
Merge pull request #763 from imwints/cmake-bump 2024-02-18 14:08:31 +01:00
Jakob P. Liljenberg e1575a1fca
Merge pull request #771 from Derppening/fix/linux-battery-wattage 2024-02-18 12:56:19 +01:00
David Mak e031cce6ba collect: Fix reading of battery power draw on Linux
This was erroneously set to read from the current battery charge.

Fixes #770.
2024-02-14 01:01:40 +08:00
Steffen Winter 83739f84e1
cmake: Remove version specifier 2024-02-12 23:56:43 +01:00
Steffen Winter bdc8d0151d Ask for 'btop --version' in issue template 2024-01-24 15:02:14 +01:00
Steffen Winter 7717020197
Include build info in binary 2024-01-24 15:02:11 +01:00
51 changed files with 408 additions and 148 deletions

View file

@ -28,10 +28,9 @@ Any bug that can be solved by just reading the [prerequisites](https://github.co
[If applicable, add screenshots to help explain your problem.]
**Info (please complete the following information):**
- btop++ version: `btop -v`
- btop++ version: `btop --version`
- If using snap: `snap info btop`
- Binary: [self compiled or static binary from release]
- (If compiled) Compiler and version:
- Architecture: [x86_64, aarch64, etc.] `uname -m`
- Platform: [Linux, FreeBSD, OsX]
- (Linux) Kernel: `uname -r`

View file

@ -33,8 +33,7 @@ jobs:
with:
release: '14.0'
usesh: true
prepare: pkg install -y cmake ninja
prepare: pkg install -y cmake ninja lowdown
run: |
CXX=clang++ cmake -B build -G Ninja -DBTOP_STATIC=ON
cmake --build build --verbose

View file

@ -30,11 +30,10 @@ jobs:
- uses: actions/checkout@v4
- name: Install build tools
run: apk add --no-cache --update clang cmake lld ninja
run: apk add --no-cache --update clang cmake lld ninja lowdown
- name: Configure
run: CXX=clang++ LDFLAGS=-fuse-ld=lld cmake -B build -G Ninja -DBTOP_STATIC=ON
- name: Compile
run: cmake --build build --verbose

View file

@ -32,7 +32,7 @@ jobs:
run: |
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
brew update --quiet
brew install --force --overwrite cmake llvm@17 ninja
brew install --force --overwrite cmake llvm ninja lowdown
- name: Configure
run: |
@ -44,4 +44,3 @@ jobs:
- name: Compile
run: cmake --build build --verbose

View file

@ -45,7 +45,7 @@ jobs:
release: '14.0'
usesh: true
prepare: |
pkg install -y gmake gcc coreutils git
pkg install -y gmake gcc coreutils git lowdown
git config --global --add safe.directory /home/runner/work/btop/btop
run: |
CXX=${{ matrix.compiler }} gmake STATIC=true STRIP=true
@ -59,4 +59,3 @@ jobs:
name: btop-x86_64-freebsd-14
path: 'bin/*'
if-no-files-found: error

View file

@ -42,7 +42,7 @@ jobs:
release: '7.4'
usesh: true
prepare: |
pkg_add gmake gcc%11 g++%11 coreutils git
pkg_add gmake gcc%11 g++%11 coreutils git lowdown
git config --global --add safe.directory /home/runner/work/btop/btop
run: |
gmake CXX=eg++ STATIC=true STRIP=true
@ -55,4 +55,3 @@ jobs:
name: btop-x86_64-openbsd-7.4
path: 'bin/*'
if-no-files-found: error

View file

@ -1,5 +1,4 @@
name: 🧪 Test snap can be built on x86_64
on:
workflow_dispatch:
push:
@ -28,7 +27,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
node-version: [20.x]
steps:
- uses: actions/checkout@v2

5
.gitignore vendored
View file

@ -46,9 +46,14 @@ stage/
*.out
*.app
# Compiled man page
btop.1
build
bin
btop
/obj/
config.h
.*/
# Optional libraries

View file

@ -180,7 +180,7 @@ Fixed incorrect used and available memory for OSX | | 4461a43
* Fixed: Wrong memory unit when shorten and size is less than 10, by @mohi001
* Fixed: Use cpu cores avarage temp if missing cpu package temp for FreeBSD
* Fixed: Use cpu cores average temp if missing cpu package temp for FreeBSD
* Changed: Enter symbol to a more common variant
@ -476,7 +476,7 @@ Fixed incorrect used and available memory for OSX | | 4461a43
* Fixed: Sizing constraints bug on start and boxes can be toggled from size error screen
* Fixed: UTF-8 check crashing if LANG was set to non existant locale
* Fixed: UTF-8 check crashing if LANG was set to non existent locale
## v1.0.4

View file

@ -11,7 +11,6 @@ if("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
endif()
project("btop"
VERSION 1.3.0
DESCRIPTION "A monitor of resources"
HOMEPAGE_URL "https://github.com/aristocratos/btop"
LANGUAGES CXX
@ -78,6 +77,21 @@ if(NOT CXX_HAVE_RANGES)
message(FATAL_ERROR "The compiler doesn't support <ranges>")
endif()
# Generate build info
execute_process(
COMMAND "git" "rev-parse" "--short" "HEAD"
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_COMMIT
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
set(CONFIGURE_COMMAND
"cmake -DBTOP_STATIC=${BTOP_STATIC} -DBTOP_USE_MOLD=${BTOP_USE_MOLD} -DBTOP_FORTIFY=${BTOP_FORTIFY} -DBTOP_GPU=${BTOP_GPU}"
)
get_filename_component(CXX_COMPILER_BASENAME "${CMAKE_CXX_COMPILER}" NAME)
set(COMPILER "${CXX_COMPILER_BASENAME}")
set(COMPILER_VERSION "${CMAKE_CXX_COMPILER_VERSION}")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY IMMEDIATE)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Check for and enable LTO
check_ipo_supported(RESULT ipo_supported)
if(ipo_supported AND BTOP_LTO)
@ -133,7 +147,7 @@ if(LINUX AND BTOP_GPU)
if(BTOP_RSMI_STATIC)
# ROCm doesn't properly add it's folders to the module path if `CMAKE_MODULE_PATH` is already
# set
# We could also manully append ROCm's path here
# We could also manually append ROCm's path here
set(_CMAKE_MODULE_PATH CMAKE_MODULE_PATH)
unset(CMAKE_MODULE_PATH)
@ -179,6 +193,12 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
INSTALL_RPATH "/usr/local/lib/gcc${GCC_VERSION_MAJOR}"
BUILD_WITH_INSTALL_RPATH TRUE
)
# The gcc compiler wrapper doesn't add '--eh-frame-hdr' on FreeBSD with static builds
# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=278551
if(BTOP_STATIC)
target_link_options(btop PRIVATE LINKER:--eh-frame-hdr)
endif()
endif()
find_package(devstat REQUIRED)
@ -196,9 +216,24 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
target_link_libraries(btop kvm::kvm)
endif()
# Check if lowdown is installed
find_program(LOWDOWN_EXECUTABLE lowdown)
if(LOWDOWN_EXECUTABLE)
# Custom target to compile Markdown to man page using lowdown
add_custom_target(btop.1 ALL
COMMAND lowdown -s -Tman -o btop.1 manpage.md
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
# Install the man page
install(FILES btop.1 DESTINATION "share/man/man1")
else()
message(WARNING "Command 'lowdown' not found: skipping generating man page btop.1")
endif()
install(TARGETS btop RUNTIME)
install(FILES "btop.desktop" DESTINATION "share/applications")
install(FILES "Img/icon.png" DESTINATION "share/icons/hicolor/48x48/apps" RENAME "btop.png")
install(FILES "Img/icon.svg" DESTINATION "share/icons/hicolor/scalable/apps" RENAME "btop.svg")
install(DIRECTORY "themes" DESTINATION "share/btop")

View file

@ -97,17 +97,18 @@ ifneq ($(PLATFORM) $(ARCH),macos arm64)
endif
ifeq ($(STATIC),true)
ifeq ($(CXX_IS_CLANG) $(CLANG_WORKS),true true)
ifeq ($(CXX_IS_CLANG),true)
ifeq ($(shell $(CXX) -print-target-triple | grep gnu >/dev/null; echo $$?),0)
$(error $(shell printf "\033[1;91mERROR: \033[97m$(CXX) can't statically link glibc\033[0m"))
endif
else
override ADDFLAGS += -static-libgcc -static-libstdc++
endif
ifeq ($(PLATFORM_LC),linux)
override ADDFLAGS += -DSTATIC_BUILD -static -Wl,--fatal-warnings
else ifeq ($(PLATFORM_LC),freebsd)
override ADDFLAGS += -DSTATIC_BUILD
ifeq ($(PLATFORM_LC),$(filter $(PLATFORM_LC),freebsd linux))
override ADDFLAGS += -DSTATIC_BUILD -static
else
ifeq ($(CXX_IS_CLANG),false)
override ADDFLAGS += -static-libgcc -static-libstdc++
endif
endif
endif
@ -130,9 +131,13 @@ else ifeq ($(PLATFORM_LC),freebsd)
PLATFORM_DIR := freebsd
THREADS := $(shell getconf NPROCESSORS_ONLN 2>/dev/null || echo 1)
SU_GROUP := wheel
override ADDFLAGS += -lm -lkvm -ldevstat -Wl,-rpath=/usr/local/lib/gcc$(CXX_VERSION_MAJOR)
ifneq ($(STATIC),true)
override ADDFLAGS += -lstdc++
override ADDFLAGS += -lm -lkvm -ldevstat
ifeq ($(STATIC),true)
override ADDFLAGS += -lelf -Wl,--eh-frame-hdr
endif
ifeq ($(CXX_IS_CLANG),false)
override ADDFLAGS += -lstdc++ -Wl,rpath=/usr/local/lib/gcc$(CXX_VERSION_MAJOR)
endif
export MAKE = gmake
else ifeq ($(PLATFORM_LC),macos)
@ -163,6 +168,12 @@ else
LTO := $(THREADS)
endif
GIT_COMMIT := $(shell git rev-parse --short HEAD 2> /dev/null || true)
CONFIGURE_COMMAND := $(MAKE) STATIC=$(STATIC) FORTIFY_SOURCE=$(FORTIFY_SOURCE)
ifeq ($(PLATFORM_LC),linux)
CONFIGURE_COMMAND += GPU_SUPPORT=$(GPU_SUPPORT) RSMI_STATIC=$(RSMI_STATIC)
endif
#? The Directories, Source, Includes, Objects and Binary
SRCDIR := src
INCDIRS := include $(wildcard lib/**/include)
@ -182,7 +193,7 @@ OPTFLAGS := -O2 -ftree-vectorize -flto=$(LTO)
LDCXXFLAGS := -pthread -DFMT_HEADER_ONLY -D_GLIBCXX_ASSERTIONS -D_FILE_OFFSET_BITS=64 $(GOODFLAGS) $(ADDFLAGS)
override CXXFLAGS += $(REQFLAGS) $(LDCXXFLAGS) $(OPTFLAGS) $(WARNFLAGS)
override LDFLAGS += $(LDCXXFLAGS) $(OPTFLAGS) $(WARNFLAGS)
INC := $(foreach incdir,$(INCDIRS),-isystem $(incdir)) -I$(SRCDIR)
INC := $(foreach incdir,$(INCDIRS),-isystem $(incdir)) -I$(SRCDIR) -I$(BUILDDIR)
SU_USER := root
ifdef DEBUG
@ -222,7 +233,7 @@ endif
#? Default Make
.ONESHELL:
all: | info rocm_smi info-quiet directories btop
all: | info rocm_smi info-quiet directories btop.1 config.h btop
ifneq ($(QUIET),true)
info:
@ -243,7 +254,6 @@ info:
@true
endif
info-quiet: | info rocm_smi
@printf "\n\033[1;92mBuilding btop++ \033[91m(\033[97mv$(BTOP_VERSION)\033[91m) \033[93m$(PLATFORM) \033[96m$(ARCH)\033[0m\n"
@ -267,6 +277,22 @@ directories:
@$(VERBOSE) || printf "mkdir -p $(BUILDDIR)/$(PLATFORM_DIR)\n"
@mkdir -p $(BUILDDIR)/$(PLATFORM_DIR)
config.h: $(BUILDDIR)/config.h
$(BUILDDIR)/config.h: $(SRCDIR)/config.h.in | directories
@$(QUIET) || printf "\033[1mConfiguring $(BUILDDIR)/config.h\033[0m\n"
@$(VERBOSE) || printf 'sed -e "s|@GIT_COMMIT@|$(GIT_COMMIT)|" -e "s|@CONFIGURE_COMMAND@|$(CONFIGURE_COMMAND)|" -e "s|@COMPILER@|$(CXX)|" -e "s|@COMPILER_VERSION@|$(CXX_VERSION)|" $< | tee $@ > /dev/null\n'
@sed -e "s|@GIT_COMMIT@|$(GIT_COMMIT)|" -e "s|@CONFIGURE_COMMAND@|$(CONFIGURE_COMMAND)|" -e "s|@COMPILER@|$(CXX)|" -e "s|@COMPILER_VERSION@|$(CXX_VERSION)|" $< | tee $@ > /dev/null
#? Man page
btop.1: manpage.md | directories
ifeq ($(shell command -v lowdown >/dev/null; echo $$?),0)
@printf "\n\033[1;92mGenerating man page $@\033[37m...\033[0m\n"
lowdown -s -Tman -o $@ $<
else
@printf "\n\033[1;93mCommand 'lowdown' not found: skipping generating man page $@\033[0m\n"
endif
#? Clean only Objects
clean:
@printf "\033[1;91mRemoving: \033[1;97mbuilt objects...\033[0m\n"
@ -298,7 +324,11 @@ install:
@printf "\033[1;92mInstalling SVG icon to: \033[1;97m$(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/btop.svg\n"
@mkdir -p $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps
@cp -p Img/icon.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/btop.svg
ifneq ($(wildcard btop.1),)
@printf "\033[1;92mInstalling man page to: \033[1;97m$(DESTDIR)$(PREFIX)/share/man/man1/btop.1\n"
@mkdir -p $(DESTDIR)$(PREFIX)/share/man/man1
@cp -p btop.1 $(DESTDIR)$(PREFIX)/share/man/man1/btop.1
endif
#? Set SUID bit for btop as $SU_USER in $SU_GROUP
setuid:
@ -308,17 +338,20 @@ setuid:
@printf "\033[1;92mSetting SUID bit\033[0m\n"
@chmod u+s $(DESTDIR)$(PREFIX)/bin/btop
# With 'rm -v' user will see what files (if any) got removed
uninstall:
@printf "\033[1;91mRemoving: \033[1;97m$(DESTDIR)$(PREFIX)/bin/btop\033[0m\n"
@rm -rf $(DESTDIR)$(PREFIX)/bin/btop
@rm -rfv $(DESTDIR)$(PREFIX)/bin/btop
@printf "\033[1;91mRemoving: \033[1;97m$(DESTDIR)$(PREFIX)/share/btop\033[0m\n"
@rm -rf $(DESTDIR)$(PREFIX)/share/btop
@rm -rfv $(DESTDIR)$(PREFIX)/share/btop
@printf "\033[1;91mRemoving: \033[1;97m$(DESTDIR)$(PREFIX)/share/applications/btop.desktop\033[0m\n"
@rm -rf $(DESTDIR)$(PREFIX)/share/applications/btop.desktop
@rm -rfv $(DESTDIR)$(PREFIX)/share/applications/btop.desktop
@printf "\033[1;91mRemoving: \033[1;97m$(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/btop.png\033[0m\n"
@rm -rf $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/btop.png
@rm -rfv $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/btop.png
@printf "\033[1;91mRemoving: \033[1;97m$(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/btop.svg\033[0m\n"
@rm -rf $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/btop.svg
@rm -rfv $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/btop.svg
@printf "\033[1;91mRemoving: \033[1;97m$(DESTDIR)$(PREFIX)/share/man/man1/btop.1\033[0m\n"
@rm -rfv $(DESTDIR)$(PREFIX)/share/man/man1/btop.1
#? Pull in dependency info for *existing* .o files
-include $(OBJECTS:.$(OBJEXT)=.$(DEPEXT))
@ -362,7 +395,7 @@ btop: $(OBJECTS) | rocm_smi directories
#? Compile
.ONESHELL:
$(BUILDDIR)/%.$(OBJEXT): $(SRCDIR)/%.$(SRCEXT) | rocm_smi directories
$(BUILDDIR)/%.$(OBJEXT): $(SRCDIR)/%.$(SRCEXT) | rocm_smi directories config.h
@sleep 0.3 2>/dev/null || true
@TSTAMP=$$(date +%s 2>/dev/null || echo "0")
@$(QUIET) || printf "\033[1;97mCompiling $<\033[0m\n"
@ -371,4 +404,4 @@ $(BUILDDIR)/%.$(OBJEXT): $(SRCDIR)/%.$(SRCEXT) | rocm_smi directories
@printf "\033[1;92m$$($(PROGRESS))$(P)\033[10D\033[5C-> \033[1;37m$@ \033[100D\033[38C\033[1;93m(\033[1;97m$$(du -ah $@ | cut -f1)iB\033[1;93m) \033[92m(\033[97m$$($(DATE_CMD) -d @$$(expr $$($(DATE_CMD) +%s 2>/dev/null || echo "0") - $${TSTAMP} 2>/dev/null) -u +%Mm:%Ss 2>/dev/null | sed 's/^00m://' || echo '')\033[92m)\033[0m\n"
#? Non-File Targets
.PHONY: all msg help pre
.PHONY: all config.h msg help pre

View file

@ -106,7 +106,7 @@ If you want to help out, test for bugs/fix bugs or just try out the branches:
**macOS / OSX**
```bash
# Install and use Homebrew or MacPorts package managers for easy dependency installation
brew install coreutils make gcc@11
brew install coreutils make gcc@11 lowdown
git clone https://github.com/aristocratos/btop.git
cd btop
git checkout OSX
@ -115,7 +115,7 @@ gmake
**FreeBSD**
```bash
sudo pkg install gmake gcc11 coreutils git
sudo pkg install gmake gcc11 coreutils git lowdown
git clone https://github.com/aristocratos/btop.git
cd btop
git checkout freebsd
@ -395,7 +395,7 @@ If you have an AMD GPU `rocm_smi_lib` is required, which may or may not be packa
1. **Install dependencies (example for Ubuntu 21.04 Hirsute)**
```bash
sudo apt install coreutils sed git build-essential gcc-11 g++-11
sudo apt install coreutils sed git build-essential gcc-11 g++-11 lowdown
```
2. **Clone repository**
@ -425,7 +425,7 @@ If you have an AMD GPU `rocm_smi_lib` is required, which may or may not be packa
| `GPU_SUPPORT=<true\|false>` | Enable/disable GPU support (Enabled by default on X86_64 Linux) |
| `RSMI_STATIC=true` | To statically link the ROCm SMI library used for querying AMDGPU |
| `ADDFLAGS=<flags>` | For appending flags to both compiler and linker |
| `CXX=<compiler>` | Manualy set which compiler to use |
| `CXX=<compiler>` | Manually set which compiler to use |
Example: `make ADDFLAGS=-march=native` might give a performance boost if compiling only for your own system.
@ -486,12 +486,12 @@ If you have an AMD GPU `rocm_smi_lib` is required, which may or may not be packa
1. **Install build dependencies**
Requires Clang / GCC, CMake, Ninja and Git
Requires Clang / GCC, CMake, Ninja, Lowdown and Git
For example, with Debian Bookworm:
```bash
sudo apt install cmake git g++ ninja-build
sudo apt install cmake git g++ ninja-build lowdown
```
2. **Clone the repository**
@ -569,7 +569,7 @@ If you have an AMD GPU `rocm_smi_lib` is required, which may or may not be packa
1. **Install dependencies (example for Homebrew)**
```bash
brew install coreutils make gcc@12
brew install coreutils make gcc@12 lowdown
```
2. **Clone repository**
@ -596,7 +596,7 @@ If you have an AMD GPU `rocm_smi_lib` is required, which may or may not be packa
| `ARCH=<architecture>` | To manually set the target architecture |
| `FORTIFY_SOURCE=false` | Disable fortification with `_FORTIFY_SOURCE=3` |
| `ADDFLAGS=<flags>` | For appending flags to both compiler and linker |
| `CXX=<compiler>` | Manualy set which compiler to use |
| `CXX=<compiler>` | Manually set which compiler to use |
Example: `gmake ADDFLAGS=-march=native` might give a performance boost if compiling only for your own system.
@ -655,11 +655,11 @@ If you have an AMD GPU `rocm_smi_lib` is required, which may or may not be packa
1. **Install build dependencies**
Requires Clang, CMake, Ninja and Git
Requires Clang, CMake, Ninja, Lowdown and Git
```bash
brew update --quiet
brew install cmake git llvm ninja
brew install cmake git llvm ninja lowdown
```
2. **Clone the repository**
@ -736,7 +736,7 @@ If you have an AMD GPU `rocm_smi_lib` is required, which may or may not be packa
1. **Install dependencies**
```bash
sudo pkg install gmake gcc11 coreutils git
sudo pkg install gmake gcc11 coreutils git lowdown
```
2. **Clone repository**
@ -764,7 +764,7 @@ If you have an AMD GPU `rocm_smi_lib` is required, which may or may not be packa
| `ARCH=<architecture>` | To manually set the target architecture |
| `FORTIFY_SOURCE=false` | Disable fortification with `_FORTIFY_SOURCE=3` |
| `ADDFLAGS=<flags>` | For appending flags to both compiler and linker |
| `CXX=<compiler>` | Manualy set which compiler to use |
| `CXX=<compiler>` | Manually set which compiler to use |
Example: `gmake ADDFLAGS=-march=native` might give a performance boost if compiling only for your own system.
@ -823,18 +823,18 @@ If you have an AMD GPU `rocm_smi_lib` is required, which may or may not be packa
1. **Install build dependencies**
Requires Clang / GCC, CMake, Ninja and Git
Requires Clang / GCC, CMake, Ninja, Lowdown and Git
_**Note:** LLVM's libc++ shipped with FreeBSD 13 is too old and cannot compile btop._
FreeBSD 14 and later:
```bash
pkg install cmake ninja
pkg install cmake ninja lowdown
```
FreeBSD 13:
```bash
pkg install cmake gcc13 ninja
pkg install cmake gcc13 ninja lowdown
```
2. **Clone the repository**
@ -917,7 +917,7 @@ If you have an AMD GPU `rocm_smi_lib` is required, which may or may not be packa
1. **Install dependencies**
```bash
pkg_add gmake gcc%11 g++%11 coreutils git
pkg_add gmake gcc%11 g++%11 coreutils git lowdown
```
2. **Clone repository**
@ -945,7 +945,7 @@ If you have an AMD GPU `rocm_smi_lib` is required, which may or may not be packa
| `ARCH=<architecture>` | To manually set the target architecture |
| `FORTIFY_SOURCE=false` | Disable fortification with `_FORTIFY_SOURCE=3` |
| `ADDFLAGS=<flags>` | For appending flags to both compiler and linker |
| `CXX=<compiler>` | Manualy set which compiler to use |
| `CXX=<compiler>` | Manually set which compiler to use |
Example: `gmake ADDFLAGS=-march=native` might give a performance boost if compiling only for your own system.
@ -1004,12 +1004,12 @@ If you have an AMD GPU `rocm_smi_lib` is required, which may or may not be packa
1. **Install build dependencies**
Requires GCC, CMake, Ninja and Git
Requires GCC, CMake, Ninja, Lowdown and Git
_**Note:** LLVM's libc++ shipped with OpenBSD 7.4 is too old and cannot compile btop._
```bash
pkg_add cmake g++%11 git ninja
pkg_add cmake g++%11 git ninja lowdown
```
2. **Clone the repository**

57
manpage.md Normal file
View file

@ -0,0 +1,57 @@
% btop(1) | User Commands
%
% "January 4 2024"
# NAME
btop - Resource monitor that shows usage and stats for processor, memory, disks, network, and processes.
# SYNOPSIS
**btop** [**-lc**] [**-t** | **+t**] [**-p** _id_] [**\-\-utf-force**]
[**\-\-debug**] [{**-h** | **\-\-help**} | {**-v** | **\-\-version**}]
# DESCRIPTION
**btop** is a program that shows usage and stats for processor, memory, disks, network, and processes.
# OPTIONS
The program follows the usual GNU command line syntax, with long options
starting with two dashes ('-'). A summary of options is included below.
**-lc**, **\-\-low-color**
: Disable truecolor, converts 24-bit colors to 256-color.
**-t**, **\-\-tty_on**
: Force (ON) tty mode, max 16 colors and tty-friendly graph symbols.
**+t**, **\-\-tty_off**
: Force (OFF) tty mode.
**-p**, **\-\-preset _id_**
: Start with preset, integer value between 0-9.
**\-\-utf-force**
: Force start even if no UTF-8 locale was detected.
**\-\-debug**
: Start in DEBUG mode: shows microsecond timer for information collect and screen draw functions and sets loglevel to DEBUG.
**-h**, **\-\-help**
: Show summary of options.
**-v**, **\-\-version**
: Show version of program.
# BUGS
The upstream bug tracker can be found at https://github.com/aristocratos/btop/issues.
# SEE ALSO
**top**(1), **htop**(1)
# AUTHOR
**btop** was written by Jakob P. Liljenberg a.k.a. "Aristocratos".

View file

@ -6,7 +6,7 @@ description: |
C++ version and continuation of bashtop and bpytop.
license: Apache-2.0
base: core20
base: core22
grade: stable
confinement: strict
compression: lzo
@ -49,6 +49,8 @@ parts:
- PREFIX=/usr/local
- STATIC=true
- ADDFLAGS="-D SNAPPED"
# Add 'lowdown' to build dependencies as soon at Snap builder updates from
# Ubuntu 20.04 "Focal" to something newer that has Lowdown included
build-packages:
- coreutils
- sed
@ -56,7 +58,7 @@ parts:
- build-essential
- gcc-11
- g++-11
override-pull: |
snapcraftctl pull
snapcraftctl set-version "$(git describe --tags | sed 's/^v//' | cut -d "-" -f1)"

View file

@ -52,6 +52,7 @@ tab-size = 4
#include "btop_theme.hpp"
#include "btop_draw.hpp"
#include "btop_menu.hpp"
#include "config.h"
#include "fmt/core.h"
#include "fmt/ostream.h"
@ -117,6 +118,19 @@ namespace Global {
int arg_update = 0;
}
static void print_version() {
if constexpr (GIT_COMMIT.empty()) {
fmt::print("btop version: {}\n", Global::Version);
} else {
fmt::print("btop version: {}+{}\n", Global::Version, GIT_COMMIT);
}
}
static void print_version_with_build_info() {
print_version();
fmt::print("Compiled with: {} ({})\nConfigured with: {}\n", COMPILER, COMPILER_VERSION, CONFIGURE_COMMAND);
}
//* A simple argument parser
void argumentParser(const int argc, char **argv) {
for(int i = 1; i < argc; i++) {
@ -138,8 +152,12 @@ void argumentParser(const int argc, char **argv) {
);
exit(0);
}
else if (is_in(argument, "-v", "--version")) {
fmt::println("btop version: {}", Global::Version);
else if (is_in(argument, "-v")) {
print_version();
exit(0);
}
else if (is_in(argument, "--version")) {
print_version_with_build_info();
exit(0);
}
else if (is_in(argument, "-lc", "--low-color")) {
@ -434,7 +452,7 @@ namespace Runner {
}
};
//* Wrapper for raising priviliges when using SUID bit
//* Wrapper for raising privileges when using SUID bit
class gain_priv {
int status = -1;
public:
@ -867,7 +885,7 @@ int main(int argc, char **argv) {
Global::start_time = time_s();
//? Save real and effective userid's and drop priviliges until needed if running with SUID bit set
//? Save real and effective userid's and drop privileges until needed if running with SUID bit set
Global::real_uid = getuid();
Global::set_uid = geteuid();
if (Global::real_uid != Global::set_uid) {

View file

@ -723,7 +723,7 @@ namespace Cpu {
old_watts = watts;
old_seconds = seconds;
old_status = status;
const string str_time = (seconds > 0 ? sec_to_dhms(seconds, true, true) : "");
const string str_time = (seconds > 0 ? sec_to_dhms(seconds, false, true) : "");
const string str_percent = to_string(percent) + '%';
const string str_watts = (watts != -1 and Config::getB("show_battery_watts") ? fmt::format("{:.2f}", watts) + 'W' : "");
const auto& bat_symbol = bat_symbols.at((bat_symbols.contains(status) ? status : "unknown"));

View file

@ -56,7 +56,7 @@ namespace Input {
//* Last entered key
extern deque<string> history;
//* Poll keyboard & mouse input for <timeout> ms and return input availabilty as a bool
//* Poll keyboard & mouse input for <timeout> ms and return input availability as a bool
bool poll(const uint64_t timeout=0);
//* Get a key or mouse action from input

View file

@ -191,7 +191,7 @@ namespace Menu {
{"z", "Toggle totals reset for current network device"},
{"a", "Toggle auto scaling for the network graphs."},
{"y", "Toggle synced scaling mode for network graphs."},
{"f, /", "To enter a process filter."},
{"f, /", "To enter a process filter. Start with ! for regex."},
{"delete", "Clear any entered filter."},
{"c", "Toggle per-core cpu usage of processes."},
{"r", "Reverse sorting order in processes box."},
@ -490,7 +490,7 @@ namespace Menu {
"Kelvin, 0 = absolute zero, 1 degree change",
"equals 1 degree change in Celsius.",
"",
"Rankine, 0 = abosulte zero, 1 degree change",
"Rankine, 0 = absolute zero, 1 degree change",
"equals 1 degree change in Fahrenheit."},
{"show_cpu_freq",
"Show CPU frequency.",
@ -651,7 +651,7 @@ namespace Menu {
"",
"Begin line with \"exclude=\" to change to",
"exclude filter.",
"Oterwise defaults to \"most include\" filter.",
"Otherwise defaults to \"most include\" filter.",
"",
"Example:",
"\"exclude=/boot /home/user\""},

View file

@ -17,6 +17,8 @@ tab-size = 4
*/
#include <ranges>
#include <regex>
#include <string>
#include "btop_config.hpp"
#include "btop_shared.hpp"
@ -111,6 +113,22 @@ namespace Proc {
}
}
bool matches_filter(const proc_info& proc, const std::string& filter) {
if (filter.starts_with("!")) {
if (filter.size() == 1) {
return true;
}
std::regex regex{filter.substr(1), std::regex::extended};
return std::regex_search(std::to_string(proc.pid), regex) ||
std::regex_search(proc.name, regex) || std::regex_match(proc.cmd, regex) ||
std::regex_search(proc.user, regex);
} else {
return s_contains(std::to_string(proc.pid), filter) ||
s_contains_ic(proc.name, filter) || s_contains_ic(proc.cmd, filter) ||
s_contains_ic(proc.user, filter);
}
}
void _tree_gen(proc_info& cur_proc, vector<proc_info>& in_procs, vector<tree_proc>& out_procs,
int cur_depth, bool collapsed, const string& filter, bool found, bool no_update, bool should_filter) {
auto cur_pos = out_procs.size();
@ -118,10 +136,7 @@ namespace Proc {
//? If filtering, include children of matching processes
if (not found and (should_filter or not filter.empty())) {
if (not s_contains(std::to_string(cur_proc.pid), filter)
and not s_contains_ic(cur_proc.name, filter)
and not s_contains_ic(cur_proc.cmd, filter)
and not s_contains_ic(cur_proc.user, filter)) {
if (!matches_filter(cur_proc, filter)) {
filtering = true;
cur_proc.filtered = true;
filter_found++;

View file

@ -424,6 +424,8 @@ namespace Proc {
void tree_sort(vector<tree_proc>& proc_vec, const string& sorting,
bool reverse, int& c_index, const int index_max, bool collapsed = false);
bool matches_filter(const proc_info& proc, const std::string& filter);
//* Generate process tree list
void _tree_gen(proc_info& cur_proc, vector<proc_info>& in_procs, vector<tree_proc>& out_procs,
int cur_depth, bool collapsed, const string& filter,

View file

@ -381,11 +381,16 @@ namespace Theme {
if (themefile.good()) {
Logger::debug("Loading theme file: " + filename);
while (not themefile.bad()) {
if (themefile.peek() == '#') {
themefile.ignore(SSmax, '\n');
continue;
}
themefile.ignore(SSmax, '[');
if (themefile.eof()) break;
string name, value;
getline(themefile, name, ']');
if (not Default_theme.contains(name)) {
themefile.ignore(SSmax, '\n');
continue;
}
themefile.ignore(SSmax, '=');
@ -394,6 +399,7 @@ namespace Theme {
if (themefile.peek() == '"') {
themefile.ignore(1);
getline(themefile, value, '"');
themefile.ignore(SSmax, '\n');
}
else getline(themefile, value, '\n');

View file

@ -32,7 +32,7 @@ namespace Theme {
extern std::filesystem::path theme_dir;
extern std::filesystem::path user_theme_dir;
//* Contains "Default" and "TTY" at indeces 0 and 1, otherwise full paths to theme files
//* Contains "Default" and "TTY" at indices 0 and 1, otherwise full paths to theme files
extern vector<string> themes;
//* Generate escape sequence for 24-bit or 256 color and return as a string

View file

@ -89,7 +89,7 @@ namespace Term {
}
bool refresh(bool only_check) {
// Query dimensions of '/dev/tty' of the 'STDOUT_FILENO' isn't avaiable.
// Query dimensions of '/dev/tty' of the 'STDOUT_FILENO' isn't available.
// This variable is set in those cases to avoid calls to ioctl
constinit static bool uses_dev_tty = false;
struct winsize wsize {};
@ -644,7 +644,7 @@ namespace Logger {
size_t loglevel;
fs::path logfile;
//* Wrapper for lowering priviliges if using SUID bit and currently isn't using real userid
//* Wrapper for lowering privileges if using SUID bit and currently isn't using real userid
class lose_priv {
int status = -1;
public:

View file

@ -114,7 +114,7 @@ namespace Mv {
//* Save cursor position
const string save = Fx::e + "s";
//* Restore saved cursor postion
//* Restore saved cursor position
const string restore = Fx::e + "u";
}
@ -286,7 +286,7 @@ namespace Tools {
return is_in(str, "true", "True");
}
//* Check if a string is a valid integer value (only postive)
//* Check if a string is a valid integer value (only positive)
inline bool isint(const string& str) {
return all_of(str.begin(), str.end(), ::isdigit);
}

10
src/config.h.in Normal file
View file

@ -0,0 +1,10 @@
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include <string_view>
constexpr std::string_view GIT_COMMIT = "@GIT_COMMIT@";
constexpr std::string_view COMPILER = "@COMPILER@";
constexpr std::string_view COMPILER_VERSION = "@COMPILER_VERSION@";
constexpr std::string_view CONFIGURE_COMMAND = "@CONFIGURE_COMMAND@";

View file

@ -265,7 +265,7 @@ namespace Cpu {
got_sensors = true;
int temp;
size_t size = sizeof(temp);
sysctlbyname("dev.cpu.0.coretemp.tjmax", &temp, &size, nullptr, 0); //asuming the max temp is same for all cores
sysctlbyname("dev.cpu.0.coretemp.tjmax", &temp, &size, nullptr, 0); //assuming the max temp is same for all cores
temp = (temp - 2732) / 10; // since it's an int, it's multiplied by 10, and offset to absolute zero...
current_cpu.temp_max = temp;
}
@ -907,7 +907,7 @@ namespace Net {
}
}
//? Get total recieved and transmitted bytes + device address if no ip was found
//? Get total received and transmitted bytes + device address if no ip was found
for (const auto &iface : interfaces) {
for (const string dir : {"download", "upload"}) {
auto &saved_stat = net.at(iface).stat.at(dir);
@ -1239,18 +1239,13 @@ namespace Proc {
filter_found = 0;
for (auto& p : current_procs) {
if (not tree and not filter.empty()) {
if (not s_contains_ic(to_string(p.pid), filter)
and not s_contains_ic(p.name, filter)
and not s_contains_ic(p.cmd, filter)
and not s_contains_ic(p.user, filter)) {
p.filtered = true;
filter_found++;
}
else {
p.filtered = false;
}
if (!matches_filter(p, filter)) {
p.filtered = true;
filter_found++;
} else {
p.filtered = false;
}
else {
} else {
p.filtered = false;
}
}

View file

@ -158,8 +158,11 @@ namespace Gpu {
//? AMD data collection
namespace Rsmi {
//? RSMI defines, structs & typedefs
#define RSMI_DEVICE_NAME_BUFFER_SIZE 128
#if !defined(RSMI_STATIC)
//? RSMI defines, structs & typedefs
#define RSMI_MAX_NUM_FREQUENCIES_V5 32
#define RSMI_MAX_NUM_FREQUENCIES_V6 33
#define RSMI_STATUS_SUCCESS 0
@ -445,7 +448,7 @@ namespace Cpu {
const int file_id = atoi(file.path().filename().c_str() + 4); // skip "temp" prefix
string file_path = file.path();
if (!s_contains(file_path, file_suffix)) {
if (!s_contains(file_path, file_suffix) or s_contains(file_path, "nvme")) {
continue;
}
@ -724,7 +727,7 @@ namespace Cpu {
if (fs::exists(bat_dir / "power_now")) {
new_bat.power_now = bat_dir / "power_now";
}
else if ((fs::exists(bat_dir / "current_now")) and (fs::exists(bat_dir / "current_now"))) {
else if ((fs::exists(bat_dir / "current_now")) and (fs::exists(bat_dir / "voltage_now"))) {
new_bat.current_now = bat_dir / "current_now";
new_bat.voltage_now = bat_dir / "voltage_now";
}
@ -835,7 +838,7 @@ namespace Cpu {
if (b.use_power) {
if (not b.power_now.empty()) {
try {
watts = (float)stoll(readfile(b.energy_now, "-1")) / 1000000.0;
watts = (float)stoll(readfile(b.power_now, "-1")) / 1000000.0;
}
catch (const std::invalid_argument&) { }
catch (const std::out_of_range&) { }
@ -1396,8 +1399,8 @@ namespace Gpu {
for (uint32_t i = 0; i < device_count; ++i) {
if constexpr(is_init) {
//? Device name
char name[NVML_DEVICE_NAME_BUFFER_SIZE]; // ROCm SMI does not provide a constant for this as far as I can tell, this should be good enough
result = rsmi_dev_name_get(i, name, NVML_DEVICE_NAME_BUFFER_SIZE);
char name[RSMI_DEVICE_NAME_BUFFER_SIZE];
result = rsmi_dev_name_get(i, name, RSMI_DEVICE_NAME_BUFFER_SIZE);
if (result != RSMI_STATUS_SUCCESS)
Logger::warning("ROCm SMI: Failed to get device name");
else gpu_names[Nvml::device_count + i] = string(name);
@ -1506,7 +1509,10 @@ namespace Gpu {
if (result != RSMI_STATUS_SUCCESS) {
Logger::warning("ROCm SMI: Failed to get GPU power usage");
if constexpr(is_init) gpus_slice[i].supported_functions.pwr_usage = false;
} else gpus_slice[i].gpu_percent.at("gpu-pwr-totals").push_back(clamp((long long)round((double)gpus_slice[i].pwr_usage * 100.0 / (double)gpus_slice[i].pwr_max_usage), 0ll, 100ll));
} else {
gpus_slice[i].pwr_usage = (long long)power / 1000;
gpus_slice[i].gpu_percent.at("gpu-pwr-totals").push_back(clamp((long long)round((double)gpus_slice[i].pwr_usage * 100.0 / (double)gpus_slice[i].pwr_max_usage), 0ll, 100ll));
}
if constexpr(is_init) gpus_slice[i].supported_functions.pwr_state = false;
}
@ -2061,7 +2067,7 @@ namespace Mem {
if (access(zfs_pool_stat_path.c_str(), R_OK) == 0) {
return zfs_pool_stat_path;
} else {
Logger::debug("Cant access folder: " + zfs_pool_stat_path.string());
Logger::debug("Can't access folder: " + zfs_pool_stat_path.string());
return "";
}
}
@ -2266,7 +2272,7 @@ namespace Net {
} //else, ignoring family==AF_PACKET (see man 3 getifaddrs) which is the first one in the `for` loop.
}
//? Get total recieved and transmitted bytes + device address if no ip was found
//? Get total received and transmitted bytes + device address if no ip was found
for (const auto& iface : interfaces) {
if (net.at(iface).ipv4.empty() and net.at(iface).ipv6.empty())
net.at(iface).ipv4 = readfile("/sys/class/net/" + iface + "/address");
@ -2793,18 +2799,13 @@ namespace Proc {
filter_found = 0;
for (auto& p : current_procs) {
if (not tree and not filter.empty()) {
if (not s_contains_ic(to_string(p.pid), filter)
and not s_contains_ic(p.name, filter)
and not s_contains_ic(p.cmd, filter)
and not s_contains_ic(p.user, filter)) {
p.filtered = true;
filter_found++;
}
else {
p.filtered = false;
}
if (!matches_filter(p, filter)) {
p.filtered = true;
filter_found++;
} else {
p.filtered = false;
}
else {
} else {
p.filtered = false;
}
}

View file

@ -859,7 +859,7 @@ namespace Net {
}
}
//? Get total recieved and transmitted bytes + device address if no ip was found
//? Get total received and transmitted bytes + device address if no ip was found
for (const auto &iface : interfaces) {
for (const string dir : {"download", "upload"}) {
auto &saved_stat = net.at(iface).stat.at(dir);
@ -1171,18 +1171,13 @@ namespace Proc {
filter_found = 0;
for (auto& p : current_procs) {
if (not tree and not filter.empty()) {
if (not s_contains_ic(to_string(p.pid), filter)
and not s_contains_ic(p.name, filter)
and not s_contains_ic(p.cmd, filter)
and not s_contains_ic(p.user, filter)) {
p.filtered = true;
filter_found++;
}
else {
p.filtered = false;
}
if (!matches_filter(p, filter)) {
p.filtered = true;
filter_found++;
} else {
p.filtered = false;
}
else {
} else {
p.filtered = false;
}
}

View file

@ -940,7 +940,7 @@ namespace Net {
}
}
//? Get total recieved and transmitted bytes + device address if no ip was found
//? Get total received and transmitted bytes + device address if no ip was found
for (const auto &iface : interfaces) {
for (const string dir : {"download", "upload"}) {
auto &saved_stat = net.at(iface).stat.at(dir);
@ -1249,7 +1249,11 @@ namespace Proc {
new_proc.ppid = kproc.kp_eproc.e_ppid;
new_proc.cpu_s = kproc.kp_proc.p_starttime.tv_sec * 1'000'000 + kproc.kp_proc.p_starttime.tv_usec;
struct passwd *pwd = getpwuid(kproc.kp_eproc.e_ucred.cr_uid);
new_proc.user = pwd->pw_name;
if (pwd != nullptr) {
new_proc.user = pwd->pw_name;
} else {
new_proc.user = std::to_string(kproc.kp_eproc.e_ucred.cr_uid);
}
}
new_proc.p_nice = kproc.kp_proc.p_nice;
new_proc.state = kproc.kp_proc.p_stat;
@ -1301,7 +1305,7 @@ namespace Proc {
filter_found = 0;
for (auto &p : current_procs) {
if (not tree and not filter.empty()) {
if (not s_contains_ic(to_string(p.pid), filter) and not s_contains_ic(p.name, filter) and not s_contains_ic(p.cmd, filter) and not s_contains_ic(p.user, filter)) {
if (!matches_filter(p, filter)) {
p.filtered = true;
filter_found++;
} else {

View file

@ -18,7 +18,7 @@ theme[main_fg]="#cfd8dc"
# Title color for boxes
theme[title]="#ff"
# Higlight color for keyboard shortcuts
# Highlight color for keyboard shortcuts
theme[hi_fg]="#90"
# Background color of selected item in processes box

View file

@ -18,7 +18,7 @@ theme[main_fg]="#2e3436"
# Title color for boxes
theme[title]="#2e3436"
# Higlight color for keyboard shortcuts
# Highlight color for keyboard shortcuts
theme[hi_fg]="#1a5fb4"
# Background color of selected item in processes box

View file

@ -18,7 +18,7 @@ theme[main_fg]="#99DFFF"
# Title color for boxes
theme[title]="#99FFFF"
# Higlight color for keyboard shortcuts
# Highlight color for keyboard shortcuts
theme[hi_fg]="#FF7F00"
# Background color of selected item in processes box

View file

@ -11,7 +11,7 @@ theme[main_fg]="#eee8d5"
# Title color for boxes
theme[title]="#eee8d5"
# Higlight color for keyboard shortcuts
# Highlight color for keyboard shortcuts
theme[hi_fg]="#d1302c"
# Background color of selected item in processes box

View file

@ -18,7 +18,7 @@ theme[main_fg]="#737680"
# Title color for boxes
theme[title]="#272a34"
# Higlight color for keyboard shortcuts
# Highlight color for keyboard shortcuts
theme[hi_fg]="#90"
# Background color of selected item in processes box

View file

@ -18,7 +18,7 @@ theme[main_fg]="#E6E6E6"
# Title color for boxes
theme[title]="#ff"
# Higlight color for keyboard shortcuts
# Highlight color for keyboard shortcuts
theme[hi_fg]="#90"
# Background color of selected item in processes box

View file

@ -18,7 +18,7 @@ theme[main_fg]="#bb"
# Title color for boxes
theme[title]="#cc"
# Higlight color for keyboard shortcuts
# Highlight color for keyboard shortcuts
theme[hi_fg]="#90"
# Background color of selected item in processes box

View file

@ -18,7 +18,7 @@ theme[main_fg]="#a89984"
# Title color for boxes
theme[title]="#ebdbb2"
# Higlight color for keyboard shortcuts
# Highlight color for keyboard shortcuts
theme[hi_fg]="#d79921"
# Background color of selected items

View file

@ -0,0 +1,89 @@
# Btop gruvbox_light theme
# by kk9uk
# Main background, empty for terminal default, need to be empty if you want transparent background
theme[main_bg]="#fbf1c7"
# Main text color
theme[main_fg]="#3c3836"
# Title color for boxes
theme[title]="#3c3836"
# Highlight color for keyboard shortcuts
theme[hi_fg]="#cc241d"
# Background color of selected items
theme[selected_bg]="#f2e5bc"
# Foreground color of selected items
theme[selected_fg]="#8f3f71"
# Color of inactive/disabled text
theme[inactive_fg]="#ebdbb2"
# Color of text appearing on top of graphs, i.e uptime and current network graph scaling
theme[graph_text]="#a89984"
# Misc colors for processes box including mini cpu graphs, details memory graph and details status text
theme[proc_misc]="#98971a"
# Cpu box outline color
theme[cpu_box]="#a89984"
# Memory/disks box outline color
theme[mem_box]="#a89984"
# Net up/down box outline color
theme[net_box]="#a89984"
# Processes box outline color
theme[proc_box]="#a89984"
# Box divider line and small boxes line color
theme[div_line]="#a89984"
# Temperature graph colors
theme[temp_start]="#98971a"
theme[temp_mid]=""
theme[temp_end]="#cc241d"
# CPU graph colors
theme[cpu_start]="#427b58"
theme[cpu_mid]="#d79921"
theme[cpu_end]="#cc241d"
# Mem/Disk free meter
theme[free_start]="#cc241d"
theme[free_mid]="#d79921"
theme[free_end]="#427b58"
# Mem/Disk cached meter
theme[cached_start]="#458588"
theme[cached_mid]="#076678"
theme[cached_end]="#427b58"
# Mem/Disk available meter
theme[available_start]="#cc241d"
theme[available_mid]="#d65d0e"
theme[available_end]="#b57614"
# Mem/Disk used meter
theme[used_start]="#427b58"
theme[used_mid]="#d65d0e"
theme[used_end]="#cc241d"
# Download graph colors
theme[download_start]="#98971a"
theme[download_mid]="#689d6a"
theme[download_end]="#79740e"
# Upload graph colors
theme[upload_start]="#cc241d"
theme[upload_mid]="#d65d0e"
theme[upload_end]="#b57614"
# Process box color gradient for threads, mem and cpu usage
theme[process_start]="#427b58"
theme[process_mid]="#af3a03"
theme[process_end]="#cc241d"

View file

@ -18,7 +18,7 @@ theme[main_fg]="#d4be98"
# Title color for boxes
theme[title]="#d4be98"
# Higlight color for keyboard shortcuts
# Highlight color for keyboard shortcuts
theme[hi_fg]="#ea6962"
# Background color of selected items

View file

@ -18,7 +18,7 @@ theme[main_fg]="#F8F8F2"
# Title color for boxes
theme[title]="#F8F8F2"
# Higlight color for keyboard shortcuts
# Highlight color for keyboard shortcuts
theme[hi_fg]="#2eb398"
# Background color of selected item in processes box

View file

@ -18,7 +18,7 @@ theme[main_fg]="#F8F8F2"
# Title color for boxes
theme[title]="#F8F8F2"
# Higlight color for keyboard shortcuts
# Highlight color for keyboard shortcuts
theme[hi_fg]="#F92672"
# Background color of selected item in processes box

View file

@ -18,7 +18,7 @@ theme[main_fg]="#d6deeb"
# Title color for boxes
theme[title]="#ffffff"
# Higlight color for keyboard shortcuts
# Highlight color for keyboard shortcuts
theme[hi_fg]="#addb67"
# Background color of selected items

View file

@ -18,7 +18,7 @@ theme[main_fg]="#D8DEE9"
# Title color for boxes
theme[title]="#8FBCBB"
# Higlight color for keyboard shortcuts
# Highlight color for keyboard shortcuts
theme[hi_fg]="#5E81AC"
# Background color of selected item in processes box

View file

@ -10,7 +10,7 @@ theme[main_fg]="#abb2bf"
# Title color for boxes
theme[title]="#abb2bf"
# Higlight color for keyboard shortcuts
# Highlight color for keyboard shortcuts
theme[hi_fg]="#61afef"
# Background color of selected item in processes box

View file

@ -12,7 +12,7 @@ theme[main_fg]="#00"
# Title color for boxes
theme[title]="#00"
# Higlight color for keyboard shortcuts
# Highlight color for keyboard shortcuts
theme[hi_fg]="#CC3E28"
# Background color of selected item in processes box

View file

@ -18,7 +18,7 @@ theme[main_fg]="#eee8d5"
# Title color for boxes
theme[title]="#fdf6e3"
# Higlight color for keyboard shortcuts
# Highlight color for keyboard shortcuts
theme[hi_fg]="#b58900"
# Background color of selected items

View file

@ -18,7 +18,7 @@ theme[main_fg]="#586e75"
# Title color for boxes
theme[title]="#002b36"
# Higlight color for keyboard shortcuts
# Highlight color for keyboard shortcuts
theme[hi_fg]="#b58900"
# Background color of selected items

View file

@ -10,7 +10,7 @@ theme[main_fg]="#cfc9c2"
# Title color for boxes
theme[title]="#cfc9c2"
# Higlight color for keyboard shortcuts
# Highlight color for keyboard shortcuts
theme[hi_fg]="#7dcfff"
# Background color of selected item in processes box

View file

@ -10,7 +10,7 @@ theme[main_fg]="#cfc9c2"
# Title color for boxes
theme[title]="#cfc9c2"
# Higlight color for keyboard shortcuts
# Highlight color for keyboard shortcuts
theme[hi_fg]="#7dcfff"
# Background color of selected item in processes box

View file

@ -18,7 +18,7 @@ theme[main_fg]="#c5c8c6"
# Title color for boxes
theme[title]="#c5c8c6"
# Higlight color for keyboard shortcuts
# Highlight color for keyboard shortcuts
theme[hi_fg]="#81beb7"
# Background color of selected item in processes box

View file

@ -18,7 +18,7 @@ theme[main_fg]="#30"
# Title color for boxes
theme[title]="#10"
# Higlight color for keyboard shortcuts
# Highlight color for keyboard shortcuts
theme[hi_fg]="#284d75"
# Background color of selected item in processes box