Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/laixintao/mactop
https://github.com/laixintao/mactop
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/laixintao/mactop
- Owner: laixintao
- License: gpl-3.0
- Created: 2023-12-05T09:12:42.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-06T08:58:11.000Z (about 1 year ago)
- Last Synced: 2024-08-04T04:06:52.627Z (6 months ago)
- Language: Python
- Size: 604 KB
- Stars: 136
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- my-awesome - laixintao/mactop - 12 star:0.1k fork:0.0k (Python)
README
# mactop
Mactop is a tool like htop, but you can decide the data you want and decide the
layout. It is more like a Grafana for your macbook, but in terminal.It looks like this:
![](./assets/mactop.png)
## Installation
```shell
pip install mactop
```## Usage
```
sudo mactop
```It requires `sudo` because `powermetrics` requires `sudo`, you can run `mactop`
without `sudo` but some metrics will be missing.For M1 Macbook users, please run:
```
sudo mactop -t m1.xml
```What is `-t` here? It's for "theme"! And you can have your own theme!
## Design Your Own Mactop
We use HTML + CSS style to setup the layout.
You can use `id` or `class` to select the element, like this:
```html
#row-1 {
color: red;
}
```
Save your content to a file, for example, `my-theme.xml`, then run `mactop` with
`mactop -t my-theme.xml`.Components do not support inline-css, but you can set attributes on components.
Common attributes that every components support:
- `id`;
- `class` or `classes`, separated by space;
- `refresh_interval`: set this will overwrite command line arguments
`--refresh-interval` for that component.For component's supported attributes and component's name, please refer to
`mactop/panels/__init__.py` and check the source code. Please bare with me, it
is messy for now, I am working on documentations. If you have any questions,
feel free to open an issue.For examples of layouts, you can refer `mactop/themes/` directory.
If you made some beautiful layout, please send it to me! By open a PR or issue,
I can merge it into this repo, thanks.## Debug
Mactop comes with verbose log support.
`-v` means enable `info` log, and more `v` means more logs, max `-vvv`.
```shell
mactop -vvv -l mactop.log
```Then you can open another terminal `tail -f mactop.log` to see the logs.
Mactop use `powermetrics` to get metrics from your mactop, `powermetrics` is
different on different Macbooks. If you met some issue, better submit a
`powermetrics` sample in the issue, thanks.Use this command (add `--debug`), Mactop will write json formatted powermetrics
file on your current `$(PWD)/debug_json`. (If you decide to paste it, only one
sample (one file) is enough).```shell
$ mactop -vvv -l mactop.log --debug
$ ls debug_json
mactop_debug_20231206_16:34:28.json mactop_debug_20231206_16:41:55.json mactop_debug_20231206_16:46:21.json
mactop_debug_20231206_16:34:29.json mactop_debug_20231206_16:44:46.json
```## Development
This project use [poetry]() to manage dependencies.
Clone this project and make sure you have poetry.
```shell
pip install poetry
git clone [email protected]:laixintao/mactop.git
```Then install dependencies:
```shell
poetry install
```You can then make changes, and test with `poetry run mactop`.