Skip to content
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

Possibility to suspend for x amount of time #98

Closed
pabloab opened this issue May 29, 2018 · 29 comments
Closed

Possibility to suspend for x amount of time #98

pabloab opened this issue May 29, 2018 · 29 comments
Assignees
Labels
feature New feature or request
Milestone

Comments

@pabloab
Copy link

pabloab commented May 29, 2018

(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.

@empz
Copy link

empz commented Jun 9, 2018

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.

@rcaelers rcaelers added the feature New feature or request label Aug 29, 2018
@pankajp
Copy link

pankajp commented Apr 10, 2019

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

@nkomarov
Copy link

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

@xeruf
Copy link
Contributor

xeruf commented Jul 8, 2020

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? ;)

@nkomarov
Copy link

nkomarov commented Jul 8, 2020

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

@xeruf
Copy link
Contributor

xeruf commented Aug 7, 2020

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
Copy link
Contributor

xeruf commented Aug 12, 2020

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
Copy link
Contributor

xeruf commented Aug 13, 2020

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

@nkomarov
Copy link

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.

@xeruf
Copy link
Contributor

xeruf commented Aug 14, 2020

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

@freetimecoder3
Copy link

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 ?

@winternet-studio
Copy link

@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.

@pabloab
Copy link
Author

pabloab commented May 27, 2021

Instead of too many alternatives Dropbox uses this approach:

image

@winternet-studio
Copy link

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?

@xeruf
Copy link
Contributor

xeruf commented Aug 10, 2021

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

@Chealer
Copy link

Chealer commented Aug 14, 2021

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.

@xeruf
Copy link
Contributor

xeruf commented Sep 15, 2021

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...

@nkomarov
Copy link

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.

@douglasg14b
Copy link

douglasg14b commented Dec 4, 2021

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!

@rcaelers
Copy link
Owner

I implemented this for Workrave 1.11:

Screenshot 2022-01-06 at 20 54 20

Feedback welcome.

@rcaelers rcaelers self-assigned this Jan 22, 2022
@Chealer
Copy link

Chealer commented Jan 22, 2022

Would candy or maple syrup qualify as "feedback"?

@pabloab
Copy link
Author

pabloab commented Jan 23, 2022

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).

@nkomarov
Copy link

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
Copy link

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

@rcaelers
Copy link
Owner

@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...

@Chealer
Copy link

Chealer commented Jan 31, 2022

@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 :-)

@nkomarov
Copy link

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.

@kees-jan
Copy link
Contributor

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

@rcaelers
Copy link
Owner

This has been implemented in 1.11, which is now in beta

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
Status: Done
Development

No branches or pull requests