Script that auto‑shutdowns after Shotcut export (Linux)

Smart Shutdown Timer – Auto‑shutdown after Shotcut export (Linux)

I didn’t want to judge how long the export would take, so I made this tool to automate it. It’s a personal project, but I think it’s especially useful for those long exports where you want to walk away and come back to a shutdown PC.

A lightweight Python GUI tool that monitors your Shotcut exports and shuts down your PC when the export finishes. No more waiting for long renders!

Demo


:clapper_board: Shotcut Tab – What it does

  • Detects melt processes (Shotcut’s render engine) – works even if export is already running
  • Shows export progress and ETA (via Shotcut’s D‑Bus progress)
  • Shuts down your PC after a configurable delay (5–600 seconds)
  • Handles queued exports (one after another)

:alarm_clock: Basic Tab

Simple countdown timer – set hours and minutes.

:fox: Firefox Tab

Watches for .part download files, skips stalled downloads, shuts down after completion.

:speaker_high_volume: Audio Tab

Monitors audio playing. Shuts down after audio stops. Proper before sleep movies,music etc.

Global Cancel

Stops any running timer immediately.


:clipboard: Requirements

  • Linux (Mint / Ubuntu / Debian / Xfce, GNOME, etc.)
  • Python 3.8 or newer
  • Shotcut (any version that uses melt -progress2)
  • Python package: psutil

:rocket: Installation

# 1. Install dependencies
sudo apt update
sudo apt install python3-pip python3-tk
pip install --break-system-packages psutil

# 2. Download the script
git clone https://github.com/spinos1995/smart-shutdown-timer.git
cd smart-shutdown-timer

# 3. Run it
python3 SmartShutdownTimer.py

---
📦 Download

[**GitHub Repository**](https://github.com/spinos1995/smart-shutdown-timer)

MIT License – free to use, modify, and share.
1 Like

Wonderfull ! :grinning_face:

1 Like

--break-system-packages , given the name of that command, I want to know more, could you explain what this does and what are the potential breaks?

I did a search and it kind of scares me…

pip install --break-system-packages psutil:

Attempts to install psutil (a process and system monitoring library) globally.
Modern Linux distributions block global pip installs by default (via PEP 668) to protect themselves.
The --break-system-packages flag explicitly tells Python to bypass this safety lock and inject the package anyway.

Thus I want to understand ALL the in and out before doing anything :wink:

1 Like

you are right i understand.

pip install is blocked for my linux system and maybe others too.

when i tried to install normally it wouldnt let me with a message like
error: externally-managed-environment

–break-system-packages bypasses this.

You basically tell the system “Its ok install it”, you dont actually break something with this command.

i saw that psutil library that doesn’t interfere with core system components, and is only needed for a user‑space GUI script. The risk is low, but not zero.

I think theres a safer more isolated way of installing this using like a virtual enviroment only for this script with something like this.

python3 -m venv ~/myenv
source ~/myenv/bin/activate
pip install psutil

i will test this way and update this and the github info and remove the break system command.

I use mostly AI for these so i cant give you a more deep technical answer. This is my first published thing.

Thanks a lot for the feedback!

1 Like

Hi, thanks a lot for your answer :+1:

I did take a look at your code, people could encounter an error because of a hard coded path…

Line 38: self.watch_dir = tk.StringVar(value="/home/spyros/Desktop") it’s the path on YOUR computer with YOUR user name :wink:

because you added a “Browse” button (self.browse_btn = ttk.Button(…)) a user can manually click “Browse”, navigate to their actual Desktop or other folder, and override this hardcoded path.

However, having to click Browse and re-select your folder every single time you open the app is bad user experience IMVHO.

Because you already import os at line 11, I would replace
self.watch_dir = tk.StringVar(value="/home/spyros/Desktop") by:
self.watch_dir = tk.StringVar(value=os.path.expanduser("~/Desktop"))

It’s a cool application with a gui :+1:
What I particularly like is the software choice that can take times to download (firefox) to export (Shotcut), etc…, that is very nice :smiling_face_with_three_hearts:
But I think there is no need to install something if you could rewrite your script, not sure about that, though… :thinking:

I’ll give an example (it’s with terminal, so ok there is no GUI and people will not like it, and might not work with flatpak or snap which are sandboxed, I use appimage):

minutes=1; while pgrep -x "melt-7" > /dev/null; do sleep 60; echo "$minutes minute(s) in and export still running..."; ((minutes++)); done && systemctl poweroff

You can even make a desktop shortcut button directly in terminal (It’s what I did, I export video, then just double click on my shortcut):

cat << 'EOF' > ~/Desktop/Shotcut_Shutdown.desktop
[Desktop Entry]
Version=1.0
Type=Application
Terminal=true
Name=Shotcut Smart Shutdown
Comment=Monitor export and shutdown with timer
Exec=bash -c 'minutes=1; while pgrep -x "melt-7" > /dev/null; do sleep 60; echo "$minutes minute(s) in and export still running..."; ((minutes++)); done && systemctl poweroff'
Icon=system-shutdown
Categories=Utility;
EOF
chmod +x ~/Desktop/Shotcut_Shutdown.desktop

EDIT for flatpak and snap

Last but not least, for which either package you are using this should work (.deb/native, flatpak, snap, appimage)

minutes=1; while pgrep -x "melt-7" > /dev/null || pgrep -f "/melt" > /dev/null || pgrep -x "melt" > /dev/null; do sleep 60; echo "$minutes minute(s) in and video export still running..."; ((minutes++)); done && systemctl poweroff
  • pgrep -x "melt-7" catches the official AppImage.
  • pgrep -f "/melt" catches the sandboxed Flatpak.
  • pgrep -x "melt" catches the official Canonical Snap or any native Linux repository installation.

In all cases thanks a lot for sharing your application :+1:
Please have a fantastic day.

1 Like

You are right i doxed myself :P. Fixed it and added the flathub,appimage exception etc.
I personally prefer a GUI feedback but i tested yours shortcut and its pretty neat.

I also added a simple shutdown after audio stops.
For the people that go to sleep leaving the pc open while watching or listening something.
Will probably add more in the future.

Thank you very much! Cheers!

1 Like

Simple is best, and your GUI is simple, keep it that way :+1:
easy to understand, easy to use, just perfect.
I would change a naming, though as Basic means nothing, I would name it just “Timer” or “Shutdown Timer”, which it is IMHO

1 Like