Forces shutdown once timer runs out or force quits specified applications if timer is interrupted.
Project description
Timed Shutdown
Shutdown your system after a given number of minutes, plays sounds for various actions to notify you.
Motivation
Every played a video game for way too long in one session? Yeah, me neither cough cough. This program allows you to set time till when your system will shutdown. By default, you will get notified via sound once the time limit is close to hitting zero. Allowing you to save and quit a singleplayer game before it's too late.
It is not meant to be used on remote servers or to specify a scheduled shutdown. Rather, it's meant as a timer that will force stop whatever you are doing.
Prerequisites
Linux
In order to use all features you need wmctrl
. On Debian like systems run
sudo apt install wmctrl
Installtion
To install, follow these steps
Linux
git clone https://github.com/PraxTube/timed-shutdown.git
cd timed-shutdown
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
Windows
git clone https://github.com/PraxTube/timed-shutdown.git
cd timed-shutdown
python -m venv venv
venv\Scripts\activate.bat
pip install -r requirements.txt
once you installed and set up your virtual environment, you can use the script.
Usage
To run the script with default settings you can execute
python main.py
which will shutdown the system after 60 minutes. The output will look something like this
Shutting down in: 0%| | 2/3600 [00:02<1:00:03, 1.00s/it]
You can cancel the process with CTRL + C
. In order to bind applications to the cancellation
process you can add them via -a <app_name>
. This will close the app if you cancel the
shutdown. To list all running apps you can run -l
.
usage: main.py [-h] [-a APP] [-l] [--sound-theme {big-sur,chime,mario,material,pokemon,sonic,zelda}] [minutes]
Shut down the system after the given time period.
positional arguments:
minutes time in minutes till shutdown
options:
-h, --help show this help message and exit
-a APP, --app APP the app that will get closed if the timer is interrupted
-l, --list-apps list all running applications and exit.
--sound-theme {big-sur,chime,mario,material,pokemon,sonic,zelda}
the theme to use to play sounds, see chime
Examples
Let's say I want to play minecraft for 45 minutes and I am in a call with a friend. I could run
python main.py 45 -a minecraft -a discord
which would bind both minecraft and discord to the cancellation process. If I cancel the shutdown process, both of them will be closed.
TO DO
- [x] Add sound notification when close to shutdown
- [x] Clear screen on initiation
- [ ] Make usage easier (create PyPi entry)
- [ ] Update README.md
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file forceful_timer-0.0.1.tar.gz
.
File metadata
- Download URL: forceful_timer-0.0.1.tar.gz
- Upload date:
- Size: 14.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22b3bfa9837d592cc2b0719058993bb2fb673a4e5d689f47c77efd6595a79e13 |
|
MD5 | 2599207bff90f954d3af40ed235ae64d |
|
BLAKE2b-256 | f3016b43cc1d8a51d96929eceb838ebc56f7c5c5893b74ec939cb4d5cc046001 |
File details
Details for the file forceful_timer-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: forceful_timer-0.0.1-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99dba1336feee367d13c32d8b9d10708c93f7c3eba3fee7655fd5040e38e93fc |
|
MD5 | 95709ffa0fa99f730d3668047fc448a3 |
|
BLAKE2b-256 | bff56be6354e19fb1c4a7db7ad90f8d32cdf8ac34596deca85fdcf7cdfdabbd3 |