Reply to topic

Simon + Dbus control and contexts

kgolubev
Registered Member
Posts
11
Karma
0

Simon + Dbus control and contexts

Sat Feb 02, 2013 3:22 pm
I can (potentially) set any scenario or microphone to listen to D-Bus, so it can be controlled by external signals. (Context - D-Bus)
And I can set any word (or comand) to send signals to D-Bus.
Is it posible to to connect comand with scenario context switching through D-Bus?

The Idea:

I have Master scenario with comands : 'Window', 'Application', 'Type' and 'Done'
And I have three scenario's:
Window - with window managing commands
Application - Commands to start applications
Type - Typing and keyboard using commands
I say 'Window' and enter Window mode (window scenario activates by D-Bus) - switching or closing windows, then say 'done' and leave Window mode.
Every Scenario (or mode) has only needed commands. I Can't close or switch window in 'Type' mode, I can't start 'Application' in 'Type' or 'Window' modes. Of course there will be more modes, and I need to isolate them.
The problem is that paralyzed men can't say clearly, and there's a lot of mistakes (yes, I know about training). The worst is when he says a word and window is closing, because of unclear pronunciation. If I turn off unneeded scenario by hand, it "solves" this problem, but I can't stand next to him and switching scenarios!

And thees different levels I was talkin about - were all about such situations.
I think, maybe it would be even better, to add an optional keyword for every scenario. The Keyword to activate scenario.
And add a rule to context switching - If scenario A is active, deactivate scenario B or vice versa.
bedahr
Moderator
Posts
101
Karma
0
OS
Okay, I already replied this on IRC but for the record:

In general the "Filter command" kinda does what you're looking for (refer to the manual, please).

However, it doesn't allow you to set up multiple different, explicit states (like "window management", etc.).
But you can build a system that works like what you describe through some creative context conditions:
Set up a simple text file (like ~/simonstate) and some scripts to manage it:
For example, the "switch_to_window_management.sh" script could look like this:
Code: Select all
#/bin/bash
echo "windowmanagement" > ~/simonstate


the "done.sh" could look like this:
Code: Select all
#/bin/bash
echo "" > ~/simonstate


...and so on.

Then associate program commands with these scripts; these commands will switch recognition states.

To actually make that work, add file content conditions to the scenarios to monitor ~/simonstate. Your window management scenario should look for the content "windowmanagement", etc.

Remember, context conditions cascade down to child scenarios so if you want multiple scenarios to activate at once, it's easiest to set up a parent scenario and define the condition there.

I hope that helps.

Best regards,
Peter
kgolubev
Registered Member
Posts
11
Karma
0
I tried this things before.
Filter doesn't filter all I need by default. It starts filtering only when I say a keyword. Inverse state would be cool. This is why I can't use it right now. Or maybe I'm missing something?

File plugin - To use that I must write a script, And for every state I need, I must write separate script. This is bad, because if I want to put it to kde-files.org to share this scenarios, I need to upload somewhere additional files. And if someone downloaded my scenario, he must go somewhere and download this scripts and install them. And what if he want to add more commands?
If I could specify this
Code: Select all
/usr/bin/echo "window" > ~/.simonstate
directly in Command editing dialog - it would be great.

brdahr?
bedahr
Moderator
Posts
101
Karma
0
OS
kgolubev wrote:I tried this things before.
Filter doesn't filter all I need by default. It starts filtering only when I say a keyword. Inverse state would be cool. This is why I can't use it right now. Or maybe I'm missing something?

Yes, you can set up a command to be executed whenever the scenario loads. Set this to the "activate filter" command.

kgolubev wrote:File plugin - To use that I must write a script, And for every state I need, I must write separate script. This is bad, because if I want to put it to kde-files.org to share this scenarios, I need to upload somewhere additional files. And if someone downloaded my scenario, he must go somewhere and download this scripts and install them. And what if he want to add more commands?
If I could specify this
Code: Select all
/usr/bin/echo "window" > ~/.simonstate
directly in Command editing dialog - it would be great.

Good point. We don't support ">" (or "|", etc.).
But on systems that have bash (basically all Linux systems), this works:
Code: Select all
bash -c "echo foo > ~/bar"


Best regards,
Peter

 
Reply to topic

Bookmarks



Who is online

Registered users: AElfwine, alake, anditosan, Artmessiah, Baidu [Spider], Bing [Bot], edmael, Exabot [Bot], garthecho, geaplanet, Google [Bot], google01103, Horus, inksi, Joif, ken300, La Ninje, lazyit, pedrorodriguez, pvonz, thalesgava, tienhung, VP1986, Yahoo [Bot]