-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Auto breaks | ||
|
||
> This example is only for GNU/Linux users w/ KDE Plasma 5. | ||
You can schedule automatic breaks or pauses by locking and unlocking the screen. In KDE Plasma 5, you can configure the screensaver to execute a custom script when any of these events occur. Please keep in mind that `toffu` considers the following: | ||
|
||
- Whether you have manually clocked in already. | ||
- Whether today is a workday. | ||
- Whether you have worked the scheduled hours. | ||
|
||
## Install Toffu | ||
|
||
Check out the [installation instructions](../../README.md#installation) first. | ||
|
||
## Setup | ||
|
||
Open `System Settings`, there you can look for `Notifications` -> `Application Settings` -> `Screen Saver` -> `Configure Events`. Toggle the `Run command` for every state: | ||
|
||
- **Screen unlocked**: `/usr/local/bin/toffu in` | ||
- **Screen locked**: `/usr/local/bin/toffu out` | ||
|
||
<img alt="Configure notifications" src="auto-breaks.gif"/> | ||
|
||
## Desktop notifications (optional) | ||
|
||
You could also customize the previous commands to send desktop notifications using `notify-send`: | ||
|
||
- **Screen unlocked**: `/usr/local/bin/toffu in && /usr/bin/notify-send -t 5 -a 'Toffu' 'You have clocked in sucessfully!' || /usr/bin/notify-send -t 0 -u critical -a 'Toffu' 'An error has ocurred while trying to clock in!'` | ||
- **Screen locked**: `/usr/local/bin/toffu out && /usr/bin/notify-send -t 5 -a 'Toffu' 'You have clocked out sucessfully!' || /usr/bin/notify-send -t 0 -u critical -a 'Toffu' 'An error has ocurred while trying to clock out!'` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Clock In On Startup | ||
|
||
> This example is only for GNU/Linux users w/ systemd. | ||
Systemd is the standard service manager used in many GNU/Linux distributions for managing system and user services. With systemd, you can set up automatic clock-in on startup. Please keep in mind that `toffu` considers the following: | ||
|
||
- Whether you have manually clocked in already. | ||
- Whether today is a workday. | ||
- Whether you have worked the scheduled hours. | ||
|
||
## Install Toffu | ||
|
||
Check out the [installation instructions](../../README.md#installation) first. | ||
|
||
## Create the systemd config file | ||
|
||
Copy the next [systemd config file](toffu-in.service) in `$HOME/.config/systemd/user/toffu-in.service`: | ||
|
||
```ini | ||
[Unit] | ||
Description=Toffu in on startup | ||
After=dbus.service network.target | ||
|
||
[Service] | ||
Type=simple | ||
ExecStart=/usr/local/bin/toffu in | ||
|
||
[Install] | ||
WantedBy=default.target | ||
``` | ||
|
||
## Enable the service | ||
|
||
Start the service: | ||
|
||
```shell | ||
systemctl --user start toffu-in.service | ||
``` | ||
|
||
And check if everything is running fine: | ||
|
||
```shell | ||
systemctl --user status toffu-in.service | ||
``` | ||
|
||
Once the service is working, you can enable it on startup: | ||
|
||
```shell | ||
systemctl --user enable toffu-in.service | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[Unit] | ||
Description=Toffu in on startup | ||
After=dbus.service network.target | ||
|
||
[Service] | ||
Type=simple | ||
ExecStart=/usr/local/bin/toffu in | ||
|
||
[Install] | ||
WantedBy=default.target |