Active Topics

 


Reply
Thread Tools
Guest | Posts: n/a | Thanked: 0 times | Joined on
#1
I apologize for asking this when I could probably read through the docs^Wsource and find out for myself, but I'm in the middle of exams, and this has been bugging me for a while. I generally keep screen vibration feedback turned off for both power reasons and the annoyance of it, but it is really useful for calculator apps, such as Free42 and ATI85, which I use in many classes. What I'm wondering is if there's a script-friendly way (e.g. D-Bus call or something) to enable and disable that feedback feature, so that I could launch certain apps through a wrapper script that enables it on program start, and disables it when I close the program.
Any pointers would be appreciated.
Thanks,
 
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#2
"gconftool -t bool /system/osso/dsm/vibra/touchscreen_vibra_enabled -s true" works for me to enable the vibration when touching the screen. And, of course, setting it to false to disable it works.
 

The Following User Says Thank You to qwerty12 For This Useful Post:
Guest | Posts: n/a | Thanked: 0 times | Joined on
#3
Awesome! That's exactly what I was looking for, but I didn't know where it was configured, or which component controlled it. Thanks a lot - now back to studying
 
Guest | Posts: n/a | Thanked: 0 times | Joined on
#4
I finally got around to trying this while waiting for pizza at a friend's birthday dinner.
Anyhow, I made a simple wrapper script, which essentially calls the gconf commands to enable vibra, runs the command passed to it, and then switches off vibra similarly. I then edited the .desktop files for ATI85 and Free42 so that the Exec lines ran the wrapper (placed in /usr/bin with appropriate permissions) with the original command line (quoted if necessary) as the first argument. However, it does not work properly, for some reason. If I launch it from the menu (Catorize), it will run the application, but vibration feedback will not be enabled; if I run the identical command as the Exec line manually from the shell, it works perfectly.
I can post the exact code here a bit later if needed, but the script is trivial. I was curious if Catorize or the .desktop tools are doing some voodoo in the background that I'm not aware of. Specifically, does the Exec command get executed in the same environment, and as the same user, as when I run it manually from X-Terminal/Ash? Assuming that the .desktop file is being parsed and handled as it should be, then the gconf commands should be executed. If that is the case, then I'm not entirely sure why they are ineffective.
Any ideas?
 
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#5
Originally Posted by jaem View Post
I then edited the .desktop files for ATI85 and Free42 so that the Exec lines ran the wrapper (placed in /usr/bin with appropriate permissions) with the original command line (quoted if necessary) as the first argument. However, it does not work properly, for some reason. If I launch it from the menu (Catorize), it will run the application, but vibration feedback will not be enabled; if I run the identical command as the Exec line manually from the shell, it works perfectly.
Just curious: Do the desktop files for these programs contain a "X-Osso-Service" line?
 
Guest | Posts: n/a | Thanked: 0 times | Joined on
#6
Originally Posted by qwerty12 View Post
Just curious: Do the desktop files for these programs contain a "X-Osso-Service" line?
They do indeed, although I'm not sure what that signifies (I assume you do :P).
Free42's says "=com.tajuma.freefourtwo", and
ATI85's says "=com.fms.ati85"

I assume these are D-Bus bus names?
 
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#7
Originally Posted by jaem View Post
They do indeed, although I'm not sure what that signifies[.]
With that line in place, hildon-desktop ignores the Exec field of your application. Look in /usr/share/dbus-1/services/ for the program's corresponding .service file and edit the Exec field found there.

If that doesn't work, you have two options:
  • Comment out the X-Osso-Service field from the program's desktop file and edit the Exec field.
  • Write a daemon that listens for the NameOwnerChanged signal with the first argument - a string one - containing the service name of your program, that will execute your script when the signal has been recieved.

Last edited by qwerty12; 2010-04-06 at 08:25.
 
Guest | Posts: n/a | Thanked: 0 times | Joined on
#8
Originally Posted by qwerty12 View Post
With that line in place, hildon-desktop ignores the Exec field of your application. Look in /usr/share/dbus-1/services/ for the program's corresponding .service file and edit the Exec field found there.

If that doesn't work, you have two options:
  • Comment out the X-Osso-Service field from the program's desktop file and edit the Exec field.
  • Write a daemon that listens for the NameOwnerChanged signal with the first argument - a string one - containing the service name of your program.
Aha! Yes, that makes perfect sense now that you explain it; I've done some work with D-Bus, but not in that area of it, and that didn't occur to me.
Awesome - I'll post back when I get it working... or not.
 
Guest | Posts: n/a | Thanked: 0 times | Joined on
#9
Editing the .service files works perfectly. Thanks.

For others' reference, here is the wrapper script I used:
Code:
#!/bin/sh
gconftool -t bool /system/osso/dsm/vibra/touchscreen_vibra_enabled -s true
$1
gconftool -t bool /system/osso/dsm/vibra/touchscreen_vibra_enabled -s false
I saved that as vibra-wrapper.sh, set it as executable, and dropped it into /usr/bin. Then I modified the Exec lines as per qwerty12's instructions, so that it ran my script with the original command line as the first argument.

Now, I would note that this script is pretty poor in that exiting one application called through it while running another similarly launched application will disable the vibration feedback. I don't have the time to improve it right now, but I'd encourage someone else to do so, and post it here.
Cheers,
 

The Following User Says Thank You to For This Useful Post:
Reply

Tags
calculator, script, vibration, wrapper


 
Forum Jump


All times are GMT. The time now is 14:51.