Re: Cannot set workrave with gconftool

Pete Crite <[email protected]> Thu, 18 Apr 2013 16:02:23 +1000
Newsgroups gmane.comp.misc.workrave.user
Message-ID <[email protected]>
Thanks for the reply.

On 15/04/13 03:16, Rob Caelers wrote:
> Workrave in Kubuntu is probably compiled with gsettings instead of gconf. Try:
>
> gsettings set org.workrave.general operation-mode 1
>
> and,
>
> gsettings list-recursively org.workrave

`list` does seem to produce output, but `set` doesn't change anything in
the GUI, although it does affect subsequent outputs of `list`.
>> A second suggestion was to use dbus with
>>      $   dbus-send --print-reply --type=method_call
>> --dest=org.workrave.Workrave /org/workrave/Workrave
>> org.workrave.WorkraveInterface.SetOperationMode string:'normal'
>>
>> but this results in:
>>      Error org.freedesktop.DBus.Error.UnknownMethod: No such interface
>> `org.workrave.WorkraveInterface' on object at path /org/workrave/Workrave
> Interfaces names have changed some while ago... Try:
>
> dbus-send --print-reply --type=method_call --dest=org.workrave.Workrave 
> /org/workrave/Workrave/Core org.workrave.CoreInterface.SetOperationMode 
> string:'normal'
This works well, with feedback from the GUI. FWIW the output of
`gsettings list` doesn't appear to be affected.

It'd be great to integrate a scheduler into workrave directly. I've had
to write scripts in three different places: cron, on wake from suspend,
and on startup. I'll detail them here if they might be useful for
anyone. They are written for a Linux computer (and based on pkill rather
than the above options).

In crontab:
====================
0    9    *    *    2-6    pgrep workrave || export DISPLAY=:0.0 && workrave
0    17    *    *    2-6    pkill workrave
====================

At wake from suspend, run the following script. (i.e. place it in
/etc/pm/sleep.d/ )
====================
#!/usr/bin/env bash
# launch workrave if between 9 to 5 on Tuesday to Saturday, else kill it

computer_resume()
{
    # sleep 10
    if [[ `date +%w` -ge 2 && `date +%H` -ge 9 && `date +%H` -le 17 ]]; then
        pgrep workrave || export DISPLAY=:0.0 && sudo -u <your_username>
workrave   
    else
        pgrep workrave && pkill workrave
    fi
}

case $1 in
    hibernate|suspend)
        true # Do nothing
        ;;
    resume|thaw)
        computer_resume & # background so it doesn't stall subsequent
processes
        ;;
esac
====================

I've not written the startup script yet, but I'll be similar to the last
one.


------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter