Bug 1146 - dconf changes not honored for /org/workrave/general/operation-mode
Status:
RESOLVED FIXED
Component:
Core :: UNIX
Version:
1.10
Hardware:
All All
Importance:
P5 normal
Target Milestone:
---
Assignee:
Rob Caelers
URL:
Depends on:
Blocks:
Reported:
Jan 24 2014 14:12:56 UTC
by:
d3vid seaward
Modified:
Feb 3 2014 10:10:38 UTC
| Who | When | What | Removed | Added |
|---|---|---|---|---|
| d3vid seaward | Jan 31 2014 11:31:42 UTC | summary | Can I change Workrave mode from a script? | dconf changes not honored for /org/workrave/general/operation-mode |
| Rob Caelers | Feb 2 2014 21:10:11 UTC | status | NEW | RESOLVED |
| resolution | FIXED |
Description
d3vid seaward Jan 24 2014 14:12:56 UTC
Can I modify the current Workrave mode from a script in Ubuntu 13.10? For example, run a command that sets the current mode to normal / quiet / suspended. The results from `workrave --help-all` indicate there isn't a command-line option to do this. Do I need to adjust dconf settings, and if so will they affect a running Workrave process? (My specific use case is to use a Cuttlefish reflex to modify the Workrave state. For example, when application X starts, suspend Workrave; when it stops, resume Workrave. See https://apps.ubuntu.com/cat/applications/cuttlefish/ for a description.)
Comment 1
d3vid seaward Jan 31 2014 11:30:48 UTC
I have attempted to do this with the CLI dconf tool. This works for some settings (for example, setting /org/workrave/gui/main-window/enabled to true/false) but not Workrave status (/org/workrave/general/operation-mode). Steps to reproduce (on Ubuntu 13.10, Workrave 1.10 from PPA): * Open dconf editor, navigate to /org/workrave/general and locate operation-mode * Set Workrave to Normal mode * Confirm operation-mode is set to 0 in dconf editor * dconf write /org/workrave/general/operation-mode 1 What should happen: * operation-mode is set to 1 in dconf editor * Workrave is set to suspended mode (for example, this should be reflected in Unity appindicator, and breaks should stop) What happens instead: * operation-mode is set to 1 in dconf editor (correct) * Workrave remains in normal mode (including still prompting for breaks) Notes: * Changing usage-mode works (ticks/unticks "Reading mode" in appindicator) * Could it be related to a discrepancy I noticed in backend/src/CoreConfig.cc and backend/src/GSettingsConfigurator.cc ... the dconf path is set to "general/operation-mode" in one file and "gui/operation-mode" in the other. You can see them side-by-side in https://github.com/rcaelers/workrave/search?q=operation-mode
Comment 2
Rob Caelers Feb 2 2014 18:21:03 UTC
You could use dbus. For example: dbus-send --type=method_call --dest=org.workrave.Workrave /org/workrave/Workrave/Core org.workrave.CoreInterface.SetOperationMode string:'normal' I will check why the operation mode is not responding to configuration changes.
Comment 3
Rob Caelers Feb 2 2014 21:10:11 UTC
The "gui/operation-mode" is incorrect. Change it to "general/operation-mode" fixes the dconf problem. Thanks! (git commit 3c386043f489fc2ff9f449d612ef279d0fe0df73)
Comment 4
d3vid seaward Feb 3 2014 10:10:38 UTC
Using dbus worked, many thanks.