A simple GUI application to shut down your computer after a set of specified processes have finished executing.
Tested on Ubuntu ... and should work on Mac OS X (let me know).
- Process Monitoring: Select one or more running processes to monitor.
- Automatic Shutdown: The application automatically shuts down the computer once all monitored processes have finished.
- System Tray Integration: The application runs in the system tray, allowing it to operate in the background without cluttering the desktop. The main window can be opened and hidden easily.
- Dynamic and Interactive UI: The interface changes based on the application's state (idle, monitoring, or shutdown countdown), providing clear visual feedback.
- Customizable Intervals: Set the monitoring interval and the shutdown countdown time.
- Responsive Process Selection: The process list can be refreshed at any time, and selections are preserved. Processes can be selected or deselected with a single click on the item.
This project has two recommended installation methods: one for end-users and one for developers.
The best way to install delayed-shutdown is using pipx, which installs the application and its dependencies in an isolated environment. This prevents conflicts with other Python packages on your system.
-
Install pipx: If you don't have
pipxinstalled, follow the official installation instructions: Install pipx. -
Install the application: You can install
delayed-shutdowndirectly from its GitHub repository:pipx install git+https://github.com/arrase/delayed-shutdown.git
After installing with pipx, you can create a desktop entry that will automatically start the application pinned to the system tray when you log in.
This repository includes a helper script, create_autostart_entry.sh, which writes a delayed-shutdown.desktop file into ~/.config/autostart and points the Exec entry to the delayed-shutdown executable (by default ~/.local/bin/delayed-shutdown, where pipx installs user commands).
To download and run the script directly from GitHub, run:
bash <(curl -sS https://raw.githubusercontent.com/arrase/delayed-shutdown/refs/heads/main/create_autostart_entry.sh)Or, if you cloned the repository or have the script locally, run:
bash ./create_autostart_entry.shThe script will create ~/.config/autostart/delayed-shutdown.desktop. On next login the application will be started and should appear minimized in the system tray. If your installation path differs from ~/.local/bin, edit the Exec line in the created .desktop file or update the script before running it.
If the desktop entry does not seem to work, ensure the .desktop file exists at ~/.config/autostart/ and that the Exec path is correct for your environment. You may need to log out and log back in for changes to take effect.
If you want to contribute to the project, you should set up a local development environment.
-
Clone the repository:
git clone https://github.com/arrase/delayed-shutdown.git cd delayed-shutdown -
Create and activate a virtual environment:
python3 -m venv .venv source .venv/bin/activate -
Install the project in editable mode: This will install the package, but any changes you make to the source code will be immediately reflected when you run the application.
pip install -e .
To allow the application to shut down the system without asking for a password, you need to configure sudo. This allows the shutdown command to be executed without user interaction.
Warning: Editing the sudoers file incorrectly can leave your system in an unstable state. Proceed with caution.
-
Find the
shutdowncommand path: Open a terminal and run:which shutdown
This will give you the full path to the command, for example,
/usr/sbin/shutdown. Copy it. -
Edit the
sudoersfile: The safest way to edit this file is with thevisudocommand, which checks the syntax before saving.sudo visudo
-
Add the rule: Add the following line to the end of the file. Important: Replace
<YOUR USER>with your username and<PATH TO SHUTDOWN>with the path you copied in the first step.<YOUR USER> ALL=(ALL) NOPASSWD: <PATH TO SHUTDOWN>For example, if your user is
johnand the path is/usr/sbin/shutdown, the line would be:john ALL=(ALL) NOPASSWD: /usr/sbin/shutdown -
Save and exit. In
visudo(which typically uses an editor likeviornano), save the changes and exit. If you're usingvi, pressEscand type:wq. If you're usingnano, pressCtrl+X, thenY, andEnter.
After installation, run the application from your terminal or the applications menu:
delayed-shutdownThe application will start minimized in the system tray.
- Show/Hide the window: A single click on the system tray icon will show or hide the main window.
- Main menu: A right-click on the icon will open a menu with options to show the window or exit the application.
Inside the main window, you can select the processes to monitor, set the monitoring interval, and define the shutdown countdown time. Once you have selected the desired processes, click "Start Monitoring and Shutdown". The application will wait for all selected processes to close and then begin the shutdown countdown.
Contributions are welcome! Please feel free to submit a pull request or open an issue if you have any suggestions or find any bugs.
This project is licensed under the MIT License. See the LICENSE file for details.
The content of this repository has been generated by AI
