rendered paste body#!/usr/bin/perl -w
use Linux::Joystick;
use X11::GUITest qw/
/;
#\/ dbus commands to move compiz cube \/
$dbus_cube_right =
"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 }'`";
$dbus_cube_left =
"dbus-send --type=method_call --dest=org.freedesktop.compiz /org/freedesktop/compiz/rotate/allscreens/rotate_left org.freedesktop.compiz.activate string:'root' int32:`xwininfo -root | grep id: | awk '{ print \$4 }'`";
$dbus_cube_unfold =
"dbus-send --print-reply --type=method_call --dest=org.freedesktop.compiz /org/freedesktop/compiz/cube/allscreens/unfold org.freedesktop.compiz.activate string:'root' int32:`xwininfo -root | grep id: | awk '{ print \$4 }'`";
$dbus_cube_initiate =
"dbus-send --print-reply --type=method_call --dest=org.freedesktop.compiz /org/freedesktop/compiz/rotate/allscreens/initiate org.freedesktop.compiz.activate string:'root' int32:`xwininfo -root | grep id: | awk '{ print \$4 }'`";
$dbus_expo_initiate =
"dbus-send --print-reply --type=method_call --dest=org.freedesktop.compiz /org/freedesktop/compiz/expo/allscreens/expo org.freedesktop.compiz.activate string:'root' int32:`xwininfo -root | grep id: | awk '{ print \$4 }'`";
$dbus_expo_kill =
"dbus-send --print-reply --type=method_call --dest=org.freedesktop.compiz /org/freedesktop/compiz/expo/allscreens/expo org.freedesktop.compiz.deactivate string:'root' int32:`xwininfo -root | grep id: | awk '{ print \$4 }'`";
$dbus_cube_kill =
"dbus-send --print-reply --type=method_call --dest=org.freedesktop.compiz /org/freedesktop/compiz/rotate/allscreens/initiate org.freedesktop.compiz.deactivate string:'root' int32:`xwininfo -root | grep id: | awk '{ print \$4 }'`";
$dbus_cube_unfold_kill =
"dbus-send --print-reply --type=method_call --dest=org.freedesktop.compiz /org/freedesktop/compiz/cube/allscreens/unfold org.freedesktop.compiz.deactivate string:'root' int32:`xwininfo -root | grep id: | awk '{ print \$4 }'`";
#^^ dbus commands to move compiz cube ^^
my $js = Linux::Joystick->new(0);
my $event;
# blocking reads:
while ( $event = $js->nextEvent ) {
#print "Event type: " . $event->type . ", ";
if ( $event->isButton ) {
#print "Button " . $event->button;
if ( $event->buttonDown ) {
if ( $event->button == 14 ) {
print "\n Up Dpad button pressed! \n";
$js->setNonblocking(1);
while (1) {
if ($event->buttonDown) {
$js->setNonblocking(0);
my ($x, $y, $scr_num) = X11::GUITest::GetMousePos();
print "current pointer position = X: $x, Y: $y,\n Current Screen number = $scr_num\n"; #print current position of pointer
$y = $y-10;
X11::GUITest::MoveMouseAbs($x,$y,$scr_num); #move pointer
} else {
break;
}
$event = $js->nextEvent;
}
}
}
}
}