workrave icon indicating copy to clipboard operation
workrave copied to clipboard

Possibility to suspend for x amount of time

Open pabloab opened this issue 6 years ago • 28 comments

(This should be labeled as a feature-request.)

Redshift have a very useful feature: The ability to suspend it for x minutes/hours: image Very useful to see movies/series. Would be great to have same feature on Workrave. Very often I suspend/quiet (BTW, one of them could be removed) and then forget to enable it again.

pabloab avatar May 29 '18 00:05 pabloab

This would be a great feature. It shouldn't be hard to code it. It's been years since I don't touch C++ but maybe I try coding it myself and send a PR.

empz avatar Jun 09 '18 10:06 empz

This is the only reason I have had to move to using stretchly, which i don't like much (web app in chromium/electron which consumes 10x the memory of workrave). When in meetings i have to set it in quiet mode and always used to forget to turn it back on

pankajp avatar Apr 10 '19 07:04 pankajp

Same for me! I'm ready to pay 10 Euro to anyone who implements this. 1/4 hours 1/2 hour 1 hour 2 hour 4 hours

nkomarov avatar Jun 25 '19 17:06 nkomarov

Yes please! Sometimes I am in a meeting, or super focused, and don't want to be interrupted for a bit - but then I forget to turn it back on again, which often leads to harmful fatigue and long unproductivity.

Maybe I can find some time to look into this - @nkomarov is your offer still on? ;)

xeruf avatar Jul 08 '20 10:07 xeruf

Maybe I can find some time to look into this - @nkomarov is your offer still on? ;) Yes it is!

nkomarov avatar Jul 08 '20 13:07 nkomarov

I am thinking of a small script now since I am not that versed in C - which you would then invoke like workrave-suspend <x> where x is the amount of minutes to suspend - @nkomarov would that work for you?

Personally, I currently rather quit Workrave than suspending, because then it at least comes back to its original state on restart. I had some really bad days which would not have happened if workrave wouldn't have been suspended from the previous day... In addition to this, I have now set a cronjob that restarts workrave hourly so I don't get too caught up without it :)

xeruf avatar Aug 07 '20 08:08 xeruf

Here is a POSIX-compliant script inspired by #134 you can put into any bin-folder (I use ~/.local/bin and named the script susrave). It takes a single argument, the number of minutes to suspend. Remove the two echo statements if you want silence, and you can replace "quiet" by "suspend" if you actually want to suspend.

Thanks to the trap, it will also reset the mode on Ctrl-C.

#!/bin/sh
set -e

my_hook() {
    echo "Setting Workrave operation mode to normal"
	setWorkraveOperationMode "normal"
}
trap my_hook EXIT INT

setWorkraveOperationMode() {
    dbus-send --session --dest=org.workrave.Workrave --type=method_call \
    /org/workrave/Workrave/Core org.workrave.CoreInterface.SetOperationMode \
    string:"$1"
}

echo "Silencing workrave"
setWorkraveOperationMode "quiet"
sleep ${1}m

xeruf avatar Aug 12 '20 10:08 xeruf

And here an even more advanced script, with full screen detection (when using X), see explanation in the script:

#!/bin/sh

# Sets Workrave mode to quiet and waits the given amount of minutes (default: 10)
# If no amount is given or the -f flag is provided, it checks whether a fullscreen application is running and if no, exits
# On exit or Ctrl-C (SIGINT) it sets the Workrave mode back to normal

while true; do
	case $1 in
		(-q) quiet=1; shift 1;;
		(-f) fullscreen=1; shift 1;;
		(*) break;;
	esac
done

getFullscreen() {
	# See https://askubuntu.com/a/1265587
	# Get screen size
	root_geo=$(xwininfo -root | awk -F'[ +x]' '$3 ~ /-geometry/ {printf "%dx%d",$4/'"$(xrandr | grep ' connected ' | wc -l)"',$5}')
	# Check if any window fills the screen
	xwininfo -root -tree | grep $root_geo | grep -qv "\(Desktop\|has no name\)"
}

setWorkraveOperationMode() {
    dbus-send --session --dest=org.workrave.Workrave --type=method_call \
    /org/workrave/Workrave/Core org.workrave.CoreInterface.SetOperationMode \
    string:"$1"
}

resetWorkraveMode() {
    test "$quiet" || echo "Setting Workrave operation mode to normal"
	setWorkraveOperationMode "normal"
}
trap resetWorkraveMode EXIT INT

test "$quiet" || echo "Silencing workrave"
setWorkraveOperationMode "quiet"
while true; do
	sleep ${1:-10}m
	test "$fullscreen" && getFullscreen || break
done

xeruf avatar Aug 13 '20 12:08 xeruf

Uhm... I appreciate your work but I use it in Windows so it doesn't run just like that. I expected a new code for the workrave itself... Anyway, if you feel like I should send you money, write to me.

nkomarov avatar Aug 14 '20 10:08 nkomarov

Nah, I'll see whether I can get something for workrave itself sometime, because this workaround is also a bit brittle :)

xeruf avatar Aug 14 '20 12:08 xeruf

This would be much helpful...

With COVID-19 and work from home for past year plus, screen share for discussions are the norm. It would be a HUGE value-add if the pop-ups do not come in when screen is shared.

Something like Skype/Teams DND status ?

freetimecoder3 avatar Feb 16 '21 12:02 freetimecoder3

@rcaelers Glad I'm not the only one requesting this :) UI wise I'm very often very annoyed when a software just gives me a few limited options time period options which often just doesn't fit me. Software isn't meant to limit us but rather to efficiently help us. In this case though, I'm not opposed to providing a set of options if that gives you less work, but it should cover all needs. I would maybe say something like 30 mins, 1 hr, 2 hrs, 3 hrs, 4 hrs, 5 hrs, 6 hrs, 8 hrs, 12 hrs, 18 hrs, 24 hrs, 7 days.

winternet-studio avatar May 12 '21 19:05 winternet-studio

Instead of too many alternatives Dropbox uses this approach:

image

pabloab avatar May 27 '21 23:05 pabloab

Instead of too many alternatives Dropbox uses this approach:

image

No, please. Why are many alternatives actually so bad? Why limit our choices when computers are suppose to give us flexibility?

winternet-studio avatar May 28 '21 06:05 winternet-studio

I am using https://github.com/hovancik/stretchly now which natively has this feature ;)

xeruf avatar Aug 10 '21 21:08 xeruf

Thank you for your comment @xeruf I confirm that Stretchly allows to suspend for 1, 2 or 5 hours.

This prompted me to compare Stretchly with Workrave, but my conclusion is that despite its technological promises, Stretchly unfortunately still has a long way to go before functionally matching Workrave as of 1.7. Workrave must overall remain better for the vast majority if not the totality of users. It should be noted that Stretchly reserves some preferences to what it calls "contributors". As I am not considered such a contributor, I did not evaluate a full version of Stretchly, but from what I can see that would not change my conclusion.

I requested Stretchly to ease comparison with Workrave.

Chealer avatar Aug 14 '21 21:08 Chealer

As for such comparisons, I am planning to create an open database that is somewhat similar to OpenStreetMap and Wikipedia but specifically for comparing things, because I am annoyed by all these bloated, undetailed alternative sites so far. It is indeed not the job of a tool creator to create separate comparison tables...

xeruf avatar Sep 15 '21 21:09 xeruf

I currently use an external reminder to check if Workrave is running/activated. @rcaelers please implement the subj feature, I (and maybe others) will donate.

nkomarov avatar Sep 17 '21 13:09 nkomarov

This would be great to have. Too many times do I suspend it during presentations and some meetings, only to forget to turn it back on. The same goes with some games where I do NOT want interruptions (ie. competitive).

It's been one of my biggest gripes actually!

douglasg14b avatar Dec 04 '21 22:12 douglasg14b

I implemented this for Workrave 1.11:

Screenshot 2022-01-06 at 20 54 20

Feedback welcome.

rcaelers avatar Jan 22 '22 20:01 rcaelers

Would candy or maple syrup qualify as "feedback"?

Chealer avatar Jan 22 '22 22:01 Chealer

Maybe I'm missing something but... What's the difference between Temporarily x > Indefinitely and just set to x mode? If it's the same you could remove both:

image

I would also change the Temporarily to Set to (or nothing, just Suspend/Quiet).

pabloab avatar Jan 23 '22 05:01 pabloab

Maybe I'm missing something but... What's the difference between Temporarily x > Indefinitely and just set to x mode? If it's the same you could remove both: I guess it's for the case when in the process of choosing you suddenly realized you want exactly this option - and here it is!

nkomarov avatar Jan 23 '22 11:01 nkomarov

Feedback welcome. Great to hear that! 1.11 not yet available as a Windows binary at the download URL.

nkomarov avatar Jan 23 '22 12:01 nkomarov

@pabloab: Using Temporarily x > Indefinitely has the same effect as just setting the mode to x. In the current implementation, I have added the time on which Workrave will revert to Normal to the selected mode (the (until 21:53)). So it may not be obvious that just setting the mode to x will disable the "Temporarily" part.

I could add the (until 21:53) to the Temporarily x submenu; maybe even the current mode indicator could be moved to the submenu, but I think it is more user-friendly to have the current state in the top Operation Mode menu. Ideas are still welcome :-)

@nkomarov: snapshots of 1.11 are available from https://workrave.org/snapshots/ (1.10.49 + 447 commit is currently the latest version). Note that 1.11 may not be as stable as 1.10

@Chealer: Not sure I understand...

rcaelers avatar Jan 30 '22 20:01 rcaelers

@pabloab could you clarify what your screenshot shows? Is it the future / bleeding edge Workrave, or is it a Workrave you modified yourself to improve the menu?

@rcaelers thank you for the complete reply. I agree the interface challenge is non-trivial. Question: suppose Workrave is set to Quiet, and the user does Temporarily Suspend for 1 hour. In that scenario, what happens after an hour? Does Workrave become Quiet or Normal?

@rcaelers regarding my question, it was mostly a funny way to express my appreciation, but if you do want something, just leave me your address and I should send you something :-)

Chealer avatar Jan 31 '22 14:01 Chealer

I checked with 1_10_49-15 of Jan 30 2022 (version v1.10.49 + 15 commits), can't see a submenu of this feature.

nkomarov avatar Feb 13 '22 18:02 nkomarov

You are probably looking at the Workrave 1.10 snapshots. You should instead go to the Workrave 1.11 snapshots. image

kees-jan avatar Feb 14 '22 07:02 kees-jan