-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not initiate breaks when the display is blank/sleeping/off or the screen is locked #134
Comments
I've implemented a workaround that works perfectly with xfce4-screensaver. I added the script below into Autostart list. It has to be constantly running and monitoring D-Bus. The script always works for screen locking. However it requires the Activate screensaver when computer is idle option to be on in xfce4-screensaver settings in order to detect display blanking/sleeping/off. With this option on the screensaver emits the necessary suspend-workrave-on-screensaver-activation#!/bin/bash
setWorkraveOperationMode () {
dbus-send --session --dest=org.workrave.Workrave --type=method_call \
/org/workrave/Workrave/Core org.workrave.CoreInterface.SetOperationMode \
string:"$1"
}
justChanged=0
dbus-monitor --session "interface='org.xfce.ScreenSaver',member='ActiveChanged'" |
while read -r line; do
if [[ $justChanged == 1 ]]; then
if [[ "$line" =~ 'true' ]]; then
setWorkraveOperationMode "suspended"
elif [[ "$line" =~ 'false' ]]; then
setWorkraveOperationMode "normal"
else
echo "Error! Unexpected activated value: '$line' $(date)"
fi
justChanged=0
elif [[ "$line" =~ 'ActiveChanged' ]]; then
justChanged=1
fi
done |
This sounds like a great way to implement other custom behavior - is the workrave dbus API documented somewhere? |
Not that I know of. You can explore the DBus API in QDBusViewer or a similar tool. |
Btw, maybe you can add a PR to add the script to the contrib section, so it doesn't get lost here :) |
The script is now in contrib. |
@vedgy nice! Can this be adapted to suspend workrave when there is a fullscreen application running? |
Only if your window manager/desktop environment sends a D-Bus signal when an application enters and exits the full-screen mode. |
Well, I now figured out how to check it: https://askubuntu.com/a/1265587 |
When the Reading mode is on, workrave keeps asking for breaks indefinitely even if there is nothing to read on the screen and the user stopped all mouse/keyboard activity some time ago.
Workrave can check if the screen is readable before initiating a break. If the screen is not readable, check again after some time (a percentage of the shortest interval between enabled breaks perhaps).
For example, on GNU/Linux
xset q
can be used to query the current display state. Unfortunately, it is probably unfeasible for workrave to support all the different screen lockers. But I think some checks (the display state at least) is better than no detection at all.#120 proposes an alternative manual way to address this issue - by configuring the inactivity timer.
The text was updated successfully, but these errors were encountered: