Merge branch 'master' into contrib

pull/96/head
Umar 2020-06-03 11:04:34 +00:00 committed by GitHub
commit 234220db33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 1638 additions and 347 deletions

View File

@ -24,11 +24,13 @@ assignees: aristocratos
[If applicable, add screenshots to help explain your problem.] [If applicable, add screenshots to help explain your problem.]
**Info (please complete the following information):** **Info (please complete the following information):**
- Bashtop version: - Bashtop version:
- Linux distribution and version: - (Linux) Linux distribution and version:
- Terminal used: - (Linux) Data collection type (/proc or psutil):
- Font used: - (OSX/FreeBSD) Os release version:
- Bash version, "bash --version" (version 4.4 or above is required): - Terminal used:
- Font used:
- Bash version, "bash --version" (version 4.4 or above is required):
- Locales: output of "locale -v" - Locales: output of "locale -v"
**Additional context** **Additional context**

9
.gitmodules vendored Normal file
View File

@ -0,0 +1,9 @@
[submodule "test/libs/bats"]
path = test/libs/bats
url = https://github.com/sstephenson/bats
[submodule "test/libs/bats-assert"]
path = test/libs/bats-assert
url = https://github.com/ztombol/bats-assert
[submodule "test/libs/bats-support"]
path = test/libs/bats-support
url = https://github.com/ztombol/bats-support

9
.travis.yml Normal file
View File

@ -0,0 +1,9 @@
# travis does not offer python container for OSX or Windows, not sure if we can get automated testing?
os: linux
language: python
python:
- "3.6"
dist: bionic
install:
- pip install -r requirements.txt
script: ./test.sh

View File

@ -1,5 +1,71 @@
# Changelog # Changelog
## v0.9.7
* Changed: UTF-8 locale check, try to find UTF-8 for current language if LANG is set but not with "UTF-8" suffix
## v0.9.6
* Fixed: UTF-8 locale check
## v0.9.5
* Added: UTF-8 locale check and automatic LANG variable set if not UTF-8
* Fixed: Filter out zero sized disks and added some psutil error checks
## v0.9.4
* Fixed: Missing path for OSX df and correct swap usage reporting for OSX
## v0.9.3
* Fixed: Resizing problems in iTerm2
* Changed: Removed redundant error checking in print function for lower cpu usage
* Fixed: Memory in OSX now shows active memory usage and /private/var/vm as swap memory
* Fixed: Disks in OSX changed from using "GNU df" to "BSD df" for better compatibility
## v0.9.2
* Fixed: Correct prefixes for some missed GNU tools
* Added: Startup progress screen
* Changed: replaced tput commands with escape sequence commands
## v0.9.1
* Added: FreeBSD support with python3 psutil data collection
* Added: Check for gnu tools on non Linux platforms
* Fixed: Increased graph history to avoid cut off on high resolution graphs
## v0.9.0
* Added: Mac OS X support with python3 psutil data collection
* Added: Ability to switch between all available network devices
## v0.8.32
* Fixed: Error in theme error checking corrupting default theme
## v0.8.31
* Fixed: Theme 2-color gradient generation
* Fixed: Theme file error checking
## v0.8.30
* Fixed: Crash on missing net device
## v0.8.29
* Fixed: Cpu temperature colors not working when above high temp value
* Fixed: Unescaped "\" in process list and indent fixes
* Changed: Changes to net graph rescaling parameters
## v0.8.28
* Fixed: Ctrl-C and Ctrl-Z not registering after change to "dd"
* Added: Option to switch to high resolution graphs
* Added: Current peak value for download/upload graphs
## v0.8.27 ## v0.8.27
* Fixed: Use value for "Inactive"+"MemFree" if "MemAvailable" is missing in /proc/meminfo * Fixed: Use value for "Inactive"+"MemFree" if "MemAvailable" is missing in /proc/meminfo

135
README.md
View File

@ -1,9 +1,13 @@
# ![bashtop](Imgs/logo-t.png) # ![bashtop](Imgs/logo-t.png)
![os](https://img.shields.io/badge/Os-Linux-yellow?logo=linux) ![Linux](https://img.shields.io/badge/-Linux-grey?logo=linux)
![usage](https://img.shields.io/badge/Usage-Linux%20resource%20monitor-red) ![OSX](https://img.shields.io/badge/-OSX-black?logo=apple)
![FreeBSD](https://img.shields.io/badge/-FreeBSD-red?logo=freebsd)
![Usage](https://img.shields.io/badge/Usage-System%20resource%20monitor-blue)
![Bash](https://img.shields.io/badge/Bash-v4.4%5E-green?logo=GNU%20bash) ![Bash](https://img.shields.io/badge/Bash-v4.4%5E-green?logo=GNU%20bash)
![Python](https://img.shields.io/badge/Python-v3.6%5E-orange?logo=python)
![bashtop_version](https://img.shields.io/github/v/tag/aristocratos/bashtop?label=version) ![bashtop_version](https://img.shields.io/github/v/tag/aristocratos/bashtop?label=version)
[![Build Status](https://travis-ci.com/aristocratos/bashtop.svg?branch=master)](https://travis-ci.com/aristocratos/bashtop)
[![Donate](https://img.shields.io/badge/-Donate-yellow?logo=paypal)](https://paypal.me/aristocratos) [![Donate](https://img.shields.io/badge/-Donate-yellow?logo=paypal)](https://paypal.me/aristocratos)
[![Sponsor](https://img.shields.io/badge/-Sponsor-red?logo=github)](https://github.com/sponsors/aristocratos) [![Sponsor](https://img.shields.io/badge/-Sponsor-red?logo=github)](https://github.com/sponsors/aristocratos)
[![Coffee](https://img.shields.io/badge/-Buy%20me%20a%20Coffee-grey?logo=Ko-fi)](https://ko-fi.com/aristocratos) [![Coffee](https://img.shields.io/badge/-Buy%20me%20a%20Coffee-grey?logo=Ko-fi)](https://ko-fi.com/aristocratos)
@ -16,8 +20,8 @@
* [Themes](#themes) * [Themes](#themes)
* [Upcoming](#upcoming) (Updated, Python port) * [Upcoming](#upcoming) (Updated, Python port)
* [Support and funding](#support-and-funding) * [Support and funding](#support-and-funding)
* [Compatibility](#compatibility) * [Compatibility](#compatibility) (Updated, OSX and FreeBSD Support)
* [Dependencies](#dependencies) * [Dependencies](#dependencies) (Updated)
* [Screenshots](#screenshots) * [Screenshots](#screenshots)
* [Installation](#installation) (Updated) * [Installation](#installation) (Updated)
* [Configurability](#configurability) * [Configurability](#configurability)
@ -47,6 +51,8 @@ Resource monitor that shows usage and stats for processor, memory, disks, networ
* UI menu for changing all config file options. * UI menu for changing all config file options.
* Auto scaling graph for network usage. * Auto scaling graph for network usage.
* Shows message in menu if new version is available * Shows message in menu if new version is available
* Shows current read and write speeds for disks
* Multiple data collection methods which can be switched if running on Linux
## Themes ## Themes
@ -58,20 +64,18 @@ Let me know if you want to contribute with new themes.
## Upcoming ## Upcoming
#### (Mac OSX and *BSD support) ~~Currently rewriting to use python3 [psutil](https://github.com/giampaolo/psutil) for data collection instead of linux specific tools.
This will add python 3 and psutil as dependencies, but will make bashtop cross platform compatible.~~
Currently rewriting to use python3 [psutil](https://github.com/giampaolo/psutil) for data collection instead of linux specific tools. ~~This will be integrated in to main version when done and add the possibility to switch between psutil and linux tools for users running linux.~~
This will add python 3 and psutil as dependencies, but will make bashtop cross platform compatible.
~~This will be in a new branch called bashtop-psutil when I'm done with initial testing~~ Bashtop is now Mac OS X and FreeBSD compatible!
This will be integrated in to main version when done and add the possibility to switch between psutil and linux tools for users running linux. #### Python port
#### Update Work on a complete python port ~~will begin this summer~~ has begun. My aim is to keep it compatible with pypy3 for a lot of added efficiency.
Work on a complete python port will begin this summer. My aim is to keep it compatible with pypy3 for a lot of added efficiency. PyPyTop?
Bash(py)top?
## Support and funding ## Support and funding
@ -90,7 +94,14 @@ Any support is greatly appreciated!
## Compatibility ## Compatibility
Should work on most modern linux distributions. Should work on most modern linux distributions, on Mac OS X and on FreeBSD.
Will not display correctly on the standard terminal on OSX!
Recommended alternative [iTerm2](https://www.iterm2.com/)
Will also need to be run as superuser on OSX to display stats for processes not owned by user.
The disk io stats on OSX and FreeBSD shows iostats for all disks at the top instead of per disk.
For correct display, a terminal with support for: For correct display, a terminal with support for:
@ -109,59 +120,104 @@ Dropbear seems to not be able to set correct locale. So if accessing bashtop ove
## Dependencies ## Dependencies
**[bash](https://www.gnu.org/software/bash/)** (v4.4 or later) Script functionality will most probably break with earlier versions. ## Linux, OSX and FreeBSD
**[bash](https://www.gnu.org/software/bash/)** (v4.4 or later) Script functionality will most probably break with earlier versions.
Bash version 5 is highly recommended to make use of $EPOCHREALTIME variable instead of a lot of external date command calls. Bash version 5 is highly recommended to make use of $EPOCHREALTIME variable instead of a lot of external date command calls.
**[GNU Core Utilities](https://www.gnu.org/software/coreutils/)** **[GNU coreutils](https://www.gnu.org/software/coreutils/)**
**[GNU Grep](https://www.gnu.org/software/grep/)** **[GNU sed](https://www.gnu.org/software/sed/)**
## Linux using /proc for data collection
**[GNU grep](https://www.gnu.org/software/grep/)**
**[ps from procps-ng](https://gitlab.com/procps-ng/procps)** (v3.1.15 or later) **[ps from procps-ng](https://gitlab.com/procps-ng/procps)** (v3.1.15 or later)
**[sed](https://www.gnu.org/software/sed/)** **[GNU awk](https://www.gnu.org/software/gawk/)**
**[awk](https://www.gnu.org/software/gawk/)** ## OSX and FreeBSD or Linux using psutil for data collection
(Optional) **[lm-sensors](https://github.com/lm-sensors/lm-sensors)** Needed to show CPU temperatures **[Python3](https://www.python.org/downloads/)** (v3.6 or later)
(Optional) **[curl](https://curl.haxx.se/download.html)** (v7.16.2 or later) Needed if you want messages about updates and the ability to download themes. **[psutil python module](https://github.com/giampaolo/psutil)**
(Optional) **[iostat (part of sysstat)](https://github.com/sysstat/sysstat)** Needed if you want disk read/write stats ## Optionals for additional stats
(Optional OSX) **[osx-cpu-temp](https://github.com/lavoiesl/osx-cpu-temp)** Needed to show CPU temperatures.
(Optional Linux) **[lm-sensors](https://github.com/lm-sensors/lm-sensors)** Needed to show CPU temperatures.
(Optional Linux) **[iostat (part of sysstat)](https://github.com/sysstat/sysstat)** Needed if you want disk read/write stats and are not using psutil data collection.
(Optional OSX/Linux/FreeBSD) **[curl](https://curl.haxx.se/download.html)** (v7.16.2 or later) Needed if you want messages about updates and the ability to download themes.
## Screenshots ## Screenshots
Main UI showing details for a selected process. Main UI showing details for a selected process.
![Screenshot 1](Imgs/main.png) ![Screenshot 1](Imgs/main.png)
Main menu. Main menu.
![Screenshot 2](Imgs/menu.png) ![Screenshot 2](Imgs/menu.png)
Options menu. Options menu.
![Screenshot 3](Imgs/options.png) ![Screenshot 3](Imgs/options.png)
## Installation ## Installation
#### Manual installation #### Dependencies installation OSX
Copy or link "bashtop" into PATH, or install with Makefile: >Install homebrew if not already installed
>From cloned directory
``` bash ``` bash
sudo make install /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
```
>Install dependencies
``` bash
brew install bash coreutils gnu-sed python3 git
pip3 install psutil
```
>Install optional dependency osx-cpu-temp
``` bash
brew install osx-cpu-temp
```
#### Dependencies installation FreeBSD
>Install with pkg and pip
``` bash
sudo pkg install coreutils gsed python3 git
sudo python3 -m ensurepip
sudo pip3 install psutil
```
#### Manual installation Linux, OSX and FreeBSD
>Clone and install
``` bash
git clone https://github.com/aristocratos/bashtop.git
cd bashtop
sudo make install
``` ```
>to uninstall it >to uninstall it
``` bash ``` bash
sudo make uninstall sudo make uninstall
``` ```
#### Arch based #### Arch based
Available in the AUR as [bashtop-git](https://aur.archlinux.org/packages/bashtop-git/) Available in the AUR as [bashtop-git](https://aur.archlinux.org/packages/bashtop-git/)
Available in the Arch Linux repository as [bashtop](https://www.archlinux.org/packages/community/any/bashtop/) (Flagged out-of-date on 2020-04-28) Available in the Arch Linux repository as [bashtop](https://www.archlinux.org/packages/community/any/bashtop/)
#### Debian based #### Debian based
@ -233,7 +289,7 @@ Config files stored in "$HOME/.config/bashtop" folder
#### bashtop.cfg: (auto generated if not found) #### bashtop.cfg: (auto generated if not found)
```bash ```bash
#? Config file for bashtop v. 0.8.22 #? Config file for bashtop v. 0.9.0
#* Color theme, looks for a .theme file in "$HOME/.config/bashtop/themes", "Default" for builtin default theme #* Color theme, looks for a .theme file in "$HOME/.config/bashtop/themes", "Default" for builtin default theme
color_theme="Default" color_theme="Default"
@ -248,7 +304,7 @@ proc_sorting="cpu lazy"
#* Reverse sorting order, "true" or "false" #* Reverse sorting order, "true" or "false"
proc_reversed="false" proc_reversed="false"
#* Check cpu temperature, only works if "sensors" command is available and have values for "Package" and "Core" #* Check cpu temperature, only works if "sensors", "vcgencmd" or "osx-cpu-temp" commands is available
check_temp="true" check_temp="true"
#* Draw a clock at top of screen, formatting according to strftime, empty string to disable #* Draw a clock at top of screen, formatting according to strftime, empty string to disable
@ -271,6 +327,15 @@ proc_per_core="false"
#* Optional filter for shown disks, should be names of mountpoints, "root" replaces "/", separate multiple values with space #* Optional filter for shown disks, should be names of mountpoints, "root" replaces "/", separate multiple values with space
disks_filter="" disks_filter=""
#* Enable check for new version from github.com/aristocratos/bashtop at start
update_check="true"
#* Enable graphs with double the horizontal resolution, increases cpu usage
hires_graphs="false"
#* Enable the use of psutil python3 module for data collection, default on OSX
use_psutil="true"
``` ```
#### Command line options: (not yet implemented) #### Command line options: (not yet implemented)
@ -285,7 +350,7 @@ USAGE: bashtop
Might finish off items out of order since I usually work on multiple at a time. Might finish off items out of order since I usually work on multiple at a time.
- [x] Add options to change colors for text, graphs and meters. - [x] Add options to change colors for text, graphs and meters.
- [ ] Fix cross platform compatibility for Mac OSX and *BSD: Currently in testing. - [x] Fix cross platform compatibility for Mac OSX and *BSD: Working on OSX, and FreeBSD.
- [x] Add support for showing AMD cpu temperatures. - [x] Add support for showing AMD cpu temperatures.
- [x] Add option to show tree view of processes. - [x] Add option to show tree view of processes.
- [x] Add option to reset network download/upload totals. - [x] Add option to reset network download/upload totals.

1639
bashtop

File diff suppressed because it is too large Load Diff

1
requirements.txt Normal file
View File

@ -0,0 +1 @@
psutil==5.7.0

3
test.sh Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
./test/libs/bats/bin/bats test/*.bats

17
test/basic_test.bats Normal file
View File

@ -0,0 +1,17 @@
#!/usr/bin/env bats
load 'libs/bats-support/load'
load 'libs/bats-assert/load'
load test_helper
@test "Sourcing works, by checking if \$system is set" {
run echo $system
refute_output ""
}
@test "#get_themes populates themes" {
get_themes
assert_success
assert [ ${#themes[@]} -gt 0 ]
}

1
test/libs/bats Submodule

@ -0,0 +1 @@
Subproject commit 03608115df2071fff4eaaff1605768c275e5f81f

1
test/libs/bats-assert Submodule

@ -0,0 +1 @@
Subproject commit 9f88b4207da750093baabc4e3f41bf68f0dd3630

@ -0,0 +1 @@
Subproject commit 004e707638eedd62e0481e8cdc9223ad471f12ee

1
test/test_helper.bash Normal file
View File

@ -0,0 +1 @@
source bashtop

View File

@ -3,6 +3,7 @@ flat-remix-light.theme
flat-remix.theme flat-remix.theme
greyscale.theme greyscale.theme
gruvbox_dark.theme gruvbox_dark.theme
monokai_mod.theme
monokai_nobg.theme monokai_nobg.theme
monokai.theme monokai.theme
solarized_dark.theme solarized_dark.theme

89
themes/monokai_mod.theme Normal file
View File

@ -0,0 +1,89 @@
#Bashtop monokai mod theme
#by aristocratos
# Colors should be in 6 or 2 character hexadecimal or single spaced rgb decimal: "#RRGGBB", "#BW" or "0-255 0-255 0-255"
# example for white: "#FFFFFF", "#ff" or "255 255 255".
# All graphs and meters can be gradients
# For single color graphs leave "mid" and "end" variable empty.
# Use "start" and "end" variables for two color gradient
# Use "start", "mid" and "end" for three color gradient
# Main background, empty for terminal default, need to be empty if you want transparent background
theme[main_bg]=""
# Main text color
theme[main_fg]="#F8F8F2"
# Title color for boxes
theme[title]="#F8F8F2"
# Higlight color for keyboard shortcuts
theme[hi_fg]="#F92672"
# Background color of selected item in processes box
theme[selected_bg]="#7a1137"
# Foreground color of selected item in processes box
theme[selected_fg]="#F8F8F2"
# Color of inactive/disabled text
theme[inactive_fg]="#595647"
# Misc colors for processes box including mini cpu graphs, details memory graph and details status text
theme[proc_misc]="#A6E22E"
# Cpu box outline color
theme[cpu_box]="#75715E"
# Memory/disks box outline color
theme[mem_box]="#75715E"
# Net up/down box outline color
theme[net_box]="#75715E"
# Processes box outline color
theme[proc_box]="#75715E"
# Box divider line and small boxes line color
theme[div_line]="#595647"
# Temperature graph colors
theme[temp_start]="#7976B7"
theme[temp_mid]="#D8B8B2"
theme[temp_end]="#F92672"
# CPU graph colors
theme[cpu_start]="#A6E22E"
theme[cpu_mid]="#F8F8F2" #b05475"
theme[cpu_end]="#F92672"
# Mem/Disk free meter
theme[free_start]="#75715E"
theme[free_mid]="a9c474"
theme[free_end]="#e2f5bc"
# Mem/Disk cached meter
theme[cached_start]="#75715E"
theme[cached_mid]="#66D9EF"
theme[cached_end]="#aae7f2"
# Mem/Disk available meter
theme[available_start]="#75715E"
theme[available_mid]="#E6DB74"
theme[available_end]="#f2ecb6"
# Mem/Disk used meter
theme[used_start]="#75715E"
theme[used_mid]="#F92672"
theme[used_end]="#ff87b2"
# Download graph colors
theme[download_start]="#2d2042"
theme[download_mid]="#7352a8"
theme[download_end]="#ccaefc"
# Upload graph colors
theme[upload_start]="#570d33"
theme[upload_mid]="#cf277d"
theme[upload_end]="#fa91c7"