@@ -5,7 +5,7 @@ [](LICENSE) [](https://www.linux.org/)
[](https://docs.python.org/3/library/curses.html)
[](https://github.com/yourusername/matrix-ss)
-[](README.md#versions)
+[](README.md#versions)
A collection of terminal-based Matrix-style screen savers that simulate the iconic "digital rain" effect from the Matrix movies. Multiple color variants available for different moods and occasions.
@@ -15,10 +15,10 @@ [](https://en.wikipedia.org/wiki/The_Matrix) [](https://en.wikipedia.org/wiki/Frame_rate)
[](README.md#controls)
[](README.md#technical-details)
-[](README.md#versions)
+[](README.md#versions)
- 🌟 Authentic Matrix-style digital rain effect
-- 🎨 Multiple color variants (Green, Red+Green, Rainbow)
+- 🎨 Multiple color variants (Green, Red+Green, Rainbow, System Monitor)
- ⚡ Smooth animation (~20 FPS)
- ⌨️ Simple controls (press 'q' to quit)
- 🐧 Linux/Unix compatible
@@ -29,13 +29,26 @@ [](https://www.python.org/downloads/)
[](https://www.linux.org/)
[](https://docs.python.org/3/library/curses.html)
+[](https://pypi.org/project/psutil/)
- Python 3.x
- Linux/Unix terminal
- `curses` library (usually included with Python)
+- `psutil` library (for system monitoring - optional, only needed for `matrix_system.py`)
## Installation
+### Dependencies Installation
+For the system monitoring version (`matrix_system.py`), you'll need to install the `psutil` library:
+
+```bash
+# Install psutil for system monitoring
+pip install psutil
+
+# Or install from requirements.txt
+pip install -r requirements.txt
+```
+
### Method 1: Direct Download
```bash
# Clone or download the repository
@@ -43,7 +56,7 @@ git clone <repository-url> cd matrix-ss
# Make all scripts executable
-chmod +x matrix.py matrix_red.py matrix_rainbow.py
+chmod +x matrix.py matrix_red.py matrix_rainbow.py matrix_system.py
```
### Method 2: Manual Setup
@@ -52,9 +65,10 @@ # Download all scripts to your desired location wget <matrix.py-url>
wget <matrix_red.py-url>
wget <matrix_rainbow.py-url>
+wget <matrix_system.py-url>
# Make executable
-chmod +x matrix.py matrix_red.py matrix_rainbow.py
+chmod +x matrix.py matrix_red.py matrix_rainbow.py matrix_system.py
```
## Usage
@@ -69,6 +83,9 @@ python3 matrix_red.py
# Rainbow Matrix (all colors)
python3 matrix_rainbow.py
+
+# System Monitor Matrix (with system info)
+python3 matrix_system.py
```
### Alternative Methods
@@ -77,11 +94,13 @@ # If made executable ./matrix.py
./matrix_red.py
./matrix_rainbow.py
+./matrix_system.py
# Or with python directly
python matrix.py
python matrix_red.py
python matrix_rainbow.py
+python matrix_system.py
```
### Controls
@@ -128,6 +147,34 @@ - 🎉 Perfect for celebrations and events - ✨ Vibrant and eye-catching
- 🎪 Great for demonstrations
+### 🖥️ System Monitor Matrix (`matrix_system.py`)
+Advanced version that displays real-time system information in the center while Matrix rain falls around it.
+
+```bash
+# Install dependencies first
+pip install -r requirements.txt
+
+# Run the system monitor
+python3 matrix_system.py
+```
+
+**Features:**
+- 🖥️ Real-time system monitoring (CPU, Memory, Disk, IP, Time, Date, User, Load)
+- 🔴 System info displayed in red at center
+- 🟢 Matrix rain falls around the information panel
+- ⏰ Updates every second
+- 🎯 Perfect for system administrators and monitoring
+
+**System Information Displayed:**
+- CPU Usage (%)
+- Memory Usage (%)
+- Disk Usage (%)
+- IP Address
+- Current Time
+- Current Date
+- Username
+- System Load (Linux)
+
### Version Comparison
| Version | Colors | Effect | Best For |
@@ -135,6 +182,7 @@ |---------|--------|--------|----------| | `matrix.py` | Green only | Classic Matrix | Nostalgia, authentic experience |
| `matrix_red.py` | Green + Red | Dramatic | Intense moments, alerts |
| `matrix_rainbow.py` | 7 rainbow colors | Festive | Celebrations, demonstrations |
+| `matrix_system.py` | Green + Red + Yellow | System Monitor | System administration, monitoring |
## How It Works
@@ -0,0 +1,157 @@+#!/usr/bin/env python3
+import curses
+import random
+import time
+import psutil
+import socket
+import datetime
+import os
+
+def get_system_info():
+ """Coleta informações do sistema"""
+ try:
+ # CPU usage
+ cpu_percent = psutil.cpu_percent(interval=1)
+
+ # Memory usage
+ memory = psutil.virtual_memory()
+ memory_percent = memory.percent
+
+ # Disk usage
+ disk = psutil.disk_usage('/')
+ disk_percent = disk.percent
+
+ # IP address
+ hostname = socket.gethostname()
+ ip_address = socket.gethostbyname(hostname)
+
+ # Current time
+ current_time = datetime.datetime.now().strftime("%H:%M:%S")
+
+ # Current date
+ current_date = datetime.datetime.now().strftime("%d/%m/%Y")
+
+ # Username
+ username = os.getlogin()
+
+ # System load (Linux only)
+ try:
+ load_avg = os.getloadavg()
+ load_1min = load_avg[0]
+ except:
+ load_1min = "N/A"
+
+ return {
+ 'cpu': f"CPU: {cpu_percent}%",
+ 'memory': f"MEM: {memory_percent}%",
+ 'disk': f"DISK: {disk_percent}%",
+ 'ip': f"IP: {ip_address}",
+ 'time': f"TIME: {current_time}",
+ 'date': f"DATE: {current_date}",
+ 'user': f"USER: {username}",
+ 'load': f"LOAD: {load_1min:.2f}" if load_1min != "N/A" else "LOAD: N/A"
+ }
+ except Exception as e:
+ return {
+ 'cpu': "CPU: ERROR",
+ 'memory': "MEM: ERROR",
+ 'disk': "DISK: ERROR",
+ 'ip': "IP: ERROR",
+ 'time': "TIME: ERROR",
+ 'date': "DATE: ERROR",
+ 'user': "USER: ERROR",
+ 'load': "LOAD: ERROR"
+ }
+
+def main(stdscr):
+ # configura terminal
+ curses.curs_set(0)
+ stdscr.nodelay(True)
+ stdscr.timeout(100) # espera de input e taxa de atualização do loop (ms)
+
+ sh, sw = stdscr.getmaxyx()
+ columns = [0] * sw # posição y para cada coluna
+
+ # inicializa cores
+ curses.start_color()
+ curses.use_default_colors()
+ curses.init_pair(1, curses.COLOR_GREEN, -1) # verde para chuva
+ curses.init_pair(2, curses.COLOR_RED, -1) # vermelho para info do sistema
+ curses.init_pair(3, curses.COLOR_YELLOW, -1) # amarelo para destaque
+
+ # define área central para informações do sistema
+ center_x = sw // 2
+ center_y = sh // 2
+ info_width = 20
+ info_start_x = center_x - info_width // 2
+
+ # lista de informações do sistema
+ system_info_keys = ['cpu', 'memory', 'disk', 'ip', 'time', 'date', 'user', 'load']
+
+ # contador para atualizar informações
+ update_counter = 0
+ system_info = get_system_info()
+
+ while True:
+ # detecta tecla 'q' para sair
+ key = stdscr.getch()
+ if key == ord('q'):
+ break
+
+ # atualiza informações do sistema a cada 20 frames (~1 segundo)
+ update_counter += 1
+ if update_counter >= 20:
+ system_info = get_system_info()
+ update_counter = 0
+
+ # não limpa a tela para acumular caracteres
+ for x in range(sw):
+ y = columns[x]
+ char = chr(random.randint(33, 126))
+
+ # verifica se está na área central de informações
+ if (info_start_x <= x < info_start_x + info_width and
+ center_y - 4 <= y <= center_y + 4):
+ # pula esta posição para não interferir com as informações
+ continue
+
+ try:
+ stdscr.addch(y, x, char, curses.color_pair(1))
+ except curses.error:
+ pass
+
+ # atualiza posição, reinicia no topo se ultrapassar altura
+ columns[x] = 0 if y >= sh - 1 else y + 1
+
+ # desenha informações do sistema no centro
+ try:
+ # título
+ title = "SYSTEM STATUS"
+ title_x = center_x - len(title) // 2
+ stdscr.addstr(center_y - 4, title_x, title, curses.color_pair(3))
+
+ # informações do sistema
+ y_offset = center_y - 2
+ for i, key in enumerate(system_info_keys):
+ if y_offset + i < sh - 1: # evita sair da tela
+ info_text = system_info[key]
+ x_pos = info_start_x
+ stdscr.addstr(y_offset + i, x_pos, info_text, curses.color_pair(2))
+
+ # borda decorativa
+ border_top = "=" * info_width
+ border_bottom = "=" * info_width
+ stdscr.addstr(center_y - 5, info_start_x, border_top, curses.color_pair(3))
+ stdscr.addstr(center_y + 3, info_start_x, border_bottom, curses.color_pair(3))
+
+ except curses.error:
+ pass
+
+ stdscr.refresh()
+ time.sleep(0.05) # ajusta taxa de quadros (~20 fps)
+
+if __name__ == '__main__':
+ try:
+ curses.wrapper(main)
+ except KeyboardInterrupt:
+ pass