# Forceful Timer
Forces shutdown once timer runs out or force quits specified applications if timer is
interrupted. Plays sound notifications once timer is almost out.
## 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
```
### Windows
As of now, it's not fully supported. You can not use it to auto close applications.
## Installtion
If you have [pipx](https://pypa.github.io/pipx/), run
```
pipx install forceful-timer
```
otherwise you can just run
```
pip install forceful-timer
```
## Usage
To run the script with default settings, you can run
```
forceful-timer
OR
ftimer
```
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 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
```
ftimer 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**.
Note that for this to work, you will need to know the name of both `minecraft` and
`discord`. In order to get a list of running applications, run
```
ftimer -l
```
which will print out something like
```
('0x01200003', 'xfce4-panel')
('0x01000003', 'Desktop')
('0x02e00003', 'forceful-timer ยท PyPI - Brave')
```
you don't have to care about the first entry (it's mainly for debugging), all you have to
care about is to match the name somewhat closely.
## Development
If you want to contribute to this repo or simple want to develop your own repo locally,
install it through
### 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
pip install -e .
```
### 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
pip install -e .
```
once you installed and set up your virtual environment, you can use the script and make
changes to it.
To contribute, feel free to simple fork and open up a pull request.
Raw data
{
"_id": null,
"home_page": "https://github.com/PraxTube/forceful-timer",
"name": "forceful-timer",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8, <4",
"maintainer_email": "",
"keywords": "timer,shutdown,forcequit",
"author": "Prax",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/03/17/a907a36e808bd49519e50e0198757dbcfb43a91de4e6184b1790f726721e/forceful-timer-0.1.1.tar.gz",
"platform": null,
"description": "# Forceful Timer\n\nForces shutdown once timer runs out or force quits specified applications if timer is\ninterrupted. Plays sound notifications once timer is almost out.\n\n## Motivation\n\nEvery played a video game for way too long in one session? Yeah, me neither *cough*\n*cough*. This program allows you to set time till when your system will shutdown. By\ndefault, you will get notified via sound once the time limit is close to hitting zero.\nAllowing you to save and quit a singleplayer game before it's too late.\n\nIt is not meant to be used on remote servers or to specify a scheduled shutdown. Rather,\nit's meant as a timer that will force stop whatever you are doing.\n\n## Prerequisites\n\n### Linux\n\nIn order to use all features you need `wmctrl`. On **Debian** like systems run\n\n```\nsudo apt install wmctrl\n```\n\n### Windows\n\nAs of now, it's not fully supported. You can not use it to auto close applications.\n\n## Installtion\n\nIf you have [pipx](https://pypa.github.io/pipx/), run\n\n```\npipx install forceful-timer\n```\n\notherwise you can just run\n\n```\npip install forceful-timer\n```\n\n## Usage\n\nTo run the script with default settings, you can run\n\n```\nforceful-timer\n\nOR\n\nftimer\n```\n\nwhich will shutdown the system after 60 minutes. The output will look something like this\n\n```\nShutting down in: 0%| | 2/3600 [00:02<1:00:03, 1.00s/it]\n```\n\nYou can **cancel** the process with `CTRL + C`. In order to bind applications to the\ncancellation process you can add them via `-a <app_name>`. This will **close** the app if\nyou cancel the shutdown. To list all running apps run `-l`.\n\n```\nusage: main.py [-h] [-a APP] [-l] [--sound-theme {big-sur,chime,mario,material,pokemon,sonic,zelda}] [minutes]\n\nShut down the system after the given time period.\n\npositional arguments:\n minutes time in minutes till shutdown\n\noptions:\n -h, --help show this help message and exit\n -a APP, --app APP the app that will get closed if the timer is interrupted\n -l, --list-apps list all running applications and exit.\n --sound-theme {big-sur,chime,mario,material,pokemon,sonic,zelda}\n the theme to use to play sounds, see chime\n```\n\n### Examples\n\nLet's say I want to play minecraft for 45 minutes and I am in a call with a friend. I\ncould run\n\n```\nftimer 45 -a minecraft -a discord\n```\n\nwhich would bind both minecraft and discord to the cancellation process. If I cancel the\nshutdown process, both of them will be **closed**.\n\nNote that for this to work, you will need to know the name of both `minecraft` and\n`discord`. In order to get a list of running applications, run\n\n```\nftimer -l\n```\n\nwhich will print out something like\n\n```\n('0x01200003', 'xfce4-panel')\n('0x01000003', 'Desktop')\n('0x02e00003', 'forceful-timer \u00b7 PyPI - Brave')\n```\n\nyou don't have to care about the first entry (it's mainly for debugging), all you have to\ncare about is to match the name somewhat closely.\n\n## Development\n\nIf you want to contribute to this repo or simple want to develop your own repo locally,\ninstall it through\n\n### Linux\n\n```\ngit clone https://github.com/PraxTube/timed-shutdown.git\ncd timed-shutdown\npython3 -m venv venv\nsource venv/bin/activate\npip install -r requirements.txt\npip install -e .\n```\n\n### Windows\n\n```\ngit clone https://github.com/PraxTube/timed-shutdown.git\ncd timed-shutdown\npython -m venv venv\nvenv\\Scripts\\activate.bat\npip install -r requirements.txt\npip install -e .\n```\n\nonce you installed and set up your virtual environment, you can use the script and make\nchanges to it.\n\nTo contribute, feel free to simple fork and open up a pull request.\n",
"bugtrack_url": null,
"license": "",
"summary": "Forces shutdown once timer runs out or force quits specified applications if timer is interrupted.",
"version": "0.1.1",
"split_keywords": [
"timer",
"shutdown",
"forcequit"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5a406f720ddb9a81cb8d1712271e5907b5fe5b892bc48e947047a4cf65803b6f",
"md5": "327c749c6556869465ab50e9fccc4ec6",
"sha256": "d7985f75b596fa1cb448226def534cd134486b5cce754c0120fa114f9e600276"
},
"downloads": -1,
"filename": "forceful_timer-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "327c749c6556869465ab50e9fccc4ec6",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8, <4",
"size": 7591,
"upload_time": "2023-03-24T07:05:57",
"upload_time_iso_8601": "2023-03-24T07:05:57.590155Z",
"url": "https://files.pythonhosted.org/packages/5a/40/6f720ddb9a81cb8d1712271e5907b5fe5b892bc48e947047a4cf65803b6f/forceful_timer-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0317a907a36e808bd49519e50e0198757dbcfb43a91de4e6184b1790f726721e",
"md5": "cfaf8e6920b6fd602bb5c832a7f08674",
"sha256": "bad065153c69c9d79ad881454aa7a2c2550fbbea9af71c6d756b8b4d8d684d13"
},
"downloads": -1,
"filename": "forceful-timer-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "cfaf8e6920b6fd602bb5c832a7f08674",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8, <4",
"size": 8494,
"upload_time": "2023-03-24T07:06:00",
"upload_time_iso_8601": "2023-03-24T07:06:00.649434Z",
"url": "https://files.pythonhosted.org/packages/03/17/a907a36e808bd49519e50e0198757dbcfb43a91de4e6184b1790f726721e/forceful-timer-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-03-24 07:06:00",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "PraxTube",
"github_project": "forceful-timer",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"tox": true,
"lcname": "forceful-timer"
}