├── .github ├── cosmocc_version.txt └── workflows │ ├── build.yml │ ├── check_cosmocc_releases.yml │ └── release.yml ├── .gitignore ├── .gitmodules ├── CMakeLists.txt ├── Dockerfile ├── LICENSE ├── README.md ├── cmake └── Modules │ ├── Finddevstat.cmake │ ├── Findelf.cmake │ ├── Findkvm.cmake │ └── Findproplib.cmake ├── img └── logo.svg ├── src ├── config.h.in ├── cosmotop.cpp ├── cosmotop_config.cpp ├── cosmotop_config.hpp ├── cosmotop_draw.cpp ├── cosmotop_draw.hpp ├── cosmotop_input.cpp ├── cosmotop_input.hpp ├── cosmotop_menu.cpp ├── cosmotop_menu.hpp ├── cosmotop_plugin.cpp ├── cosmotop_plugin.hpp ├── cosmotop_shared.cpp ├── cosmotop_shared.hpp ├── cosmotop_theme.cpp ├── cosmotop_theme.hpp ├── cosmotop_tools.hpp ├── cosmotop_tools_host.cpp ├── cosmotop_tools_shared.cpp ├── freebsd │ └── cosmotop_collect.cpp ├── linux │ ├── cosmotop_collect.cpp │ └── intel_gpu_top │ │ ├── drm.h │ │ ├── drm_mode.h │ │ ├── i915_drm.h │ │ ├── i915_pciids.h │ │ ├── i915_pciids_local.h │ │ ├── igt_perf.c │ │ ├── igt_perf.h │ │ ├── intel_chipset.h │ │ ├── intel_device_info.c │ │ ├── intel_gpu_top.c │ │ ├── intel_gpu_top.h │ │ ├── intel_name_lookup_shim.c │ │ ├── source.txt │ │ └── xe_pciids.h ├── netbsd │ └── cosmotop_collect.cpp ├── openbsd │ ├── cosmotop_collect.cpp │ ├── internal.h │ ├── sysctlbyname.cpp │ └── sysctlbyname.h ├── osx │ ├── cosmotop_collect.cpp │ ├── ioreport.cpp │ ├── ioreport.hpp │ ├── sensors.cpp │ ├── sensors.hpp │ ├── smc.cpp │ └── smc.hpp └── windows │ └── cosmotop_collect.cpp ├── themes ├── HotPurpleTrafficLight.theme ├── adapta.theme ├── adwaita.theme ├── ayu.theme ├── dracula.theme ├── dusklight.theme ├── elementarish.theme ├── everforest-dark-hard.theme ├── everforest-dark-medium.theme ├── everforest-light-medium.theme ├── flat-remix-light.theme ├── flat-remix.theme ├── greyscale.theme ├── gruvbox_dark.theme ├── gruvbox_dark_v2.theme ├── gruvbox_light.theme ├── gruvbox_material_dark.theme ├── horizon.theme ├── kyli0x.theme ├── matcha-dark-sea.theme ├── monokai.theme ├── night-owl.theme ├── nord.theme ├── onedark.theme ├── paper.theme ├── phoenix-night.theme ├── solarized_dark.theme ├── solarized_light.theme ├── tokyo-night.theme ├── tokyo-storm.theme ├── tomorrow-night.theme └── whiteout.theme └── zigshim └── zig /.github/cosmocc_version.txt: -------------------------------------------------------------------------------- 1 | 4.0.2 -------------------------------------------------------------------------------- /.github/workflows/check_cosmocc_releases.yml: -------------------------------------------------------------------------------- 1 | name: Autoupdate Cosmopolitan 2 | 3 | on: 4 | workflow_dispatch: 5 | schedule: 6 | - cron: "15 4 * * *" 7 | 8 | permissions: 9 | contents: write 10 | pull-requests: write 11 | 12 | jobs: 13 | check_new_releases: 14 | name: Check for new releases 15 | runs-on: ubuntu-latest 16 | 17 | steps: 18 | - name: Checkout repository 19 | uses: actions/checkout@v4 20 | 21 | - name: Check versions 22 | run: | 23 | CURRENT=$(cat .github/cosmocc_version.txt) 24 | LATEST=$(curl -s -S -H "Authorization: Bearer ${{ github.token }}" https://api.github.com/repos/jart/cosmopolitan/releases | jq -r .[0].tag_name) 25 | echo "current=${CURRENT}" >> "$GITHUB_ENV" 26 | echo "latest=${LATEST}" >> "$GITHUB_ENV" 27 | 28 | - name: Do update 29 | if: ${{ env.current != env.latest }} 30 | run: | 31 | sed -i 's/${{ env.current }}/${{ env.latest }}/g' .github/cosmocc_version.txt 32 | 33 | - name: Create PR 34 | uses: peter-evans/create-pull-request@v7 35 | with: 36 | committer: github-actions[bot] 37 | author: github-actions[bot] 38 | commit-message: 'Bump Cosmopolitan to ${{ env.latest }}' 39 | title: '[🤖] Bump Cosmopolitan to ${{ env.latest }}' 40 | body: Automatically generated PR - Bumping Cosmopolitan from ${{ env.current }} to ${{ env.latest }} 41 | branch: bump-cosmocc 42 | token: ${{ secrets.PR_PAT }} 43 | delete-branch: true -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Build and publish 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | version: 7 | required: true 8 | type: string 9 | beta: 10 | required: true 11 | type: boolean 12 | dry_run: 13 | required: true 14 | type: boolean 15 | 16 | jobs: 17 | validate-version: 18 | name: Validate Version 19 | runs-on: ubuntu-latest 20 | steps: 21 | - name: Check if version is prefixed with 'v' 22 | run: | 23 | if [[ "${{ inputs.version }}" != v* ]]; then 24 | echo "Error: Version must be prefixed with 'v'." 25 | exit 1 26 | fi 27 | 28 | build: 29 | name: Build 30 | permissions: 31 | contents: read 32 | packages: write 33 | needs: validate-version 34 | uses: ./.github/workflows/build.yml 35 | with: 36 | version: ${{ inputs.version }} 37 | beta: ${{ inputs.beta && 'true' || 'false' }} 38 | dry_run: ${{ inputs.dry_run && 'true' || 'false' }} 39 | 40 | publish: 41 | name: Publish 42 | needs: build 43 | runs-on: ubuntu-latest 44 | permissions: 45 | contents: write 46 | 47 | steps: 48 | - name: Download artifact 49 | uses: actions/download-artifact@v4 50 | with: 51 | name: cosmotop.exe 52 | path: . 53 | 54 | - name: Download artifact 55 | uses: actions/download-artifact@v4 56 | with: 57 | name: cosmotop 58 | path: . 59 | 60 | - name: Download artifact 61 | uses: actions/download-artifact@v4 62 | with: 63 | pattern: plugin-* 64 | path: . 65 | merge-multiple: true 66 | 67 | - name: Download artifact 68 | uses: actions/download-artifact@v4 69 | with: 70 | name: cosmotop.parts 71 | path: . 72 | 73 | - name: Remove pre-bundled plugins 74 | run: | 75 | rm cosmotop-linux-x86_64.exe 76 | rm cosmotop-linux-aarch64.exe 77 | rm cosmotop-macos-x86_64.exe 78 | rm cosmotop-macos-aarch64.exe 79 | rm cosmotop-windows-x86_64.dll 80 | 81 | - name: Make bundle from debug 82 | run: | 83 | mkdir debug 84 | cp *.dbg debug/ 85 | cp cosmotop.aarch64.elf debug/ 86 | cp cosmotop.exe debug/ 87 | zip -r debug.zip debug 88 | 89 | - name: Release 90 | if: ${{ !inputs.dry_run }} 91 | uses: softprops/action-gh-release@v2 92 | with: 93 | files: | 94 | cosmotop 95 | cosmotop-*.exe 96 | ${{ inputs.beta && 'debug.zip' || '' }} 97 | tag_name: ${{ inputs.version }} 98 | generate_release_notes: true 99 | prerelease: ${{ inputs.beta }} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # gitginore template for creating Snap packages 2 | # website: https://snapcraft.io/ 3 | 4 | parts/ 5 | prime/ 6 | stage/ 7 | *.snap 8 | 9 | # Snapcraft global state tracking data(automatically generated) 10 | # https://forum.snapcraft.io/t/location-to-save-global-state/768 11 | /snap/.snapcraft/ 12 | 13 | # Source archive packed by `snapcraft cleanbuild` before pushing to the LXD container 14 | /*_source.tar.bz2 15 | 16 | # Prerequisites 17 | *.d 18 | 19 | # Compiled Object files 20 | *.slo 21 | *.lo 22 | *.o 23 | *.obj 24 | 25 | # Precompiled Headers 26 | *.gch 27 | *.pch 28 | 29 | # Compiled Dynamic libraries 30 | *.so 31 | *.dylib 32 | *.dll 33 | 34 | # Fortran module files 35 | *.mod 36 | *.smod 37 | 38 | # Compiled Static libraries 39 | *.lai 40 | *.la 41 | *.a 42 | *.lib 43 | 44 | # Executables 45 | *.exe 46 | *.out 47 | *.app 48 | *.com 49 | 50 | # Compiled man page 51 | cosmotop.1 52 | 53 | build*/ 54 | bin 55 | cosmotop 56 | /obj/ 57 | config.h 58 | .*/ 59 | 60 | # Optional libraries 61 | lib/rocm_smi_lib 62 | 63 | # Don't ignore .github directory 64 | !.github/ 65 | 66 | # Ignore files created by Qt Creator 67 | *.config 68 | *.creator 69 | *.creator.user 70 | *.creator.user.* 71 | *.cflags 72 | *.cxxflags 73 | *.files 74 | *.includes 75 | 76 | # CMake 77 | CMakeLists.txt.user 78 | CMakeCache.txt 79 | CMakeFiles 80 | CMakeScripts 81 | Testing 82 | Makefile 83 | cmake_install.cmake 84 | install_manifest.txt 85 | compile_commands.json 86 | CTestTestfile.cmake 87 | _deps 88 | 89 | # CLion 90 | cmake-build-* 91 | 92 | # gdb 93 | .gdb_history -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "third_party/libcosmo_plugin"] 2 | path = third_party/libcosmo_plugin 3 | url = https://github.com/bjia56/libcosmo_plugin.git 4 | [submodule "third_party/cpp-httplib"] 5 | path = third_party/cpp-httplib 6 | url = https://github.com/yhirose/cpp-httplib.git 7 | [submodule "third_party/fmt"] 8 | path = third_party/fmt 9 | url = https://github.com/fmtlib/fmt.git 10 | [submodule "third_party/widecharwidth"] 11 | path = third_party/widecharwidth 12 | url = https://github.com/ridiculousfish/widecharwidth.git 13 | [submodule "third_party/range-v3"] 14 | path = third_party/range-v3 15 | url = https://github.com/ericniebler/range-v3.git 16 | [submodule "third_party/rocm_smi_lib"] 17 | path = third_party/rocm_smi_lib 18 | url = https://github.com/ROCm/rocm_smi_lib.git 19 | [submodule "third_party/catppuccin"] 20 | path = third_party/catppuccin 21 | url = https://github.com/catppuccin/btop.git 22 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: Apache-2.0 2 | # 3 | # CMake configuration for cosmotop 4 | # 5 | 6 | cmake_minimum_required(VERSION 3.24) 7 | 8 | # Disable in-source builds 9 | if("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") 10 | message(FATAL_ERROR "In-source builds are not allowed") 11 | endif() 12 | 13 | project("cosmotop" 14 | DESCRIPTION "Multiplatform system monitoring tool using Cosmopolitan Libc" 15 | HOMEPAGE_URL "https://github.com/bjia56/cosmotop" 16 | LANGUAGES CXX C 17 | ) 18 | 19 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/") 20 | include(CheckIncludeFileCXX) 21 | 22 | add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/libcosmo_plugin) 23 | 24 | set(CMAKE_CXX_STANDARD 20) 25 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 26 | set(CMAKE_CXX_EXTENSIONS OFF) 27 | set(CMAKE_COLOR_DIAGNOSTICS ON) 28 | set(CMAKE_EXPORT_COMPILE_COMMANDS ON) 29 | 30 | if(NOT CMAKE_BUILD_TYPE) 31 | set(CMAKE_BUILD_TYPE Release) 32 | endif() 33 | 34 | set(THIRD_PARTY_INCLUDES 35 | ${LIBCOSMO_PLUGIN_INCLUDE_DIRS} 36 | ${PROJECT_SOURCE_DIR}/third_party/cpp-httplib 37 | ${PROJECT_SOURCE_DIR}/third_party/fmt/include 38 | ${PROJECT_SOURCE_DIR}/third_party/widecharwidth 39 | ${PROJECT_SOURCE_DIR}/third_party/range-v3/include 40 | ) 41 | 42 | # Generate build info 43 | if(NOT RELEASE) 44 | execute_process( 45 | COMMAND "git" "rev-parse" "--short" "HEAD" 46 | WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" 47 | OUTPUT_VARIABLE GIT_COMMIT 48 | OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET) 49 | endif() 50 | get_filename_component(CXX_COMPILER_BASENAME "${CMAKE_CXX_COMPILER}" NAME) 51 | set(COMPILER "${CXX_COMPILER_BASENAME}") 52 | set(COMPILER_VERSION "${CMAKE_CXX_COMPILER_VERSION}") 53 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY IMMEDIATE) 54 | set(CMAKE_INCLUDE_CURRENT_DIR ON) 55 | 56 | if(NOT TARGET) 57 | set(TARGET "host") 58 | endif() 59 | 60 | if(${TARGET} STREQUAL "host") 61 | 62 | set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") 63 | 64 | add_executable(cosmotop.com 65 | src/cosmotop.cpp 66 | src/cosmotop_config.cpp 67 | src/cosmotop_draw.cpp 68 | src/cosmotop_input.cpp 69 | src/cosmotop_menu.cpp 70 | src/cosmotop_shared.cpp 71 | src/cosmotop_theme.cpp 72 | src/cosmotop_tools_host.cpp 73 | src/cosmotop_tools_shared.cpp 74 | src/cosmotop_plugin.cpp 75 | ${LIBCOSMO_PLUGIN_SOURCES} 76 | ) 77 | 78 | target_compile_options(cosmotop.com PRIVATE -mcosmo) 79 | target_include_directories(cosmotop.com SYSTEM PRIVATE ${THIRD_PARTY_INCLUDES}) 80 | 81 | # Enable pthreads 82 | set(THREADS_PREFER_PTHREAD_FLAG ON) 83 | find_package(Threads REQUIRED) 84 | 85 | set(LINK_LIBS 86 | Threads::Threads 87 | ) 88 | set(COMPILE_DEFINITIONS 89 | FMT_HEADER_ONLY 90 | _FILE_OFFSET_BITS=64 91 | ) 92 | 93 | target_link_libraries(cosmotop.com PRIVATE ${LINK_LIBS}) 94 | target_compile_definitions(cosmotop.com PRIVATE ${COMPILE_DEFINITIONS}) 95 | 96 | elseif(${TARGET} STREQUAL "plugin") 97 | 98 | set(BUILD_EXE ON) 99 | 100 | if(CMAKE_SYSTEM MATCHES "Linux") 101 | set(PLUGIN_SOURCES 102 | src/cosmotop_plugin.cpp 103 | src/cosmotop_shared.cpp 104 | src/cosmotop_tools_shared.cpp 105 | src/linux/cosmotop_collect.cpp 106 | src/linux/intel_gpu_top/intel_gpu_top.c 107 | src/linux/intel_gpu_top/igt_perf.c 108 | src/linux/intel_gpu_top/intel_device_info.c 109 | src/linux/intel_gpu_top/intel_name_lookup_shim.c 110 | ${LIBCOSMO_PLUGIN_SOURCES} 111 | ) 112 | set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") 113 | 114 | if(RSMI_STATIC) 115 | # ROCm doesn't properly add it's folders to the module path if `CMAKE_MODULE_PATH` is already 116 | # set 117 | # We could also manually append ROCm's path here 118 | set(_CMAKE_MODULE_PATH CMAKE_MODULE_PATH) 119 | unset(CMAKE_MODULE_PATH) 120 | 121 | # Build a static ROCm library 122 | set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) 123 | 124 | add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/rocm_smi_lib EXCLUDE_FROM_ALL) 125 | 126 | add_library(ROCm INTERFACE) 127 | # Export ROCm's properties to a target 128 | target_compile_definitions(ROCm INTERFACE RSMI_STATIC) 129 | target_include_directories(ROCm INTERFACE ${PROJECT_SOURCE_DIR}/third_party/rocm_smi_lib/include) 130 | target_link_libraries(ROCm INTERFACE rocm_smi64) 131 | 132 | set(CMAKE_MODULE_PATH _CMAKE_MODULE_PATH) 133 | endif() 134 | elseif(CMAKE_SYSTEM MATCHES "Darwin") 135 | set(PLUGIN_SOURCES 136 | src/cosmotop_plugin.cpp 137 | src/cosmotop_shared.cpp 138 | src/cosmotop_tools_shared.cpp 139 | src/osx/cosmotop_collect.cpp 140 | src/osx/sensors.cpp 141 | src/osx/smc.cpp 142 | src/osx/ioreport.cpp 143 | ${LIBCOSMO_PLUGIN_SOURCES} 144 | ) 145 | set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version") 146 | elseif(CMAKE_SYSTEM MATCHES "Windows") 147 | set(PLUGIN_SOURCES 148 | src/cosmotop_plugin.cpp 149 | src/cosmotop_shared.cpp 150 | src/cosmotop_tools_shared.cpp 151 | src/windows/cosmotop_collect.cpp 152 | ${LIBCOSMO_PLUGIN_SOURCES} 153 | ) 154 | 155 | # Windows doesn't exit properly 156 | set(BUILD_EXE OFF) 157 | 158 | # range/v3 doesn't compile properly with MSVC, so prefer stdlib ranges on Windows 159 | check_include_file_cxx(ranges CXX_HAVE_RANGES) 160 | if(NOT CXX_HAVE_RANGES) 161 | message(FATAL_ERROR "The compiler doesn't support ") 162 | endif() 163 | elseif(CMAKE_SYSTEM MATCHES "FreeBSD") 164 | set(PLUGIN_SOURCES 165 | src/cosmotop_plugin.cpp 166 | src/cosmotop_shared.cpp 167 | src/cosmotop_tools_shared.cpp 168 | src/freebsd/cosmotop_collect.cpp 169 | ${LIBCOSMO_PLUGIN_SOURCES} 170 | ) 171 | find_package(devstat REQUIRED) 172 | find_package(kvm REQUIRED) 173 | find_package(elf REQUIRED) 174 | elseif(CMAKE_SYSTEM MATCHES "NetBSD") 175 | set(PLUGIN_SOURCES 176 | src/cosmotop_plugin.cpp 177 | src/cosmotop_shared.cpp 178 | src/cosmotop_tools_shared.cpp 179 | src/netbsd/cosmotop_collect.cpp 180 | ${LIBCOSMO_PLUGIN_SOURCES} 181 | ) 182 | find_package(kvm REQUIRED) 183 | find_package(proplib REQUIRED) 184 | elseif(CMAKE_SYSTEM MATCHES "OpenBSD") 185 | set(PLUGIN_SOURCES 186 | src/cosmotop_plugin.cpp 187 | src/cosmotop_shared.cpp 188 | src/cosmotop_tools_shared.cpp 189 | src/openbsd/cosmotop_collect.cpp 190 | src/openbsd/sysctlbyname.cpp 191 | ${LIBCOSMO_PLUGIN_SOURCES} 192 | ) 193 | find_package(kvm REQUIRED) 194 | else() 195 | message(FATAL_ERROR "Unsupported platform") 196 | endif() 197 | 198 | if(BUILD_EXE) 199 | if(CMAKE_SYSTEM MATCHES "Windows") 200 | set(BINARY_NAME "cosmotop-plugin") 201 | else() 202 | set(BINARY_NAME "cosmotop-plugin.exe") 203 | endif() 204 | add_executable(${BINARY_NAME} ${PLUGIN_SOURCES}) 205 | target_compile_definitions(${BINARY_NAME} PRIVATE COSMO_PLUGIN_WANT_MAIN) 206 | if(CMAKE_SYSTEM MATCHES "Linux") 207 | target_compile_options(${BINARY_NAME} PRIVATE -static) 208 | endif() 209 | else() 210 | set(BINARY_NAME "cosmotop-plugin") 211 | add_library(${BINARY_NAME} SHARED ${PLUGIN_SOURCES}) 212 | endif() 213 | 214 | target_include_directories(${BINARY_NAME} PRIVATE ${THIRD_PARTY_INCLUDES}) 215 | target_compile_definitions(${BINARY_NAME} PRIVATE FMT_HEADER_ONLY _FILE_OFFSET_BITS=64) 216 | if(CMAKE_SYSTEM MATCHES "Windows") 217 | target_compile_options(${BINARY_NAME} PRIVATE /utf-8) 218 | target_compile_definitions(${BINARY_NAME} PRIVATE UNICODE _UNICODE) 219 | endif() 220 | 221 | set(THREADS_PREFER_PTHREAD_FLAG ON) 222 | find_package(Threads REQUIRED) 223 | 224 | target_link_libraries(${BINARY_NAME} PRIVATE Threads::Threads) 225 | if(CMAKE_SYSTEM MATCHES "Linux" AND RSMI_STATIC) 226 | target_link_libraries(${BINARY_NAME} PRIVATE ROCm) 227 | elseif(CMAKE_SYSTEM MATCHES "Darwin") 228 | target_link_libraries(${BINARY_NAME} PRIVATE $ $ IOReport) 229 | elseif(CMAKE_SYSTEM MATCHES "FreeBSD") 230 | target_link_libraries(${BINARY_NAME} PRIVATE devstat::devstat kvm::kvm elf::elf) 231 | elseif(CMAKE_SYSTEM MATCHES "NetBSD") 232 | target_link_libraries(${BINARY_NAME} PRIVATE kvm::kvm proplib::proplib) 233 | elseif(CMAKE_SYSTEM MATCHES "OpenBSD") 234 | target_link_libraries(${BINARY_NAME} PRIVATE kvm::kvm) 235 | endif() 236 | 237 | endif() # TARGET 238 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:latest AS setup 2 | ADD cosmotop.exe / 3 | RUN wget -O /ape https://cosmo.zip/pub/cosmos/bin/ape-$(uname -m).elf 4 | RUN chmod +x /ape && chmod +x /cosmotop.exe 5 | 6 | FROM scratch AS cosmotop 7 | COPY --from=setup /cosmotop.exe /ape / 8 | ENV LANG=en_US.UTF-8 9 | ENTRYPOINT ["/ape", "/cosmotop.exe"] -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ![cosmotop](img/logo.svg) 2 | 3 | `cosmotop` is a system monitoring tool distributed as a single executable for multiple platforms. 4 | A fork of [`btop++`](https://github.com/aristocratos/btop) and built with 5 | [Cosmopolitan Libc](https://github.com/jart/cosmopolitan). 6 | 7 | ## Installation 8 | 9 | Download `cosmotop` from [GitHub releases](https://github.com/bjia56/cosmotop/releases/latest). 10 | Place it anywhere and run! 11 | 12 | ### Homebrew 13 | 14 | The Homebrew tap [`bjia56/tap`](https://github.com/bjia56/homebrew-tap) supports installing the latest `cosmotop` from GitHub releases on both MacOS and Linux. 15 | 16 | ```bash 17 | brew tap bjia56/tap 18 | brew install cosmotop 19 | ``` 20 | 21 | ### Docker 22 | 23 | A Docker image is available for Linux x86_64 and aarch64 hosts. 24 | 25 | ```bash 26 | docker run -it --rm --net=host --pid=host ghcr.io/bjia56/cosmotop:latest 27 | ``` 28 | 29 | ### Windows setup notes 30 | 31 | On Windows, rename `cosmotop` to either `cosmotop.cmd` or `cosmotop.bat` before running. This allows Windows to execute the file as a batch script, which can then properly self-extract and execute the embedded executable. 32 | 33 | ## Usage and features 34 | 35 | ``` 36 | Usage: cosmotop [OPTIONS] 37 | 38 | Options: 39 | -h, --help show this help message and exit 40 | -v, --version show version info and exit 41 | -lc, --low-color disable truecolor, converts 24-bit colors to 256-color 42 | -t, --tty_on force (ON) tty mode, max 16 colors and tty friendly graph symbols 43 | +t, --tty_off force (OFF) tty mode 44 | -p, --preset start with preset, integer value between 0-9 45 | -u, --update set the program update rate in milliseconds 46 | -o, --option override a configuration option in KEY=VALUE format, can use multiple times 47 | --utf-force force start even if no UTF-8 locale was detected 48 | --show-defaults print default configuration values to stdout 49 | --show-themes list all available themes 50 | --licenses display licenses of open-source software used in cosmotop 51 | --debug start in DEBUG mode: shows microsecond timer for information collect 52 | and screen draw functions and sets loglevel to DEBUG 53 | ``` 54 | 55 | ### GPU monitoring 56 | 57 | Monitoring of GPUs is supported on Linux and Windows. 58 | - Windows: LibreHardwareMonitor is included with `cosmotop` and automatically used to fetch GPU information. 59 | - Linux: Intel, AMD, and NVIDIA GPUs are supported, provided the appropriate driver is installed, and the following: 60 | - Intel: Root privileges are required to access metrics directly. Alternatively, run [intel-gpu-exporter](https://github.com/bjia56/intel-gpu-exporter) in a privileged Docker container, then set the `intel_gpu_exporter` configuration option in `cosmotop` to the exporter's HTTP endpoint. 61 | - AMD: `rocm_smi_lib` is statically linked and should work out of the box. 62 | - NVIDIA: `libnvidia-ml.so` must be available. 63 | 64 | ### NPU monitoring 65 | 66 | Utilization monitoring of Intel and Rockchip NPUs is supported on Linux, provided the following: 67 | - Intel: The path `/sys/devices/pci0000:00/0000:00:0b.0` must be readable. 68 | - Rockchip: The path `/sys/kernel/debug/rknpu` must be readable. 69 | 70 | Utilization monitoring of the Apple Neural Engine is supported on Apple Silicon. Sudo is not required. 71 | 72 | ### Configuration 73 | 74 | The configuration file for `cosmotop` is stored at `~/.config/cosmotop/cosmotop.conf`, populated with defaults 75 | the first time the program runs. 76 | 77 | ### Themes 78 | 79 | A number of themes are available within `cosmotop`. Place custom themes at `~/.config/cosmotop/themes`. 80 | 81 | ## Supported platforms 82 | 83 | `cosmotop` supports the following operating systems and architectures: 84 | 85 | - Linux 2.6.18+ (x86_64, aarch64, powerpc64le, s390x, and riscv64) 86 | - MacOS 13+ (x86_64 and aarch64) 87 | - Windows 10+ (x86_64) 88 | - FreeBSD 13+ (x86_64 and aarch64) 89 | - NetBSD 10.0+ (x86_64 and aarch64) 90 | - OpenBSD 7.6+ (x86_64 and aarch64) 91 | 92 | Core platforms (Linux x86_64/aarch64, MacOS, Windows) are self-contained and require no additional tooling. 93 | Other platforms require that the host `PATH` contains either `curl`, `wget`, or `python3` to download required plugin components (see [below](#how-it-works)). 94 | 95 | ## How it works 96 | 97 | `cosmotop` uses [Cosmopolitan Libc](https://github.com/jart/cosmopolitan) and the 98 | [Actually Portable Executable](https://justine.lol/ape.html) (APE) and [Chimp](https://github.com/bjia56/chimp) file formats to create a single executable capable of 99 | running on multiple operating systems and architectures. This multiplatform executable contains code to draw 100 | the terminal UI and handle generic systems metrics, like processes, memory, disk, etc. At runtime, the APE executable is extracted out to disk before execution. On Windows, the APE 101 | runs natively. On UNIX, a small loader binary is additionally extracted to run the APE executable. 102 | 103 | Collecting real data from the underlying system is done by helper [plugins](https://github.com/bjia56/libcosmo_plugin), which are built for each target platform using host-native compilers and libraries. On core platforms (see [above](#supported-platforms)), plugins are bundled into `cosmotop` and extracted out onto the host under the path `~/.cosmotop`. On other platforms, plugins are downloaded from GitHub releases from the same release tag as `cosmotop` and placed under `~/.cosmotop`, and are optionally re-bundled into the executable. Plugins are used at runtime to gather system metrics that are then displayed by the primary multiplatform executable process in the terminal. 104 | 105 | For platforms not supported natively by Cosmpolitan Libc, `cosmotop` uses the [Blink](https://github.com/jart/blink) lightweight virtual machine 106 | to run the x86_64 version of `cosmotop`. Data collection is still done by host-native plugin executables. 107 | 108 | ## Building from source 109 | 110 | `cosmotop` is built with CMake. Both the multiplatform host executable and platform-native plugins can be built with the CMakeLists.txt at the root of this repository, but they *must be built with separate CMake invocations* due to the usage of different compilers. 111 | 112 | ### Building the multiplatform "host" executable 113 | 114 | Download the `cosmocc` toolchain (`cosmocc-X.Y.Z.zip`) from the Cosmopolitan [GitHub releases](https://github.com/jart/cosmopolitan/releases/latest) and extract it somewhere on your filesystem. Add the `bin` directory to `PATH` to ensure the compilers can be found. For best results, compile this part on Linux. 115 | 116 | On Linux, it may be needed to [modify `binfmt_misc`](#linux-troubleshooting) to run the `cosmocc` toolchain. 117 | 118 | ```bash 119 | export CC=cosmocc 120 | export CXX=cosmoc++ 121 | cmake -B build-host -DTARGET=host 122 | cmake --build build 123 | # or: cmake --build build --parallel 124 | ``` 125 | 126 | This should produce a `cosmotop.com` binary. 127 | 128 | ### Building platform-native "plugin" binaries 129 | 130 | Platform-native plugins are built as executables on all supported platforms except Windows, which builds as a DLL. 131 | To tell CMake to build plugins, use `-DTARGET=plugin`. 132 | 133 | ```bash 134 | cmake -B build-plugin -DTARGET=plugin 135 | cmake --build build 136 | # or: cmake --build build --parallel 137 | ``` 138 | 139 | This should produce a `cosmotop-plugin.exe` (or `cosmotop-plugin.dll` on Windows). Rename it to one of the following, matching the target platform: 140 | 141 | ``` 142 | cosmotop-linux-x86_64.exe 143 | cosmotop-linux-aarch64.exe 144 | cosmotop-macos-x86_64.exe 145 | cosmotop-macos-aarch64.exe 146 | cosmotop-windows-x86_64.dll 147 | cosmotop-freebsd-x86_64.exe 148 | cosmotop-freebsd-aarch64.exe 149 | cosmotop-netbsd-x86_64.exe 150 | cosmotop-netbsd-aarch64.exe 151 | cosmotop-openbsd-x86_64.exe 152 | ``` 153 | 154 | ### Bundling everything together 155 | 156 | The plugin binaries can be added to `cosmotop.com` with `zip`, for example: 157 | 158 | ```bash 159 | zip cosmotop.com cosmotop-linux-x86_64.exe 160 | ``` 161 | 162 | Themes can also be bundled: 163 | 164 | ```bash 165 | zip -r cosmotop.com themes/ 166 | ``` 167 | 168 | Optionally, rename `cosmotop.com` to `cosmotop.exe`. 169 | 170 | ### Optional: Producing a Chimp executable 171 | 172 | Download `chimplink` from the Chimp [GitHub releases](https://github.com/bjia56/chimp/releases/latest) and add it to your `PATH`. 173 | 174 | Build Blink VMs for any platforms not natively supported by Cosmopolitan Libc. Prebuilts for a variety of platforms are available from Blinkverse [GitHub releases](https://github.com/bjia56/blinkverse/releases). 175 | 176 | Use `chimplink` to bundle `cosmotop.exe` with your selection of loaders, for example: 177 | 178 | ```bash 179 | cosmo_bin=$(dirname $(which cosmocc)) 180 | chimplink cosmotop.exe cosmotop some_string_here \ 181 | ${cosmo_bin}/ape-x86_64.elf \ 182 | ${cosmo_bin}/ape-aarch64.elf \ 183 | --os Linux blink-linux-* \ 184 | --os NetBSD blink-netbsd-* \ 185 | --os OpenBSD blink-openbsd-* 186 | ``` 187 | 188 | For optimal Chimp startup performance, instead of using `cosmotop.com` after the host build above, use `apelink` to produce a version that has a special embedded string: 189 | 190 | ```bash 191 | cosmo_bin=$(dirname $(which cosmocc)) 192 | apelink \ 193 | -S "V=some_string_here" \ 194 | -l ${cosmo_bin}/ape-x86_64.elf \ 195 | -M ${cosmo_bin}/ape-m1.c \ 196 | -o cosmotop.com \ 197 | build/cosmotop.com.dbg \ 198 | build/cosmotop.aarch64.elf 199 | ``` 200 | 201 | The final Chimp executable will check if the string matches before overwriting the extracted file on disk. A good choice for this string is a git SHA for uniqueness. 202 | 203 | ## Licensing 204 | 205 | Unless otherwise stated, the code in this repository is licensed under Apache-2.0. 206 | 207 | For the most up to date list of licenses included in `cosmotop` release builds, run `cosmotop.exe --licenses`. 208 | -------------------------------------------------------------------------------- /cmake/Modules/Finddevstat.cmake: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: Apache-2.0 2 | # 3 | # Find devstat, the Device Statistics Library 4 | # 5 | 6 | if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") 7 | find_path(devstat_INCLUDE_DIR NAMES devstat.h) 8 | find_library(devstat_LIBRARY NAMES devstat) 9 | 10 | include(FindPackageHandleStandardArgs) 11 | find_package_handle_standard_args(devstat REQUIRED_VARS devstat_LIBRARY devstat_INCLUDE_DIR) 12 | 13 | if(devstat_FOUND AND NOT TARGET devstat::devstat) 14 | add_library(devstat::devstat UNKNOWN IMPORTED) 15 | set_target_properties(devstat::devstat PROPERTIES 16 | IMPORTED_LOCATION "${devstat_LIBRARY}" 17 | INTERFACE_INCLUDE_DIRECTORIES "${devstat_INCLUDE_DIR}" 18 | ) 19 | endif() 20 | 21 | mark_as_advanced(devstat_INCLUDE_DIR devstat_LIBRARY) 22 | endif() 23 | 24 | -------------------------------------------------------------------------------- /cmake/Modules/Findelf.cmake: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: Apache-2.0 2 | # 3 | # Find libelf, the ELF Access Library 4 | # 5 | 6 | if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") 7 | find_path(elf_INCLUDE_DIR NAMES libelf.h) 8 | find_library(elf_LIBRARY NAMES elf) 9 | 10 | include(FindPackageHandleStandardArgs) 11 | find_package_handle_standard_args(elf REQUIRED_VARS elf_LIBRARY elf_INCLUDE_DIR) 12 | 13 | if(elf_FOUND AND NOT TARGET elf::elf) 14 | add_library(elf::elf UNKNOWN IMPORTED) 15 | set_target_properties(elf::elf PROPERTIES 16 | IMPORTED_LOCATION "${elf_LIBRARY}" 17 | INTERFACE_INCLUDE_DIRECTORIES "${elf_INCLUDE_DIR}" 18 | ) 19 | endif() 20 | 21 | mark_as_advanced(elf_INCLUDE_DIR elf_LIBRARY) 22 | endif() 23 | 24 | -------------------------------------------------------------------------------- /cmake/Modules/Findkvm.cmake: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: Apache-2.0 2 | # 3 | # Find libkvm, the Kernel Data Access Library 4 | # 5 | 6 | if(BSD) 7 | find_path(kvm_INCLUDE_DIR NAMES kvm.h) 8 | find_library(kvm_LIBRARY NAMES kvm) 9 | 10 | include(FindPackageHandleStandardArgs) 11 | find_package_handle_standard_args(kvm REQUIRED_VARS kvm_LIBRARY kvm_INCLUDE_DIR) 12 | 13 | if(kvm_FOUND AND NOT TARGET kvm::kvm) 14 | add_library(kvm::kvm UNKNOWN IMPORTED) 15 | set_target_properties(kvm::kvm PROPERTIES 16 | IMPORTED_LOCATION "${kvm_LIBRARY}" 17 | INTERFACE_INCLUDE_DIRECTORIES "${kvm_INCLUDE_DIR}" 18 | ) 19 | endif() 20 | 21 | mark_as_advanced(kvm_INCLUDE_DIR kvm_LIBRARY) 22 | endif() 23 | 24 | -------------------------------------------------------------------------------- /cmake/Modules/Findproplib.cmake: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: Apache-2.0 2 | # 3 | # Find proplib – property container object library 4 | # 5 | 6 | if(BSD) 7 | find_path(proplib_INCLUDE_DIR NAMES prop/proplib.h) 8 | find_library(proplib_LIBRARY NAMES libprop prop) 9 | 10 | include(FindPackageHandleStandardArgs) 11 | find_package_handle_standard_args(proplib REQUIRED_VARS proplib_LIBRARY proplib_INCLUDE_DIR) 12 | 13 | if(proplib_FOUND AND NOT TARGET proplib::proplib) 14 | add_library(proplib::proplib UNKNOWN IMPORTED) 15 | set_target_properties(proplib::proplib PROPERTIES 16 | IMPORTED_LOCATION "${proplib_LIBRARY}" 17 | INTERFACE_INCLUDE_DIRECTORIES "${proplib_INCLUDE_DIR}" 18 | ) 19 | endif() 20 | 21 | mark_as_advanced(proplib_INCLUDE_DIR proplib_LIBRARY) 22 | endif() 23 | 24 | -------------------------------------------------------------------------------- /img/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /src/config.h.in: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | 3 | #pragma once 4 | 5 | #include 6 | 7 | constexpr std::string_view GIT_COMMIT = "@GIT_COMMIT@"; 8 | constexpr std::string_view COMPILER = "@COMPILER@"; 9 | constexpr std::string_view COMPILER_VERSION = "@COMPILER_VERSION@"; 10 | constexpr std::string_view CONFIGURE_COMMAND = "@CONFIGURE_COMMAND@"; 11 | -------------------------------------------------------------------------------- /src/cosmotop_config.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 Aristocratos (jakob@qvantnet.com) 2 | Copyright 2025 Brett Jia (dev.bjia56@gmail.com) 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | indent = tab 17 | tab-size = 4 18 | */ 19 | 20 | #pragma once 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | using std::string; 30 | using std::vector; 31 | 32 | //* Functions and variables for reading and writing the cosmotop config file 33 | namespace Config { 34 | 35 | extern std::filesystem::path conf_dir; 36 | extern std::filesystem::path conf_file; 37 | 38 | extern std::unordered_map strings; 39 | extern std::unordered_map stringsTmp; 40 | extern std::unordered_map stringsOverrides; 41 | extern std::unordered_map bools; 42 | extern std::unordered_map boolsTmp; 43 | extern std::unordered_map boolsOverrides; 44 | extern std::unordered_map ints; 45 | extern std::unordered_map intsTmp; 46 | extern std::unordered_map intsOverrides; 47 | 48 | const vector valid_graph_symbols = { "braille", "block", "tty" }; 49 | const vector valid_graph_symbols_def = { "default", "braille", "block", "tty" }; 50 | const vector valid_boxes = { 51 | "cpu", "mem", "net", "proc", 52 | "gpu0", "gpu1", "gpu2", "gpu3", "gpu4", "gpu5", 53 | "npu0", "npu1", "npu2", 54 | }; 55 | const vector temp_scales = { "celsius", "fahrenheit", "kelvin", "rankine" }; 56 | const vector show_gpu_values = { "Auto", "On", "Off" }; 57 | const vector show_npu_values = { "Auto", "On", "Off" }; 58 | extern vector current_boxes; 59 | extern vector preset_list; 60 | extern vector available_batteries; 61 | extern int current_preset; 62 | 63 | void push_back_available_batteries(const string& battery); 64 | std::unordered_map& get_ints(); 65 | void ints_set_at(const std::string_view name, const int value); 66 | 67 | constexpr int ONE_DAY_MILLIS = 1000 * 60 * 60 * 24; 68 | 69 | [[nodiscard]] std::optional get_config_dir() noexcept; 70 | 71 | //* Check if string only contains space separated valid names for boxes and set current_boxes 72 | bool set_boxes(const string& boxes); 73 | 74 | bool validBoxSizes(const string& boxes); 75 | 76 | //* Toggle box and update config string shown_boxes 77 | bool toggle_box(const string& box); 78 | 79 | //* Parse and setup config value presets 80 | bool presetsValid(const string& presets); 81 | 82 | //* Apply selected preset 83 | bool apply_preset(const string& preset); 84 | 85 | bool _locked(const std::string_view name); 86 | 87 | //* Return bool for config key 88 | bool getB(const std::string_view name); 89 | 90 | //* Return integer for config key 91 | const int& getI(const std::string_view name); 92 | 93 | //* Return string for config key 94 | const string& getS(const std::string_view name); 95 | 96 | string getAsString(const std::string_view name); 97 | 98 | extern string validError; 99 | 100 | bool intValid(const std::string_view name, const string& value); 101 | bool stringValid(const std::string_view name, const string& value); 102 | 103 | //* Set config key to bool 104 | inline void set(const std::string_view name, bool value) { 105 | if (_locked(name)) { 106 | boolsTmp.insert_or_assign(name, value); 107 | } else { 108 | bools.at(name) = value; 109 | if (boolsOverrides.contains(name)) boolsOverrides.erase(name); 110 | } 111 | } 112 | 113 | //* Set config key to int 114 | inline void set(const std::string_view name, const int value) { 115 | if (_locked(name)) { 116 | intsTmp.insert_or_assign(name, value); 117 | } else { 118 | ints.at(name) = value; 119 | if (intsOverrides.contains(name)) intsOverrides.erase(name); 120 | } 121 | } 122 | 123 | //* Set config key to string 124 | inline void set(const std::string_view name, const string& value) { 125 | if (_locked(name)) { 126 | stringsTmp.insert_or_assign(name, value); 127 | } else { 128 | strings.at(name) = value; 129 | if (stringsOverrides.contains(name)) stringsOverrides.erase(name); 130 | } 131 | } 132 | 133 | //* Flip config key bool 134 | void flip(const std::string_view name); 135 | 136 | //* Lock config and cache changes until unlocked 137 | void lock(); 138 | 139 | //* Unlock config and write any cached values to config 140 | void unlock(); 141 | 142 | //* Load the config file from disk 143 | void load(const std::filesystem::path& conf_file, vector& load_warnings); 144 | 145 | //* Load config overrides from a stream 146 | void loadOverrides(std::istream& conf, vector& load_warnings); 147 | 148 | //* Write the config file to disk 149 | void write(); 150 | 151 | //* Write the config file to a stream 152 | void write(std::ostream& cwrite); 153 | } 154 | -------------------------------------------------------------------------------- /src/cosmotop_draw.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 Aristocratos (jakob@qvantnet.com) 2 | Copyright 2025 Brett Jia (dev.bjia56@gmail.com) 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | indent = tab 17 | tab-size = 4 18 | */ 19 | 20 | #pragma once 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | using std::array; 29 | using std::deque; 30 | using std::string; 31 | using std::vector; 32 | 33 | namespace Symbols { 34 | const string h_line = "─"; 35 | const string v_line = "│"; 36 | const string dotted_v_line = "╎"; 37 | const string left_up = "┌"; 38 | const string right_up = "┐"; 39 | const string left_down = "└"; 40 | const string right_down = "┘"; 41 | const string round_left_up = "╭"; 42 | const string round_right_up = "╮"; 43 | const string round_left_down = "╰"; 44 | const string round_right_down = "╯"; 45 | const string title_left_down = "┘"; 46 | const string title_right_down = "└"; 47 | const string title_left = "┐"; 48 | const string title_right = "┌"; 49 | const string div_right = "┤"; 50 | const string div_left = "├"; 51 | const string div_up = "┬"; 52 | const string div_down = "┴"; 53 | 54 | 55 | const string up = "↑"; 56 | const string down = "↓"; 57 | const string left = "←"; 58 | const string right = "→"; 59 | const string enter = "↵"; 60 | } 61 | 62 | namespace Draw { 63 | 64 | //* Generate if needed and return the cosmotop banner 65 | string banner_gen(int y=0, int x=0, bool centered=false, bool redraw=false); 66 | 67 | //* An editable text field 68 | class TextEdit { 69 | size_t pos{}; 70 | size_t upos{}; 71 | bool numeric; 72 | public: 73 | string text; 74 | TextEdit(); 75 | TextEdit(string text, bool numeric=false); 76 | bool command(const string& key); 77 | string operator()(const size_t limit=0); 78 | void clear(); 79 | }; 80 | 81 | //* Create a box and return as a string 82 | string createBox(const int x, const int y, const int width, 83 | const int height, string line_color = "", bool fill = false, 84 | const string title = "", const string title2 = "", const int num = 0); 85 | 86 | bool update_clock(bool force = false); 87 | 88 | //* Class holding a percentage meter 89 | class Meter { 90 | int width; 91 | string color_gradient; 92 | bool invert; 93 | array cache; 94 | public: 95 | Meter(); 96 | Meter(const int width, const string& color_gradient, bool invert = false); 97 | 98 | //* Return a string representation of the meter with given value 99 | string operator()(int value); 100 | }; 101 | 102 | //* Class holding a percentage graph 103 | class Graph { 104 | int width, height; 105 | string color_gradient; 106 | string out, symbol = "default"; 107 | bool invert, no_zero; 108 | long long offset; 109 | long long last = 0, max_value = 0; 110 | bool current = true, tty_mode = false; 111 | std::unordered_map> graphs = { {true, {}}, {false, {}}}; 112 | 113 | //* Create two representations of the graph to switch between to represent two values for each braille character 114 | void _create(const deque& data, int data_offset); 115 | 116 | public: 117 | Graph(); 118 | Graph(int width, int height, 119 | const string& color_gradient, 120 | const deque& data, 121 | const string& symbol="default", 122 | bool invert=false, bool no_zero=false, 123 | long long max_value=0, long long offset=0); 124 | 125 | //* Add last value from back of and return string representation of graph 126 | string& operator()(const deque& data, bool data_same=false); 127 | 128 | //* Return string representation of graph 129 | string& operator()(); 130 | }; 131 | 132 | //* Calculate sizes of boxes, draw outlines and save to enabled boxes namespaces 133 | void calcSizes(); 134 | } 135 | 136 | namespace Proc { 137 | extern Draw::TextEdit filter; 138 | extern std::unordered_map p_graphs; 139 | extern std::unordered_map p_counters; 140 | 141 | // Taking into account the multiline processes, converts a selected 142 | // row into the true selected row in the process list 143 | int selected_to_true_selected(int selected); 144 | } 145 | -------------------------------------------------------------------------------- /src/cosmotop_input.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 Aristocratos (jakob@qvantnet.com) 2 | Copyright 2025 Brett Jia (dev.bjia56@gmail.com) 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | indent = tab 17 | tab-size = 4 18 | */ 19 | 20 | #pragma once 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | using std::array; 29 | using std::atomic; 30 | using std::deque; 31 | using std::string; 32 | 33 | /* The input functions rely on the following termios parameters being set: 34 | Non-canonical mode (c_lflags & ~(ICANON)) 35 | VMIN and VTIME (c_cc) set to 0 36 | These will automatically be set when running Term::init() from cosmotop_tools.cpp 37 | */ 38 | 39 | //* Functions and variables for handling keyboard and mouse input 40 | namespace Input { 41 | 42 | struct Mouse_loc { 43 | int line, col, height, width; 44 | }; 45 | 46 | //? line, col, height, width 47 | extern std::unordered_map mouse_mappings; 48 | 49 | //* Signal mask used during polling read 50 | extern sigset_t signal_mask; 51 | 52 | extern atomic polling; 53 | 54 | //* Mouse column and line position 55 | extern array mouse_pos; 56 | 57 | //* Last entered key 58 | extern deque history; 59 | 60 | //* Poll keyboard & mouse input for ms and return input availability as a bool 61 | bool poll(const uint64_t timeout=0); 62 | 63 | //* Get a key or mouse action from input 64 | string get(); 65 | 66 | //* Wait until input is available and return key 67 | string wait(); 68 | 69 | //* Interrupt poll/wait 70 | void interrupt(); 71 | 72 | //* Clears last entered key 73 | void clear(); 74 | 75 | //* Process actions for input 76 | void process(const string& key); 77 | 78 | } 79 | -------------------------------------------------------------------------------- /src/cosmotop_menu.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 Aristocratos (jakob@qvantnet.com) 2 | Copyright 2025 Brett Jia (dev.bjia56@gmail.com) 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | indent = tab 17 | tab-size = 4 18 | */ 19 | 20 | #pragma once 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | #include "cosmotop_input.hpp" 28 | 29 | using std::atomic; 30 | using std::bitset; 31 | using std::string; 32 | using std::vector; 33 | 34 | namespace Menu { 35 | 36 | extern atomic active; 37 | extern string output; 38 | extern int signalToSend; 39 | extern bool redraw; 40 | 41 | //? line, col, height, width 42 | extern std::unordered_map mouse_mappings; 43 | 44 | //* Creates a message box centered on screen 45 | //? Height of box is determined by size of content vector 46 | //? Boxtypes: 0 = OK button | 1 = YES and NO with YES selected | 2 = Same as 1 but with NO selected 47 | //? Strings in content vector is not checked for box width overflow 48 | class msgBox { 49 | string box_contents, button_left, button_right; 50 | int height{}; 51 | int width{}; 52 | int boxtype{}; 53 | int selected{}; 54 | int x{}; 55 | int y{}; 56 | public: 57 | enum BoxTypes { OK, YES_NO, NO_YES }; 58 | enum msgReturn { 59 | Invalid, 60 | Ok_Yes, 61 | No_Esc, 62 | Select 63 | }; 64 | msgBox(); 65 | msgBox(int width, int boxtype, vector content, string title); 66 | 67 | //? Draw and return box as a string 68 | string operator()(); 69 | 70 | //? Process input and returns value from enum Ret 71 | int input(string key); 72 | 73 | //? Clears content vector and private strings 74 | void clear(); 75 | }; 76 | 77 | extern bitset<8> menuMask; 78 | 79 | //* Enum for functions in vector menuFuncs 80 | enum Menus { 81 | SizeError, 82 | SignalChoose, 83 | SignalSend, 84 | SignalReturn, 85 | Options, 86 | Help, 87 | Main 88 | }; 89 | 90 | //* Handles redirection of input for menu functions and handles return codes 91 | void process(string key=""); 92 | 93 | //* Show a menu from enum Menu::Menus 94 | void show(int menu, int signal=-1); 95 | 96 | } 97 | -------------------------------------------------------------------------------- /src/cosmotop_plugin.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2025 Brett Jia (dev.bjia56@gmail.com) 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | 15 | indent = tab 16 | tab-size = 4 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | 23 | void create_plugin_host(); 24 | bool is_plugin_loaded(); 25 | void trigger_plugin_refresh(); 26 | void shutdown_plugin(); 27 | std::string plugin_build_info(); -------------------------------------------------------------------------------- /src/cosmotop_shared.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 Aristocratos (jakob@qvantnet.com) 2 | Copyright 2025 Brett Jia (dev.bjia56@gmail.com) 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | indent = tab 17 | tab-size = 4 18 | */ 19 | 20 | #include 21 | #include 22 | 23 | #include "cosmotop_config.hpp" 24 | #include "cosmotop_shared.hpp" 25 | #include "cosmotop_tools.hpp" 26 | 27 | using namespace Tools; 28 | 29 | namespace Proc { 30 | void proc_sorter(vector& proc_vec, const string& sorting, bool reverse, bool tree) { 31 | if (reverse) { 32 | switch (v_index(sort_vector, sorting)) { 33 | case 0: rng::stable_sort(proc_vec, rng::less{}, &proc_info::pid); break; 34 | case 1: rng::stable_sort(proc_vec, rng::less{}, &proc_info::name); break; 35 | case 2: rng::stable_sort(proc_vec, rng::less{}, &proc_info::cmd); break; 36 | case 3: rng::stable_sort(proc_vec, rng::less{}, &proc_info::threads); break; 37 | case 4: rng::stable_sort(proc_vec, rng::less{}, &proc_info::user); break; 38 | case 5: rng::stable_sort(proc_vec, rng::less{}, &proc_info::mem); break; 39 | case 6: rng::stable_sort(proc_vec, rng::less{}, &proc_info::cpu_p); break; 40 | case 7: rng::stable_sort(proc_vec, rng::less{}, &proc_info::cpu_c); break; 41 | } 42 | } 43 | else { 44 | switch (v_index(sort_vector, sorting)) { 45 | case 0: rng::stable_sort(proc_vec, rng::greater{}, &proc_info::pid); break; 46 | case 1: rng::stable_sort(proc_vec, rng::greater{}, &proc_info::name); break; 47 | case 2: rng::stable_sort(proc_vec, rng::greater{}, &proc_info::cmd); break; 48 | case 3: rng::stable_sort(proc_vec, rng::greater{}, &proc_info::threads); break; 49 | case 4: rng::stable_sort(proc_vec, rng::greater{}, &proc_info::user); break; 50 | case 5: rng::stable_sort(proc_vec, rng::greater{}, &proc_info::mem); break; 51 | case 6: rng::stable_sort(proc_vec, rng::greater{}, &proc_info::cpu_p); break; 52 | case 7: rng::stable_sort(proc_vec, rng::greater{}, &proc_info::cpu_c); break; 53 | } 54 | } 55 | 56 | //* When sorting with "cpu lazy" push processes over threshold cpu usage to the front regardless of cumulative usage 57 | if (not tree and not reverse and sorting == "cpu lazy") { 58 | double max = 10.0, target = 30.0; 59 | for (size_t i = 0, x = 0, offset = 0; i < proc_vec.size(); i++) { 60 | if (i <= 5 and proc_vec.at(i).cpu_p > max) 61 | max = proc_vec.at(i).cpu_p; 62 | else if (i == 6) 63 | target = (max > 30.0) ? max : 10.0; 64 | if (i == offset and proc_vec.at(i).cpu_p > 30.0) 65 | offset++; 66 | else if (proc_vec.at(i).cpu_p > target) { 67 | rotate(proc_vec.begin() + offset, proc_vec.begin() + i, proc_vec.begin() + i + 1); 68 | if (++x > 10) break; 69 | } 70 | } 71 | } 72 | } 73 | 74 | void tree_sort(vector& proc_vec, const string& sorting, bool reverse, int& c_index, const int index_max, bool collapsed) { 75 | if (proc_vec.size() > 1) { 76 | if (reverse) { 77 | switch (v_index(sort_vector, sorting)) { 78 | case 3: rng::stable_sort(proc_vec, [](const auto& a, const auto& b) { return a.entry.get().threads < b.entry.get().threads; }); break; 79 | case 5: rng::stable_sort(proc_vec, [](const auto& a, const auto& b) { return a.entry.get().mem < b.entry.get().mem; }); break; 80 | case 6: rng::stable_sort(proc_vec, [](const auto& a, const auto& b) { return a.entry.get().cpu_p < b.entry.get().cpu_p; }); break; 81 | case 7: rng::stable_sort(proc_vec, [](const auto& a, const auto& b) { return a.entry.get().cpu_c < b.entry.get().cpu_c; }); break; 82 | } 83 | } 84 | else { 85 | switch (v_index(sort_vector, sorting)) { 86 | case 3: rng::stable_sort(proc_vec, [](const auto& a, const auto& b) { return a.entry.get().threads > b.entry.get().threads; }); break; 87 | case 5: rng::stable_sort(proc_vec, [](const auto& a, const auto& b) { return a.entry.get().mem > b.entry.get().mem; }); break; 88 | case 6: rng::stable_sort(proc_vec, [](const auto& a, const auto& b) { return a.entry.get().cpu_p > b.entry.get().cpu_p; }); break; 89 | case 7: rng::stable_sort(proc_vec, [](const auto& a, const auto& b) { return a.entry.get().cpu_c > b.entry.get().cpu_c; }); break; 90 | } 91 | } 92 | } 93 | 94 | for (auto& r : proc_vec) { 95 | r.entry.get().tree_index = (collapsed or r.entry.get().filtered ? index_max : c_index++); 96 | if (not r.children.empty()) { 97 | tree_sort(r.children, sorting, reverse, c_index, (collapsed or r.entry.get().collapsed or r.entry.get().tree_index == (size_t)index_max)); 98 | } 99 | } 100 | } 101 | 102 | bool matches_filter(const proc_info& proc, const std::string& filter) { 103 | if (filter.starts_with("!")) { 104 | if (filter.size() == 1) { 105 | return true; 106 | } 107 | std::regex regex{filter.substr(1), std::regex::extended}; 108 | return std::regex_search(std::to_string(proc.pid), regex) || 109 | std::regex_search(proc.name, regex) || std::regex_match(proc.cmd, regex) || 110 | std::regex_search(proc.user, regex); 111 | } else { 112 | return s_contains(std::to_string(proc.pid), filter) || 113 | s_contains_ic(proc.name, filter) || s_contains_ic(proc.cmd, filter) || 114 | s_contains_ic(proc.user, filter); 115 | } 116 | } 117 | 118 | void _tree_gen(proc_info& cur_proc, vector& in_procs, vector& out_procs, 119 | int cur_depth, bool collapsed, const string& filter, bool found, bool no_update, bool should_filter) { 120 | auto cur_pos = out_procs.size(); 121 | bool filtering = false; 122 | 123 | //? If filtering, include children of matching processes 124 | if (not found and (should_filter or not filter.empty())) { 125 | if (!matches_filter(cur_proc, filter)) { 126 | filtering = true; 127 | cur_proc.filtered = true; 128 | #ifndef __COSMOPOLITAN__ 129 | filter_found++; 130 | #else 131 | increment_filter_found(); 132 | #endif 133 | } 134 | else { 135 | found = true; 136 | cur_depth = 0; 137 | } 138 | } 139 | else if (cur_proc.filtered) cur_proc.filtered = false; 140 | 141 | cur_proc.depth = cur_depth; 142 | 143 | //? Set tree index position for process if not filtered out or currently in a collapsed sub-tree 144 | out_procs.push_back({ cur_proc, {} }); 145 | if (not collapsed and not filtering) { 146 | cur_proc.tree_index = out_procs.size() - 1; 147 | 148 | //? Try to find name of the binary file and append to program name if not the same 149 | if (cur_proc.short_cmd.empty() and not cur_proc.cmd.empty()) { 150 | std::string_view cmd_view = cur_proc.cmd; 151 | cmd_view = cmd_view.substr((size_t)0, std::min(cmd_view.find(' '), cmd_view.size())); 152 | cmd_view = cmd_view.substr(std::min(cmd_view.find_last_of('/') + 1, cmd_view.size())); 153 | cur_proc.short_cmd = string{cmd_view}; 154 | } 155 | } 156 | else { 157 | cur_proc.tree_index = in_procs.size(); 158 | } 159 | 160 | //? Recursive iteration over all children 161 | for (auto& p : rng::equal_range(in_procs, cur_proc.pid, rng::less{}, &proc_info::ppid)) { 162 | if (collapsed and not filtering) { 163 | cur_proc.filtered = true; 164 | } 165 | 166 | _tree_gen(p, in_procs, out_procs.back().children, cur_depth + 1, (collapsed or cur_proc.collapsed), filter, found, no_update, should_filter); 167 | 168 | if (not no_update and not filtering and (collapsed or cur_proc.collapsed)) { 169 | //auto& parent = cur_proc; 170 | cur_proc.cpu_p += p.cpu_p; 171 | cur_proc.cpu_c += p.cpu_c; 172 | cur_proc.mem += p.mem; 173 | cur_proc.threads += p.threads; 174 | #ifndef __COSMOPOLITAN__ 175 | filter_found++; 176 | #else 177 | increment_filter_found(); 178 | #endif 179 | p.filtered = true; 180 | } 181 | else if (Config::getB("proc_aggregate")) { 182 | cur_proc.cpu_p += p.cpu_p; 183 | cur_proc.cpu_c += p.cpu_c; 184 | cur_proc.mem += p.mem; 185 | cur_proc.threads += p.threads; 186 | } 187 | } 188 | if (collapsed or filtering) { 189 | return; 190 | } 191 | 192 | //? Add tree terminator symbol if it's the last child in a sub-tree 193 | if (out_procs.back().children.size() > 0 and out_procs.back().children.back().entry.get().prefix.size() >= 8 and not out_procs.back().children.back().entry.get().prefix.ends_with("]─")) 194 | out_procs.back().children.back().entry.get().prefix.replace(out_procs.back().children.back().entry.get().prefix.size() - 8, 8, " └─ "); 195 | 196 | //? Add collapse/expand symbols if process have any children 197 | out_procs.at(cur_pos).entry.get().prefix = " │ "s * cur_depth + (out_procs.at(cur_pos).children.size() > 0 ? (cur_proc.collapsed ? "[+]─" : "[-]─") : " ├─ "); 198 | 199 | } 200 | 201 | } 202 | -------------------------------------------------------------------------------- /src/cosmotop_theme.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 Aristocratos (jakob@qvantnet.com) 2 | Copyright 2025 Brett Jia (dev.bjia56@gmail.com) 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | indent = tab 17 | tab-size = 4 18 | */ 19 | 20 | #pragma once 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | using std::array; 29 | using std::string; 30 | using std::vector; 31 | 32 | namespace Theme { 33 | extern std::filesystem::path theme_dir; 34 | extern std::filesystem::path user_theme_dir; 35 | 36 | //* Contains "Default" and "TTY" at indices 0 and 1, otherwise full paths to theme files 37 | extern vector themes; 38 | 39 | //* Generate escape sequence for 24-bit or 256 color and return as a string 40 | //* Args hexa: ["#000000"-"#ffffff"] for color, ["#00"-"#ff"] for greyscale 41 | //* t_to_256: [true|false] convert 24bit value to 256 color value 42 | //* depth: ["fg"|"bg"] for either a foreground color or a background color 43 | string hex_to_color(string hexa, bool t_to_256=false, const string& depth="fg"); 44 | 45 | //* Generate escape sequence for 24-bit or 256 color and return as a string 46 | //* Args r: [0-255], g: [0-255], b: [0-255] 47 | //* t_to_256: [true|false] convert 24bit value to 256 color value 48 | //* depth: ["fg"|"bg"] for either a foreground color or a background color 49 | string dec_to_color(int r, int g, int b, bool t_to_256=false, const string& depth="fg"); 50 | 51 | //* List of system themes 52 | vector getSystemThemes(); 53 | 54 | //* List of themes bundled within zipos 55 | vector getBundledThemes(); 56 | 57 | //* List of user themes 58 | vector getUserThemes(); 59 | 60 | //* Update list of paths for available themes 61 | void updateThemes(); 62 | 63 | //* Set current theme from current "color_theme" value in config 64 | void setTheme(); 65 | 66 | extern std::unordered_map colors; 67 | extern std::unordered_map> rgbs; 68 | extern std::unordered_map> gradients; 69 | 70 | //* Return escape code for color 71 | inline const string& c(const string& name) { return colors.at(name); } 72 | 73 | //* Return array of escape codes for color gradient 74 | inline const array& g(string name) { return gradients.at(name); } 75 | 76 | //* Return array of red, green and blue in decimal for color 77 | inline const std::array& dec(string name) { return rgbs.at(name); } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /src/cosmotop_tools_host.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 Aristocratos (jakob@qvantnet.com) 2 | Copyright 2025 Brett Jia (dev.bjia56@gmail.com) 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | indent = tab 17 | tab-size = 4 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | #include 36 | 37 | #include "cosmotop_shared.hpp" 38 | #include "cosmotop_tools.hpp" 39 | #include "cosmotop_config.hpp" 40 | 41 | using std::cout; 42 | using std::floor; 43 | using std::flush; 44 | using std::max; 45 | using std::string_view; 46 | using std::to_string; 47 | 48 | using namespace std::literals; // to use operator""s 49 | 50 | namespace fs = std::filesystem; 51 | namespace rng = ranges; 52 | 53 | //? ------------------------------------------------- NAMESPACES ------------------------------------------------------ 54 | 55 | //* Collection of escape codes and functions for terminal manipulation 56 | namespace Term { 57 | 58 | atomic initialized{}; 59 | atomic width{}; 60 | atomic height{}; 61 | string current_tty; 62 | 63 | namespace { 64 | struct termios initial_settings; 65 | 66 | //* Toggle terminal input echo 67 | bool echo(bool on=true) { 68 | struct termios settings; 69 | if (tcgetattr(STDIN_FILENO, &settings)) return false; 70 | if (on) settings.c_lflag |= ECHO; 71 | else settings.c_lflag &= ~(ECHO); 72 | return 0 == tcsetattr(STDIN_FILENO, TCSANOW, &settings); 73 | } 74 | 75 | //* Toggle need for return key when reading input 76 | bool linebuffered(bool on=true) { 77 | struct termios settings; 78 | if (tcgetattr(STDIN_FILENO, &settings)) return false; 79 | if (on) settings.c_lflag |= ICANON; 80 | else { 81 | settings.c_lflag &= ~(ICANON); 82 | settings.c_cc[VMIN] = 0; 83 | settings.c_cc[VTIME] = 0; 84 | } 85 | if (tcsetattr(STDIN_FILENO, TCSANOW, &settings)) return false; 86 | if (on) setlinebuf(stdin); 87 | else setbuf(stdin, nullptr); 88 | return true; 89 | } 90 | } 91 | 92 | bool refresh(bool only_check) { 93 | // Query dimensions of '/dev/tty' of the 'STDOUT_FILENO' isn't available. 94 | // This variable is set in those cases to avoid calls to ioctl 95 | constinit static bool uses_dev_tty = false; 96 | struct winsize wsize {}; 97 | if (uses_dev_tty || ioctl(STDOUT_FILENO, TIOCGWINSZ, &wsize) < 0 || (wsize.ws_col == 0 && wsize.ws_row == 0)) { 98 | Logger::error(R"(Couldn't determine terminal size of "STDOUT_FILENO"!)"); 99 | auto dev_tty = open("/dev/tty", O_RDONLY); 100 | if (dev_tty != -1) { 101 | ioctl(dev_tty, TIOCGWINSZ, &wsize); 102 | close(dev_tty); 103 | } 104 | else { 105 | Logger::error(R"(Couldn't determine terminal size of "/dev/tty"!)"); 106 | return false; 107 | } 108 | uses_dev_tty = true; 109 | } 110 | if (width != wsize.ws_col or height != wsize.ws_row) { 111 | if (not only_check) { 112 | width = wsize.ws_col; 113 | height = wsize.ws_row; 114 | } 115 | return true; 116 | } 117 | return false; 118 | } 119 | 120 | auto get_min_size(const string& boxes) -> array { 121 | bool cpu = boxes.find("cpu") != string::npos; 122 | bool mem = boxes.find("mem") != string::npos; 123 | bool net = boxes.find("net") != string::npos; 124 | bool proc = boxes.find("proc") != string::npos; 125 | 126 | int gpu = 0; 127 | if (Gpu::get_count() > 0) 128 | for (char i = '0'; i <= '5'; i++) 129 | gpu += (Tools::s_contains(boxes, "gpu"s + i) ? 1 : 0); 130 | 131 | int width = 0; 132 | if (mem) width = Mem::min_width; 133 | else if (net) width = Mem::min_width; 134 | width += (proc ? Proc::min_width : 0); 135 | if (cpu and width < Cpu::min_width) width = Cpu::min_width; 136 | if (gpu != 0 and width < Gpu::min_width) width = Gpu::min_width; 137 | 138 | int height = (cpu ? Cpu::min_height : 0); 139 | if (proc) height += Proc::min_height; 140 | else height += (mem ? Mem::min_height : 0) + (net ? Net::min_height : 0); 141 | height += Gpu::min_height*gpu; 142 | 143 | return { width, height }; 144 | } 145 | 146 | bool init() { 147 | if (not initialized) { 148 | initialized = (bool)isatty(STDIN_FILENO); 149 | if (initialized) { 150 | tcgetattr(STDIN_FILENO, &initial_settings); 151 | current_tty = (ttyname(STDIN_FILENO) != nullptr ? static_cast(ttyname(STDIN_FILENO)) : "unknown"); 152 | 153 | //? Disable stream sync - this does not seem to work on OpenBSD 154 | cout.sync_with_stdio(false); 155 | 156 | //? Disable stream ties 157 | cout.tie(nullptr); 158 | echo(false); 159 | linebuffered(false); 160 | refresh(); 161 | 162 | cout << alt_screen << hide_cursor << mouse_on << flush; 163 | Global::resized = false; 164 | } 165 | } 166 | return initialized; 167 | } 168 | 169 | void restore() { 170 | if (initialized) { 171 | tcsetattr(STDIN_FILENO, TCSANOW, &initial_settings); 172 | cout << mouse_off << clear << Fx::reset << normal_screen << show_cursor << flush; 173 | initialized = false; 174 | } 175 | } 176 | } 177 | 178 | namespace Logger { 179 | using namespace Tools; 180 | std::atomic busy (false); 181 | bool first = true; 182 | const string tdf = "%Y/%m/%d (%T) | "; 183 | 184 | size_t loglevel; 185 | fs::path logfile; 186 | 187 | //* Wrapper for lowering privileges if using SUID bit and currently isn't using real userid 188 | class lose_priv { 189 | int status = -1; 190 | public: 191 | lose_priv() { 192 | if (geteuid() != Global::real_uid) { 193 | this->status = seteuid(Global::real_uid); 194 | } 195 | } 196 | ~lose_priv() { 197 | if (status == 0) { 198 | status = seteuid(Global::set_uid); 199 | } 200 | } 201 | }; 202 | 203 | void set(const string& level) { 204 | loglevel = v_index(log_levels, level); 205 | } 206 | 207 | void log_write(const Level level, const string& msg) { 208 | if (loglevel < level or logfile.empty()) return; 209 | atomic_lock lck(busy, true); 210 | lose_priv neutered{}; 211 | std::error_code ec; 212 | try { 213 | // NOTE: `exist()` could throw but since we return with an empty logfile we don't care 214 | if (fs::exists(logfile) and fs::file_size(logfile, ec) > 1024 << 10 and not ec) { 215 | auto old_log = logfile; 216 | old_log += ".1"; 217 | 218 | if (fs::exists(old_log)) 219 | fs::remove(old_log, ec); 220 | 221 | if (not ec) 222 | fs::rename(logfile, old_log, ec); 223 | } 224 | if (not ec) { 225 | std::ofstream lwrite(logfile, std::ios::app); 226 | if (first) { 227 | first = false; 228 | lwrite << "\n" << strf_time(tdf) << "===> cosmotop v" << Global::Version << "\n"; 229 | } 230 | lwrite << strf_time(tdf) << log_levels.at(level) << ": " << msg << "\n"; 231 | } 232 | else logfile.clear(); 233 | } 234 | catch (const std::exception& e) { 235 | logfile.clear(); 236 | throw std::runtime_error("Exception in Logger::log_write() : " + string{e.what()}); 237 | } 238 | } 239 | } 240 | -------------------------------------------------------------------------------- /src/linux/intel_gpu_top/i915_pciids_local.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | /* 3 | * Copyright © 2022 Intel Corporation 4 | */ 5 | #ifndef _I915_PCIIDS_LOCAL_H_ 6 | #define _I915_PCIIDS_LOCAL_H_ 7 | 8 | #include "i915_pciids.h" 9 | 10 | /* MTL perf */ 11 | #ifndef INTEL_MTL_M_IDS 12 | #define INTEL_MTL_M_IDS(MACRO__, ...) \ 13 | MACRO__(0x7D60, ## __VA_ARGS__), \ 14 | MACRO__(0x7D67, ## __VA_ARGS__) 15 | #endif 16 | 17 | #ifndef INTEL_MTL_P_GT2_IDS 18 | #define INTEL_MTL_P_GT2_IDS(MACRO__, ...) \ 19 | MACRO__(0x7D45, ## __VA_ARGS__) 20 | #endif 21 | 22 | #ifndef INTEL_MTL_P_GT3_IDS 23 | #define INTEL_MTL_P_GT3_IDS(MACRO__, ...) \ 24 | MACRO__(0x7D55, ## __VA_ARGS__), \ 25 | MACRO__(0x7DD5, ## __VA_ARGS__) 26 | #endif 27 | 28 | #ifndef INTEL_MTL_P_IDS 29 | #define INTEL_MTL_P_IDS(MACRO__, ...) \ 30 | INTEL_MTL_P_GT2_IDS(MACRO__, ## __VA_ARGS__), \ 31 | INTEL_MTL_P_GT3_IDS(MACRO__, ## __VA_ARGS__) 32 | #endif 33 | 34 | #ifndef INTEL_ARL_GT1_IDS 35 | #define INTEL_ARL_GT1_IDS(MACRO__, ...) \ 36 | MACRO__(0x7D41, ## __VA_ARGS__), \ 37 | MACRO__(0x7D67, ## __VA_ARGS__) 38 | #endif 39 | 40 | #ifndef INTEL_ARL_GT2_IDS 41 | #define INTEL_ARL_GT2_IDS(MACRO__, ...) \ 42 | MACRO__(0x7D51, ## __VA_ARGS__), \ 43 | MACRO__(0x7DD1, ## __VA_ARGS__) 44 | #endif 45 | 46 | #ifndef INTEL_ARL_IDS 47 | #define INTEL_ARL_IDS(MACRO__, ...) \ 48 | INTEL_ARL_GT1_IDS(MACRO__, ## __VA_ARGS__), \ 49 | INTEL_ARL_GT2_IDS(MACRO__, ## __VA_ARGS__) 50 | #endif 51 | 52 | /* PVC */ 53 | #ifndef INTEL_PVC_IDS 54 | #define INTEL_PVC_IDS(MACRO__, ...) \ 55 | MACRO__(0x0BD0, ## __VA_ARGS__), \ 56 | MACRO__(0x0BD1, ## __VA_ARGS__), \ 57 | MACRO__(0x0BD2, ## __VA_ARGS__), \ 58 | MACRO__(0x0BD5, ## __VA_ARGS__), \ 59 | MACRO__(0x0BD6, ## __VA_ARGS__), \ 60 | MACRO__(0x0BD7, ## __VA_ARGS__), \ 61 | MACRO__(0x0BD8, ## __VA_ARGS__), \ 62 | MACRO__(0x0BD9, ## __VA_ARGS__), \ 63 | MACRO__(0x0BDA, ## __VA_ARGS__), \ 64 | MACRO__(0x0BDB, ## __VA_ARGS__) 65 | #endif 66 | 67 | #endif /* _I915_PCIIDS_LOCAL_H */ 68 | -------------------------------------------------------------------------------- /src/linux/intel_gpu_top/igt_perf.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #ifdef __linux__ 9 | #include 10 | #include 11 | #include 12 | #endif 13 | #include 14 | #include 15 | #include 16 | 17 | #include "igt_perf.h" 18 | 19 | static char *bus_address(int i915, char *path, int pathlen) 20 | { 21 | struct stat st; 22 | int len = -1; 23 | int dir; 24 | char *s; 25 | 26 | if (fstat(i915, &st) || !S_ISCHR(st.st_mode)) 27 | return NULL; 28 | 29 | snprintf(path, pathlen, "/sys/dev/char/%d:%d", 30 | major(st.st_rdev), minor(st.st_rdev)); 31 | 32 | dir = open(path, O_RDONLY); 33 | if (dir != -1) { 34 | len = readlinkat(dir, "device", path, pathlen - 1); 35 | close(dir); 36 | } 37 | if (len < 0) 38 | return NULL; 39 | 40 | path[len] = '\0'; 41 | 42 | /* strip off the relative path */ 43 | s = strrchr(path, '/'); 44 | if (s) 45 | memmove(path, s + 1, len - (s - path) + 1); 46 | 47 | return path; 48 | } 49 | 50 | const char *i915_perf_device(int i915, char *buf, int buflen) 51 | { 52 | char *s; 53 | 54 | #define prefix "i915_" 55 | #define plen strlen(prefix) 56 | 57 | if (!buf || buflen < plen) 58 | return "i915"; 59 | 60 | memcpy(buf, prefix, plen); 61 | 62 | if (!bus_address(i915, buf + plen, buflen - plen) || 63 | strcmp(buf + plen, "0000:00:02.0") == 0) /* legacy name for igfx */ 64 | buf[plen - 1] = '\0'; 65 | 66 | /* Convert all colons in the address to '_', thanks perf! */ 67 | for (s = buf; *s; s++) 68 | if (*s == ':') 69 | *s = '_'; 70 | 71 | return buf; 72 | } 73 | 74 | const char *xe_perf_device(int xe, char *buf, int buflen) 75 | { 76 | char *s; 77 | char pref[] = "xe_"; 78 | int len = strlen(pref); 79 | 80 | 81 | if (!buf || buflen < len) 82 | return "xe"; 83 | 84 | memcpy(buf, pref, len); 85 | 86 | if (!bus_address(xe, buf + len, buflen - len)) 87 | buf[len - 1] = '\0'; 88 | 89 | /* Convert all colons in the address to '_', thanks perf! */ 90 | for (s = buf; *s; s++) 91 | if (*s == ':') 92 | *s = '_'; 93 | 94 | return buf; 95 | } 96 | 97 | uint64_t xe_perf_type_id(int xe) 98 | { 99 | char buf[80]; 100 | 101 | return igt_perf_type_id(xe_perf_device(xe, buf, sizeof(buf))); 102 | } 103 | 104 | uint64_t i915_perf_type_id(int i915) 105 | { 106 | char buf[80]; 107 | 108 | return igt_perf_type_id(i915_perf_device(i915, buf, sizeof(buf))); 109 | } 110 | 111 | uint64_t igt_perf_type_id(const char *device) 112 | { 113 | char buf[64]; 114 | ssize_t ret; 115 | int fd; 116 | 117 | snprintf(buf, sizeof(buf), 118 | "/sys/bus/event_source/devices/%s/type", device); 119 | 120 | fd = open(buf, O_RDONLY); 121 | if (fd < 0) 122 | return 0; 123 | 124 | ret = read(fd, buf, sizeof(buf) - 1); 125 | close(fd); 126 | if (ret < 1) 127 | return 0; 128 | 129 | buf[ret] = '\0'; 130 | 131 | return strtoull(buf, NULL, 0); 132 | } 133 | 134 | int igt_perf_events_dir(int i915) 135 | { 136 | char buf[80]; 137 | char path[PATH_MAX]; 138 | 139 | i915_perf_device(i915, buf, sizeof(buf)); 140 | snprintf(path, sizeof(path), "/sys/bus/event_source/devices/%s/events", buf); 141 | return open(path, O_RDONLY); 142 | } 143 | 144 | static int 145 | _perf_open(uint64_t type, uint64_t config, int group, uint64_t format) 146 | { 147 | struct perf_event_attr attr = { }; 148 | int nr_cpus = get_nprocs_conf(); 149 | int cpu = 0, ret; 150 | 151 | attr.type = type; 152 | if (attr.type == 0) 153 | return -ENOENT; 154 | 155 | if (group >= 0) 156 | format &= ~PERF_FORMAT_GROUP; 157 | 158 | attr.read_format = format; 159 | attr.config = config; 160 | attr.use_clockid = 1; 161 | attr.clockid = CLOCK_MONOTONIC; 162 | 163 | do { 164 | ret = perf_event_open(&attr, -1, cpu++, group, 0); 165 | } while ((ret < 0 && errno == EINVAL) && (cpu < nr_cpus)); 166 | 167 | return ret; 168 | } 169 | 170 | int perf_igfx_open(uint64_t config) 171 | { 172 | return _perf_open(igt_perf_type_id("i915"), config, -1, 173 | PERF_FORMAT_TOTAL_TIME_ENABLED); 174 | } 175 | 176 | int perf_igfx_open_group(uint64_t config, int group) 177 | { 178 | return _perf_open(igt_perf_type_id("i915"), config, group, 179 | PERF_FORMAT_TOTAL_TIME_ENABLED | PERF_FORMAT_GROUP); 180 | } 181 | 182 | int perf_xe_open(int xe, uint64_t config) 183 | { 184 | return _perf_open(xe_perf_type_id(xe), config, -1, 185 | PERF_FORMAT_TOTAL_TIME_ENABLED); 186 | } 187 | 188 | int perf_i915_open(int i915, uint64_t config) 189 | { 190 | return _perf_open(i915_perf_type_id(i915), config, -1, 191 | PERF_FORMAT_TOTAL_TIME_ENABLED); 192 | } 193 | 194 | int perf_i915_open_group(int i915, uint64_t config, int group) 195 | { 196 | return _perf_open(i915_perf_type_id(i915), config, group, 197 | PERF_FORMAT_TOTAL_TIME_ENABLED | PERF_FORMAT_GROUP); 198 | } 199 | 200 | int igt_perf_open(uint64_t type, uint64_t config) 201 | { 202 | return _perf_open(type, config, -1, 203 | PERF_FORMAT_TOTAL_TIME_ENABLED); 204 | } 205 | 206 | int igt_perf_open_group(uint64_t type, uint64_t config, int group) 207 | { 208 | return _perf_open(type, config, group, 209 | PERF_FORMAT_TOTAL_TIME_ENABLED | PERF_FORMAT_GROUP); 210 | } 211 | -------------------------------------------------------------------------------- /src/linux/intel_gpu_top/igt_perf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Intel Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice (including the next 12 | * paragraph) shall be included in all copies or substantial portions of the 13 | * Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21 | * IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | #ifndef I915_PERF_H 26 | #define I915_PERF_H 27 | 28 | #include 29 | 30 | #ifdef __linux__ 31 | #include 32 | #endif 33 | 34 | //#include "igt_gt.h" 35 | 36 | static inline int 37 | perf_event_open(struct perf_event_attr *attr, 38 | pid_t pid, 39 | int cpu, 40 | int group_fd, 41 | unsigned long flags) 42 | { 43 | #ifndef __NR_perf_event_open 44 | #if defined(__i386__) 45 | #define __NR_perf_event_open 336 46 | #elif defined(__x86_64__) 47 | #define __NR_perf_event_open 298 48 | #else 49 | #define __NR_perf_event_open 0 50 | #endif 51 | #endif 52 | attr->size = sizeof(*attr); 53 | return syscall(__NR_perf_event_open, attr, pid, cpu, group_fd, flags); 54 | } 55 | 56 | uint64_t igt_perf_type_id(const char *device); 57 | int igt_perf_events_dir(int i915); 58 | int igt_perf_open(uint64_t type, uint64_t config); 59 | int igt_perf_open_group(uint64_t type, uint64_t config, int group); 60 | 61 | const char *i915_perf_device(int i915, char *buf, int buflen); 62 | uint64_t i915_perf_type_id(int i915); 63 | 64 | const char *xe_perf_device(int xe, char *buf, int buflen); 65 | uint64_t xe_perf_type_id(int); 66 | 67 | int perf_igfx_open(uint64_t config); 68 | int perf_igfx_open_group(uint64_t config, int group); 69 | 70 | int perf_i915_open(int i915, uint64_t config); 71 | int perf_i915_open_group(int i915, uint64_t config, int group); 72 | 73 | int perf_xe_open(int xe, uint64_t config); 74 | 75 | #endif /* I915_PERF_H */ 76 | -------------------------------------------------------------------------------- /src/linux/intel_gpu_top/intel_chipset.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2007 Intel Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice (including the next 12 | * paragraph) shall be included in all copies or substantial portions of the 13 | * Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21 | * IN THE SOFTWARE. 22 | * 23 | * Authors: 24 | * Eric Anholt 25 | * 26 | */ 27 | 28 | #ifndef _INTEL_CHIPSET_H 29 | #define _INTEL_CHIPSET_H 30 | 31 | #include 32 | #include 33 | 34 | #define BIT(x) (1ul <<(x)) 35 | 36 | struct intel_device_info { 37 | unsigned graphics_ver; 38 | unsigned graphics_rel; 39 | unsigned display_ver; 40 | unsigned gt; /* 0 if unknown */ 41 | bool has_4tile : 1; 42 | bool has_flatccs : 1; 43 | bool has_oam : 1; 44 | bool is_mobile : 1; 45 | bool is_whitney : 1; 46 | bool is_almador : 1; 47 | bool is_brookdale : 1; 48 | bool is_montara : 1; 49 | bool is_springdale : 1; 50 | bool is_grantsdale : 1; 51 | bool is_alviso : 1; 52 | bool is_lakeport : 1; 53 | bool is_calistoga : 1; 54 | bool is_bearlake : 1; 55 | bool is_pineview : 1; 56 | bool is_broadwater : 1; 57 | bool is_crestline : 1; 58 | bool is_eaglelake : 1; 59 | bool is_cantiga : 1; 60 | bool is_ironlake : 1; 61 | bool is_arrandale : 1; 62 | bool is_sandybridge : 1; 63 | bool is_ivybridge : 1; 64 | bool is_valleyview : 1; 65 | bool is_haswell : 1; 66 | bool is_broadwell : 1; 67 | bool is_cherryview : 1; 68 | bool is_skylake : 1; 69 | bool is_broxton : 1; 70 | bool is_kabylake : 1; 71 | bool is_geminilake : 1; 72 | bool is_coffeelake : 1; 73 | bool is_cometlake : 1; 74 | bool is_cannonlake : 1; 75 | bool is_icelake : 1; 76 | bool is_elkhartlake : 1; 77 | bool is_jasperlake : 1; 78 | bool is_tigerlake : 1; 79 | bool is_rocketlake : 1; 80 | bool is_dg1 : 1; 81 | bool is_dg2 : 1; 82 | bool is_alderlake_s : 1; 83 | bool is_raptorlake_s : 1; 84 | bool is_alderlake_p : 1; 85 | bool is_alderlake_n : 1; 86 | bool is_meteorlake : 1; 87 | bool is_pontevecchio : 1; 88 | bool is_lunarlake : 1; 89 | bool is_battlemage : 1; 90 | const char *codename; 91 | }; 92 | 93 | const struct intel_device_info *intel_get_device_info(uint16_t devid) __attribute__((pure)); 94 | 95 | extern enum pch_type intel_pch; 96 | 97 | enum pch_type { 98 | PCH_NONE, 99 | PCH_IBX, 100 | PCH_CPT, 101 | PCH_LPT, 102 | }; 103 | 104 | void intel_check_pch(void); 105 | 106 | #define HAS_IBX (intel_pch == PCH_IBX) 107 | #define HAS_CPT (intel_pch == PCH_CPT) 108 | #define HAS_LPT (intel_pch == PCH_LPT) 109 | 110 | #define IP_VER(ver, rel) ((ver) << 8 | (rel)) 111 | 112 | /* Exclude chipset #defines, they just add noise */ 113 | #ifndef __GTK_DOC_IGNORE__ 114 | 115 | #define PCI_CHIP_I810 0x7121 116 | #define PCI_CHIP_I810_DC100 0x7123 117 | #define PCI_CHIP_I810_E 0x7125 118 | #define PCI_CHIP_I815 0x1132 119 | 120 | #define PCI_CHIP_I830_M 0x3577 121 | #define PCI_CHIP_845_G 0x2562 122 | #define PCI_CHIP_I854_G 0x358e 123 | #define PCI_CHIP_I855_GM 0x3582 124 | #define PCI_CHIP_I865_G 0x2572 125 | 126 | #define PCI_CHIP_I915_G 0x2582 127 | #define PCI_CHIP_E7221_G 0x258A 128 | #define PCI_CHIP_I915_GM 0x2592 129 | #define PCI_CHIP_I945_G 0x2772 130 | #define PCI_CHIP_I945_GM 0x27A2 131 | #define PCI_CHIP_I945_GME 0x27AE 132 | 133 | #define PCI_CHIP_I965_G 0x29A2 134 | #define PCI_CHIP_I965_Q 0x2992 135 | #define PCI_CHIP_I965_G_1 0x2982 136 | #define PCI_CHIP_I946_GZ 0x2972 137 | #define PCI_CHIP_I965_GM 0x2A02 138 | #define PCI_CHIP_I965_GME 0x2A12 139 | 140 | #define PCI_CHIP_GM45_GM 0x2A42 141 | 142 | #define PCI_CHIP_Q45_G 0x2E12 143 | #define PCI_CHIP_G45_G 0x2E22 144 | #define PCI_CHIP_G41_G 0x2E32 145 | 146 | #endif /* __GTK_DOC_IGNORE__ */ 147 | 148 | #define IS_915G(devid) (intel_get_device_info(devid)->is_grantsdale) 149 | #define IS_915GM(devid) (intel_get_device_info(devid)->is_alviso) 150 | 151 | #define IS_915(devid) (IS_915G(devid) || IS_915GM(devid)) 152 | 153 | #define IS_945G(devid) (intel_get_device_info(devid)->is_lakeport) 154 | #define IS_945GM(devid) (intel_get_device_info(devid)->is_calistoga) 155 | 156 | #define IS_945(devid) (IS_945G(devid) || \ 157 | IS_945GM(devid) || \ 158 | IS_G33(devid)) 159 | 160 | #define IS_PINEVIEW(devid) (intel_get_device_info(devid)->is_pineview) 161 | #define IS_G33(devid) (intel_get_device_info(devid)->is_bearlake || \ 162 | intel_get_device_info(devid)->is_pineview) 163 | 164 | #define IS_BROADWATER(devid) (intel_get_device_info(devid)->is_broadwater) 165 | #define IS_CRESTLINE(devid) (intel_get_device_info(devid)->is_crestline) 166 | 167 | #define IS_GM45(devid) (intel_get_device_info(devid)->is_cantiga) 168 | #define IS_G45(devid) (intel_get_device_info(devid)->is_eaglelake) 169 | #define IS_G4X(devid) (IS_G45(devid) || IS_GM45(devid)) 170 | 171 | #define IS_IRONLAKE(devid) (intel_get_device_info(devid)->is_ironlake) 172 | #define IS_ARRANDALE(devid) (intel_get_device_info(devid)->is_arrandale) 173 | #define IS_SANDYBRIDGE(devid) (intel_get_device_info(devid)->is_sandybridge) 174 | #define IS_IVYBRIDGE(devid) (intel_get_device_info(devid)->is_ivybridge) 175 | #define IS_VALLEYVIEW(devid) (intel_get_device_info(devid)->is_valleyview) 176 | #define IS_HASWELL(devid) (intel_get_device_info(devid)->is_haswell) 177 | #define IS_BROADWELL(devid) (intel_get_device_info(devid)->is_broadwell) 178 | #define IS_CHERRYVIEW(devid) (intel_get_device_info(devid)->is_cherryview) 179 | #define IS_SKYLAKE(devid) (intel_get_device_info(devid)->is_skylake) 180 | #define IS_BROXTON(devid) (intel_get_device_info(devid)->is_broxton) 181 | #define IS_KABYLAKE(devid) (intel_get_device_info(devid)->is_kabylake) 182 | #define IS_GEMINILAKE(devid) (intel_get_device_info(devid)->is_geminilake) 183 | #define IS_COFFEELAKE(devid) (intel_get_device_info(devid)->is_coffeelake) 184 | #define IS_COMETLAKE(devid) (intel_get_device_info(devid)->is_cometlake) 185 | #define IS_CANNONLAKE(devid) (intel_get_device_info(devid)->is_cannonlake) 186 | #define IS_ICELAKE(devid) (intel_get_device_info(devid)->is_icelake) 187 | #define IS_TIGERLAKE(devid) (intel_get_device_info(devid)->is_tigerlake) 188 | #define IS_ROCKETLAKE(devid) (intel_get_device_info(devid)->is_rocketlake) 189 | #define IS_DG1(devid) (intel_get_device_info(devid)->is_dg1) 190 | #define IS_DG2(devid) (intel_get_device_info(devid)->is_dg2) 191 | #define IS_ALDERLAKE_S(devid) (intel_get_device_info(devid)->is_alderlake_s) 192 | #define IS_RAPTORLAKE_S(devid) (intel_get_device_info(devid)->is_raptorlake_s) 193 | #define IS_ALDERLAKE_P(devid) (intel_get_device_info(devid)->is_alderlake_p) 194 | #define IS_ALDERLAKE_N(devid) (intel_get_device_info(devid)->is_alderlake_n) 195 | #define IS_METEORLAKE(devid) (intel_get_device_info(devid)->is_meteorlake) 196 | #define IS_PONTEVECCHIO(devid) (intel_get_device_info(devid)->is_pontevecchio) 197 | #define IS_LUNARLAKE(devid) (intel_get_device_info(devid)->is_lunarlake) 198 | #define IS_BATTLEMAGE(devid) (intel_get_device_info(devid)->is_battlemage) 199 | 200 | #define IS_GEN(devid, x) (intel_get_device_info(devid)->graphics_ver == x) 201 | #define AT_LEAST_GEN(devid, x) (intel_get_device_info(devid)->graphics_ver >= x) 202 | #define AT_LEAST_DISPLAY(devid, x) (intel_get_device_info(devid)->display_ver >= x) 203 | 204 | #define IS_GEN2(devid) IS_GEN(devid, 2) 205 | #define IS_GEN3(devid) IS_GEN(devid, 3) 206 | #define IS_GEN4(devid) IS_GEN(devid, 4) 207 | #define IS_GEN5(devid) IS_GEN(devid, 5) 208 | #define IS_GEN6(devid) IS_GEN(devid, 6) 209 | #define IS_GEN7(devid) IS_GEN(devid, 7) 210 | #define IS_GEN8(devid) IS_GEN(devid, 8) 211 | #define IS_GEN9(devid) IS_GEN(devid, 9) 212 | #define IS_GEN10(devid) IS_GEN(devid, 10) 213 | #define IS_GEN11(devid) IS_GEN(devid, 11) 214 | #define IS_GEN12(devid) IS_GEN(devid, 12) 215 | 216 | #define IS_MOBILE(devid) (intel_get_device_info(devid)->is_mobile) 217 | #define IS_965(devid) AT_LEAST_GEN(devid, 4) 218 | 219 | #define HAS_BSD_RING(devid) AT_LEAST_GEN(devid, 5) 220 | #define HAS_BLT_RING(devid) AT_LEAST_GEN(devid, 6) 221 | 222 | #define HAS_PCH_SPLIT(devid) (AT_LEAST_GEN(devid, 5) && \ 223 | !(IS_VALLEYVIEW(devid) || \ 224 | IS_CHERRYVIEW(devid) || \ 225 | IS_BROXTON(devid))) 226 | 227 | #define HAS_4TILE(devid) (intel_get_device_info(devid)->has_4tile) 228 | 229 | #define HAS_FLATCCS(devid) (intel_get_device_info(devid)->has_flatccs) 230 | 231 | #define HAS_OAM(devid) (intel_get_device_info(devid)->has_oam) 232 | 233 | #endif /* _INTEL_CHIPSET_H */ 234 | -------------------------------------------------------------------------------- /src/linux/intel_gpu_top/intel_gpu_top.h: -------------------------------------------------------------------------------- 1 | #ifndef INTEL_GPU_TOP_H 2 | #define INTEL_GPU_TOP_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | struct pmu_pair { 9 | uint64_t cur; 10 | uint64_t prev; 11 | }; 12 | 13 | struct pmu_counter { 14 | uint64_t type; 15 | uint64_t config; 16 | unsigned int idx; 17 | struct pmu_pair val; 18 | double scale; 19 | const char *units; 20 | bool present; 21 | }; 22 | 23 | struct engine_class { 24 | unsigned int engine_class; 25 | const char *name; 26 | unsigned int num_engines; 27 | }; 28 | 29 | struct engine { 30 | const char *name; 31 | char *display_name; 32 | char *short_name; 33 | 34 | unsigned int class; 35 | unsigned int instance; 36 | 37 | unsigned int num_counters; 38 | 39 | struct pmu_counter busy; 40 | struct pmu_counter wait; 41 | struct pmu_counter sema; 42 | }; 43 | 44 | #define MAX_GTS 4 45 | struct engines { 46 | unsigned int num_engines; 47 | unsigned int num_classes; 48 | struct engine_class *class; 49 | unsigned int num_counters; 50 | DIR *root; 51 | int fd; 52 | struct pmu_pair ts; 53 | 54 | int rapl_fd; 55 | struct pmu_counter r_gpu, r_pkg; 56 | unsigned int num_rapl; 57 | 58 | int imc_fd; 59 | struct pmu_counter imc_reads; 60 | struct pmu_counter imc_writes; 61 | unsigned int num_imc; 62 | 63 | struct pmu_counter freq_req; 64 | struct pmu_counter freq_req_gt[MAX_GTS]; 65 | struct pmu_counter freq_act; 66 | struct pmu_counter freq_act_gt[MAX_GTS]; 67 | struct pmu_counter irq; 68 | struct pmu_counter rc6; 69 | struct pmu_counter rc6_gt[MAX_GTS]; 70 | 71 | bool discrete; 72 | char *device; 73 | 74 | int num_gts; 75 | 76 | /* Do not edit below this line. 77 | * This structure is reallocated every time a new engine is 78 | * found and size is increased by sizeof (engine). 79 | */ 80 | 81 | struct engine engine; 82 | 83 | }; 84 | 85 | struct engines *discover_engines(const char *device); 86 | void free_engines(struct engines *engines); 87 | int pmu_init(struct engines *engines); 88 | void pmu_sample(struct engines *engines); 89 | double pmu_calc(struct pmu_pair *p, double d, double t, double s); 90 | 91 | char* find_intel_gpu_dir(); 92 | char* get_intel_device_id(const char* vendor_path); 93 | char *get_intel_device_name(const char *device_id); 94 | 95 | #endif -------------------------------------------------------------------------------- /src/linux/intel_gpu_top/intel_name_lookup_shim.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2024 Aristocratos (jakob@qvantnet.com) 2 | Copyright 2025 Brett Jia (dev.bjia56@gmail.com) 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | #include "intel_gpu_top.h" 25 | #include "intel_chipset.h" 26 | 27 | #define VENDOR_ID "0x8086" 28 | #define SYSFS_PATH "/sys/class/drm" 29 | #define VENDOR_FILE "vendor" 30 | #define DEVICE_FILE "device" 31 | 32 | // Caller must free the returned pointer 33 | char* find_intel_gpu_dir() { 34 | DIR *dir; 35 | struct dirent *entry; 36 | char path[256]; 37 | char vendor_path[256]; 38 | char vendor_id[16]; 39 | 40 | if ((dir = opendir(SYSFS_PATH)) == NULL) { 41 | perror("opendir"); 42 | return NULL; 43 | } 44 | 45 | while ((entry = readdir(dir)) != NULL) { 46 | // Construct the path to the vendor file 47 | snprintf(vendor_path, sizeof(vendor_path), "%s/%s/device/%s", SYSFS_PATH, entry->d_name, VENDOR_FILE); 48 | 49 | // Check if the vendor file exists 50 | if (access(vendor_path, F_OK) != -1) { 51 | FILE *file = fopen(vendor_path, "r"); 52 | if (file) { 53 | if (fgets(vendor_id, sizeof(vendor_id), file)) { 54 | // Trim the newline character 55 | vendor_id[strcspn(vendor_id, "\n")] = 0; 56 | 57 | if (strcmp(vendor_id, VENDOR_ID) == 0) { 58 | // Return the parent directory (i.e., /sys/class/drm/card*) 59 | snprintf(path, sizeof(path), "%s/%s", SYSFS_PATH, entry->d_name); 60 | fclose(file); 61 | closedir(dir); 62 | return strdup(path); 63 | } 64 | } 65 | fclose(file); 66 | } 67 | } 68 | } 69 | 70 | closedir(dir); 71 | return NULL; // Intel GPU not found 72 | } 73 | 74 | // Caller must free the returned pointer 75 | char* get_intel_device_id(const char* gpu_dir) { 76 | char device_path[256]; 77 | char device_id[16]; 78 | 79 | // Construct the path to the device file 80 | snprintf(device_path, sizeof(device_path), "%s/device/%s", gpu_dir, DEVICE_FILE); 81 | 82 | FILE *file = fopen(device_path, "r"); 83 | if (file) { 84 | if (fgets(device_id, sizeof(device_id), file)) { 85 | fclose(file); 86 | // Trim the newline character 87 | device_id[strcspn(device_id, "\n")] = 0; 88 | // Return a copy of the device ID 89 | return strdup(device_id); 90 | } 91 | fclose(file); 92 | } else { 93 | perror("fopen"); 94 | } 95 | 96 | return NULL; 97 | } 98 | 99 | // Caller must free the returned pointer 100 | char *get_intel_device_name(const char *device_id) { 101 | uint16_t devid = strtol(device_id, NULL, 16); 102 | char dev_name[256]; 103 | char full_name[256]; 104 | const struct intel_device_info *info = intel_get_device_info(devid); 105 | if (info) { 106 | if (info->codename == NULL) { 107 | strcpy(dev_name, "(unknown)"); 108 | } else { 109 | strcpy(dev_name, info->codename); 110 | dev_name[0] = toupper(dev_name[0]); 111 | } 112 | snprintf(full_name, sizeof(full_name), "Intel %s (Gen%u)", dev_name, info->graphics_ver); 113 | return strdup(full_name); 114 | } 115 | return NULL; 116 | } 117 | -------------------------------------------------------------------------------- /src/linux/intel_gpu_top/source.txt: -------------------------------------------------------------------------------- 1 | 0f02dc176959e6296866b1bafd3982e277a5e44b 2 | https://gitlab.freedesktop.org/drm/igt-gpu-tools.git -------------------------------------------------------------------------------- /src/linux/intel_gpu_top/xe_pciids.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | /* 3 | * Copyright © 2022 Intel Corporation 4 | */ 5 | 6 | #ifndef _XE_PCIIDS_H_ 7 | #define _XE_PCIIDS_H_ 8 | 9 | /* 10 | * Lists below can be turned into initializers for a struct pci_device_id 11 | * by defining INTEL_VGA_DEVICE: 12 | * 13 | * #define INTEL_VGA_DEVICE(id, info) { \ 14 | * 0x8086, id, \ 15 | * ~0, ~0, \ 16 | * 0x030000, 0xff0000, \ 17 | * (unsigned long) info } 18 | * 19 | * And then calling like: 20 | * 21 | * XE_TGL_12_GT1_IDS(INTEL_VGA_DEVICE, ## __VA_ARGS__) 22 | * 23 | * To turn them into something else, just provide a different macro passed as 24 | * first argument. 25 | */ 26 | 27 | /* TGL */ 28 | #define XE_TGL_GT1_IDS(MACRO__, ...) \ 29 | MACRO__(0x9A60, ## __VA_ARGS__), \ 30 | MACRO__(0x9A68, ## __VA_ARGS__), \ 31 | MACRO__(0x9A70, ## __VA_ARGS__) 32 | 33 | #define XE_TGL_GT2_IDS(MACRO__, ...) \ 34 | MACRO__(0x9A40, ## __VA_ARGS__), \ 35 | MACRO__(0x9A49, ## __VA_ARGS__), \ 36 | MACRO__(0x9A59, ## __VA_ARGS__), \ 37 | MACRO__(0x9A78, ## __VA_ARGS__), \ 38 | MACRO__(0x9AC0, ## __VA_ARGS__), \ 39 | MACRO__(0x9AC9, ## __VA_ARGS__), \ 40 | MACRO__(0x9AD9, ## __VA_ARGS__), \ 41 | MACRO__(0x9AF8, ## __VA_ARGS__) 42 | 43 | #define XE_TGL_IDS(MACRO__, ...) \ 44 | XE_TGL_GT1_IDS(MACRO__, ## __VA_ARGS__),\ 45 | XE_TGL_GT2_IDS(MACRO__, ## __VA_ARGS__) 46 | 47 | /* RKL */ 48 | #define XE_RKL_IDS(MACRO__, ...) \ 49 | MACRO__(0x4C80, ## __VA_ARGS__), \ 50 | MACRO__(0x4C8A, ## __VA_ARGS__), \ 51 | MACRO__(0x4C8B, ## __VA_ARGS__), \ 52 | MACRO__(0x4C8C, ## __VA_ARGS__), \ 53 | MACRO__(0x4C90, ## __VA_ARGS__), \ 54 | MACRO__(0x4C9A, ## __VA_ARGS__) 55 | 56 | /* DG1 */ 57 | #define XE_DG1_IDS(MACRO__, ...) \ 58 | MACRO__(0x4905, ## __VA_ARGS__), \ 59 | MACRO__(0x4906, ## __VA_ARGS__), \ 60 | MACRO__(0x4907, ## __VA_ARGS__), \ 61 | MACRO__(0x4908, ## __VA_ARGS__), \ 62 | MACRO__(0x4909, ## __VA_ARGS__) 63 | 64 | /* ADL-S */ 65 | #define XE_ADLS_IDS(MACRO__, ...) \ 66 | MACRO__(0x4680, ## __VA_ARGS__), \ 67 | MACRO__(0x4682, ## __VA_ARGS__), \ 68 | MACRO__(0x4688, ## __VA_ARGS__), \ 69 | MACRO__(0x468A, ## __VA_ARGS__), \ 70 | MACRO__(0x468B, ## __VA_ARGS__), \ 71 | MACRO__(0x4690, ## __VA_ARGS__), \ 72 | MACRO__(0x4692, ## __VA_ARGS__), \ 73 | MACRO__(0x4693, ## __VA_ARGS__) 74 | 75 | /* ADL-P */ 76 | #define XE_ADLP_IDS(MACRO__, ...) \ 77 | MACRO__(0x46A0, ## __VA_ARGS__), \ 78 | MACRO__(0x46A1, ## __VA_ARGS__), \ 79 | MACRO__(0x46A2, ## __VA_ARGS__), \ 80 | MACRO__(0x46A3, ## __VA_ARGS__), \ 81 | MACRO__(0x46A6, ## __VA_ARGS__), \ 82 | MACRO__(0x46A8, ## __VA_ARGS__), \ 83 | MACRO__(0x46AA, ## __VA_ARGS__), \ 84 | MACRO__(0x462A, ## __VA_ARGS__), \ 85 | MACRO__(0x4626, ## __VA_ARGS__), \ 86 | MACRO__(0x4628, ## __VA_ARGS__), \ 87 | MACRO__(0x46B0, ## __VA_ARGS__), \ 88 | MACRO__(0x46B1, ## __VA_ARGS__), \ 89 | MACRO__(0x46B2, ## __VA_ARGS__), \ 90 | MACRO__(0x46B3, ## __VA_ARGS__), \ 91 | MACRO__(0x46C0, ## __VA_ARGS__), \ 92 | MACRO__(0x46C1, ## __VA_ARGS__), \ 93 | MACRO__(0x46C2, ## __VA_ARGS__), \ 94 | MACRO__(0x46C3, ## __VA_ARGS__) 95 | 96 | /* ADL-N */ 97 | #define XE_ADLN_IDS(MACRO__, ...) \ 98 | MACRO__(0x46D0, ## __VA_ARGS__), \ 99 | MACRO__(0x46D1, ## __VA_ARGS__), \ 100 | MACRO__(0x46D2, ## __VA_ARGS__) 101 | 102 | /* RPL-S */ 103 | #define XE_RPLS_IDS(MACRO__, ...) \ 104 | MACRO__(0xA780, ## __VA_ARGS__), \ 105 | MACRO__(0xA781, ## __VA_ARGS__), \ 106 | MACRO__(0xA782, ## __VA_ARGS__), \ 107 | MACRO__(0xA783, ## __VA_ARGS__), \ 108 | MACRO__(0xA788, ## __VA_ARGS__), \ 109 | MACRO__(0xA789, ## __VA_ARGS__), \ 110 | MACRO__(0xA78A, ## __VA_ARGS__), \ 111 | MACRO__(0xA78B, ## __VA_ARGS__) 112 | 113 | /* RPL-U */ 114 | #define XE_RPLU_IDS(MACRO__, ...) \ 115 | MACRO__(0xA721, ## __VA_ARGS__), \ 116 | MACRO__(0xA7A1, ## __VA_ARGS__), \ 117 | MACRO__(0xA7A9, ## __VA_ARGS__), \ 118 | MACRO__(0xA7AC, ## __VA_ARGS__), \ 119 | MACRO__(0xA7AD, ## __VA_ARGS__) 120 | 121 | /* RPL-P */ 122 | #define XE_RPLP_IDS(MACRO__, ...) \ 123 | XE_RPLU_IDS(MACRO__, ## __VA_ARGS__), \ 124 | MACRO__(0xA720, ## __VA_ARGS__), \ 125 | MACRO__(0xA7A0, ## __VA_ARGS__), \ 126 | MACRO__(0xA7A8, ## __VA_ARGS__), \ 127 | MACRO__(0xA7AA, ## __VA_ARGS__), \ 128 | MACRO__(0xA7AB, ## __VA_ARGS__) 129 | 130 | /* DG2 */ 131 | #define XE_DG2_G10_IDS(MACRO__, ...) \ 132 | MACRO__(0x5690, ## __VA_ARGS__), \ 133 | MACRO__(0x5691, ## __VA_ARGS__), \ 134 | MACRO__(0x5692, ## __VA_ARGS__), \ 135 | MACRO__(0x56A0, ## __VA_ARGS__), \ 136 | MACRO__(0x56A1, ## __VA_ARGS__), \ 137 | MACRO__(0x56A2, ## __VA_ARGS__), \ 138 | MACRO__(0x56BE, ## __VA_ARGS__), \ 139 | MACRO__(0x56BF, ## __VA_ARGS__) 140 | 141 | #define XE_DG2_G11_IDS(MACRO__, ...) \ 142 | MACRO__(0x5693, ## __VA_ARGS__), \ 143 | MACRO__(0x5694, ## __VA_ARGS__), \ 144 | MACRO__(0x5695, ## __VA_ARGS__), \ 145 | MACRO__(0x56A5, ## __VA_ARGS__), \ 146 | MACRO__(0x56A6, ## __VA_ARGS__), \ 147 | MACRO__(0x56B0, ## __VA_ARGS__), \ 148 | MACRO__(0x56B1, ## __VA_ARGS__), \ 149 | MACRO__(0x56BA, ## __VA_ARGS__), \ 150 | MACRO__(0x56BB, ## __VA_ARGS__), \ 151 | MACRO__(0x56BC, ## __VA_ARGS__), \ 152 | MACRO__(0x56BD, ## __VA_ARGS__) 153 | 154 | #define XE_DG2_G12_IDS(MACRO__, ...) \ 155 | MACRO__(0x5696, ## __VA_ARGS__), \ 156 | MACRO__(0x5697, ## __VA_ARGS__), \ 157 | MACRO__(0x56A3, ## __VA_ARGS__), \ 158 | MACRO__(0x56A4, ## __VA_ARGS__), \ 159 | MACRO__(0x56B2, ## __VA_ARGS__), \ 160 | MACRO__(0x56B3, ## __VA_ARGS__) 161 | 162 | #define XE_DG2_IDS(MACRO__, ...) \ 163 | XE_DG2_G10_IDS(MACRO__, ## __VA_ARGS__),\ 164 | XE_DG2_G11_IDS(MACRO__, ## __VA_ARGS__),\ 165 | XE_DG2_G12_IDS(MACRO__, ## __VA_ARGS__) 166 | 167 | #define XE_ATS_M150_IDS(MACRO__, ...) \ 168 | MACRO__(0x56C0, ## __VA_ARGS__), \ 169 | MACRO__(0x56C2, ## __VA_ARGS__) 170 | 171 | #define XE_ATS_M75_IDS(MACRO__, ...) \ 172 | MACRO__(0x56C1, ## __VA_ARGS__) 173 | 174 | #define XE_ATS_M_IDS(MACRO__, ...) \ 175 | XE_ATS_M150_IDS(MACRO__, ## __VA_ARGS__),\ 176 | XE_ATS_M75_IDS(MACRO__, ## __VA_ARGS__) 177 | 178 | /* MTL / ARL */ 179 | #define XE_MTL_IDS(MACRO__, ...) \ 180 | MACRO__(0x7D40, ## __VA_ARGS__), \ 181 | MACRO__(0x7D41, ## __VA_ARGS__), \ 182 | MACRO__(0x7D45, ## __VA_ARGS__), \ 183 | MACRO__(0x7D51, ## __VA_ARGS__), \ 184 | MACRO__(0x7D55, ## __VA_ARGS__), \ 185 | MACRO__(0x7D60, ## __VA_ARGS__), \ 186 | MACRO__(0x7D67, ## __VA_ARGS__), \ 187 | MACRO__(0x7DD1, ## __VA_ARGS__), \ 188 | MACRO__(0x7DD5, ## __VA_ARGS__) 189 | 190 | /* PVC */ 191 | #define XE_PVC_IDS(MACRO__, ...) \ 192 | MACRO__(0x0B69, ## __VA_ARGS__), \ 193 | MACRO__(0x0B6E, ## __VA_ARGS__), \ 194 | MACRO__(0x0BD4, ## __VA_ARGS__), \ 195 | MACRO__(0x0BD5, ## __VA_ARGS__), \ 196 | MACRO__(0x0BD6, ## __VA_ARGS__), \ 197 | MACRO__(0x0BD7, ## __VA_ARGS__), \ 198 | MACRO__(0x0BD8, ## __VA_ARGS__), \ 199 | MACRO__(0x0BD9, ## __VA_ARGS__), \ 200 | MACRO__(0x0BDA, ## __VA_ARGS__), \ 201 | MACRO__(0x0BDB, ## __VA_ARGS__), \ 202 | MACRO__(0x0BE0, ## __VA_ARGS__), \ 203 | MACRO__(0x0BE1, ## __VA_ARGS__), \ 204 | MACRO__(0x0BE5, ## __VA_ARGS__) 205 | 206 | #define XE_LNL_IDS(MACRO__, ...) \ 207 | MACRO__(0x6420, ## __VA_ARGS__), \ 208 | MACRO__(0x64A0, ## __VA_ARGS__), \ 209 | MACRO__(0x64B0, ## __VA_ARGS__) 210 | 211 | #define XE_BMG_IDS(MACRO__, ...) \ 212 | MACRO__(0xE202, ## __VA_ARGS__), \ 213 | MACRO__(0xE20B, ## __VA_ARGS__), \ 214 | MACRO__(0xE20C, ## __VA_ARGS__), \ 215 | MACRO__(0xE20D, ## __VA_ARGS__), \ 216 | MACRO__(0xE212, ## __VA_ARGS__) 217 | 218 | #endif 219 | -------------------------------------------------------------------------------- /src/openbsd/internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019-2021 Brian Callahan 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | struct sysctls { 18 | const char *name; 19 | int mib0; 20 | int mib1; 21 | int mib2; 22 | } sysctlnames[] = { 23 | { "hw.machine", CTL_HW, HW_MACHINE, 0 }, 24 | { "hw.model", CTL_HW, HW_MODEL, 0 }, 25 | { "hw.ncpu", CTL_HW, HW_NCPU, 0 }, 26 | { "hw.byteorder", CTL_HW, HW_BYTEORDER, 0 }, 27 | { "hw.pagesize", CTL_HW, HW_PAGESIZE, 0 }, 28 | { "hw.disknames", CTL_HW, HW_DISKNAMES, 0 }, 29 | { "hw.diskcount", CTL_HW, HW_DISKCOUNT, 0 }, 30 | { "hw.sensors", CTL_HW, HW_SENSORS, 0 }, 31 | { "hw.model", CTL_HW, HW_MODEL, 0 }, 32 | { "hw.ncpu", CTL_HW, HW_NCPU, 0 }, 33 | { "hw.byteorder", CTL_HW, HW_BYTEORDER, 0 }, 34 | { "hw.pagesize", CTL_HW, HW_PAGESIZE, 0 }, 35 | { "hw.disknames", CTL_HW, HW_DISKNAMES, 0 }, 36 | { "hw.diskcount", CTL_HW, HW_DISKCOUNT, 0 }, 37 | { "hw.sensors", CTL_HW, HW_SENSORS, 0 }, 38 | { "hw.cpuspeed", CTL_HW, HW_CPUSPEED, 0 }, 39 | { "hw.setperf", CTL_HW, HW_SETPERF, 0 }, 40 | { "hw.vendor", CTL_HW, HW_VENDOR, 0 }, 41 | { "hw.product", CTL_HW, HW_PRODUCT, 0 }, 42 | { "hw.serialno", CTL_HW, HW_SERIALNO, 0 }, 43 | { "hw.uuid", CTL_HW, HW_UUID, 0 }, 44 | { "hw.physmem", CTL_HW, HW_PHYSMEM64, 0 }, 45 | { "hw.usermem", CTL_HW, HW_USERMEM64, 0 }, 46 | { "hw.ncpufound", CTL_HW, HW_NCPUFOUND, 0 }, 47 | { "hw.allowpowerdown", CTL_HW, HW_ALLOWPOWERDOWN, 0 }, 48 | { "hw.perfpolicy", CTL_HW, HW_PERFPOLICY, 0 }, 49 | { "hw.smt", CTL_HW, HW_SMT, 0 }, 50 | { "hw.ncpuonline", CTL_HW, HW_NCPUONLINE, 0 }, 51 | { "hw.cpuspeed", CTL_HW, HW_CPUSPEED, 0 }, 52 | { "hw.setperf", CTL_HW, HW_SETPERF, 0 }, 53 | { "hw.vendor", CTL_HW, HW_VENDOR, 0 }, 54 | { "hw.product", CTL_HW, HW_PRODUCT, 0 }, 55 | { "hw.serialno", CTL_HW, HW_SERIALNO, 0 }, 56 | { "hw.uuid", CTL_HW, HW_UUID, 0 }, 57 | { "hw.physmem", CTL_HW, HW_PHYSMEM64, 0 }, 58 | { "hw.usermem", CTL_HW, HW_USERMEM64, 0 }, 59 | { "hw.ncpufound", CTL_HW, HW_NCPUFOUND, 0 }, 60 | { "hw.allowpowerdown", CTL_HW, HW_ALLOWPOWERDOWN, 0 }, 61 | { "hw.perfpolicy", CTL_HW, HW_PERFPOLICY, 0 }, 62 | { "hw.smt", CTL_HW, HW_SMT, 0 }, 63 | { "hw.ncpuonline", CTL_HW, HW_NCPUONLINE, 0 }, 64 | { "kern.ostype", CTL_KERN, KERN_OSTYPE, 0 }, 65 | { "kern.osrelease", CTL_KERN, KERN_OSRELEASE, 0 }, 66 | { "kern.osrevision", CTL_KERN, KERN_OSREV, 0 }, 67 | { "kern.version", CTL_KERN, KERN_VERSION, 0 }, 68 | { "kern.maxvnodes", CTL_KERN, KERN_MAXVNODES, 0 }, 69 | { "kern.maxproc", CTL_KERN, KERN_MAXPROC, 0 }, 70 | { "kern.maxfiles", CTL_KERN, KERN_MAXFILES, 0 }, 71 | { "kern.argmax", CTL_KERN, KERN_ARGMAX, 0 }, 72 | { "kern.securelevel", CTL_KERN, KERN_SECURELVL, 0 }, 73 | { "kern.hostname", CTL_KERN, KERN_HOSTNAME, 0 }, 74 | { "kern.hostid", CTL_KERN, KERN_HOSTID, 0 }, 75 | { "kern.clockrate", CTL_KERN, KERN_CLOCKRATE, 0 }, 76 | { "kern.profiling", CTL_KERN, KERN_PROF, 0 }, 77 | { "kern.posix1version", CTL_KERN, KERN_POSIX1, 0 }, 78 | { "kern.ngroups", CTL_KERN, KERN_NGROUPS, 0 }, 79 | { "kern.job_control", CTL_KERN, KERN_JOB_CONTROL, 0 }, 80 | { "kern.saved_ids", CTL_KERN, KERN_SAVED_IDS, 0 }, 81 | { "kern.boottime", CTL_KERN, KERN_BOOTTIME, 0 }, 82 | { "kern.domainname", CTL_KERN, KERN_DOMAINNAME, 0 }, 83 | { "kern.maxpartitions", CTL_KERN, KERN_MAXPARTITIONS, 0 }, 84 | { "kern.rawpartition", CTL_KERN, KERN_RAWPARTITION, 0 }, 85 | { "kern.maxthread", CTL_KERN, KERN_MAXTHREAD, 0 }, 86 | { "kern.nthreads", CTL_KERN, KERN_NTHREADS, 0 }, 87 | { "kern.osversion", CTL_KERN, KERN_OSVERSION, 0 }, 88 | { "kern.somaxconn", CTL_KERN, KERN_SOMAXCONN, 0 }, 89 | { "kern.sominconn", CTL_KERN, KERN_SOMINCONN, 0 }, 90 | { "kern.nosuidcoredump", CTL_KERN, KERN_NOSUIDCOREDUMP, 0 }, 91 | { "kern.fsync", CTL_KERN, KERN_FSYNC, 0 }, 92 | { "kern.sysvmsg", CTL_KERN, KERN_SYSVMSG, 0 }, 93 | { "kern.sysvsem", CTL_KERN, KERN_SYSVSEM, 0 }, 94 | { "kern.sysvshm", CTL_KERN, KERN_SYSVSHM, 0 }, 95 | { "kern.msgbufsize", CTL_KERN, KERN_MSGBUFSIZE, 0 }, 96 | { "kern.malloc", CTL_KERN, KERN_MALLOCSTATS, 0 }, 97 | { "kern.cp_time", CTL_KERN, KERN_CPTIME, 0 }, 98 | { "kern.nchstats", CTL_KERN, KERN_NCHSTATS, 0 }, 99 | { "kern.forkstat", CTL_KERN, KERN_FORKSTAT, 0 }, 100 | { "kern.tty", CTL_KERN, KERN_TTY, 0 }, 101 | { "kern.ccpu", CTL_KERN, KERN_CCPU, 0 }, 102 | { "kern.fscale", CTL_KERN, KERN_FSCALE, 0 }, 103 | { "kern.nprocs", CTL_KERN, KERN_NPROCS, 0 }, 104 | { "kern.msgbuf", CTL_KERN, KERN_MSGBUF, 0 }, 105 | { "kern.pool", CTL_KERN, KERN_POOL, 0 }, 106 | { "kern.stackgap_random", CTL_KERN, KERN_STACKGAPRANDOM, 0 }, 107 | { "kern.sysvipc_info", CTL_KERN, KERN_SYSVIPC_INFO, 0 }, 108 | { "kern.allowkmem", CTL_KERN, KERN_ALLOWKMEM, 0 }, 109 | { "kern.witnesswatch", CTL_KERN, KERN_WITNESSWATCH, 0 }, 110 | { "kern.splassert", CTL_KERN, KERN_SPLASSERT, 0 }, 111 | { "kern.procargs", CTL_KERN, KERN_PROC_ARGS, 0 }, 112 | { "kern.nfiles", CTL_KERN, KERN_NFILES, 0 }, 113 | { "kern.ttycount", CTL_KERN, KERN_TTYCOUNT, 0 }, 114 | { "kern.numvnodes", CTL_KERN, KERN_NUMVNODES, 0 }, 115 | { "kern.mbstat", CTL_KERN, KERN_MBSTAT, 0 }, 116 | { "kern.witness", CTL_KERN, KERN_WITNESS, 0 }, 117 | { "kern.seminfo", CTL_KERN, KERN_SEMINFO, 0 }, 118 | { "kern.shminfo", CTL_KERN, KERN_SHMINFO, 0 }, 119 | { "kern.intrcnt", CTL_KERN, KERN_INTRCNT, 0 }, 120 | { "kern.watchdog", CTL_KERN, KERN_WATCHDOG, 0 }, 121 | { "kern.proc", CTL_KERN, KERN_PROC, 0 }, 122 | { "kern.maxclusters", CTL_KERN, KERN_MAXCLUSTERS, 0 }, 123 | { "kern.evcount", CTL_KERN, KERN_EVCOUNT, 0 }, 124 | { "kern.timecounter", CTL_KERN, KERN_TIMECOUNTER, 0 }, 125 | { "kern.maxlocksperuid", CTL_KERN, KERN_MAXLOCKSPERUID, 0 }, 126 | { "kern.cp_time2", CTL_KERN, KERN_CPTIME2, 0 }, 127 | { "kern.bufcachepercent", CTL_KERN, KERN_CACHEPCT, 0 }, 128 | { "kern.file", CTL_KERN, KERN_FILE, 0 }, 129 | { "kern.wxabort", CTL_KERN, KERN_WXABORT, 0 }, 130 | { "kern.consdev", CTL_KERN, KERN_CONSDEV, 0 }, 131 | { "kern.netlivelocks", CTL_KERN, KERN_NETLIVELOCKS, 0 }, 132 | { "kern.pool_debug", CTL_KERN, KERN_POOL_DEBUG, 0 }, 133 | { "kern.proc_cwd", CTL_KERN, KERN_PROC_CWD, 0 }, 134 | { "kern.proc_nobroadcastkill", CTL_KERN, KERN_PROC_NOBROADCASTKILL, 0 }, 135 | { "kern.proc_vmap", CTL_KERN, KERN_PROC_VMMAP, 0 }, 136 | { "kern.global_ptrace", CTL_KERN, KERN_GLOBAL_PTRACE, 0 }, 137 | { "kern.consbufsize", CTL_KERN, KERN_CONSBUFSIZE, 0 }, 138 | { "kern.consbuf", CTL_KERN, KERN_CONSBUF, 0 }, 139 | { "kern.audio", CTL_KERN, KERN_AUDIO, 0 }, 140 | { "kern.cpustats", CTL_KERN, KERN_CPUSTATS, 0 }, 141 | { "kern.pfstatus", CTL_KERN, KERN_PFSTATUS, 0 }, 142 | { "kern.timeout_stats", CTL_KERN, KERN_TIMEOUT_STATS, 0 }, 143 | { "kern.utc_offset", CTL_KERN, KERN_UTC_OFFSET, 0 }, 144 | { "vm.vmmeter", CTL_VM, VM_METER, 0 }, 145 | { "vm.loadavg", CTL_VM, VM_LOADAVG, 0 }, 146 | { "vm.psstrings", CTL_VM, VM_PSSTRINGS, 0 }, 147 | { "vm.uvmexp", CTL_VM, VM_UVMEXP, 0 }, 148 | { "vm.swapencrypt", CTL_VM, VM_SWAPENCRYPT, 0 }, 149 | { "vm.nkmempages", CTL_VM, VM_NKMEMPAGES, 0 }, 150 | { "vm.anonmin", CTL_VM, VM_ANONMIN, 0 }, 151 | { "vm.vtextmin", CTL_VM, VM_VTEXTMIN, 0 }, 152 | { "vm.vnodemin", CTL_VM, VM_VNODEMIN, 0 }, 153 | { "vm.maxslp", CTL_VM, VM_MAXSLP, 0 }, 154 | { "vm.uspace", CTL_VM, VM_USPACE, 0 }, 155 | { "vm.malloc_conf", CTL_VM, VM_MALLOC_CONF, 0 }, 156 | { NULL, 0, 0, 0 }, 157 | }; 158 | -------------------------------------------------------------------------------- /src/openbsd/sysctlbyname.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019-2021 Brian Callahan 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include "internal.h" 25 | #include "../cosmotop_tools.hpp" 26 | 27 | int 28 | sysctlbyname(const char *name, void *oldp, size_t *oldlenp, 29 | void *newp, size_t newlen) 30 | { 31 | int i, mib[2]; 32 | 33 | for (i = 0; i < 132; i++) { 34 | // for (i = 0; i < sizeof(sysctlnames) / sizeof(sysctlnames[0]); i++) { 35 | if (!strcmp(name, sysctlnames[i].name)) { 36 | mib[0] = sysctlnames[i].mib0; 37 | mib[1] = sysctlnames[i].mib1; 38 | 39 | return sysctl(mib, 2, oldp, oldlenp, newp, newlen); 40 | } 41 | } 42 | 43 | errno = ENOENT; 44 | 45 | return (-1); 46 | } 47 | -------------------------------------------------------------------------------- /src/openbsd/sysctlbyname.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Brian Callahan 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | extern int sysctlbyname(const char *, void *, size_t *, void *, size_t); 21 | -------------------------------------------------------------------------------- /src/osx/ioreport.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2025 Brett Jia (dev.bjia56@gmail.com) 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | 15 | indent = tab 16 | tab-size = 4 17 | */ 18 | 19 | #include "ioreport.hpp" 20 | 21 | #include 22 | 23 | static std::string CFStringRefToString(CFStringRef str, UInt32 encoding = kCFStringEncodingUTF8) { 24 | if (str == nullptr) { 25 | return ""; 26 | } 27 | 28 | auto cstr = CFStringGetCStringPtr(str, encoding); 29 | if (cstr != nullptr) { 30 | return std::string(cstr); 31 | } 32 | 33 | auto length = CFStringGetLength(str); 34 | auto max_size = CFStringGetMaximumSizeForEncoding(length, encoding); 35 | std::vector buffer(max_size, 0); 36 | CFStringGetCString(str, buffer.data(), max_size, encoding); 37 | return std::string(buffer.data()); 38 | } 39 | 40 | namespace Npu { 41 | // this sampling interval seems to give results similar to asitop 42 | // a lower sampling interval doesn't seem to produce better results 43 | const long sampling_interval = 1000; // ms 44 | 45 | IOReportSubscription::IOReportSubscription() { 46 | ane_power = 0; 47 | 48 | thread_stop = false; 49 | thread = new std::thread([this]() { 50 | CFMutableDictionaryRef energy_model_channel = IOReportCopyChannelsInGroup(CFSTR("Energy Model"), nullptr, 0, 0, 0); 51 | CFMutableDictionaryRef pmp_channel = IOReportCopyChannelsInGroup(CFSTR("PMP"), nullptr, 0, 0, 0); 52 | IOReportMergeChannels(energy_model_channel, pmp_channel, nullptr); 53 | CFMutableDictionaryRef power_subchannel = nullptr; 54 | struct IOReportSubscriptionRef *power_subscription = IOReportCreateSubscription(nullptr, energy_model_channel, &power_subchannel, 0, nullptr); 55 | 56 | while (!thread_stop) { 57 | CFDictionaryRef sample_a = IOReportCreateSamples(power_subscription, power_subchannel, nullptr); 58 | std::this_thread::sleep_for(std::chrono::milliseconds(sampling_interval)); 59 | CFDictionaryRef sample_b = IOReportCreateSamples(power_subscription, power_subchannel, nullptr); 60 | 61 | CFDictionaryRef delta = IOReportCreateSamplesDelta(sample_a, sample_b, nullptr); 62 | CFRelease(sample_a); 63 | CFRelease(sample_b); 64 | 65 | IOReportIterate(delta, ^int (IOReportSampleRef sample) { 66 | std::string group = CFStringRefToString(IOReportChannelGetGroup(sample)); 67 | std::string name = CFStringRefToString(IOReportChannelGetChannelName(sample)); 68 | std::string units = CFStringRefToString(IOReportChannelGetUnitLabel(sample)); 69 | if ( 70 | (group == "PMP" and name == "ANE") or 71 | (group == "Energy Model" and name.starts_with("ANE")) 72 | ) { 73 | int format = IOReportChannelGetFormat(sample); 74 | double value = format == kIOReportFormatSimple ? IOReportSimpleGetIntegerValue(sample, nullptr) : 0; 75 | if (units.find("mJ") != std::string::npos) { 76 | value /= 1000; // convert to joules 77 | } else if (units.find("uJ") != std::string::npos) { 78 | value /= 1000000; // convert to joules 79 | } else if (units.find("nJ") != std::string::npos) { 80 | value /= 1000000000; // convert to joules 81 | } 82 | 83 | ane_power = value / (sampling_interval / 1000.0); // convert to watts 84 | if (!has_ane.has_value()) { 85 | has_ane = true; 86 | } 87 | } 88 | return kIOReportIterOk; 89 | }); 90 | CFRelease(delta); 91 | 92 | if (!has_ane.has_value()) { 93 | has_ane = false; 94 | break; 95 | } 96 | } 97 | }); 98 | 99 | while (!has_ane.has_value()) { 100 | std::this_thread::sleep_for(std::chrono::milliseconds(10)); 101 | } 102 | } 103 | 104 | IOReportSubscription::~IOReportSubscription() { 105 | thread_stop = true; 106 | thread->join(); 107 | delete thread; 108 | } 109 | 110 | bool IOReportSubscription::hasANE() { 111 | return has_ane.value(); 112 | } 113 | 114 | double IOReportSubscription::getANEPower() { 115 | return ane_power; 116 | } 117 | } // namespace Npu -------------------------------------------------------------------------------- /src/osx/ioreport.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2025 Brett Jia (dev.bjia56@gmail.com) 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | 15 | indent = tab 16 | tab-size = 4 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | enum { 30 | kIOReportIterOk, 31 | kIOReportIterFailed, 32 | kIOReportIterSkipped 33 | }; 34 | 35 | enum { 36 | kIOReportInvalidFormat = 0, 37 | kIOReportFormatSimple = 1, 38 | kIOReportFormatState = 2, 39 | kIOReportFormatHistogram = 3, 40 | kIOReportFormatSimpleArray = 4 41 | }; 42 | 43 | typedef CFDictionaryRef IOReportSampleRef; 44 | typedef int (^ioreportiterateblock)(IOReportSampleRef sample); 45 | 46 | extern "C" { 47 | extern CFMutableDictionaryRef IOReportCopyAllChannels(uint64_t, uint64_t); 48 | extern CFMutableDictionaryRef IOReportCopyChannelsInGroup(CFStringRef, CFStringRef, uint64_t, uint64_t, uint64_t); 49 | extern void IOReportMergeChannels(CFMutableDictionaryRef, CFMutableDictionaryRef, CFTypeRef); 50 | extern struct IOReportSubscriptionRef *IOReportCreateSubscription(void *a, CFMutableDictionaryRef desiredChannels, CFMutableDictionaryRef *subbedChannels, uint64_t channel_id, CFTypeRef b); 51 | extern CFDictionaryRef IOReportCreateSamples(struct IOReportSubscriptionRef *iorsub, CFMutableDictionaryRef subbedChannels, CFTypeRef a); 52 | extern CFDictionaryRef IOReportCreateSamplesDelta(CFDictionaryRef prev, CFDictionaryRef current, CFTypeRef a); 53 | extern void IOReportIterate(CFDictionaryRef samples, ioreportiterateblock); 54 | extern CFStringRef IOReportChannelGetGroup(IOReportSampleRef sample); 55 | extern CFStringRef IOReportChannelGetSubGroup(IOReportSampleRef sample); 56 | extern CFStringRef IOReportChannelGetChannelName(IOReportSampleRef sample); 57 | extern int IOReportChannelGetFormat(IOReportSampleRef sample); 58 | extern uint64_t IOReportSimpleGetIntegerValue(IOReportSampleRef sample, void *a); 59 | extern uint64_t IOReportStateGetCount(IOReportSampleRef sample); 60 | extern uint64_t IOReportStateGetResidency(IOReportSampleRef sample, uint32_t index); 61 | extern CFStringRef IOReportStateGetNameForIndex(CFDictionaryRef sample, uint32_t index); 62 | extern uint64_t IOReportArrayGetValueAtIndex(CFDictionaryRef sample, uint32_t index); 63 | extern CFStringRef IOReportChannelGetUnitLabel(CFDictionaryRef sample); 64 | } 65 | 66 | namespace Npu { 67 | // todo: neoasitop appears to use different max wattages 68 | // based on the cpu generation/model 69 | class PowerEstimate { 70 | public: 71 | PowerEstimate(std::string cpuModel); 72 | ~PowerEstimate(); 73 | 74 | double getANEMaxPower(); 75 | 76 | private: 77 | std::string cpuModel; 78 | }; 79 | 80 | class IOReportSubscription { 81 | public: 82 | IOReportSubscription(); 83 | ~IOReportSubscription(); 84 | 85 | bool hasANE(); 86 | double getANEPower(); 87 | 88 | private: 89 | // metrics gathering thread 90 | std::atomic thread_stop; 91 | std::thread *thread; 92 | 93 | std::optional has_ane; 94 | std::atomic ane_power; // watts 95 | }; 96 | } -------------------------------------------------------------------------------- /src/osx/sensors.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 Aristocratos (jakob@qvantnet.com) 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | 15 | indent = tab 16 | tab-size = 4 17 | */ 18 | 19 | #include 20 | #if __MAC_OS_X_VERSION_MIN_REQUIRED > 101504 21 | #include "sensors.hpp" 22 | 23 | #include 24 | #include 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | extern "C" { 31 | typedef struct __IOHIDEvent *IOHIDEventRef; 32 | typedef struct __IOHIDServiceClient *IOHIDServiceClientRef; 33 | #ifdef __LP64__ 34 | typedef double IOHIDFloat; 35 | #else 36 | typedef float IOHIDFloat; 37 | #endif 38 | 39 | #define IOHIDEventFieldBase(type) (type << 16) 40 | #define kIOHIDEventTypeTemperature 15 41 | 42 | IOHIDEventSystemClientRef IOHIDEventSystemClientCreate(CFAllocatorRef allocator); 43 | int IOHIDEventSystemClientSetMatching(IOHIDEventSystemClientRef client, CFDictionaryRef match); 44 | int IOHIDEventSystemClientSetMatchingMultiple(IOHIDEventSystemClientRef client, CFArrayRef match); 45 | IOHIDEventRef IOHIDServiceClientCopyEvent(IOHIDServiceClientRef, int64_t, int32_t, int64_t); 46 | CFStringRef IOHIDServiceClientCopyProperty(IOHIDServiceClientRef service, CFStringRef property); 47 | IOHIDFloat IOHIDEventGetFloatValue(IOHIDEventRef event, int32_t field); 48 | 49 | // create a dict ref, like for temperature sensor {"PrimaryUsagePage":0xff00, "PrimaryUsage":0x5} 50 | CFDictionaryRef matching(int page, int usage) { 51 | CFNumberRef nums[2]; 52 | CFStringRef keys[2]; 53 | 54 | keys[0] = CFStringCreateWithCString(0, "PrimaryUsagePage", 0); 55 | keys[1] = CFStringCreateWithCString(0, "PrimaryUsage", 0); 56 | nums[0] = CFNumberCreate(0, kCFNumberSInt32Type, &page); 57 | nums[1] = CFNumberCreate(0, kCFNumberSInt32Type, &usage); 58 | 59 | CFDictionaryRef dict = CFDictionaryCreate(0, (const void **)keys, (const void **)nums, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); 60 | CFRelease(keys[0]); 61 | CFRelease(keys[1]); 62 | return dict; 63 | } 64 | 65 | double getValue(IOHIDServiceClientRef sc) { 66 | IOHIDEventRef event = IOHIDServiceClientCopyEvent(sc, kIOHIDEventTypeTemperature, 0, 0); // here we use ...CopyEvent 67 | IOHIDFloat temp = 0.0; 68 | if (event != 0) { 69 | temp = IOHIDEventGetFloatValue(event, IOHIDEventFieldBase(kIOHIDEventTypeTemperature)); 70 | CFRelease(event); 71 | } 72 | return temp; 73 | } 74 | 75 | } // extern C 76 | 77 | long long Cpu::ThermalSensors::getSensors() { 78 | CFDictionaryRef thermalSensors = matching(0xff00, 5); // 65280_10 = FF00_16 79 | // thermalSensors's PrimaryUsagePage should be 0xff00 for M1 chip, instead of 0xff05 80 | // can be checked by ioreg -lfx 81 | IOHIDEventSystemClientRef system = IOHIDEventSystemClientCreate(kCFAllocatorDefault); 82 | IOHIDEventSystemClientSetMatching(system, thermalSensors); 83 | CFArrayRef matchingsrvs = IOHIDEventSystemClientCopyServices(system); 84 | std::vector temps; 85 | if (matchingsrvs) { 86 | long count = CFArrayGetCount(matchingsrvs); 87 | for (int i = 0; i < count; i++) { 88 | IOHIDServiceClientRef sc = (IOHIDServiceClientRef)CFArrayGetValueAtIndex(matchingsrvs, i); 89 | if (sc) { 90 | CFStringRef name = IOHIDServiceClientCopyProperty(sc, CFSTR("Product")); // here we use ...CopyProperty 91 | if (name) { 92 | char buf[200]; 93 | CFStringGetCString(name, buf, 200, kCFStringEncodingASCII); 94 | std::string n(buf); 95 | // this is just a guess, nobody knows which sensors mean what 96 | // on my system PMU tdie 3 and 9 are missing... 97 | // there is also PMU tdev1-8 but it has negative values?? 98 | // there is also eACC for efficiency package but it only has 2 entries 99 | // and pACC for performance but it has 7 entries (2 - 9) WTF 100 | if (n.starts_with("eACC") or n.starts_with("pACC")) { 101 | temps.push_back(getValue(sc)); 102 | } 103 | CFRelease(name); 104 | } 105 | } 106 | } 107 | CFRelease(matchingsrvs); 108 | } 109 | CFRelease(system); 110 | CFRelease(thermalSensors); 111 | if (temps.empty()) return 0ll; 112 | return round(std::accumulate(temps.begin(), temps.end(), 0ll) / temps.size()); 113 | } 114 | #endif 115 | -------------------------------------------------------------------------------- /src/osx/sensors.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 Aristocratos (jakob@qvantnet.com) 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | 15 | indent = tab 16 | tab-size = 4 17 | */ 18 | 19 | #include 20 | #if __MAC_OS_X_VERSION_MIN_REQUIRED > 101504 21 | namespace Cpu { 22 | class ThermalSensors { 23 | public: 24 | long long getSensors(); 25 | }; 26 | } // namespace Cpu 27 | #endif 28 | -------------------------------------------------------------------------------- /src/osx/smc.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 Aristocratos (jakob@qvantnet.com) 2 | Copyright 2025 Brett Jia (dev.bjia56@gmail.com) 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | indent = tab 17 | tab-size = 4 18 | */ 19 | 20 | #include 21 | #include 22 | 23 | #include "smc.hpp" 24 | 25 | static constexpr size_t MaxIndexCount = sizeof("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ") - 1; 26 | static constexpr const char *KeyIndexes = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 27 | 28 | static UInt32 _strtoul(char *str, int size, int base) { 29 | UInt32 total = 0; 30 | int i; 31 | 32 | for (i = 0; i < size; i++) { 33 | if (base == 16) { 34 | total += str[i] << (size - 1 - i) * 8; 35 | } else { 36 | total += (unsigned char)(str[i] << (size - 1 - i) * 8); 37 | } 38 | } 39 | return total; 40 | } 41 | 42 | static void _ultostr(char *str, UInt32 val) { 43 | str[0] = '\0'; 44 | snprintf(str, 5, "%c%c%c%c", 45 | (unsigned int)val >> 24, 46 | (unsigned int)val >> 16, 47 | (unsigned int)val >> 8, 48 | (unsigned int)val); 49 | } 50 | 51 | namespace Cpu { 52 | 53 | std::unordered_map> converters = { 54 | { 55 | "ui8", [](const SMCVal_t &val) -> double { 56 | return val.bytes[0]; 57 | } 58 | }, 59 | { 60 | "ui16", [](const SMCVal_t &val) -> double { 61 | return (UInt16)val.bytes[0] << 8 | (UInt16)val.bytes[1]; 62 | } 63 | }, 64 | { 65 | "ui32", [](const SMCVal_t &val) -> double { 66 | return (UInt32)val.bytes[0] << 24 | (UInt32)val.bytes[1] << 16 | (UInt32)val.bytes[2] << 8 | (UInt32)val.bytes[3]; 67 | } 68 | }, 69 | { 70 | "sp1e", [](const SMCVal_t &val) -> double { 71 | return ((UInt16)val.bytes[0] << 8 | (UInt16)val.bytes[1]) / 16384.0; 72 | } 73 | }, 74 | { 75 | "sp3c", [](const SMCVal_t &val) -> double { 76 | return ((UInt16)val.bytes[0] << 8 | (UInt16)val.bytes[1]) / 4096.0; 77 | } 78 | }, 79 | { 80 | "sp5b", [](const SMCVal_t &val) -> double { 81 | return ((UInt16)val.bytes[0] << 8 | (UInt16)val.bytes[1]) / 2048.0; 82 | } 83 | }, 84 | { 85 | "sp5a", [](const SMCVal_t &val) -> double { 86 | return ((UInt16)val.bytes[0] << 8 | (UInt16)val.bytes[1]) / 1024.0; 87 | } 88 | }, 89 | { 90 | "sp69", [](const SMCVal_t &val) -> double { 91 | return ((UInt16)val.bytes[0] << 8 | (UInt16)val.bytes[1]) / 512.0; 92 | } 93 | }, 94 | { 95 | "sp78", [](const SMCVal_t &val) -> double { 96 | return ((int)val.bytes[0] << 8 | (int)val.bytes[1]) / 256.0; 97 | } 98 | }, 99 | { 100 | "sp87", [](const SMCVal_t &val) -> double { 101 | return ((int)val.bytes[0] << 8 | (int)val.bytes[1]) / 128.0; 102 | } 103 | }, 104 | { 105 | "sp96", [](const SMCVal_t &val) -> double { 106 | return ((int)val.bytes[0] << 8 | (int)val.bytes[1]) / 64.0; 107 | } 108 | }, 109 | { 110 | "spb4", [](const SMCVal_t &val) -> double { 111 | return ((int)val.bytes[0] << 8 | (int)val.bytes[1]) / 16.0; 112 | } 113 | }, 114 | { 115 | "spf0", [](const SMCVal_t &val) -> double { 116 | return ((int)val.bytes[0] << 8 | (int)val.bytes[1]); 117 | } 118 | }, 119 | { 120 | "flt ", [](const SMCVal_t &val) -> double { 121 | return *(float *)val.bytes; 122 | } 123 | }, 124 | { 125 | "fpe2", [](const SMCVal_t &val) -> double { 126 | return (int)val.bytes[0] << 6 | (int)val.bytes[1] >> 2; 127 | } 128 | } 129 | }; 130 | 131 | SMCConnection::SMCConnection() { 132 | CFMutableDictionaryRef matchingDictionary = IOServiceMatching("AppleSMC"); 133 | io_iterator_t iterator; 134 | kern_return_t result = IOServiceGetMatchingServices(0, matchingDictionary, &iterator); 135 | if (result != kIOReturnSuccess) { 136 | throw std::runtime_error("failed to get AppleSMC"); 137 | } 138 | 139 | io_object_t device = IOIteratorNext(iterator); 140 | IOObjectRelease(iterator); 141 | if (device == 0) { 142 | throw std::runtime_error("failed to get SMC device"); 143 | } 144 | 145 | result = IOServiceOpen(device, mach_task_self(), 0, &conn); 146 | IOObjectRelease(device); 147 | if (result != kIOReturnSuccess) { 148 | throw std::runtime_error("failed to get SMC connection"); 149 | } 150 | } 151 | SMCConnection::~SMCConnection() { 152 | IOServiceClose(conn); 153 | } 154 | 155 | // core means physical core in SMC, while in core map it's cpu threads :-/ Only an issue on hackintosh? 156 | // this means we can only get the T per physical core 157 | // another issue with the SMC API is that the key is always 4 chars -> what with systems with more than 9 physical cores? 158 | // no Mac models with more than 18 threads are released, so no problem so far 159 | // according to VirtualSMC docs (hackintosh fake SMC) the enumeration follows with alphabetic chars - not implemented yet here (nor in VirtualSMC) 160 | long long SMCConnection::getTemp(int core) { 161 | char key[] = SMC_KEY_CPU_TEMP; 162 | if (core >= 0) { 163 | if ((size_t)core > MaxIndexCount) { 164 | return -1; 165 | } 166 | snprintf(key, 5, "TC%1cc", KeyIndexes[core]); 167 | } 168 | long long result = static_cast(getValue(key)); 169 | if (result == -1) { 170 | // try again with C 171 | snprintf(key, 5, "TC%1dC", KeyIndexes[core]); 172 | result = static_cast(getValue(key)); 173 | } 174 | return result; 175 | } 176 | 177 | std::vector SMCConnection::listKeys() { 178 | double numKeys = getValue("#KEY"); 179 | if (numKeys == -1) { 180 | return {}; 181 | } 182 | 183 | std::vector keys; 184 | for (int i = 0; i < (int)numKeys; i++) { 185 | SMCKeyData_t inputStructure; 186 | SMCKeyData_t outputStructure; 187 | 188 | inputStructure.data8 = SMC_CMD_READ_INDEX; 189 | inputStructure.data32 = (UInt32)i; 190 | 191 | kern_return_t result = SMCCall(KERNEL_INDEX_SMC, &inputStructure, &outputStructure); 192 | if (result == kIOReturnSuccess) { 193 | UInt32Char_t key; 194 | _ultostr(key, outputStructure.key); 195 | keys.push_back(std::string(key)); 196 | } 197 | } 198 | 199 | return keys; 200 | } 201 | 202 | double SMCConnection::getValue(char *key) { 203 | SMCVal_t val; 204 | kern_return_t result; 205 | result = SMCReadKey(key, &val); 206 | if (result == kIOReturnSuccess) { 207 | if (val.dataSize > 0) { 208 | std::string dataType(val.dataType); 209 | if (converters.find(dataType) != converters.end()) { 210 | return converters[dataType](val); 211 | } 212 | } 213 | } 214 | return -1; 215 | } 216 | 217 | kern_return_t SMCConnection::SMCReadKey(UInt32Char_t key, SMCVal_t *val) { 218 | kern_return_t result; 219 | SMCKeyData_t inputStructure; 220 | SMCKeyData_t outputStructure; 221 | 222 | memset(&inputStructure, 0, sizeof(SMCKeyData_t)); 223 | memset(&outputStructure, 0, sizeof(SMCKeyData_t)); 224 | memset(val, 0, sizeof(SMCVal_t)); 225 | 226 | inputStructure.key = _strtoul(key, 4, 16); 227 | inputStructure.data8 = SMC_CMD_READ_KEYINFO; 228 | 229 | result = SMCCall(KERNEL_INDEX_SMC, &inputStructure, &outputStructure); 230 | if (result != kIOReturnSuccess) 231 | return result; 232 | 233 | val->dataSize = outputStructure.keyInfo.dataSize; 234 | _ultostr(val->dataType, outputStructure.keyInfo.dataType); 235 | inputStructure.keyInfo.dataSize = val->dataSize; 236 | inputStructure.data8 = SMC_CMD_READ_BYTES; 237 | 238 | result = SMCCall(KERNEL_INDEX_SMC, &inputStructure, &outputStructure); 239 | if (result != kIOReturnSuccess) 240 | return result; 241 | 242 | memcpy(val->bytes, outputStructure.bytes, sizeof(outputStructure.bytes)); 243 | 244 | return kIOReturnSuccess; 245 | } 246 | 247 | kern_return_t SMCConnection::SMCCall(int index, SMCKeyData_t *inputStructure, SMCKeyData_t *outputStructure) { 248 | size_t structureInputSize; 249 | size_t structureOutputSize; 250 | 251 | structureInputSize = sizeof(SMCKeyData_t); 252 | structureOutputSize = sizeof(SMCKeyData_t); 253 | 254 | return IOConnectCallStructMethod(conn, index, 255 | // inputStructure 256 | inputStructure, structureInputSize, 257 | // ouputStructure 258 | outputStructure, &structureOutputSize); 259 | } 260 | 261 | } // namespace Cpu 262 | -------------------------------------------------------------------------------- /src/osx/smc.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 Aristocratos (jakob@qvantnet.com) 2 | Copyright 2025 Brett Jia (dev.bjia56@gmail.com) 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | indent = tab 17 | tab-size = 4 18 | */ 19 | 20 | #pragma once 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | #define VERSION "0.01" 32 | 33 | #define KERNEL_INDEX_SMC 2 34 | 35 | #define SMC_CMD_READ_BYTES 5 36 | #define SMC_CMD_WRITE_BYTES 6 37 | #define SMC_CMD_READ_INDEX 8 38 | #define SMC_CMD_READ_KEYINFO 9 39 | #define SMC_CMD_READ_PLIMIT 11 40 | #define SMC_CMD_READ_VERS 12 41 | 42 | // key values 43 | #define SMC_KEY_CPU_TEMP "TC0P" // proximity temp? 44 | #define SMC_KEY_CPU_DIODE_TEMP "TC0D" // diode temp? 45 | #define SMC_KEY_CPU_DIE_TEMP "TC0F" // die temp? 46 | #define SMC_KEY_CPU1_TEMP "TC1C" 47 | #define SMC_KEY_CPU2_TEMP "TC2C" // etc 48 | #define SMC_KEY_FAN0_RPM_CUR "F0Ac" 49 | 50 | typedef struct { 51 | char major; 52 | char minor; 53 | char build; 54 | char reserved[1]; 55 | UInt16 release; 56 | } SMCKeyData_vers_t; 57 | 58 | typedef struct { 59 | UInt16 version; 60 | UInt16 length; 61 | UInt32 cpuPLimit; 62 | UInt32 gpuPLimit; 63 | UInt32 memPLimit; 64 | } SMCKeyData_pLimitData_t; 65 | 66 | typedef struct { 67 | UInt32 dataSize; 68 | UInt32 dataType; 69 | char dataAttributes; 70 | } SMCKeyData_keyInfo_t; 71 | 72 | typedef unsigned char SMCBytes_t[32]; 73 | 74 | typedef struct { 75 | UInt32 key; 76 | SMCKeyData_vers_t vers; 77 | SMCKeyData_pLimitData_t pLimitData; 78 | SMCKeyData_keyInfo_t keyInfo; 79 | char result; 80 | char status; 81 | char data8; 82 | UInt32 data32; 83 | SMCBytes_t bytes; 84 | } SMCKeyData_t; 85 | 86 | typedef char UInt32Char_t[5]; 87 | 88 | typedef struct { 89 | UInt32Char_t key; 90 | UInt32 dataSize; 91 | UInt32Char_t dataType; 92 | SMCBytes_t bytes; 93 | } SMCVal_t; 94 | 95 | namespace Cpu { 96 | class SMCConnection { 97 | public: 98 | SMCConnection(); 99 | virtual ~SMCConnection(); 100 | 101 | long long getTemp(int core); 102 | 103 | private: 104 | std::vector listKeys(); 105 | double getValue(char *key); 106 | kern_return_t SMCReadKey(UInt32Char_t key, SMCVal_t *val); 107 | kern_return_t SMCCall(int index, SMCKeyData_t *inputStructure, SMCKeyData_t *outputStructure); 108 | 109 | // Connection to the SMC service 110 | io_connect_t conn; 111 | }; 112 | } // namespace Cpu 113 | -------------------------------------------------------------------------------- /themes/HotPurpleTrafficLight.theme: -------------------------------------------------------------------------------- 1 | #HotPurpleTrafficLight 2 | #by Pete Allebone - mess with the best... you know the rest. 3 | #Designed to flash up bright red with danger when loads are high and attention is needed. 4 | 5 | # Main background, empty for terminal default, need to be empty if you want transparent background 6 | theme[main_bg]="#000000" 7 | 8 | # Main text color 9 | theme[main_fg]="#d1d1e0" 10 | 11 | # Title color for boxes 12 | theme[title]="#d1d1e0" 13 | 14 | # Highlight color for keyboard shortcuts 15 | theme[hi_fg]="#9933ff" 16 | 17 | # Background color of selected item in processes box 18 | theme[selected_bg]="#6666ff" 19 | 20 | # Foreground color of selected item in processes box 21 | theme[selected_fg]="#d1d1e0" 22 | 23 | # Color of inactive/disabled text 24 | theme[inactive_fg]="#9999ff" 25 | 26 | # Color of text appearing on top of graphs, i.e uptime and current network graph scaling 27 | theme[graph_text]="#9933ff" 28 | 29 | # Background color of the percentage meters 30 | theme[meter_bg]="#4d4dff" 31 | 32 | # Misc colors for processes box including mini cpu graphs, details memory graph and details status text 33 | theme[proc_misc]="#9933ff" 34 | 35 | # Cpu box outline color 36 | theme[cpu_box]="#a64dff" 37 | 38 | # Memory/disks box outline color 39 | theme[mem_box]="#a64dff" 40 | 41 | # Net up/down box outline color 42 | theme[net_box]="#a64dff" 43 | 44 | # Processes box outline color 45 | theme[proc_box]="#a64dff" 46 | 47 | # Box divider line and small boxes line color 48 | theme[div_line]="#4d4dff" 49 | 50 | # Temperature graph colors 51 | theme[temp_start]="#00ff00" 52 | theme[temp_mid]="#ff9933" 53 | theme[temp_end]="#ff0000" 54 | 55 | # CPU graph colors 56 | theme[cpu_start]="#00ff00" 57 | theme[cpu_mid]="#ccff66" 58 | theme[cpu_end]="#ff0000" 59 | 60 | # Mem/Disk free meter 61 | theme[free_end]="#00ff00" 62 | theme[free_mid]="#ccff66" 63 | theme[free_start]="#ff0000" 64 | 65 | # Mem/Disk cached meter 66 | theme[cached_start]="#00ff00" 67 | theme[cached_mid]="#ccff66" 68 | theme[cached_end]="#ff0000" 69 | 70 | # Mem/Disk available meter 71 | theme[available_start]="#ff0000" 72 | theme[available_mid]="#ccff66" 73 | theme[available_end]="#00ff00" 74 | 75 | # Mem/Disk used meter 76 | theme[used_start]="#00ff00" 77 | theme[used_mid]="#ccff66" 78 | theme[used_end]="#ff0000" 79 | 80 | # Download graph colors 81 | theme[download_start]="#00ff00" 82 | theme[download_mid]="#ff9933" 83 | theme[download_end]="#ff0000" 84 | 85 | # Upload graph colors 86 | theme[upload_start]="#00ff00" 87 | theme[upload_mid]="#ff9933" 88 | theme[upload_end]="#ff0000" 89 | 90 | # Process box color gradient for threads, mem and cpu usage 91 | theme[process_start]="#9999ff" 92 | theme[process_mid]="#4d4dff" 93 | theme[process_end]="#a64dff" 94 | 95 | -------------------------------------------------------------------------------- /themes/adapta.theme: -------------------------------------------------------------------------------- 1 | #Bashtop Adapta theme 2 | #by olokelo 3 | 4 | # Colors should be in 6 or 2 character hexadecimal or single spaced rgb decimal: "#RRGGBB", "#BW" or "0-255 0-255 0-255" 5 | # example for white: "#ffffff", "#ff" or "255 255 255". 6 | 7 | # All graphs and meters can be gradients 8 | # For single color graphs leave "mid" and "end" variable empty. 9 | # Use "start" and "end" variables for two color gradient 10 | # Use "start", "mid" and "end" for three color gradient 11 | 12 | # Main background, empty for terminal default, need to be empty if you want transparent background 13 | theme[main_bg]="" 14 | 15 | # Main text color 16 | theme[main_fg]="#cfd8dc" 17 | 18 | # Title color for boxes 19 | theme[title]="#ff" 20 | 21 | # Highlight color for keyboard shortcuts 22 | theme[hi_fg]="#90" 23 | 24 | # Background color of selected item in processes box 25 | theme[selected_bg]="#bb0040" 26 | 27 | # Foreground color of selected item in processes box 28 | theme[selected_fg]="#ff" 29 | 30 | # Color of inactive/disabled text 31 | theme[inactive_fg]="#40" 32 | 33 | # Misc colors for processes box including mini cpu graphs, details memory graph and details status text 34 | theme[proc_misc]="#55bcea" 35 | 36 | # Cpu box outline color 37 | theme[cpu_box]="#00bcd4" 38 | 39 | # Memory/disks box outline color 40 | theme[mem_box]="#00bcd4" 41 | 42 | # Net up/down box outline color 43 | theme[net_box]="#00bcd4" 44 | 45 | # Processes box outline color 46 | theme[proc_box]="#00bcd4" 47 | 48 | # Box divider line and small boxes line color 49 | theme[div_line]="#50" 50 | 51 | # Temperature graph colors 52 | theme[temp_start]="#00bcd4" 53 | theme[temp_mid]="#d4d400" 54 | theme[temp_end]="#ff0040" 55 | 56 | # CPU graph colors 57 | theme[cpu_start]="#00bcd4" 58 | theme[cpu_mid]="#d4d400" 59 | theme[cpu_end]="#ff0040" 60 | 61 | # Mem/Disk free meter 62 | theme[free_start]="#00bcd4" 63 | theme[free_mid]="#1090a0" 64 | theme[free_end]="#206f79" 65 | 66 | # Mem/Disk cached meter 67 | theme[cached_start]="#991199" 68 | theme[cached_mid]="#770a55" 69 | theme[cached_end]="#550055" 70 | 71 | # Mem/Disk available meter 72 | theme[available_start]="#00b0ff" 73 | theme[available_mid]="#1099cc" 74 | theme[available_end]="#2070aa" 75 | 76 | # Mem/Disk used meter 77 | theme[used_start]="#ff0040" 78 | theme[used_mid]="#ff2060" 79 | theme[used_end]="#ff4080" 80 | 81 | # Download graph colors 82 | theme[download_start]="#00bcd4" 83 | theme[download_mid]="#991199" 84 | theme[download_end]="#ff0040" 85 | 86 | # Upload graph colors 87 | theme[upload_start]="#00bcd4" 88 | theme[upload_mid]="#991199" 89 | theme[upload_end]="#ff0040" 90 | -------------------------------------------------------------------------------- /themes/adwaita.theme: -------------------------------------------------------------------------------- 1 | #Bashtop Adwaita theme 2 | #by flipflop133 3 | 4 | # Colors should be in 6 or 2 character hexadecimal or single spaced rgb decimal: "#RRGGBB", "#BW" or "0-255 0-255 0-255" 5 | # example for white: "#FFFFFF", "#ff" or "255 255 255". 6 | 7 | # All graphs and meters can be gradients 8 | # For single color graphs leave "mid" and "end" variable empty. 9 | # Use "start" and "end" variables for two color gradient 10 | # Use "start", "mid" and "end" for three color gradient 11 | 12 | # Main background, empty for terminal default, need to be empty if you want transparent background 13 | theme[main_bg]="#f6f5f4" 14 | 15 | # Main text color 16 | theme[main_fg]="#2e3436" 17 | 18 | # Title color for boxes 19 | theme[title]="#2e3436" 20 | 21 | # Highlight color for keyboard shortcuts 22 | theme[hi_fg]="#1a5fb4" 23 | 24 | # Background color of selected item in processes box 25 | theme[selected_bg]="#1c71d8" 26 | 27 | # Foreground color of selected item in processes box 28 | theme[selected_fg]="#ffffff" 29 | 30 | # Color of inactive/disabled text 31 | theme[inactive_fg]="#5e5c64" 32 | 33 | # Misc colors for processes box including mini cpu graphs, details memory graph and details status text 34 | theme[proc_misc]="#1a5fb4" 35 | 36 | # Cpu box outline color 37 | theme[cpu_box]="#2e3436" 38 | 39 | # Memory/disks box outline color 40 | theme[mem_box]="#3d3c14" 41 | 42 | # Net up/down box outline color 43 | theme[net_box]="#2e3436" 44 | 45 | # Processes box outline color 46 | theme[proc_box]="#2e3436" 47 | 48 | # Box divider line and small boxes line color 49 | theme[div_line]="#2e3436" 50 | 51 | # Temperature graph colors 52 | theme[temp_start]="#1a5fb4" 53 | theme[temp_mid]="#1a5fb4" 54 | theme[temp_end]="#c01c28" 55 | 56 | # CPU graph colors 57 | theme[cpu_start]="#1a5fb4" 58 | theme[cpu_mid]="#1a5fb4" 59 | theme[cpu_end]="#c01c28" 60 | 61 | # Mem/Disk free meter 62 | theme[free_start]="#1a5fb4" 63 | theme[free_mid]="#1a5fb4" 64 | theme[free_end]="#c01c28" 65 | 66 | # Mem/Disk cached meter 67 | theme[cached_start]="#1a5fb4" 68 | theme[cached_mid]="#1a5fb4" 69 | theme[cached_end]="#c01c28" 70 | 71 | # Mem/Disk available meter 72 | theme[available_start]="#1a5fb4" 73 | theme[available_mid]="#1a5fb4" 74 | theme[available_end]="#c01c28" 75 | 76 | # Mem/Disk used meter 77 | theme[used_start]="#1a5fb4" 78 | theme[used_mid]="#1a5fb4" 79 | theme[used_end]="#c01c28" 80 | 81 | # Download graph colors 82 | theme[download_start]="#1a5fb4" 83 | theme[download_mid]="#1a5fb4" 84 | theme[download_end]="#c01c28" 85 | 86 | # Upload graph colors 87 | theme[upload_start]="#1a5fb4" 88 | theme[upload_mid]="#1a5fb4" 89 | theme[upload_end]="#c01c28" 90 | -------------------------------------------------------------------------------- /themes/ayu.theme: -------------------------------------------------------------------------------- 1 | # Main background, empty for terminal default, need to be empty if you want transparent background 2 | theme[main_bg]="#0B0E14" 3 | 4 | # Main text color 5 | theme[main_fg]="#BFBDB6" 6 | 7 | # Title color for boxes 8 | theme[title]="#BFBDB6" 9 | 10 | # Highlight color for keyboard shortcuts 11 | theme[hi_fg]="#E6B450" 12 | 13 | # Background color of selected item in processes box 14 | theme[selected_bg]="#E6B450" 15 | 16 | # Foreground color of selected item in processes box 17 | theme[selected_fg]="#f8f8f2" 18 | 19 | # Color of inactive/disabled text 20 | theme[inactive_fg]="#565B66" 21 | 22 | # Color of text appearing on top of graphs, i.e uptime and current network graph scaling 23 | theme[graph_text]="#BFBDB6" 24 | 25 | # Background color of the percentage meters 26 | theme[meter_bg]="#565B66" 27 | 28 | # Misc colors for processes box including mini cpu graphs, details memory graph and details status text 29 | theme[proc_misc]="#DFBFFF" 30 | 31 | # Cpu box outline color 32 | theme[cpu_box]="#DFBFFF" 33 | 34 | # Memory/disks box outline color 35 | theme[mem_box]="#95E6CB" 36 | 37 | # Net up/down box outline color 38 | theme[net_box]="#F28779" 39 | 40 | # Processes box outline color 41 | theme[proc_box]="#E6B673" 42 | 43 | # Box divider line and small boxes line color 44 | theme[div_line]="#565B66" 45 | 46 | # Temperature graph colors 47 | theme[temp_start]="#DFBFFF" 48 | theme[temp_mid]="#D2A6FF" 49 | theme[temp_end]="#A37ACC" 50 | 51 | # CPU graph colors 52 | theme[cpu_start]="#DFBFFF" 53 | theme[cpu_mid]="#D2A6FF" 54 | theme[cpu_end]="#A37ACC" 55 | 56 | # Mem/Disk free meter 57 | theme[free_start]="#95E6CB" 58 | theme[free_mid]="#95E6CB" 59 | theme[free_end]="#4CBF99" 60 | 61 | # Mem/Disk cached meter 62 | theme[cached_start]="#95E6CB" 63 | theme[cached_mid]="#95E6CB" 64 | theme[cached_end]="#4CBF99" 65 | 66 | # Mem/Disk available meter 67 | theme[available_start]="#95E6CB" 68 | theme[available_mid]="#95E6CB" 69 | theme[available_end]="#4CBF99" 70 | 71 | # Mem/Disk used meter 72 | theme[used_start]="#95E6CB" 73 | theme[used_mid]="#95E6CB" 74 | theme[used_end]="#4CBF99" 75 | 76 | # Download graph colors 77 | theme[download_start]="#F28779" 78 | theme[download_mid]="#F07178" 79 | theme[download_end]="#F07171" 80 | 81 | # Upload graph colors 82 | theme[upload_start]="#73D0FF" 83 | theme[upload_mid]="#59C2FF" 84 | theme[upload_end]="#399EE6" 85 | 86 | # Process box color gradient for threads, mem and cpu usage 87 | theme[process_start]="#FFCC66" 88 | theme[process_mid]="#E6B450" 89 | theme[process_end]="#FFAA33" 90 | -------------------------------------------------------------------------------- /themes/dracula.theme: -------------------------------------------------------------------------------- 1 | # Main background, empty for terminal default, need to be empty if you want transparent background 2 | theme[main_bg]="#282a36" 3 | 4 | # Main text color 5 | theme[main_fg]="#f8f8f2" 6 | 7 | # Title color for boxes 8 | theme[title]="#f8f8f2" 9 | 10 | # Highlight color for keyboard shortcuts 11 | theme[hi_fg]="#6272a4" 12 | 13 | # Background color of selected item in processes box 14 | theme[selected_bg]="#ff79c6" 15 | 16 | # Foreground color of selected item in processes box 17 | theme[selected_fg]="#f8f8f2" 18 | 19 | # Color of inactive/disabled text 20 | theme[inactive_fg]="#44475a" 21 | 22 | # Color of text appearing on top of graphs, i.e uptime and current network graph scaling 23 | theme[graph_text]="#f8f8f2" 24 | 25 | # Background color of the percentage meters 26 | theme[meter_bg]="#44475a" 27 | 28 | # Misc colors for processes box including mini cpu graphs, details memory graph and details status text 29 | theme[proc_misc]="#bd93f9" 30 | 31 | # Cpu box outline color 32 | theme[cpu_box]="#bd93f9" 33 | 34 | # Memory/disks box outline color 35 | theme[mem_box]="#50fa7b" 36 | 37 | # Net up/down box outline color 38 | theme[net_box]="#ff5555" 39 | 40 | # Processes box outline color 41 | theme[proc_box]="#8be9fd" 42 | 43 | # Box divider line and small boxes line color 44 | theme[div_line]="#44475a" 45 | 46 | # Temperature graph colors 47 | theme[temp_start]="#bd93f9" 48 | theme[temp_mid]="#ff79c6" 49 | theme[temp_end]="#ff33a8" 50 | 51 | # CPU graph colors 52 | theme[cpu_start]="#bd93f9" 53 | theme[cpu_mid]="#8be9fd" 54 | theme[cpu_end]="#50fa7b" 55 | 56 | # Mem/Disk free meter 57 | theme[free_start]="#ffa6d9" 58 | theme[free_mid]="#ff79c6" 59 | theme[free_end]="#ff33a8" 60 | 61 | # Mem/Disk cached meter 62 | theme[cached_start]="#b1f0fd" 63 | theme[cached_mid]="#8be9fd" 64 | theme[cached_end]="#26d7fd" 65 | 66 | # Mem/Disk available meter 67 | theme[available_start]="#ffd4a6" 68 | theme[available_mid]="#ffb86c" 69 | theme[available_end]="#ff9c33" 70 | 71 | # Mem/Disk used meter 72 | theme[used_start]="#96faaf" 73 | theme[used_mid]="#50fa7b" 74 | theme[used_end]="#0dfa49" 75 | 76 | # Download graph colors 77 | theme[download_start]="#bd93f9" 78 | theme[download_mid]="#50fa7b" 79 | theme[download_end]="#8be9fd" 80 | 81 | # Upload graph colors 82 | theme[upload_start]="#8c42ab" 83 | theme[upload_mid]="#ff79c6" 84 | theme[upload_end]="#ff33a8" 85 | 86 | # Process box color gradient for threads, mem and cpu usage 87 | theme[process_start]="#50fa7b" 88 | theme[process_mid]="#59b690" 89 | theme[process_end]="#6272a4" 90 | -------------------------------------------------------------------------------- /themes/dusklight.theme: -------------------------------------------------------------------------------- 1 | #Bpytop theme comprised of blues, oranges, cyan, and yellow. 2 | #by Drazil100 3 | 4 | # Colors should be in 6 or 2 character hexadecimal or single spaced rgb decimal: "#RRGGBB", "#BW" or "0-255 0-255 0-255" 5 | # example for white: "#FFFFFF", "#ff" or "255 255 255". 6 | 7 | # All graphs and meters can be gradients 8 | # For single color graphs leave "mid" and "end" variable empty. 9 | # Use "start" and "end" variables for two color gradient 10 | # Use "start", "mid" and "end" for three color gradient 11 | 12 | # Main background, empty for terminal default, need to be empty if you want transparent background 13 | theme[main_bg]="#04142E" 14 | 15 | # Main text color 16 | theme[main_fg]="#99DFFF" 17 | 18 | # Title color for boxes 19 | theme[title]="#99FFFF" 20 | 21 | # Highlight color for keyboard shortcuts 22 | theme[hi_fg]="#FF7F00" 23 | 24 | # Background color of selected item in processes box 25 | theme[selected_bg]="#722B01" 26 | 27 | # Foreground color of selected item in processes box 28 | theme[selected_fg]="#99FFFF" 29 | 30 | # Color of inactive/disabled text 31 | theme[inactive_fg]="#052E51" 32 | 33 | # Color of text appearing on top of graphs, i.e uptime and current network graph scaling 34 | theme[graph_text]="#79A1B4" 35 | 36 | # Background color of the percentage meters 37 | theme[meter_bg]="#052E51" 38 | 39 | # Misc colors for processes box including mini cpu graphs, details memory graph and details status text 40 | theme[proc_misc]="#B46718" 41 | 42 | # Cpu box outline color 43 | theme[cpu_box]="#00FFFF" 44 | 45 | # Memory/disks box outline color 46 | theme[mem_box]="#00FFFF" 47 | 48 | # Net up/down box outline color 49 | theme[net_box]="#00FFFF" 50 | 51 | # Processes box outline color 52 | theme[proc_box]="#00FFFF" 53 | 54 | # Box divider line and small boxes line color 55 | theme[div_line]="#A55800" 56 | 57 | # Temperature graph colors 58 | theme[temp_start]="#00ADFF" 59 | theme[temp_mid]="#00FFFF" 60 | theme[temp_end]="#FFF86B" 61 | 62 | # CPU graph colors 63 | theme[cpu_start]="#00D4FF" 64 | theme[cpu_mid]="#FFF86B" 65 | theme[cpu_end]="#FF7F00" 66 | 67 | # Mem/Disk free meter 68 | theme[free_start]="#0187CB" 69 | theme[free_mid]="" 70 | theme[free_end]="" 71 | 72 | # Mem/Disk cached meter 73 | theme[cached_start]="#B4BB63" 74 | theme[cached_mid]="" 75 | theme[cached_end]="" 76 | 77 | # Mem/Disk available meter 78 | theme[available_start]="#01C0CB" 79 | theme[available_mid]="" 80 | theme[available_end]="" 81 | 82 | # Mem/Disk used meter 83 | theme[used_start]="#B46718" 84 | theme[used_mid]="" 85 | theme[used_end]="" 86 | 87 | # Download graph colors 88 | theme[download_start]="#009EFF" 89 | theme[download_mid]="" 90 | theme[download_end]="#00FFFF" 91 | 92 | # Upload graph colors 93 | theme[upload_start]="#FF7F00" 94 | theme[upload_mid]="" 95 | theme[upload_end]="#FFF86B" 96 | -------------------------------------------------------------------------------- /themes/elementarish.theme: -------------------------------------------------------------------------------- 1 | # Theme: Elementarish 2 | # (inspired by Elementary OS) 3 | # By: Dennis Mayr 4 | 5 | # Main bg 6 | theme[main_bg]="#333333" 7 | 8 | # Main text color 9 | theme[main_fg]="#eee8d5" 10 | 11 | # Title color for boxes 12 | theme[title]="#eee8d5" 13 | 14 | # Highlight color for keyboard shortcuts 15 | theme[hi_fg]="#d1302c" 16 | 17 | # Background color of selected item in processes box 18 | theme[selected_bg]="#268ad0" 19 | 20 | # Foreground color of selected item in processes box 21 | theme[selected_fg]="#eee8d5" 22 | 23 | # Color of inactive/disabled text 24 | theme[inactive_fg]="#657b83" 25 | 26 | # Misc colors for processes box including mini cpu graphs, details memory graph and details status text 27 | theme[proc_misc]="#268ad0" 28 | 29 | # Cpu box outline color 30 | theme[cpu_box]="#657b83" 31 | 32 | # Memory/disks box outline color 33 | theme[mem_box]="#657b83" 34 | 35 | # Net up/down box outline color 36 | theme[net_box]="#657b83" 37 | 38 | # Processes box outline color 39 | theme[proc_box]="#657b83" 40 | 41 | # Box divider line and small boxes line color 42 | theme[div_line]="#657b83" 43 | 44 | # Temperature graph colors 45 | theme[temp_start]="#859900" 46 | theme[temp_mid]="#b28602" 47 | theme[temp_end]="#d1302c" 48 | 49 | # CPU graph colors 50 | theme[cpu_start]="#859900" 51 | theme[cpu_mid]="#b28602" 52 | theme[cpu_end]="#d1302c" 53 | 54 | # Mem/Disk free meter 55 | theme[free_start]="#268ad0" 56 | theme[free_mid]="#6c71c4" 57 | theme[free_end]="#2a9d95" 58 | 59 | # Mem/Disk cached meter 60 | theme[cached_start]="#268ad0" 61 | theme[cached_mid]="#6c71c4" 62 | theme[cached_end]="#d1302c" 63 | 64 | # Mem/Disk available meter 65 | theme[available_start]="#268ad0" 66 | theme[available_mid]="#6c71c4" 67 | theme[available_end]="#d1302c" 68 | 69 | # Mem/Disk used meter 70 | theme[used_start]="#859900" 71 | theme[used_mid]="#b28602" 72 | theme[used_end]="#d1302c" 73 | 74 | # Download graph colors 75 | theme[download_start]="#268ad0" 76 | theme[download_mid]="#6c71c4" 77 | theme[download_end]="#d1302c" 78 | 79 | # Upload graph colors 80 | theme[upload_start]="#268ad0" 81 | theme[upload_mid]="#6c71c4" 82 | theme[upload_end]="#d1302c" 83 | -------------------------------------------------------------------------------- /themes/everforest-dark-hard.theme: -------------------------------------------------------------------------------- 1 | # All graphs and meters can be gradients 2 | # For single color graphs leave "mid" and "end" variable empty. 3 | # Use "start" and "end" variables for two color gradient 4 | # Use "start", "mid" and "end" for three color gradient 5 | 6 | # Main background, empty for terminal default, need to be empty if you want transparent background 7 | theme[main_bg]="#272e33" 8 | 9 | # Main text color 10 | theme[main_fg]="#d3c6aa" 11 | 12 | # Title color for boxes 13 | theme[title]="#d3c6aa" 14 | 15 | # Highlight color for keyboard shortcuts 16 | theme[hi_fg]="#e67e80" 17 | 18 | # Background color of selected items 19 | theme[selected_bg]="#374145" 20 | 21 | # Foreground color of selected items 22 | theme[selected_fg]="#dbbc7f" 23 | 24 | # Color of inactive/disabled text 25 | theme[inactive_fg]="#272e33" 26 | 27 | # Color of text appearing on top of graphs, i.e uptime and current network graph scaling 28 | theme[graph_text]="#d3c6aa" 29 | 30 | # Misc colors for processes box including mini cpu graphs, details memory graph and details status text 31 | theme[proc_misc]="#a7c080" 32 | 33 | # Cpu box outline color 34 | theme[cpu_box]="#374145" 35 | 36 | # Memory/disks box outline color 37 | theme[mem_box]="#374145" 38 | 39 | # Net up/down box outline color 40 | theme[net_box]="#374145" 41 | 42 | # Processes box outline color 43 | theme[proc_box]="#374145" 44 | 45 | # Box divider line and small boxes line color 46 | theme[div_line]="#374145" 47 | 48 | # Temperature graph colors 49 | theme[temp_start]="#a7c080" 50 | theme[temp_mid]="#dbbc7f" 51 | theme[temp_end]="#f85552" 52 | 53 | # CPU graph colors 54 | theme[cpu_start]="#a7c080" 55 | theme[cpu_mid]="#dbbc7f" 56 | theme[cpu_end]="#f85552" 57 | 58 | # Mem/Disk free meter 59 | theme[free_start]="#f85552" 60 | theme[free_mid]="#dbbc7f" 61 | theme[free_end]="#a7c080" 62 | 63 | # Mem/Disk cached meter 64 | theme[cached_start]="#7fbbb3" 65 | theme[cached_mid]="#83c092" 66 | theme[cached_end]="#a7c080" 67 | 68 | # Mem/Disk available meter 69 | theme[available_start]="#f85552" 70 | theme[available_mid]="#dbbc7f" 71 | theme[available_end]="#a7c080" 72 | 73 | # Mem/Disk used meter 74 | theme[used_start]="#a7c080" 75 | theme[used_mid]="#dbbc7f" 76 | theme[used_end]="#f85552" 77 | 78 | # Download graph colors 79 | theme[download_start]="#a7c080" 80 | theme[download_mid]="#83c092" 81 | theme[download_end]="#7fbbb3" 82 | 83 | # Upload graph colors 84 | theme[upload_start]="#dbbc7f" 85 | theme[upload_mid]="#e69875" 86 | theme[upload_end]="#e67e80" 87 | 88 | # Process box color gradient for threads, mem and cpu usage 89 | theme[process_start]="#a7c080" 90 | theme[process_mid]="#f85552" 91 | theme[process_end]="#CC241D" 92 | -------------------------------------------------------------------------------- /themes/everforest-dark-medium.theme: -------------------------------------------------------------------------------- 1 | # All graphs and meters can be gradients 2 | # For single color graphs leave "mid" and "end" variable empty. 3 | # Use "start" and "end" variables for two color gradient 4 | # Use "start", "mid" and "end" for three color gradient 5 | 6 | # Main background, empty for terminal default, need to be empty if you want transparent background 7 | theme[main_bg]="#2d353b" 8 | 9 | # Main text color 10 | theme[main_fg]="#d3c6aa" 11 | 12 | # Title color for boxes 13 | theme[title]="#d3c6aa" 14 | 15 | # Highlight color for keyboard shortcuts 16 | theme[hi_fg]="#e67e80" 17 | 18 | # Background color of selected items 19 | theme[selected_bg]="#3d484d" 20 | 21 | # Foreground color of selected items 22 | theme[selected_fg]="#dbbc7f" 23 | 24 | # Color of inactive/disabled text 25 | theme[inactive_fg]="#2d353b" 26 | 27 | # Color of text appearing on top of graphs, i.e uptime and current network graph scaling 28 | theme[graph_text]="#d3c6aa" 29 | 30 | # Misc colors for processes box including mini cpu graphs, details memory graph and details status text 31 | theme[proc_misc]="#a7c080" 32 | 33 | # Cpu box outline color 34 | theme[cpu_box]="#3d484d" 35 | 36 | # Memory/disks box outline color 37 | theme[mem_box]="#3d484d" 38 | 39 | # Net up/down box outline color 40 | theme[net_box]="#3d484d" 41 | 42 | # Processes box outline color 43 | theme[proc_box]="#3d484d" 44 | 45 | # Box divider line and small boxes line color 46 | theme[div_line]="#3d484d" 47 | 48 | # Temperature graph colors 49 | theme[temp_start]="#a7c080" 50 | theme[temp_mid]="#dbbc7f" 51 | theme[temp_end]="#f85552" 52 | 53 | # CPU graph colors 54 | theme[cpu_start]="#a7c080" 55 | theme[cpu_mid]="#dbbc7f" 56 | theme[cpu_end]="#f85552" 57 | 58 | # Mem/Disk free meter 59 | theme[free_start]="#f85552" 60 | theme[free_mid]="#dbbc7f" 61 | theme[free_end]="#a7c080" 62 | 63 | # Mem/Disk cached meter 64 | theme[cached_start]="#7fbbb3" 65 | theme[cached_mid]="#83c092" 66 | theme[cached_end]="#a7c080" 67 | 68 | # Mem/Disk available meter 69 | theme[available_start]="#f85552" 70 | theme[available_mid]="#dbbc7f" 71 | theme[available_end]="#a7c080" 72 | 73 | # Mem/Disk used meter 74 | theme[used_start]="#a7c080" 75 | theme[used_mid]="#dbbc7f" 76 | theme[used_end]="#f85552" 77 | 78 | # Download graph colors 79 | theme[download_start]="#a7c080" 80 | theme[download_mid]="#83c092" 81 | theme[download_end]="#7fbbb3" 82 | 83 | # Upload graph colors 84 | theme[upload_start]="#dbbc7f" 85 | theme[upload_mid]="#e69875" 86 | theme[upload_end]="#e67e80" 87 | 88 | # Process box color gradient for threads, mem and cpu usage 89 | theme[process_start]="#a7c080" 90 | theme[process_mid]="#e67e80" 91 | theme[process_end]="#f85552" 92 | 93 | -------------------------------------------------------------------------------- /themes/everforest-light-medium.theme: -------------------------------------------------------------------------------- 1 | # All graphs and meters can be gradients 2 | # For single color graphs leave "mid" and "end" variable empty. 3 | # Use "start" and "end" variables for two color gradient 4 | # Use "start", "mid" and "end" for three color gradient 5 | 6 | # Main background, empty for terminal default, need to be empty if you want transparent background 7 | theme[main_bg]="#fdf6e3" 8 | 9 | # Main text color 10 | theme[main_fg]="#5c6a72" 11 | 12 | # Title color for boxes 13 | theme[title]="#5c6a72" 14 | 15 | # Highlight color for keyboard shortcuts 16 | theme[hi_fg]="#df69ba" 17 | 18 | # Background color of selected items 19 | theme[selected_bg]="#4F585E" 20 | 21 | # Foreground color of selected items 22 | theme[selected_fg]="#dfa000" 23 | 24 | # Color of inactive/disabled text 25 | theme[inactive_fg]="#9DA9A0" 26 | 27 | # Color of text appearing on top of graphs, i.e uptime and current network graph scaling 28 | theme[graph_text]="#5c6a72" 29 | 30 | # Misc colors for processes box including mini cpu graphs, details memory graph and details status text 31 | theme[proc_misc]="#8da101" 32 | 33 | # Cpu box outline color 34 | theme[cpu_box]="#4F585E" 35 | 36 | # Memory/disks box outline color 37 | theme[mem_box]="#4F585E" 38 | 39 | # Net up/down box outline color 40 | theme[net_box]="#4F585E" 41 | 42 | # Processes box outline color 43 | theme[proc_box]="#4F585E" 44 | 45 | # Box divider line and small boxes line color 46 | theme[div_line]="#4F585E" 47 | 48 | # Temperature graph colors 49 | theme[temp_start]="#8da101" 50 | theme[temp_mid]="#dfa000" 51 | theme[temp_end]="#f85552" 52 | 53 | # CPU graph colors 54 | theme[cpu_start]="#8da101" 55 | theme[cpu_mid]="#dfa000" 56 | theme[cpu_end]="#f85552" 57 | 58 | # Mem/Disk free meter 59 | theme[free_start]="#f85552" 60 | theme[free_mid]="#dfa000" 61 | theme[free_end]="#8da101" 62 | 63 | # Mem/Disk cached meter 64 | theme[cached_start]="#3994c5" 65 | theme[cached_mid]="#35a77c" 66 | theme[cached_end]="#8da101" 67 | 68 | # Mem/Disk available meter 69 | theme[available_start]="#f85552" 70 | theme[available_mid]="#dfa000" 71 | theme[available_end]="#8da101" 72 | 73 | # Mem/Disk used meter 74 | theme[used_start]="#8da101" 75 | theme[used_mid]="#dfa000" 76 | theme[used_end]="#f85552" 77 | 78 | # Download graph colors 79 | theme[download_start]="#8da101" 80 | theme[download_mid]="#35a77c" 81 | theme[download_end]="#3994c5" 82 | 83 | # Upload graph colors 84 | theme[upload_start]="#dfa000" 85 | theme[upload_mid]="#e66868" 86 | theme[upload_end]="#df69ba" 87 | 88 | # Process box color gradient for threads, mem and cpu usage 89 | theme[process_start]="#8da101" 90 | theme[process_mid]="#df69ba" 91 | theme[process_end]="#f85552" 92 | 93 | -------------------------------------------------------------------------------- /themes/flat-remix-light.theme: -------------------------------------------------------------------------------- 1 | #Bashtop theme with flat-remix colors 2 | #by Daniel Ruiz de Alegría 3 | 4 | # Colors should be in 6 or 2 character hexadecimal or single spaced rgb decimal: "#RRGGBB", "#BW" or "0-255 0-255 0-255" 5 | # example for white: "#ffffff", "#ff" or "255 255 255". 6 | 7 | # All graphs and meters can be gradients 8 | # For single color graphs leave "mid" and "end" variable empty. 9 | # Use "start" and "end" variables for two color gradient 10 | # Use "start", "mid" and "end" for three color gradient 11 | 12 | # Main background, empty for terminal default, need to be empty if you want transparent background 13 | theme[main_bg]="#e4e4e7" 14 | 15 | # Main text color 16 | theme[main_fg]="#737680" 17 | 18 | # Title color for boxes 19 | theme[title]="#272a34" 20 | 21 | # Highlight color for keyboard shortcuts 22 | theme[hi_fg]="#90" 23 | 24 | # Background color of selected item in processes box 25 | theme[selected_bg]="#b8174c" 26 | 27 | # Foreground color of selected item in processes box 28 | theme[selected_fg]="#ff" 29 | 30 | # Color of inactive/disabled text 31 | theme[inactive_fg]="#40" 32 | 33 | # Misc colors for processes box including mini cpu graphs, details memory graph and details status text 34 | theme[proc_misc]="#367bf0" 35 | 36 | # Cpu box outline color 37 | theme[cpu_box]="#367bf0" 38 | 39 | # Memory/disks box outline color 40 | theme[mem_box]="#19a187" 41 | 42 | # Net up/down box outline color 43 | theme[net_box]="#fd3535" 44 | 45 | # Processes box outline color 46 | theme[proc_box]="#4aaee6" 47 | 48 | # Box divider line and small boxes line color 49 | theme[div_line]="#50" 50 | 51 | # Temperature graph colors 52 | theme[temp_start]="#367bf0" 53 | theme[temp_mid]="#b8174c" 54 | theme[temp_end]="#d41919" 55 | 56 | # CPU graph colors 57 | theme[cpu_start]="#367bf0" 58 | theme[cpu_mid]="#4aaee6" 59 | theme[cpu_end]="#54bd8e" 60 | 61 | # Mem/Disk free meter 62 | theme[free_start]="#811035" 63 | theme[free_mid]="#b8174c" 64 | theme[free_end]="#d41919" 65 | 66 | # Mem/Disk cached meter 67 | theme[cached_start]="#2656a8" 68 | theme[cached_mid]="#4aaee6" 69 | theme[cached_end]="#23bac2" 70 | 71 | # Mem/Disk available meter 72 | theme[available_start]="#fea44c" 73 | theme[available_mid]="#fd7d00" 74 | theme[available_end]="#fe7171" 75 | 76 | # Mem/Disk used meter 77 | theme[used_start]="#12715f" 78 | theme[used_mid]="#19a187" 79 | theme[used_end]="#23bac2" 80 | 81 | # Download graph colors 82 | theme[download_start]="#367bf0" 83 | theme[download_mid]="#19a187" 84 | theme[download_end]="#4aaee6" 85 | 86 | # Upload graph colors 87 | theme[upload_start]="#8c42ab" 88 | theme[upload_mid]="#b8174c" 89 | theme[upload_end]="#d41919" 90 | -------------------------------------------------------------------------------- /themes/flat-remix.theme: -------------------------------------------------------------------------------- 1 | #Bashtop theme with flat-remix colors 2 | #by Daniel Ruiz de Alegría 3 | 4 | # Colors should be in 6 or 2 character hexadecimal or single spaced rgb decimal: "#RRGGBB", "#BW" or "0-255 0-255 0-255" 5 | # example for white: "#ffffff", "#ff" or "255 255 255". 6 | 7 | # All graphs and meters can be gradients 8 | # For single color graphs leave "mid" and "end" variable empty. 9 | # Use "start" and "end" variables for two color gradient 10 | # Use "start", "mid" and "end" for three color gradient 11 | 12 | # Main background, empty for terminal default, need to be empty if you want transparent background 13 | theme[main_bg]="" 14 | 15 | # Main text color 16 | theme[main_fg]="#E6E6E6" 17 | 18 | # Title color for boxes 19 | theme[title]="#ff" 20 | 21 | # Highlight color for keyboard shortcuts 22 | theme[hi_fg]="#90" 23 | 24 | # Background color of selected item in processes box 25 | theme[selected_bg]="#b8174c" 26 | 27 | # Foreground color of selected item in processes box 28 | theme[selected_fg]="#ff" 29 | 30 | # Color of inactive/disabled text 31 | theme[inactive_fg]="#40" 32 | 33 | # Misc colors for processes box including mini cpu graphs, details memory graph and details status text 34 | theme[proc_misc]="#367bf0" 35 | 36 | # Cpu box outline color 37 | theme[cpu_box]="#367bf0" 38 | 39 | # Memory/disks box outline color 40 | theme[mem_box]="#19a187" 41 | 42 | # Net up/down box outline color 43 | theme[net_box]="#fd3535" 44 | 45 | # Processes box outline color 46 | theme[proc_box]="#4aaee6" 47 | 48 | # Box divider line and small boxes line color 49 | theme[div_line]="#50" 50 | 51 | # Temperature graph colors 52 | theme[temp_start]="#367bf0" 53 | theme[temp_mid]="#b8174c" 54 | theme[temp_end]="#d41919" 55 | 56 | # CPU graph colors 57 | theme[cpu_start]="#367bf0" 58 | theme[cpu_mid]="#4aaee6" 59 | theme[cpu_end]="#54bd8e" 60 | 61 | # Mem/Disk free meter 62 | theme[free_start]="#811035" 63 | theme[free_mid]="#b8174c" 64 | theme[free_end]="#d41919" 65 | 66 | # Mem/Disk cached meter 67 | theme[cached_start]="#2656a8" 68 | theme[cached_mid]="#4aaee6" 69 | theme[cached_end]="#23bac2" 70 | 71 | # Mem/Disk available meter 72 | theme[available_start]="#fea44c" 73 | theme[available_mid]="#fd7d00" 74 | theme[available_end]="#fe7171" 75 | 76 | # Mem/Disk used meter 77 | theme[used_start]="#12715f" 78 | theme[used_mid]="#19a187" 79 | theme[used_end]="#23bac2" 80 | 81 | # Download graph colors 82 | theme[download_start]="#367bf0" 83 | theme[download_mid]="#19a187" 84 | theme[download_end]="#4aaee6" 85 | 86 | # Upload graph colors 87 | theme[upload_start]="#8c42ab" 88 | theme[upload_mid]="#b8174c" 89 | theme[upload_end]="#d41919" 90 | -------------------------------------------------------------------------------- /themes/greyscale.theme: -------------------------------------------------------------------------------- 1 | #Bashtop grayscale theme 2 | #by aristocratos 3 | 4 | # Colors should be in 6 or 2 character hexadecimal or single spaced rgb decimal: "#RRGGBB", "#BW" or "0-255 0-255 0-255" 5 | # example for white: "#FFFFFF", "#ff" or "255 255 255". 6 | 7 | # All graphs and meters can be gradients 8 | # For single color graphs leave "mid" and "end" variable empty. 9 | # Use "start" and "end" variables for two color gradient 10 | # Use "start", "mid" and "end" for three color gradient 11 | 12 | # Main background, empty for terminal default, need to be empty if you want transparent background 13 | theme[main_bg]="#00" 14 | 15 | # Main text color 16 | theme[main_fg]="#bb" 17 | 18 | # Title color for boxes 19 | theme[title]="#cc" 20 | 21 | # Highlight color for keyboard shortcuts 22 | theme[hi_fg]="#90" 23 | 24 | # Background color of selected item in processes box 25 | theme[selected_bg]="#ff" 26 | 27 | # Foreground color of selected item in processes box 28 | theme[selected_fg]="#00" 29 | 30 | # Color of inactive/disabled text 31 | theme[inactive_fg]="#30" 32 | 33 | # Misc colors for processes box including mini cpu graphs, details memory graph and details status text 34 | theme[proc_misc]="#90" 35 | 36 | # Cpu box outline color 37 | theme[cpu_box]="#90" 38 | 39 | # Memory/disks box outline color 40 | theme[mem_box]="#90" 41 | 42 | # Net up/down box outline color 43 | theme[net_box]="#90" 44 | 45 | # Processes box outline color 46 | theme[proc_box]="#90" 47 | 48 | # Box divider line and small boxes line color 49 | theme[div_line]="#30" 50 | 51 | # Temperature graph colors 52 | theme[temp_start]="#50" 53 | theme[temp_mid]="" 54 | theme[temp_end]="#ff" 55 | 56 | # CPU graph colors 57 | theme[cpu_start]="#50" 58 | theme[cpu_mid]="" 59 | theme[cpu_end]="#ff" 60 | 61 | # Mem/Disk free meter 62 | theme[free_start]="#50" 63 | theme[free_mid]="" 64 | theme[free_end]="#ff" 65 | 66 | # Mem/Disk cached meter 67 | theme[cached_start]="#50" 68 | theme[cached_mid]="" 69 | theme[cached_end]="#ff" 70 | 71 | # Mem/Disk available meter 72 | theme[available_start]="#50" 73 | theme[available_mid]="" 74 | theme[available_end]="#ff" 75 | 76 | # Mem/Disk used meter 77 | theme[used_start]="#50" 78 | theme[used_mid]="" 79 | theme[used_end]="#ff" 80 | 81 | # Download graph colors 82 | theme[download_start]="#30" 83 | theme[download_mid]="" 84 | theme[download_end]="#ff" 85 | 86 | # Upload graph colors 87 | theme[upload_start]="#30" 88 | theme[upload_mid]="" 89 | theme[upload_end]="#ff" -------------------------------------------------------------------------------- /themes/gruvbox_dark.theme: -------------------------------------------------------------------------------- 1 | #Bashtop gruvbox (https://github.com/morhetz/gruvbox) theme 2 | #by BachoSeven 3 | 4 | # Colors should be in 6 or 2 character hexadecimal or single spaced rgb decimal: "#RRGGBB", "#BW" or "0-255 0-255 0-255" 5 | # example for white: "#FFFFFF", "#ff" or "255 255 255". 6 | 7 | # All graphs and meters can be gradients 8 | # For single color graphs leave "mid" and "end" variable empty. 9 | # Use "start" and "end" variables for two color gradient 10 | # Use "start", "mid" and "end" for three color gradient 11 | 12 | # Main background, empty for terminal default, need to be empty if you want transparent background 13 | theme[main_bg]="#1d2021" 14 | 15 | # Main text color 16 | theme[main_fg]="#a89984" 17 | 18 | # Title color for boxes 19 | theme[title]="#ebdbb2" 20 | 21 | # Highlight color for keyboard shortcuts 22 | theme[hi_fg]="#d79921" 23 | 24 | # Background color of selected items 25 | theme[selected_bg]="#282828" 26 | 27 | # Foreground color of selected items 28 | theme[selected_fg]="#fabd2f" 29 | 30 | # Color of inactive/disabled text 31 | theme[inactive_fg]="#282828" 32 | 33 | # Color of text appearing on top of graphs, i.e uptime and current network graph scaling 34 | theme[graph_text]="#585858" 35 | 36 | # Misc colors for processes box including mini cpu graphs, details memory graph and details status text 37 | theme[proc_misc]="#98971a" 38 | 39 | # Cpu box outline color 40 | theme[cpu_box]="#a89984" 41 | 42 | # Memory/disks box outline color 43 | theme[mem_box]="#a89984" 44 | 45 | # Net up/down box outline color 46 | theme[net_box]="#a89984" 47 | 48 | # Processes box outline color 49 | theme[proc_box]="#a89984" 50 | 51 | # Box divider line and small boxes line color 52 | theme[div_line]="#a89984" 53 | 54 | # Temperature graph colors 55 | theme[temp_start]="#458588" 56 | theme[temp_mid]="#d3869b" 57 | theme[temp_end]="#fb4394" 58 | 59 | # CPU graph colors 60 | theme[cpu_start]="#b8bb26" 61 | theme[cpu_mid]="#d79921" 62 | theme[cpu_end]="#fb4934" 63 | 64 | # Mem/Disk free meter 65 | theme[free_start]="#4e5900" 66 | theme[free_mid]="" 67 | theme[free_end]="#98971a" 68 | 69 | # Mem/Disk cached meter 70 | theme[cached_start]="#458588" 71 | theme[cached_mid]="" 72 | theme[cached_end]="#83a598" 73 | 74 | # Mem/Disk available meter 75 | theme[available_start]="#d79921" 76 | theme[available_mid]="" 77 | theme[available_end]="#fabd2f" 78 | 79 | # Mem/Disk used meter 80 | theme[used_start]="#cc241d" 81 | theme[used_mid]="" 82 | theme[used_end]="#fb4934" 83 | 84 | # Download graph colors 85 | theme[download_start]="#3d4070" 86 | theme[download_mid]="#6c71c4" 87 | theme[download_end]="#a3a8f7" 88 | 89 | # Upload graph colors 90 | theme[upload_start]="#701c45" 91 | theme[upload_mid]="#b16286" 92 | theme[upload_end]="#d3869b" 93 | -------------------------------------------------------------------------------- /themes/gruvbox_dark_v2.theme: -------------------------------------------------------------------------------- 1 | # Bashtop gruvbox (https://github.com/morhetz/gruvbox) theme 2 | # First version created By BachoSeven 3 | # Adjustments to proper colors by Pietryszak (https://github.com/pietryszak/) 4 | 5 | # Colors should be in 6 or 2 character hexadecimal or single spaced rgb decimal: "#RRGGBB", "#BW" or "0-255 0-255 0-255" 6 | # example for white: "#FFFFFF", "#ff" or "255 255 255". 7 | 8 | # All graphs and meters can be gradients 9 | # For single color graphs leave "mid" and "end" variable empty. 10 | # Use "start" and "end" variables for two color gradient 11 | # Use "start", "mid" and "end" for three color gradient 12 | 13 | # Main background, empty for terminal default, need to be empty if you want transparent background 14 | theme[main_bg]="#282828" 15 | 16 | # Main text color 17 | theme[main_fg]="#EBDBB2" 18 | 19 | # Title color for boxes 20 | theme[title]="#EBDBB2" 21 | 22 | # Highlight color for keyboard shortcuts 23 | theme[hi_fg]="#CC241D" 24 | 25 | # Background color of selected items 26 | theme[selected_bg]="#32302F" 27 | 28 | # Foreground color of selected items 29 | theme[selected_fg]="#D3869B" 30 | 31 | # Color of inactive/disabled text 32 | theme[inactive_fg]="#3C3836" 33 | 34 | # Color of text appearing on top of graphs, i.e uptime and current network graph scaling 35 | theme[graph_text]="#A89984" 36 | 37 | # Misc colors for processes box including mini cpu graphs, details memory graph and details status text 38 | theme[proc_misc]="#98971A" 39 | 40 | # Cpu box outline color 41 | theme[cpu_box]="#A89984" 42 | 43 | # Memory/disks box outline color 44 | theme[mem_box]="#A89984" 45 | 46 | # Net up/down box outline color 47 | theme[net_box]="#A89984" 48 | 49 | # Processes box outline color 50 | theme[proc_box]="#A89984" 51 | 52 | # Box divider line and small boxes line color 53 | theme[div_line]="#A89984" 54 | 55 | # Temperature graph colors 56 | theme[temp_start]="#98971A" 57 | theme[temp_mid]="" 58 | theme[temp_end]="#CC241D" 59 | 60 | # CPU graph colors 61 | theme[cpu_start]="#8EC07C" 62 | theme[cpu_mid]="#D79921" 63 | theme[cpu_end]="#CC241D" 64 | 65 | # Mem/Disk free meter 66 | theme[free_start]="#CC241D" 67 | theme[free_mid]="#D79921" 68 | theme[free_end]="#8EC07C" 69 | 70 | # Mem/Disk cached meter 71 | theme[cached_start]="#458588" 72 | theme[cached_mid]="#83A598" 73 | theme[cached_end]="#8EC07C" 74 | 75 | # Mem/Disk available meter 76 | theme[available_start]="#CC241D" 77 | theme[available_mid]="#D65D0E" 78 | theme[available_end]="#FABD2F" 79 | 80 | # Mem/Disk used meter 81 | theme[used_start]="#8EC07C" 82 | theme[used_mid]="#D65D0E" 83 | theme[used_end]="#CC241D" 84 | 85 | # Download graph colors 86 | theme[download_start]="#98971A" 87 | theme[download_mid]="#689d6A" 88 | theme[download_end]="#B8BB26" 89 | 90 | # Upload graph colors 91 | theme[upload_start]="#CC241D" 92 | theme[upload_mid]="#D65d0E" 93 | theme[upload_end]="#FABF2F" 94 | 95 | # Process box color gradient for threads, mem and cpu usage 96 | theme[process_start]="#8EC07C" 97 | theme[process_mid]="#FE8019" 98 | theme[process_end]="#CC241D" 99 | -------------------------------------------------------------------------------- /themes/gruvbox_light.theme: -------------------------------------------------------------------------------- 1 | # cosmotop gruvbox_light theme 2 | # by kk9uk 3 | 4 | # Main background, empty for terminal default, need to be empty if you want transparent background 5 | theme[main_bg]="#fbf1c7" 6 | 7 | # Main text color 8 | theme[main_fg]="#3c3836" 9 | 10 | # Title color for boxes 11 | theme[title]="#3c3836" 12 | 13 | # Highlight color for keyboard shortcuts 14 | theme[hi_fg]="#cc241d" 15 | 16 | # Background color of selected items 17 | theme[selected_bg]="#f2e5bc" 18 | 19 | # Foreground color of selected items 20 | theme[selected_fg]="#8f3f71" 21 | 22 | # Color of inactive/disabled text 23 | theme[inactive_fg]="#ebdbb2" 24 | 25 | # Color of text appearing on top of graphs, i.e uptime and current network graph scaling 26 | theme[graph_text]="#a89984" 27 | 28 | # Misc colors for processes box including mini cpu graphs, details memory graph and details status text 29 | theme[proc_misc]="#98971a" 30 | 31 | # Cpu box outline color 32 | theme[cpu_box]="#a89984" 33 | 34 | # Memory/disks box outline color 35 | theme[mem_box]="#a89984" 36 | 37 | # Net up/down box outline color 38 | theme[net_box]="#a89984" 39 | 40 | # Processes box outline color 41 | theme[proc_box]="#a89984" 42 | 43 | # Box divider line and small boxes line color 44 | theme[div_line]="#a89984" 45 | 46 | # Temperature graph colors 47 | theme[temp_start]="#98971a" 48 | theme[temp_mid]="" 49 | theme[temp_end]="#cc241d" 50 | 51 | # CPU graph colors 52 | theme[cpu_start]="#427b58" 53 | theme[cpu_mid]="#d79921" 54 | theme[cpu_end]="#cc241d" 55 | 56 | # Mem/Disk free meter 57 | theme[free_start]="#cc241d" 58 | theme[free_mid]="#d79921" 59 | theme[free_end]="#427b58" 60 | 61 | # Mem/Disk cached meter 62 | theme[cached_start]="#458588" 63 | theme[cached_mid]="#076678" 64 | theme[cached_end]="#427b58" 65 | 66 | # Mem/Disk available meter 67 | theme[available_start]="#cc241d" 68 | theme[available_mid]="#d65d0e" 69 | theme[available_end]="#b57614" 70 | 71 | # Mem/Disk used meter 72 | theme[used_start]="#427b58" 73 | theme[used_mid]="#d65d0e" 74 | theme[used_end]="#cc241d" 75 | 76 | # Download graph colors 77 | theme[download_start]="#98971a" 78 | theme[download_mid]="#689d6a" 79 | theme[download_end]="#79740e" 80 | 81 | # Upload graph colors 82 | theme[upload_start]="#cc241d" 83 | theme[upload_mid]="#d65d0e" 84 | theme[upload_end]="#b57614" 85 | 86 | # Process box color gradient for threads, mem and cpu usage 87 | theme[process_start]="#427b58" 88 | theme[process_mid]="#af3a03" 89 | theme[process_end]="#cc241d" 90 | -------------------------------------------------------------------------------- /themes/gruvbox_material_dark.theme: -------------------------------------------------------------------------------- 1 | # cosmotop gruvbox material dark (https://github.com/sainnhe/gruvbox-material) theme 2 | # by Marco Radocchia 3 | 4 | # Colors should be in 6 or 2 character hexadecimal or single spaced rgb decimal: "#RRGGBB", "#BW" or "0-255 0-255 0-255" 5 | # example for white: "#FFFFFF", "#ff" or "255 255 255". 6 | 7 | # All graphs and meters can be gradients 8 | # For single color graphs leave "mid" and "end" variable empty. 9 | # Use "start" and "end" variables for two color gradient 10 | # Use "start", "mid" and "end" for three color gradient 11 | 12 | # Main background, empty for terminal default, need to be empty if you want transparent background 13 | theme[main_bg]="#282828" 14 | 15 | # Main text color 16 | theme[main_fg]="#d4be98" 17 | 18 | # Title color for boxes 19 | theme[title]="#d4be98" 20 | 21 | # Highlight color for keyboard shortcuts 22 | theme[hi_fg]="#ea6962" 23 | 24 | # Background color of selected items 25 | theme[selected_bg]="#d8a657" 26 | 27 | # Foreground color of selected items 28 | theme[selected_fg]="#282828" 29 | 30 | # Color of inactive/disabled text 31 | theme[inactive_fg]="#282828" 32 | 33 | # Color of text appearing on top of graphs, i.e uptime and current network graph scaling 34 | theme[graph_text]="#665c54" 35 | 36 | # Misc colors for processes box including mini cpu graphs, details memory graph and details status text 37 | theme[proc_misc]="#a9b665" 38 | 39 | # Cpu box outline color 40 | theme[cpu_box]="#7c6f64" 41 | 42 | # Memory/disks box outline color 43 | theme[mem_box]="#7c6f64" 44 | 45 | # Net up/down box outline color 46 | theme[net_box]="#7c6f64" 47 | 48 | # Processes box outline color 49 | theme[proc_box]="#7c6f64" 50 | 51 | # Box divider line and small boxes line color 52 | theme[div_line]="#7c6f64" 53 | 54 | # Temperature graph colors 55 | theme[temp_start]="#7daea3" 56 | theme[temp_mid]="#e78a4e" 57 | theme[temp_end]="#ea6962" 58 | 59 | # CPU graph colors 60 | theme[cpu_start]="#a9b665" 61 | theme[cpu_mid]="#d8a657" 62 | theme[cpu_end]="#ea6962" 63 | 64 | # Mem/Disk free meter 65 | theme[free_start]="#89b482" 66 | theme[free_mid]="" 67 | theme[free_end]="" 68 | 69 | # Mem/Disk cached meter 70 | theme[cached_start]="#7daea3" 71 | theme[cached_mid]="" 72 | theme[cached_end]="" 73 | 74 | # Mem/Disk available meter 75 | theme[available_start]="#d8a657" 76 | theme[available_mid]="" 77 | theme[available_end]="" 78 | 79 | # Mem/Disk used meter 80 | theme[used_start]="#ea6962" 81 | theme[used_mid]="" 82 | theme[used_end]="" 83 | 84 | # Download graph colors 85 | theme[download_start]="#e78a4e" 86 | theme[download_mid]="" 87 | theme[download_end]="" 88 | 89 | # Upload graph colors 90 | theme[upload_start]="#d3869b" 91 | theme[upload_mid]="" 92 | theme[upload_end]="" 93 | -------------------------------------------------------------------------------- /themes/horizon.theme: -------------------------------------------------------------------------------- 1 | # All graphs and meters can be gradients 2 | # For single color graphs leave "mid" and "end" variable empty. 3 | # Use "start" and "end" variables for two color gradient 4 | # Use "start", "mid" and "end" for three color gradient 5 | 6 | # Main background, empty for terminal default, need to be empty if you want transparent background 7 | theme[main_bg]="#1C1E26" 8 | 9 | # Main text color 10 | theme[main_fg]="#f8f8f2" 11 | 12 | # Title color for boxes 13 | theme[title]="#f8f8f2" 14 | 15 | # Highlight color for keyboard shortcuts 16 | theme[hi_fg]="#B877DB" 17 | 18 | # Background color of selected items 19 | theme[selected_bg]="#282b37" 20 | 21 | # Foreground color of selected items 22 | theme[selected_fg]="#f8f8f2" 23 | 24 | # Color of inactive/disabled text 25 | theme[inactive_fg]="#272e33" 26 | 27 | # Color of text appearing on top of graphs, i.e uptime and current network graph scaling 28 | theme[graph_text]="#f8f8f2" 29 | 30 | # Misc colors for processes box including mini cpu graphs, details memory graph and details status text 31 | theme[proc_misc]="#27D796" 32 | 33 | # Cpu box outline color 34 | theme[cpu_box]="#B877DB" 35 | 36 | # Memory/disks box outline color 37 | theme[mem_box]="#27D796" 38 | 39 | # Net up/down box outline color 40 | theme[net_box]="#E95678" 41 | 42 | # Processes box outline color 43 | theme[proc_box]="#25B2BC" 44 | 45 | # Box divider line and small boxes line color 46 | theme[div_line]="#272e33" 47 | 48 | # Temperature graph colors 49 | theme[temp_start]="#27D796" 50 | theme[temp_mid]="#FAC29A" 51 | theme[temp_end]="#E95678" 52 | 53 | # CPU graph colors 54 | theme[cpu_start]="#27D796" 55 | theme[cpu_mid]="#FAC29A" 56 | theme[cpu_end]="#E95678" 57 | 58 | # Mem/Disk free meter 59 | theme[free_start]="#E95678" 60 | theme[free_mid]="#FAC29A" 61 | theme[free_end]="#27D796" 62 | 63 | # Mem/Disk cached meter 64 | theme[cached_start]="#27D796" 65 | theme[cached_mid]="#FAC29A" 66 | theme[cached_end]="#E95678" 67 | 68 | # Mem/Disk available meter 69 | theme[available_start]="#27D796" 70 | theme[available_mid]="#FAC29A" 71 | theme[available_end]="#E95678" 72 | 73 | # Mem/Disk used meter 74 | theme[used_start]="#27D796" 75 | theme[used_mid]="#FAC29A" 76 | theme[used_end]="#E95678" 77 | 78 | # Download graph colors 79 | theme[download_start]="#27D796" 80 | theme[download_mid]="#FAC29A" 81 | theme[download_end]="#E95678" 82 | 83 | # Upload graph colors 84 | theme[upload_start]="#27D796" 85 | theme[upload_mid]="#FAC29A" 86 | theme[upload_end]="#E95678" 87 | -------------------------------------------------------------------------------- /themes/kyli0x.theme: -------------------------------------------------------------------------------- 1 | #Bashtop Kyli0x Theme 2 | #by Kyli0x 3 | 4 | # Main background, empty for terminal default, need to be empty if you want transparent background 5 | theme[main_bg]="#222222" 6 | 7 | # Main text color 8 | theme[main_fg]="#e8f6f5" 9 | 10 | # Title color for boxes 11 | theme[title]="#e8f6f5" 12 | 13 | # Highlight color for keyboard shortcuts 14 | theme[hi_fg]="#21d6c9" 15 | 16 | # Background color of selected item in processes box 17 | theme[selected_bg]="#1aaba0" 18 | 19 | # Foreground color of selected item in processes box 20 | theme[selected_fg]="#e8f6f5" 21 | 22 | # Color of inactive/disabled text 23 | theme[inactive_fg]="#5ec4bc" 24 | 25 | # Color of text appearing on top of graphs, i.e uptime and current network graph scaling 26 | theme[graph_text]="#ba1a84" 27 | 28 | # Background color of the percentage meters 29 | theme[meter_bg]="#5ec4bc" 30 | 31 | # Misc colors for processes box including mini cpu graphs, details memory graph and details status text 32 | theme[proc_misc]="#21d6c9" 33 | 34 | # Cpu box outline color 35 | theme[cpu_box]="#d486d4" 36 | 37 | # Memory/disks box outline color 38 | theme[mem_box]="#d486d4" 39 | 40 | # Net up/down box outline color 41 | theme[net_box]="#d486d4" 42 | 43 | # Processes box outline color 44 | theme[proc_box]="#d486d4" 45 | 46 | # Box divider line and small boxes line color 47 | theme[div_line]="#80638e" 48 | 49 | # Temperature graph colors 50 | theme[temp_start]="#21d6c9" 51 | theme[temp_mid]="#1aaba0" 52 | theme[temp_end]="#5ec4bc" 53 | 54 | # CPU graph colors 55 | theme[cpu_start]="#21d6c9" 56 | theme[cpu_mid]="#1aaba0" 57 | theme[cpu_end]="#5ec4bc" 58 | 59 | # Mem/Disk free meter 60 | theme[free_start]="#21d6c9" 61 | theme[free_mid]="#1aaba0" 62 | theme[free_end]="#5ec4bc" 63 | 64 | # Mem/Disk cached meter 65 | theme[cached_start]="#21d6c9" 66 | theme[cached_mid]="#1aaba0" 67 | theme[cached_end]="#5ec4bc" 68 | 69 | # Mem/Disk available meter 70 | theme[available_start]="#21d6c9" 71 | theme[available_mid]="#1aaba0" 72 | theme[available_end]="#5ec4bc" 73 | 74 | # Mem/Disk used meter 75 | theme[used_start]="#21d6c9" 76 | theme[used_mid]="#1aaba0" 77 | theme[used_end]="#5ec4bc" 78 | 79 | # Download graph colors 80 | theme[download_start]="#21d6c9" 81 | theme[download_mid]="#1aaba0" 82 | theme[download_end]="#5ec4bc" 83 | 84 | # Upload graph colors 85 | theme[upload_start]="#ec95ec" 86 | theme[upload_mid]="#1aaba0" 87 | theme[upload_end]="#5ec4bc" 88 | 89 | # Process box color gradient for threads, mem and cpu usage 90 | theme[process_start]="#21d6c9" 91 | theme[process_mid]="#1aaba0" 92 | theme[process_end]="#ba1a84" 93 | -------------------------------------------------------------------------------- /themes/matcha-dark-sea.theme: -------------------------------------------------------------------------------- 1 | #Bashtop matcha-dark-sea theme 2 | #by TheCynicalTeam 3 | 4 | # Colors should be in 6 or 2 character hexadecimal or single spaced rgb decimal: "#RRGGBB", "#BW" or "0-255 0-255 0-255" 5 | # example for white: "#FFFFFF", "#ff" or "255 255 255". 6 | 7 | # All graphs and meters can be gradients 8 | # For single color graphs leave "mid" and "end" variable empty. 9 | # Use "start" and "end" variables for two color gradient 10 | # Use "start", "mid" and "end" for three color gradient 11 | 12 | # Main background, empty for terminal default, need to be empty if you want transparent background 13 | theme[main_bg]="" 14 | 15 | # Main text color 16 | theme[main_fg]="#F8F8F2" 17 | 18 | # Title color for boxes 19 | theme[title]="#F8F8F2" 20 | 21 | # Highlight color for keyboard shortcuts 22 | theme[hi_fg]="#2eb398" 23 | 24 | # Background color of selected item in processes box 25 | theme[selected_bg]="#0d493d" 26 | 27 | # Foreground color of selected item in processes box 28 | theme[selected_fg]="#F8F8F2" 29 | 30 | # Color of inactive/disabled text 31 | theme[inactive_fg]="#595647" 32 | 33 | # Color of text appearing on top of graphs, i.e uptime and current network graph scaling 34 | theme[graph_text]="#797667" 35 | 36 | # Misc colors for processes box including mini cpu graphs, details memory graph and details status text 37 | theme[proc_misc]="#33b165" 38 | 39 | # Cpu box outline color 40 | theme[cpu_box]="#75715E" 41 | 42 | # Memory/disks box outline color 43 | theme[mem_box]="#75715E" 44 | 45 | # Net up/down box outline color 46 | theme[net_box]="#75715E" 47 | 48 | # Processes box outline color 49 | theme[proc_box]="#75715E" 50 | 51 | # Box divider line and small boxes line color 52 | theme[div_line]="#595647" 53 | 54 | # Temperature graph colors 55 | theme[temp_start]="#7976B7" 56 | theme[temp_mid]="#D8B8B2" 57 | theme[temp_end]="#33b165" 58 | 59 | # CPU graph colors 60 | theme[cpu_start]="#33b165" 61 | theme[cpu_mid]="#F8F8F2" #2eb398" 62 | theme[cpu_end]="#2eb398" 63 | 64 | # Mem/Disk free meter 65 | theme[free_start]="#75715E" 66 | theme[free_mid]="#a9c474" 67 | theme[free_end]="#e2f5bc" 68 | 69 | # Mem/Disk cached meter 70 | theme[cached_start]="#75715E" 71 | theme[cached_mid]="#66D9EF" 72 | theme[cached_end]="#aae7f2" 73 | 74 | # Mem/Disk available meter 75 | theme[available_start]="#75715E" 76 | theme[available_mid]="#E6DB74" 77 | theme[available_end]="#f2ecb6" 78 | 79 | # Mem/Disk used meter 80 | theme[used_start]="#75715E" 81 | theme[used_mid]="#2eb398" 82 | theme[used_end]="#33b165" 83 | 84 | # Download graph colors 85 | theme[download_start]="#2d2042" 86 | theme[download_mid]="#2eb398" 87 | theme[download_end]="#33b165" 88 | 89 | # Upload graph colors 90 | theme[upload_start]="#0d493d" 91 | theme[upload_mid]="#2eb398" 92 | theme[upload_end]="#33b165" 93 | -------------------------------------------------------------------------------- /themes/monokai.theme: -------------------------------------------------------------------------------- 1 | #Bashtop monokai theme 2 | #by aristocratos 3 | 4 | # Colors should be in 6 or 2 character hexadecimal or single spaced rgb decimal: "#RRGGBB", "#BW" or "0-255 0-255 0-255" 5 | # example for white: "#FFFFFF", "#ff" or "255 255 255". 6 | 7 | # All graphs and meters can be gradients 8 | # For single color graphs leave "mid" and "end" variable empty. 9 | # Use "start" and "end" variables for two color gradient 10 | # Use "start", "mid" and "end" for three color gradient 11 | 12 | # Main background, empty for terminal default, need to be empty if you want transparent background 13 | theme[main_bg]="#060604" 14 | 15 | # Main text color 16 | theme[main_fg]="#F8F8F2" 17 | 18 | # Title color for boxes 19 | theme[title]="#F8F8F2" 20 | 21 | # Highlight color for keyboard shortcuts 22 | theme[hi_fg]="#F92672" 23 | 24 | # Background color of selected item in processes box 25 | theme[selected_bg]="#7a1137" 26 | 27 | # Foreground color of selected item in processes box 28 | theme[selected_fg]="#F8F8F2" 29 | 30 | # Color of inactive/disabled text 31 | theme[inactive_fg]="#595647" 32 | 33 | # Color of text appearing on top of graphs, i.e uptime and current network graph scaling 34 | theme[graph_text]="#797667" 35 | 36 | # Misc colors for processes box including mini cpu graphs, details memory graph and details status text 37 | theme[proc_misc]="#A6E22E" 38 | 39 | # Cpu box outline color 40 | theme[cpu_box]="#75715E" 41 | 42 | # Memory/disks box outline color 43 | theme[mem_box]="#75715E" 44 | 45 | # Net up/down box outline color 46 | theme[net_box]="#75715E" 47 | 48 | # Processes box outline color 49 | theme[proc_box]="#75715E" 50 | 51 | # Box divider line and small boxes line color 52 | theme[div_line]="#595647" 53 | 54 | # Temperature graph colors 55 | theme[temp_start]="#7976B7" 56 | theme[temp_mid]="#D8B8B2" 57 | theme[temp_end]="#F92672" 58 | 59 | # CPU graph colors 60 | theme[cpu_start]="#A6E22E" 61 | theme[cpu_mid]="#F8F8F2" #b05475" 62 | theme[cpu_end]="#F92672" 63 | 64 | # Mem/Disk free meter 65 | theme[free_start]="#75715E" 66 | theme[free_mid]="#a9c474" 67 | theme[free_end]="#e2f5bc" 68 | 69 | # Mem/Disk cached meter 70 | theme[cached_start]="#75715E" 71 | theme[cached_mid]="#66D9EF" 72 | theme[cached_end]="#aae7f2" 73 | 74 | # Mem/Disk available meter 75 | theme[available_start]="#75715E" 76 | theme[available_mid]="#E6DB74" 77 | theme[available_end]="#f2ecb6" 78 | 79 | # Mem/Disk used meter 80 | theme[used_start]="#75715E" 81 | theme[used_mid]="#F92672" 82 | theme[used_end]="#ff87b2" 83 | 84 | # Download graph colors 85 | theme[download_start]="#2d2042" 86 | theme[download_mid]="#7352a8" 87 | theme[download_end]="#ccaefc" 88 | 89 | # Upload graph colors 90 | theme[upload_start]="#570d33" 91 | theme[upload_mid]="#cf277d" 92 | theme[upload_end]="#fa91c7" 93 | -------------------------------------------------------------------------------- /themes/night-owl.theme: -------------------------------------------------------------------------------- 1 | #Bashtop theme with night-owl colors 2 | #by zkourouma 3 | 4 | # Colors should be in 6 or 2 character hexadecimal or single spaced rgb decimal: "#RRGGBB", "#BW" or "0-255 0-255 0-255" 5 | # example for white: "#ffffff", "#ff" or "255 255 255". 6 | 7 | # All graphs and meters can be gradients 8 | # For single color graphs leave "mid" and "end" variable empty. 9 | # Use "start" and "end" variables for two color gradient 10 | # Use "start", "mid" and "end" for three color gradient 11 | 12 | # Main background, empty for terminal default, need to be empty if you want transparent background 13 | theme[main_bg]="#011627" 14 | 15 | # Main text color 16 | theme[main_fg]="#d6deeb" 17 | 18 | # Title color for boxes 19 | theme[title]="#ffffff" 20 | 21 | # Highlight color for keyboard shortcuts 22 | theme[hi_fg]="#addb67" 23 | 24 | # Background color of selected items 25 | theme[selected_bg]="#000000" 26 | 27 | # Foreground color of selected items 28 | theme[selected_fg]="#ffeb95" 29 | 30 | # Color of inactive/disabled text 31 | theme[inactive_fg]="#575656" 32 | 33 | # Color of text appearing on top of graphs, i.e uptime and current network graph scaling 34 | theme[graph_text]="#585858" 35 | 36 | # Misc colors for processes box including mini cpu graphs, details memory graph and details status text 37 | theme[proc_misc]="#22da6e" 38 | 39 | # Cpu box outline color 40 | theme[cpu_box]="#ffffff" 41 | 42 | # Memory/disks box outline color 43 | theme[mem_box]="#ffffff" 44 | 45 | # Net up/down box outline color 46 | theme[net_box]="#ffffff" 47 | 48 | # Processes box outline color 49 | theme[proc_box]="#ffffff" 50 | 51 | # Box divider line and small boxes line color 52 | theme[div_line]="#ffffff" 53 | 54 | # Temperature graph colors 55 | theme[temp_start]="#82aaff" 56 | theme[temp_mid]="#c792ea" 57 | theme[temp_end]="#fb4394" 58 | 59 | # CPU graph colors 60 | theme[cpu_start]="#22da6e" 61 | theme[cpu_mid]="#addb67" 62 | theme[cpu_end]="#ef5350" 63 | 64 | # Mem/Disk free meter 65 | theme[free_start]="#4e5900" 66 | theme[free_mid]="" 67 | theme[free_end]="#22da6e" 68 | 69 | # Mem/Disk cached meter 70 | theme[cached_start]="#82aaff" 71 | theme[cached_mid]="" 72 | theme[cached_end]="#82aaff" 73 | 74 | # Mem/Disk available meter 75 | theme[available_start]="#addb67" 76 | theme[available_mid]="" 77 | theme[available_end]="#ffeb95" 78 | 79 | # Mem/Disk used meter 80 | theme[used_start]="#ef5350" 81 | theme[used_mid]="" 82 | theme[used_end]="#ef5350" 83 | 84 | # Download graph colors 85 | theme[download_start]="#3d4070" 86 | theme[download_mid]="#6c71c4" 87 | theme[download_end]="#a3a8f7" 88 | 89 | # Upload graph colors 90 | theme[upload_start]="#701c45" 91 | theme[upload_mid]="#c792ea" 92 | theme[upload_end]="#c792ea" 93 | -------------------------------------------------------------------------------- /themes/nord.theme: -------------------------------------------------------------------------------- 1 | #Bashtop theme with nord palette (https://www.nordtheme.com) 2 | #by Justin Zobel 3 | 4 | # Colors should be in 6 or 2 character hexadecimal or single spaced rgb decimal: "#RRGGBB", "#BW" or "0-255 0-255 0-255" 5 | # example for white: "#ffffff", "#ff" or "255 255 255". 6 | 7 | # All graphs and meters can be gradients 8 | # For single color graphs leave "mid" and "end" variable empty. 9 | # Use "start" and "end" variables for two color gradient 10 | # Use "start", "mid" and "end" for three color gradient 11 | 12 | # Main background, empty for terminal default, need to be empty if you want transparent background 13 | theme[main_bg]="#2E3440" 14 | 15 | # Main text color 16 | theme[main_fg]="#D8DEE9" 17 | 18 | # Title color for boxes 19 | theme[title]="#8FBCBB" 20 | 21 | # Highlight color for keyboard shortcuts 22 | theme[hi_fg]="#5E81AC" 23 | 24 | # Background color of selected item in processes box 25 | theme[selected_bg]="#4C566A" 26 | 27 | # Foreground color of selected item in processes box 28 | theme[selected_fg]="#ECEFF4" 29 | 30 | # Color of inactive/disabled text 31 | theme[inactive_fg]="#4C566A" 32 | 33 | # Misc colors for processes box including mini cpu graphs, details memory graph and details status text 34 | theme[proc_misc]="#5E81AC" 35 | 36 | # Cpu box outline color 37 | theme[cpu_box]="#4C566A" 38 | 39 | # Memory/disks box outline color 40 | theme[mem_box]="#4C566A" 41 | 42 | # Net up/down box outline color 43 | theme[net_box]="#4C566A" 44 | 45 | # Processes box outline color 46 | theme[proc_box]="#4C566A" 47 | 48 | # Box divider line and small boxes line color 49 | theme[div_line]="#4C566A" 50 | 51 | # Temperature graph colors 52 | theme[temp_start]="#81A1C1" 53 | theme[temp_mid]="#88C0D0" 54 | theme[temp_end]="#ECEFF4" 55 | 56 | # CPU graph colors 57 | theme[cpu_start]="#81A1C1" 58 | theme[cpu_mid]="#88C0D0" 59 | theme[cpu_end]="#ECEFF4" 60 | 61 | # Mem/Disk free meter 62 | theme[free_start]="#81A1C1" 63 | theme[free_mid]="#88C0D0" 64 | theme[free_end]="#ECEFF4" 65 | 66 | # Mem/Disk cached meter 67 | theme[cached_start]="#81A1C1" 68 | theme[cached_mid]="#88C0D0" 69 | theme[cached_end]="#ECEFF4" 70 | 71 | # Mem/Disk available meter 72 | theme[available_start]="#81A1C1" 73 | theme[available_mid]="#88C0D0" 74 | theme[available_end]="#ECEFF4" 75 | 76 | # Mem/Disk used meter 77 | theme[used_start]="#81A1C1" 78 | theme[used_mid]="#88C0D0" 79 | theme[used_end]="#ECEFF4" 80 | 81 | # Download graph colors 82 | theme[download_start]="#81A1C1" 83 | theme[download_mid]="#88C0D0" 84 | theme[download_end]="#ECEFF4" 85 | 86 | # Upload graph colors 87 | theme[upload_start]="#81A1C1" 88 | theme[upload_mid]="#88C0D0" 89 | theme[upload_end]="#ECEFF4" 90 | -------------------------------------------------------------------------------- /themes/onedark.theme: -------------------------------------------------------------------------------- 1 | # Theme: OneDark 2 | # By: Vitor Melo 3 | 4 | # Main bg 5 | theme[main_bg]="#282c34" 6 | 7 | # Main text color 8 | theme[main_fg]="#abb2bf" 9 | 10 | # Title color for boxes 11 | theme[title]="#abb2bf" 12 | 13 | # Highlight color for keyboard shortcuts 14 | theme[hi_fg]="#61afef" 15 | 16 | # Background color of selected item in processes box 17 | theme[selected_bg]="#2c313c" 18 | 19 | # Foreground color of selected item in processes box 20 | theme[selected_fg]="#abb2bf" 21 | 22 | # Color of inactive/disabled text 23 | theme[inactive_fg]="#5c6370" 24 | 25 | # Misc colors for processes box including mini cpu graphs, details memory graph and details status text 26 | theme[proc_misc]="#61afef" 27 | 28 | # Cpu box outline color 29 | theme[cpu_box]="#5c6370" 30 | 31 | # Memory/disks box outline color 32 | theme[mem_box]="#5c6370" 33 | 34 | # Net up/down box outline color 35 | theme[net_box]="#5c6370" 36 | 37 | # Processes box outline color 38 | theme[proc_box]="#5c6370" 39 | 40 | # Box divider line and small boxes line color 41 | theme[div_line]="#5c6370" 42 | 43 | # Temperature graph colors 44 | theme[temp_start]="#98c379" 45 | theme[temp_mid]="#e5c07b" 46 | theme[temp_end]="#e06c75" 47 | 48 | # CPU graph colors 49 | theme[cpu_start]="#98c379" 50 | theme[cpu_mid]="#e5c07b" 51 | theme[cpu_end]="#e06c75" 52 | 53 | # Mem/Disk free meter 54 | theme[free_start]="#98c379" 55 | theme[free_mid]="#e5c07b" 56 | theme[free_end]="#e06c75" 57 | 58 | # Mem/Disk cached meter 59 | theme[cached_start]="#98c379" 60 | theme[cached_mid]="#e5c07b" 61 | theme[cached_end]="#e06c75" 62 | 63 | # Mem/Disk available meter 64 | theme[available_start]="#98c379" 65 | theme[available_mid]="#e5c07b" 66 | theme[available_end]="#e06c75" 67 | 68 | # Mem/Disk used meter 69 | theme[used_start]="#98c379" 70 | theme[used_mid]="#e5c07b" 71 | theme[used_end]="#e06c75" 72 | 73 | # Download graph colors 74 | theme[download_start]="#98c379" 75 | theme[download_mid]="#e5c07b" 76 | theme[download_end]="#e06c75" 77 | 78 | # Upload graph colors 79 | theme[upload_start]="#98c379" 80 | theme[upload_mid]="#e5c07b" 81 | theme[upload_end]="#e06c75" 82 | -------------------------------------------------------------------------------- /themes/paper.theme: -------------------------------------------------------------------------------- 1 | # Bashtop Paper theme 2 | # c/o @s6muel 3 | # inspired by @yorickpeterse's vim-paper theme at https://gitlab.com/yorickpeterse/vim-paper 4 | # 5 | 6 | # Main background, empty for terminal default, need to be empty if you want transparent background 7 | theme[main_bg]="#F2EEDE" 8 | 9 | # Main text color 10 | theme[main_fg]="#00" 11 | 12 | # Title color for boxes 13 | theme[title]="#00" 14 | 15 | # Highlight color for keyboard shortcuts 16 | theme[hi_fg]="#CC3E28" 17 | 18 | # Background color of selected item in processes box 19 | theme[selected_bg]="#D8D5C7" 20 | 21 | # Foreground color of selected item in processes box 22 | theme[selected_fg]="#00" 23 | 24 | # Color of inactive/disabled text 25 | theme[inactive_fg]="#d8d5c7" 26 | 27 | # Misc colors for processes box including mini cpu graphs, details memory graph and details status text 28 | theme[proc_misc]="#00" 29 | 30 | # Cpu box outline color 31 | theme[cpu_box]="#00" 32 | 33 | # Memory/disks box outline color 34 | theme[mem_box]="#00" 35 | 36 | # Net up/down box outline color 37 | theme[net_box]="#00" 38 | 39 | # Processes box outline color 40 | theme[proc_box]="#00" 41 | 42 | # Box divider line and small boxes line color 43 | theme[div_line]="#00" 44 | 45 | # Temperature graph colors 46 | theme[temp_start]="#55" 47 | theme[temp_mid]="#00" 48 | theme[temp_end]="#CC3E28" 49 | 50 | # CPU graph colors 51 | theme[cpu_start]="#55" 52 | theme[cpu_mid]="#00" 53 | theme[cpu_end]="#CC3E28" 54 | 55 | # Mem/Disk free meter 56 | theme[free_start]="#216609" 57 | theme[free_mid]="" 58 | theme[free_end]="#216609" 59 | 60 | # Mem/Disk cached meter 61 | theme[cached_start]="#1e6fcc" 62 | theme[cached_mid]="" 63 | theme[cached_end]="#1e6fcc" 64 | 65 | # Mem/Disk available meter 66 | theme[available_start]="#216609" 67 | theme[available_mid]="" 68 | theme[available_end]="#216609" 69 | 70 | # Mem/Disk used meter 71 | theme[used_start]="#CC3E28" 72 | theme[used_mid]="" 73 | theme[used_end]="#CC3E28" 74 | 75 | # Download graph colors 76 | theme[download_start]="#55" 77 | theme[download_mid]="#00" 78 | theme[download_end]="#CC3E28" 79 | 80 | # Upload graph colors 81 | theme[upload_start]="#55" 82 | theme[upload_mid]="#00" 83 | theme[upload_end]="#CC3E28" 84 | -------------------------------------------------------------------------------- /themes/phoenix-night.theme: -------------------------------------------------------------------------------- 1 | # Theme: Phoenix Night 2 | # By: Firehawke 3 | # A combination of: 4 | # Base theme colors from Pascal Jaeger's tokyo-night 5 | # Graph theme colors from Pete Allebone's HotPurpleTrafficLight 6 | # ...basically, I wanted most of Tokyo Night with a significantly more visible graph bar coloration. 7 | 8 | # Main bg 9 | theme[main_bg]="#1a1b26" 10 | 11 | # Main text color 12 | theme[main_fg]="#cfc9c2" 13 | 14 | # Title color for boxes 15 | theme[title]="#cfc9c2" 16 | 17 | # Higlight color for keyboard shortcuts 18 | theme[hi_fg]="#7dcfff" 19 | 20 | # Background color of selected item in processes box 21 | theme[selected_bg]="#414868" 22 | 23 | # Foreground color of selected item in processes box 24 | theme[selected_fg]="#cfc9c2" 25 | 26 | # Color of inactive/disabled text 27 | theme[inactive_fg]="#565f89" 28 | 29 | # Misc colors for processes box including mini cpu graphs, details memory graph and details status text 30 | theme[proc_misc]="#7dcfff" 31 | 32 | # Cpu box outline color 33 | theme[cpu_box]="#565f89" 34 | 35 | # Memory/disks box outline color 36 | theme[mem_box]="#565f89" 37 | 38 | # Net up/down box outline color 39 | theme[net_box]="#565f89" 40 | 41 | # Processes box outline color 42 | theme[proc_box]="#565f89" 43 | 44 | # Box divider line and small boxes line color 45 | theme[div_line]="#565f89" 46 | 47 | # Temperature graph colors 48 | theme[temp_start]="#00ff00" 49 | theme[temp_mid]="#ff9933" 50 | theme[temp_end]="#ff0000" 51 | 52 | # CPU graph colors 53 | theme[cpu_start]="#00ff00" 54 | theme[cpu_mid]="#ccff66" 55 | theme[cpu_end]="#ff0000" 56 | 57 | # Mem/Disk free meter 58 | theme[free_end]="#00ff00" 59 | theme[free_mid]="#ccff66" 60 | theme[free_start]="#ff0000" 61 | 62 | # Mem/Disk cached meter 63 | theme[cached_start]="#00ff00" 64 | theme[cached_mid]="#ccff66" 65 | theme[cached_end]="#ff0000" 66 | 67 | # Mem/Disk available meter 68 | theme[available_start]="#ff0000" 69 | theme[available_mid]="#ccff66" 70 | theme[available_end]="#00ff00" 71 | 72 | # Mem/Disk used meter 73 | theme[used_start]="#00ff00" 74 | theme[used_mid]="#ccff66" 75 | theme[used_end]="#ff0000" 76 | 77 | # Download graph colors 78 | theme[download_start]="#00ff00" 79 | theme[download_mid]="#ff9933" 80 | theme[download_end]="#ff0000" 81 | 82 | # Upload graph colors 83 | theme[upload_start]="#00ff00" 84 | theme[upload_mid]="#ff9933" 85 | theme[upload_end]="#ff0000" 86 | 87 | # Process box color gradient for threads, mem and cpu usage 88 | theme[process_start]="#9999ff" 89 | theme[process_mid]="#4d4dff" 90 | theme[process_end]="#a64dff" 91 | -------------------------------------------------------------------------------- /themes/solarized_dark.theme: -------------------------------------------------------------------------------- 1 | #Bashtop solarized theme 2 | #by aristocratos 3 | 4 | # Colors should be in 6 or 2 character hexadecimal or single spaced rgb decimal: "#RRGGBB", "#BW" or "0-255 0-255 0-255" 5 | # example for white: "#FFFFFF", "#ff" or "255 255 255". 6 | 7 | # All graphs and meters can be gradients 8 | # For single color graphs leave "mid" and "end" variable empty. 9 | # Use "start" and "end" variables for two color gradient 10 | # Use "start", "mid" and "end" for three color gradient 11 | 12 | # Main background, empty for terminal default, need to be empty if you want transparent background 13 | theme[main_bg]="#002b36" 14 | 15 | # Main text color 16 | theme[main_fg]="#eee8d5" 17 | 18 | # Title color for boxes 19 | theme[title]="#fdf6e3" 20 | 21 | # Highlight color for keyboard shortcuts 22 | theme[hi_fg]="#b58900" 23 | 24 | # Background color of selected items 25 | theme[selected_bg]="#073642" 26 | 27 | # Foreground color of selected items 28 | theme[selected_fg]="#d6a200" 29 | 30 | # Color of inactive/disabled text 31 | theme[inactive_fg]="#073642" 32 | 33 | # Misc colors for processes box including mini cpu graphs, details memory graph and details status text 34 | theme[proc_misc]="#bad600" 35 | 36 | # Cpu box outline color 37 | theme[cpu_box]="#586e75" 38 | 39 | # Memory/disks box outline color 40 | theme[mem_box]="#586e75" 41 | 42 | # Net up/down box outline color 43 | theme[net_box]="#586e75" 44 | 45 | # Processes box outline color 46 | theme[proc_box]="#586e75" 47 | 48 | # Box divider line and small boxes line color 49 | theme[div_line]="#586e75" 50 | 51 | # Temperature graph colors 52 | theme[temp_start]="#268bd2" 53 | theme[temp_mid]="#ccb5f7" 54 | theme[temp_end]="#fc5378" 55 | 56 | # CPU graph colors 57 | theme[cpu_start]="#adc700" 58 | theme[cpu_mid]="#d6a200" 59 | theme[cpu_end]="#e65317" 60 | 61 | # Mem/Disk free meter 62 | theme[free_start]="#4e5900" 63 | theme[free_mid]="" 64 | theme[free_end]="#bad600" 65 | 66 | # Mem/Disk cached meter 67 | theme[cached_start]="#114061" 68 | theme[cached_mid]="" 69 | theme[cached_end]="#268bd2" 70 | 71 | # Mem/Disk available meter 72 | theme[available_start]="#705500" 73 | theme[available_mid]="" 74 | theme[available_end]="#edb400" 75 | 76 | # Mem/Disk used meter 77 | theme[used_start]="#6e1718" 78 | theme[used_mid]="" 79 | theme[used_end]="#e02f30" 80 | 81 | # Download graph colors 82 | theme[download_start]="#3d4070" 83 | theme[download_mid]="#6c71c4" 84 | theme[download_end]="#a3a8f7" 85 | 86 | # Upload graph colors 87 | theme[upload_start]="#701c45" 88 | theme[upload_mid]="#d33682" 89 | theme[upload_end]="#f56caf" -------------------------------------------------------------------------------- /themes/solarized_light.theme: -------------------------------------------------------------------------------- 1 | #solarized_light theme 2 | #modified from solarized_dark theme 3 | 4 | # Colors should be in 6 or 2 character hexadecimal or single spaced rgb decimal: "#RRGGBB", "#BW" or "0-255 0-255 0-255" 5 | # example for white: "#FFFFFF", "#ff" or "255 255 255". 6 | 7 | # All graphs and meters can be gradients 8 | # For single color graphs leave "mid" and "end" variable empty. 9 | # Use "start" and "end" variables for two color gradient 10 | # Use "start", "mid" and "end" for three color gradient 11 | 12 | # Main background, empty for terminal default, need to be empty if you want transparent background 13 | theme[main_bg]="#fdf6e3" 14 | 15 | # Main text color 16 | theme[main_fg]="#586e75" 17 | 18 | # Title color for boxes 19 | theme[title]="#002b36" 20 | 21 | # Highlight color for keyboard shortcuts 22 | theme[hi_fg]="#b58900" 23 | 24 | # Background color of selected items 25 | theme[selected_bg]="#eee8d5" 26 | 27 | # Foreground color of selected items 28 | theme[selected_fg]="#b58900" 29 | 30 | # Color of inactive/disabled text 31 | theme[inactive_fg]="#eee8d5" 32 | 33 | # Misc colors for processes box including mini cpu graphs, details memory graph and details status text 34 | theme[proc_misc]="#d33682" 35 | 36 | # Cpu box outline color 37 | theme[cpu_box]="#93a1a1" 38 | 39 | # Memory/disks box outline color 40 | theme[mem_box]="#93a1a1" 41 | 42 | # Net up/down box outline color 43 | theme[net_box]="#93a1a1" 44 | 45 | # Processes box outline color 46 | theme[proc_box]="#93a1a1" 47 | 48 | # Box divider line and small boxes line color 49 | theme[div_line]="#93a1a1" 50 | 51 | # Temperature graph colors 52 | theme[temp_start]="#268bd2" 53 | theme[temp_mid]="#ccb5f7" 54 | theme[temp_end]="#fc5378" 55 | 56 | # CPU graph colors 57 | theme[cpu_start]="#adc700" 58 | theme[cpu_mid]="#d6a200" 59 | theme[cpu_end]="#e65317" 60 | 61 | # Mem/Disk free meter 62 | theme[free_start]="#4e5900" 63 | theme[free_mid]="" 64 | theme[free_end]="#bad600" 65 | 66 | # Mem/Disk cached meter 67 | theme[cached_start]="#114061" 68 | theme[cached_mid]="" 69 | theme[cached_end]="#268bd2" 70 | 71 | # Mem/Disk available meter 72 | theme[available_start]="#705500" 73 | theme[available_mid]="" 74 | theme[available_end]="#edb400" 75 | 76 | # Mem/Disk used meter 77 | theme[used_start]="#6e1718" 78 | theme[used_mid]="" 79 | theme[used_end]="#e02f30" 80 | 81 | # Download graph colors 82 | theme[download_start]="#3d4070" 83 | theme[download_mid]="#6c71c4" 84 | theme[download_end]="#a3a8f7" 85 | 86 | # Upload graph colors 87 | theme[upload_start]="#701c45" 88 | theme[upload_mid]="#d33682" 89 | theme[upload_end]="#f56caf" 90 | -------------------------------------------------------------------------------- /themes/tokyo-night.theme: -------------------------------------------------------------------------------- 1 | # Theme: tokyo-night 2 | # By: Pascal Jaeger 3 | 4 | # Main bg 5 | theme[main_bg]="#1a1b26" 6 | 7 | # Main text color 8 | theme[main_fg]="#cfc9c2" 9 | 10 | # Title color for boxes 11 | theme[title]="#cfc9c2" 12 | 13 | # Highlight color for keyboard shortcuts 14 | theme[hi_fg]="#7dcfff" 15 | 16 | # Background color of selected item in processes box 17 | theme[selected_bg]="#414868" 18 | 19 | # Foreground color of selected item in processes box 20 | theme[selected_fg]="#cfc9c2" 21 | 22 | # Color of inactive/disabled text 23 | theme[inactive_fg]="#565f89" 24 | 25 | # Misc colors for processes box including mini cpu graphs, details memory graph and details status text 26 | theme[proc_misc]="#7dcfff" 27 | 28 | # Cpu box outline color 29 | theme[cpu_box]="#565f89" 30 | 31 | # Memory/disks box outline color 32 | theme[mem_box]="#565f89" 33 | 34 | # Net up/down box outline color 35 | theme[net_box]="#565f89" 36 | 37 | # Processes box outline color 38 | theme[proc_box]="#565f89" 39 | 40 | # Box divider line and small boxes line color 41 | theme[div_line]="#565f89" 42 | 43 | # Temperature graph colors 44 | theme[temp_start]="#9ece6a" 45 | theme[temp_mid]="#e0af68" 46 | theme[temp_end]="#f7768e" 47 | 48 | # CPU graph colors 49 | theme[cpu_start]="#9ece6a" 50 | theme[cpu_mid]="#e0af68" 51 | theme[cpu_end]="#f7768e" 52 | 53 | # Mem/Disk free meter 54 | theme[free_start]="#9ece6a" 55 | theme[free_mid]="#e0af68" 56 | theme[free_end]="#f7768e" 57 | 58 | # Mem/Disk cached meter 59 | theme[cached_start]="#9ece6a" 60 | theme[cached_mid]="#e0af68" 61 | theme[cached_end]="#f7768e" 62 | 63 | # Mem/Disk available meter 64 | theme[available_start]="#9ece6a" 65 | theme[available_mid]="#e0af68" 66 | theme[available_end]="#f7768e" 67 | 68 | # Mem/Disk used meter 69 | theme[used_start]="#9ece6a" 70 | theme[used_mid]="#e0af68" 71 | theme[used_end]="#f7768e" 72 | 73 | # Download graph colors 74 | theme[download_start]="#9ece6a" 75 | theme[download_mid]="#e0af68" 76 | theme[download_end]="#f7768e" 77 | 78 | # Upload graph colors 79 | theme[upload_start]="#9ece6a" 80 | theme[upload_mid]="#e0af68" 81 | theme[upload_end]="#f7768e" 82 | -------------------------------------------------------------------------------- /themes/tokyo-storm.theme: -------------------------------------------------------------------------------- 1 | # Theme: tokyo-storm 2 | # By: Pascal Jaeger 3 | 4 | # Main bg 5 | theme[main_bg]="#24283b" 6 | 7 | # Main text color 8 | theme[main_fg]="#cfc9c2" 9 | 10 | # Title color for boxes 11 | theme[title]="#cfc9c2" 12 | 13 | # Highlight color for keyboard shortcuts 14 | theme[hi_fg]="#7dcfff" 15 | 16 | # Background color of selected item in processes box 17 | theme[selected_bg]="#414868" 18 | 19 | # Foreground color of selected item in processes box 20 | theme[selected_fg]="#cfc9c2" 21 | 22 | # Color of inactive/disabled text 23 | theme[inactive_fg]="#565f89" 24 | 25 | # Misc colors for processes box including mini cpu graphs, details memory graph and details status text 26 | theme[proc_misc]="#7dcfff" 27 | 28 | # Cpu box outline color 29 | theme[cpu_box]="#565f89" 30 | 31 | # Memory/disks box outline color 32 | theme[mem_box]="#565f89" 33 | 34 | # Net up/down box outline color 35 | theme[net_box]="#565f89" 36 | 37 | # Processes box outline color 38 | theme[proc_box]="#565f89" 39 | 40 | # Box divider line and small boxes line color 41 | theme[div_line]="#565f89" 42 | 43 | # Temperature graph colors 44 | theme[temp_start]="#9ece6a" 45 | theme[temp_mid]="#e0af68" 46 | theme[temp_end]="#f7768e" 47 | 48 | # CPU graph colors 49 | theme[cpu_start]="#9ece6a" 50 | theme[cpu_mid]="#e0af68" 51 | theme[cpu_end]="#f7768e" 52 | 53 | # Mem/Disk free meter 54 | theme[free_start]="#9ece6a" 55 | theme[free_mid]="#e0af68" 56 | theme[free_end]="#f7768e" 57 | 58 | # Mem/Disk cached meter 59 | theme[cached_start]="#9ece6a" 60 | theme[cached_mid]="#e0af68" 61 | theme[cached_end]="#f7768e" 62 | 63 | # Mem/Disk available meter 64 | theme[available_start]="#9ece6a" 65 | theme[available_mid]="#e0af68" 66 | theme[available_end]="#f7768e" 67 | 68 | # Mem/Disk used meter 69 | theme[used_start]="#9ece6a" 70 | theme[used_mid]="#e0af68" 71 | theme[used_end]="#f7768e" 72 | 73 | # Download graph colors 74 | theme[download_start]="#9ece6a" 75 | theme[download_mid]="#e0af68" 76 | theme[download_end]="#f7768e" 77 | 78 | # Upload graph colors 79 | theme[upload_start]="#9ece6a" 80 | theme[upload_mid]="#e0af68" 81 | theme[upload_end]="#f7768e" 82 | -------------------------------------------------------------------------------- /themes/tomorrow-night.theme: -------------------------------------------------------------------------------- 1 | #Nord theme but using the Tomorrow Night palette 2 | #by Appuchia 3 | 4 | # Colors should be in 6 or 2 character hexadecimal or single spaced rgb decimal: "#RRGGBB", "#BW" or "0-255 0-255 0-255" 5 | # example for white: "#ffffff", "#ff" or "255 255 255". 6 | 7 | # All graphs and meters can be gradients 8 | # For single color graphs leave "mid" and "end" variable empty. 9 | # Use "start" and "end" variables for two color gradient 10 | # Use "start", "mid" and "end" for three color gradient 11 | 12 | # Main background, empty for terminal default, need to be empty if you want transparent background 13 | theme[main_bg]="#1d1f21" 14 | 15 | # Main text color 16 | theme[main_fg]="#c5c8c6" 17 | 18 | # Title color for boxes 19 | theme[title]="#c5c8c6" 20 | 21 | # Highlight color for keyboard shortcuts 22 | theme[hi_fg]="#81beb7" 23 | 24 | # Background color of selected item in processes box 25 | theme[selected_bg]="#282a2e" 26 | 27 | # Foreground color of selected item in processes box 28 | theme[selected_fg]="#c5c8c6" 29 | 30 | # Color of inactive/disabled text 31 | theme[inactive_fg]="#373b41" 32 | 33 | # Misc colors for processes box including mini cpu graphs, details memory graph and details status text 34 | theme[proc_misc]="#969896" 35 | 36 | # Cpu box outline color 37 | theme[cpu_box]="#81a2be" 38 | 39 | # Memory/disks box outline color 40 | theme[mem_box]="#81a2be" 41 | 42 | # Net up/down box outline color 43 | theme[net_box]="#81a2be" 44 | 45 | # Processes box outline color 46 | theme[proc_box]="#81a2be" 47 | 48 | # Box divider line and small boxes line color 49 | theme[div_line]="#81a2be" 50 | 51 | # Temperature graph colors 52 | theme[temp_start]="#b5bd68" 53 | theme[temp_mid]="#f0c674" 54 | theme[temp_end]="#cc6666" 55 | 56 | # CPU graph colors 57 | theme[cpu_start]="#b5bd68" 58 | theme[cpu_mid]="#f0c674" 59 | theme[cpu_end]="#cc6666" 60 | 61 | # Mem/Disk free meter 62 | theme[free_start]="#b5bd68" 63 | theme[free_mid]="#f0c674" 64 | theme[free_end]="#cc6666" 65 | 66 | # Mem/Disk cached meter 67 | theme[cached_start]="#b5bd68" 68 | theme[cached_mid]="#f0c674" 69 | theme[cached_end]="#cc6666" 70 | 71 | # Mem/Disk available meter 72 | theme[available_start]="#b5bd68" 73 | theme[available_mid]="#f0c674" 74 | theme[available_end]="#cc6666" 75 | 76 | # Mem/Disk used meter 77 | theme[used_start]="#b5bd68" 78 | theme[used_mid]="#f0c674" 79 | theme[used_end]="#cc6666" 80 | 81 | # Download graph colors 82 | theme[download_start]="#b5bd68" 83 | theme[download_mid]="#f0c674" 84 | theme[download_end]="#cc6666" 85 | 86 | # Upload graph colors 87 | theme[upload_start]="#b5bd68" 88 | theme[upload_mid]="#f0c674" 89 | theme[upload_end]="#cc6666" 90 | -------------------------------------------------------------------------------- /themes/whiteout.theme: -------------------------------------------------------------------------------- 1 | #Bashtop "whiteout" theme 2 | #by aristocratos 3 | 4 | # Colors should be in 6 or 2 character hexadecimal or single spaced rgb decimal: "#RRGGBB", "#BW" or "0-255 0-255 0-255" 5 | # example for white: "#FFFFFF", "#ff" or "255 255 255". 6 | 7 | # All graphs and meters can be gradients 8 | # For single color graphs leave "mid" and "end" variable empty. 9 | # Use "start" and "end" variables for two color gradient 10 | # Use "start", "mid" and "end" for three color gradient 11 | 12 | # Main background, empty for terminal default, need to be empty if you want transparent background 13 | theme[main_bg]="#ff" 14 | 15 | # Main text color 16 | theme[main_fg]="#30" 17 | 18 | # Title color for boxes 19 | theme[title]="#10" 20 | 21 | # Highlight color for keyboard shortcuts 22 | theme[hi_fg]="#284d75" 23 | 24 | # Background color of selected item in processes box 25 | theme[selected_bg]="#15283d" 26 | 27 | # Foreground color of selected item in processes box 28 | theme[selected_fg]="#ff" 29 | 30 | # Color of inactive/disabled text 31 | theme[inactive_fg]="#dd" 32 | 33 | # Misc colors for processes box including mini cpu graphs, details memory graph and details status text 34 | theme[proc_misc]="#03521d" 35 | 36 | # Cpu box outline color 37 | theme[cpu_box]="#1a361e" 38 | 39 | # Memory/disks box outline color 40 | theme[mem_box]="#3d3c14" 41 | 42 | # Net up/down box outline color 43 | theme[net_box]="#1a1742" 44 | 45 | # Processes box outline color 46 | theme[proc_box]="#3b1515" 47 | 48 | # Box divider line and small boxes line color 49 | theme[div_line]="#80" 50 | 51 | # Temperature graph colors 52 | theme[temp_start]="#184567" 53 | theme[temp_mid]="#122c87" 54 | theme[temp_end]="#9e0061" 55 | 56 | # CPU graph colors 57 | theme[cpu_start]="#0b8e44" 58 | theme[cpu_mid]="#a49104" 59 | theme[cpu_end]="#8d0202" 60 | 61 | # Mem/Disk free meter 62 | theme[free_start]="#b0d090" 63 | theme[free_mid]="#70ba26" 64 | theme[free_end]="#496600" 65 | 66 | # Mem/Disk cached meter 67 | theme[cached_start]="#26c5ff" 68 | theme[cached_mid]="#74e6fc" 69 | theme[cached_end]="#0b1a29" 70 | 71 | # Mem/Disk available meter 72 | theme[available_start]="#ffb814" 73 | theme[available_mid]="#ffd77a" 74 | theme[available_end]="#292107" 75 | 76 | # Mem/Disk used meter 77 | theme[used_start]="#ff4769" 78 | theme[used_mid]="#d9626d" 79 | theme[used_end]="#3b1f1c" 80 | 81 | # Download graph colors 82 | theme[download_start]="#8d82de" 83 | theme[download_mid]="#413786" 84 | theme[download_end]="#130f29" 85 | 86 | # Upload graph colors 87 | theme[upload_start]="#f590f9" 88 | theme[upload_mid]="#722e76" 89 | theme[upload_end]="#2b062d" -------------------------------------------------------------------------------- /zigshim/zig: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Initialize an empty array to hold the filtered arguments 4 | filtered_args=() 5 | 6 | # Iterate over all provided arguments 7 | for arg in "$@"; do 8 | # Exclude unsupported noexecheap flag 9 | if [[ "$arg" != "-Wl,-znoexecheap" ]]; then 10 | filtered_args+=("$arg") 11 | fi 12 | done 13 | 14 | # Execute the compiler with the filtered arguments 15 | exec zig "${filtered_args[@]}" 16 | --------------------------------------------------------------------------------