• Stars
    star
    136
  • Rank 267,670 (Top 6 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created 12 months ago
  • Updated 12 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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:

Installation

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:

<Mactop>
  <layout>
    <Horizontal id="row-1">
      <SensorsPanel></SensorsPanel>
    </Horizontal>
  </layout>

  <style>
    #row-1 {
      color: red;
    }
  </style>
</Mactop>

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.

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).

$ 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.

pip install poetry
git clone [email protected]:laixintao/mactop.git

Then install dependencies:

poetry install

You can then make changes, and test with poetry run mactop.

More Repositories

1

iredis

Interactive Redis: A Terminal Client for Redis with AutoCompletion and Syntax Highlighting.
Python
2,541
star
2

python-parallel-programming-cookbook-cn

📖《Python Parallel Programming Cookbook》中文版
Python
1,469
star
3

flameshow

A terminal Flamegraph viewer.
Python
1,012
star
4

pingtop

🏓Ping multiple servers and show results in a top-like terminal UI.
Python
499
star
5

slic-python-implementation

🖼The python implementation to make superpixels by slic.
Python
203
star
6

tokei-pie

Render tokei's output to interactive sunburst chart.
Python
178
star
7

myrc

⚙️ My Linux Config files.
Vim Script
158
star
8

jupyter-dot-kernel

📝Dot language kernel for jupyter.
Python
86
star
9

prometheus-http-sd

Prometheus HTTP SD framework.
Python
43
star
10

Report-IP-hourly

📬 Report Linux IP by email hourly.
Python
42
star
11

promqlpy

Python
32
star
12

vcron

Interactive TUI crontab editor
Python
28
star
13

HoldemCalculator

计算德州扑克胜率的一个webapp
HTML
26
star
14

git-ext

🛠 A git extension that allows you submit pullrequests from command line.
Python
21
star
15

feed

Some feeds output from feedly.
Python
19
star
16

learn-dot

graphviz/dot语言 教程。
Jupyter Notebook
18
star
17

ISAAC-Atlas-online

👹以撒的结合,中文在线图鉴。
HTML
17
star
18

patrolify

Do some checks every day, so that you can read the "news" in the morning while drinking coffee.
Python
17
star
19

mepe

Cli Prometheus metrics viewer.
Python
15
star
20

blackemail

Dirty email address.
Python
13
star
21

django-migrations-under-the-hood

My slide for PyCon China 2019.
Python
13
star
22

vagrant-wordpress

Bootstrap LEMP WrodPress on virtual machine use VagrantFile.
Shell
12
star
23

iredis-website

Source code of iredis.io, the site for iredis project.
JavaScript
11
star
24

asyncomplete-gitcommit

Provides common words of git commit message autocomplete for asyncomplete.vim
Vim Script
11
star
25

laixintao

Python
9
star
26

vain-git

虚荣的git,填满 Github 日历。
Python
8
star
27

mydumper2s3

Upload mydumper files to S3 bucket in real time.
Python
8
star
28

myslides

Python
7
star
29

Princess-Diaries

👸 A jekyll theme.
CSS
6
star
30

metrics-render

HTTP service that rendering promql into image, support alerting rules expression
Python
6
star
31

side-project-slide

My slides for PyCon2019 Hangzhou.
5
star
32

douban-movie

抓取自己豆瓣上标记的电影和评论。
Python
5
star
33

pytest-mock-helper

Help you mock HTTP call and generate mock code.
Python
4
star
34

go-systemd-readiness-example

A simple example of systemd's readiness protocol.
Go
4
star
35

tmux-auto-select

Perl
4
star
36

iredis-bin

Python
3
star
37

tmux-demo

3
star
38

alerting-with-confidence

alerting-with-confidence talk slides. https://promcon.io/2022-munich/talks/alerting-with-confidence/
HTML
3
star
39

promql-metricsql-prettify

Make your PromQL or MetricsQL beautiful.
HTML
3
star
40

resp3-py

(WIP) A python implementation of RESP3.
Python
3
star
41

RaspberryPI.python

Python code for Raspberry Pi.
Python
3
star
42

leetcode

Python
3
star
43

JOANNA

An Operating System.
C
2
star
44

atomic_or_channel

Go
2
star
45

pycon-en

Pycon-China English site.
2
star
46

page-watcher

Python
2
star
47

yqt

YuQue Tools, now you can edit your markdown with your favorite editor and use yqt to upload them to yuque.com.
Python
2
star
48

blue-nginx

Dockerfile
1
star
49

hack-google-arts

1
star
50

adventofcode

Python
1
star
51

git-check

CI for git repo.
1
star
52

learn-jdbc

Learn jdbc for postgres by example.
Java
1
star
53

workdays-bot

中国大陆法定工作日日推机器人。
Python
1
star
54

maggr

1
star
55

gogogo

My go scripts.
Go
1
star
56

tlpi-code

source code of tlpi and my notes.
C
1
star
57

python3.9-import-test

Python
1
star
58

omnigraffle-automation

My Omnigraffle Automation Scripts
1
star