Redesign icon, fix dGPU process detection, polish menu

- Replace chip-outline icon with a GPU card shape (PCIe card body,
  two cooling fans, gold contact fingers) — fixes color stripping
  introduced by Qt 6.11 + KDE Plasma 6.6 tray icon colorization
- Active GPU indicator: yellow-tinted fan disc + bright ring on the
  active side in Hybrid mode (replaces the invisible 2px hub dot)
- dGPU process list now scans /proc/<pid>/fd for open NVIDIA devices
  instead of nvidia-smi --query-compute-apps, so graphics/rendering
  processes (Lutris, games, Vulkan/OpenGL apps) are included
- "Show dGPU processes" menu item is now hidden unless the dGPU is
  actually active (was shown whenever mode == hybrid)
- Menu labels changed from AMD/NVIDIA to generic iGPU/dGPU
- Popup dialogs now inherit the tray icon via QApplication.setWindowIcon

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
pongsn 2026-06-30 00:58:48 -05:00
parent b03f0a182d
commit 4e13f08b07
2 changed files with 105 additions and 57 deletions

View file

@ -4,13 +4,14 @@ A lightweight KDE system tray application for switching GPU modes on Lenovo Legi
## Features
- Shows current GPU mode in the system tray (chip icon: red/green split outline for Hybrid, solid green for NVIDIA only)
- **In Hybrid mode**, the chip body fills red (iGPU active) or green (dGPU active) to show which GPU is currently doing work — updates every 5 seconds via `/dev/nvidia0` usage detection
- Switch between **Hybrid** (AMD iGPU drives internal display, NVIDIA exposes HDMI) and **NVIDIA only** (dGPU drives everything) with one click
- Shows current GPU mode in the system tray — GPU card icon (PCIe card body with two cooling fans and gold contact fingers): red/green split for Hybrid, solid green for dGPU only
- **In Hybrid mode**, the fan on the active GPU's side glows yellow to show which GPU is currently doing work — updates every 5 seconds via `/dev/nvidia*` usage detection
- Switch between **Hybrid (iGPU + dGPU)** and **dGPU only** with one click — menu labels are hardware-agnostic (iGPU/dGPU rather than AMD/NVIDIA)
- No password prompt for the active desktop session (polkit `allow_active: yes`)
- Tracks pending mode switches before reboot — shows an orange badge on the icon and allows cancelling the switch
- Triggers a reboot prompt after switching; also offers "Reboot now" from the tray menu
- **In Hybrid mode**, shows a "Show dGPU processes" menu item listing which processes are currently using the dGPU (via `nvidia-smi`)
- Shows a **"Show dGPU processes"** menu item only when the dGPU is actually in use; lists all processes with an NVIDIA device open (graphics and compute — detected via `/proc/<pid>/fd`, not just CUDA via `nvidia-smi`)
- Popup dialogs share the same tray icon
- Installs itself as a KDE autostart entry
## Compatibility