MagX is a lightweight, real-time screen magnifier for Linux systems. It creates a zoomed-in view of the area around your mouse cursor, perfect for presentations, accessibility, or detailed work.
- 🖱️ Real-time magnification - Follows your mouse cursor instantly
- 🔍 Adjustable zoom scale - Configure the magnification level
- ⚡ Lightweight - Minimal resource usage with efficient screen capture
- 🖥️ Customizable window - Adjustable position and size
- 🎯 Smart centering - Automatically centers on cursor position
- 🚀 Fast performance - Optimized for smooth real-time updates
MagX requires the following Linux utilities:
bash(included with most Linux distributions)flock(util-linux package)feh- Image viewerxdotool- X11 automation toolscrot- Screen capture utilitybasenc- Base encoding/decoding utility
Debian/Ubuntu:
sudo apt-get install feh xdotool scrot coreutilsFedora/CentOS:
sudo dnf install feh xdotool scrot coreutilsArch Linux:
sudo pacman -S feh xdotool scrot coreutilsSimply run the script:
./magxThis will start MagX with default settings:
- Zoom scale: 2x
- Update interval: 1 second
- Window geometry: 800x160 at position +0+920
You can customize MagX's behavior using environment variables:
# Set zoom scale (higher = more zoom)
SCALE=4 ./magx
# Set update interval in seconds (lower = smoother but more CPU)
INTERVAL=0.5 ./magx
# Set custom window geometry (widthxheight+x+y)
FEH_GEOMETRY=1024x200+100+800 ./magx
# Disable cursor centering (zoom from top-left)
NOCENTER=1 ./magxHigh zoom for detailed work:
SCALE=8 INTERVAL=0.3 ./magxLarge window for presentations:
FEH_GEOMETRY=1200x300+0+0 SCALE=3 ./magxMinimal CPU usage:
INTERVAL=2 SCALE=2 ./magx- Initialization: Creates a temporary image file with a default pattern
- Window Setup: Launches
fehto display the magnified view in a borderless window - Main Loop: Continuously captures screen regions around the cursor:
- Gets current mouse position using
xdotool - Calculates the capture area based on zoom scale
- Captures the screen region using
scrot - Updates the display window with the new image
- Gets current mouse position using
- Cleanup: Automatically removes temporary files when exiting
- Lower intervals (e.g., 0.5) provide smoother animation but use more CPU
- Higher intervals (e.g., 2) reduce CPU usage but may feel less responsive
- The script automatically runs with low priority (
renice -n 19) to minimize system impact - Use appropriate zoom levels - higher zoom requires more processing
"Error getting screen resolution"
- Ensure you're running in an X11 environment
- Check that
xwininfois installed and working
"Feh closed..." message
- The feh window was closed manually
- The script will exit automatically
Performance is slow
- Try increasing the
INTERVALvalue - Reduce the
SCALEif zoom level is very high - Ensure your system has adequate resources
Window positioning issues
- Verify your screen resolution with
xrandr - Adjust
FEH_GEOMETRYto fit your screen layout
Run this command to verify all dependencies are installed:
for cmd in feh xdotool scrot basenc flock xwininfo; do
if command -v "$cmd" >/dev/null 2>&1; then
echo "✓ $cmd is installed"
else
echo "✗ $cmd is missing"
fi
doneThis project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Feel free to submit issues and enhancement requests.
Created by DanielT
Note: MagX is designed for X11 environments. Wayland support may require additional configuration or alternative tools.