Download Latest Version Power TUI source code.zip (6.8 kB)
Email in envelope

Get an email when there's a new version of PowerTUI

Home / v1.2.0
Name Modified Size InfoDownloads / Week
Parent folder
LICENSE 2026-05-08 1.1 kB
README.md 2026-05-08 3.2 kB
shutd.cpp 2026-05-08 21.5 kB
Totals: 3 Items   25.8 kB 0

⚡ PowerTUI

A lightweight, high-performance C++ wrapper for Linux shutdown and reboot commands.

Featuring a real-time Terminal UI, interactive safety buttons, and inhibitor awareness.

License Platform Language


📋 Table of Contents

✨ Features

  • 🎯 High-Precision Timing: Uses the C++ std::chrono::steady_clock to prevent clock drift. Stay accurate even under high CPU load.
  • 🛡️ Universal Inhibitor Awareness:
    • Systemd Systems: Queries systemd-inhibit to identify exactly which app is blocking shutdown.
    • Non-Systemd Systems: Fallback to a process watchlist (pgrep) to protect active tasks on Artix, Void, or Gentoo.
  • 🎮 Interactive TUI: Switch between "Act Now" and "Cancel" using Arrow Keys, Tab, or Space.
  • 🚨 Safety First: Critical inhibitors trigger an immediate program termination to prevent "ghost" shutdown attempts.
  • 📦 Zero Dependencies: Pure C++11. No ncurses or external libraries required.

🚀 Installation

1. Clone & Compile

Clone the repository and compile the source code using g++:

git clone https://github.com/adilhaimoura/PowerTUI.git
cd PowerTUI
g++ shutd.cpp -o shutd

2. Install Globally

Move the binary to your local bin folder to run it from anywhere:

sudo mv shutd /usr/local/bin/
sudo chmod +x /usr/local/bin/shutd

💻 Usage

Run a standard 1-minute shutdown countdown:

shutd

Options

Command Description

shutd --help Show help.

shutd Schedules a shutdown in 1 minute (default).

shutd -s <min> Schedules a shutdown in <min> minutes.

shutd -r <min> Schedules a reboot in <min> minutes.

shutd -h <min> Schedules a shutdown in <min> minutes. (compatibility with shutdown)

Examples:

# Reboot in 10 minutes
shutd -r 10

# Shutdown in 5 minutes
shutd 5
shutd -s 5
shutd -h 5

⌨️ Controls

The interface is designed for quick keyboard interaction.

Key

Action

Tab / Arrows

Toggle between Action and Cancel.

Enter

Confirm selection.

C or Ctrl+C

Immediate Abort.

🧠 Why PowerTUI?

Standard shutdown +m commands are "set and forget," often leading to lost work if you forget a timer is running in the background.

PowerTUI solves this by staying in your terminal, providing constant visual feedback. If a background process (like a large download, a render, or a media player) is inhibiting shutdown, PowerTUI will detect it and alert you before the final execution, ensuring you never lose unsaved work accidentally.

📄 License

Distributed under the MIT License. See LICENSE for more information.

Source: README.md, updated 2026-05-08