PDA

View Full Version : Rotate Cube


origin of
December 8th, 2006, 02:36 PM
How can i write a small script, that using dbus for rotate cube ??

mikedee
December 8th, 2006, 02:48 PM
Here is a small bash script which you can use.

#!/bin/sh

ROOT_ID=`xwininfo -root | grep id: | awk '{ print $4 }'`

echo "dbus-send --type=method_call --dest=org.freedesktop.compiz /org/freedesktop/compiz/$1/allscreens/$2 org.freedesktop.compiz.$3 string:'root' int32:$ROOT_ID $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} ${14}"

dbus-send --type=method_call --print-reply \
--dest=org.freedesktop.compiz /org/freedesktop/compiz/$1/allscreens/$2 \
org.freedesktop.compiz.$3 \
string:'root' int32:$ROOT_ID \
$4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} ${14}

exit 0

To use it, save it somewhere in your path as compiz-dbus and chmod +x it. ie. save to /usr/local/bin/compiz-dbus

This command will rotate the cube right

compiz-dbus rotate rotate_right activate

origin of
December 8th, 2006, 03:46 PM
thanks, but....it doesn't works

manuel@unix:~/Desktop$ ./compiz-dbus rotate rotate_right activate
dbus-send --type=method_call --dest=org.freedesktop.compiz
/org/freedesktop/compiz/rotate/allscreens/rotate_right org.freedesktop.compiz.activate
string:'root' int32:0x4d

Usage: dbus-send [--help] [--system | --session] [--dest=NAME] [--type=TYPE] [--print-reply=(literal)] [--reply-timeout=MSEC] <destination object path> <message name> [contents ...]
./compiz-dbus: 11: /org/freedesktop/compiz/rotate/allscreens/rotate_right: not found
./compiz-dbus: 12: string:root: not found

mikedee
December 8th, 2006, 03:50 PM
It is breaking the command, try copy and pasting this as one line

dbus-send --type=method_call --dest=org.freedesktop.compiz /org/freedesktop/compiz/rotate/allscreens/rotate_right org.freedesktop.compiz.activate string:'root' int32:`xwininfo -root | grep id: | awk '{ print $4 }'`

Edit: I just changed the compiz-dbus script to be more copy & paste friendly

origin of
December 8th, 2006, 05:16 PM
something is changed, but it doesn't works again

manuel@unix:~/Desktop$ ./compiz-dbus rotate rotate_left activate
dbus-send --type=method_call --dest=org.freedesktop.compiz /org/freedesktop/compiz/rotate/allscreens/rotate_left org.freedesktop.compiz.activate string:'root' int32:0x4d
Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.compiz was not provided by any .service files
manuel@unix:~/Desktop$

mikedee
December 8th, 2006, 06:02 PM
First check that you have dbus running

ps -A | grep dbus

This should output something

If dbus is not running then you need to start it by typing /etc/init.d/dbus start

Then check that you have the dbus plugin loaded, it can be loaded anywhere but I tend to put it after move and resize.

If you are still having problems it is possible that your desktop is not being started by dbus-launch. I need to know if you use KDE or Gnome for that (and what version you use). KDE version 3.5.5 will work automatically and Gnome should be OK too.

origin of
December 8th, 2006, 06:35 PM
i use gnome, and this is the output of the command


manuel@unix:~/Desktop$ ps -A | grep dbus
3744 ? 00:00:00 dbus-daemon
4195 ? 00:00:00 dbus-launch
4196 ? 00:00:00 dbus-daemon



EDIT : I added dbus to the list of plugins and it works...thank you very much :D