# X11 TV Overscan Fixer Slider
A lightweight, automated **Zenity graphical slider utility** designed to easily fix TV overscan on Linux systems using X11 (such as Linux Mint, Ubuntu, and Debian derivatives).
This tool is especially useful for **Intel graphics hardware configurations** where the open-source drivers no longer provide a native overscan or underscan slider in the system display settings.
---
## 🌟 Features
* **Dynamic Resolution Detection**: Automatically extracts the current active display name and screen resolution using `xrandr`—no manual terminal lookups required.
* **Intuitive GUI Slider**: Provides a clean graphical scale interface (from 0% to 15%) to compress screen borders smoothly.
* **Automatic Centering Math**: Dynamically computes the precise hardware transformation matrix (`xrandr --transform`) to keep your desktop perfectly centered relative to your resolution.
* **Persistent Boot Recovery**: Remembers the user's last chosen configuration and automatically re-applies it in the background on every system startup.
* **Zero Dependencies Beyond Core Tools**: Built natively using `bash`, `zenity`, `bc`, and `gawk`.
---
## 🛠️ How It Works (The Math)
When a television cuts off the edges of your desktop, the driver needs to compress the viewing field and shift the frame inward. The script calculates a custom coordinate mapping system on the fly:
\[\text{Scale Factor} = 1 + \left(\frac{\text{Percent Drop}}{100}\right)\]
\[\text{X Offset} = \frac{\text{Width} \times (1 - \text{Scale Factor})}{2}\]
\[\text{Y Offset} = \frac{\text{Height} \times (1 - \text{Scale Factor})}{2}\]
These dynamic adjustments are fed straight into the X11 display engine command string:
```bash
xrandr --output [DISPLAY] --transform [SCALE],0,[X_OFF],0,[SCALE],[Y_OFF],0,0,1
```
---
## 💾 Installation
### Method 1: Pre-compiled `.deb` Package (Easiest)
If you have downloaded the pre-compiled `tv-overscan-fixer.deb` file:
1. Double-click the `.deb` package file to open it with your system's graphical package installer (e.g., **Gdebi** in Linux Mint).
2. Click **Install Package**. Any required sub-dependencies (like `bc` or `gawk`) will be pulled from your official distribution repositories automatically.
Alternatively, you can install it via the terminal:
```bash
sudo apt install ./tv-overscan-fixer.deb
```
### Method 2: Manual Installation from Source
If you prefer managing the scripts manually without packaging:
1. Move the core script to a system binary path and make it executable:
```bash
sudo cp usr/local/bin/fix_overscan.sh /usr/local/bin/fix_overscan.sh
sudo chmod +x /usr/local/bin/fix_overscan.sh
```
2. Copy the desktop application shortcut to your local apps space:
```bash
cp usr/share/applications/tv-overscan-fixer.desktop ~/.local/share/applications/
```
3. To enable autostart on boot, copy the autostart layout to your config path:
```bash
mkdir -p ~/.config/autostart
cp etc/skel/.config/autostart/tv-overscan-boot.desktop ~/.config/autostart/
```
---
## 🚀 Usage
1. Open your system's application menu and look for **"Fix TV Overscan"** (or look directly on your desktop if installed via the `.deb` package skeleton).
2. Drag the slider to scale the view down (e.g., `4` or `5` works well for most television sets).
3. Click **OK** to instantly apply the boundary transformation and lock the selection for your next reboot.
4. To reverse changes or restore default mappings, launch the utility again, slide the bar back to `0`, and click **OK**.
---
## ⚠️ Notes & Limitations
* **Single Display Intent**: This tool is designed explicitly for single-display systems (such as a dedicated Home Theater PC or a desktop box wired directly to a television set). Running this utility on multi-monitor configurations may cause viewport coordinate overlaps.
* **X11 Framework**: This tool interacts directly with the `xrandr` display server protocols. It is compatible with X11 desktop environments (MATE, Cinnamon, XFCE). It does **not** natively support modern Wayland sessions.
---
## 📄 License
This utility is released as open-source software under the **MIT License**. Feel free to fork, adapt, modify, and distribute it to any users or communities in need!