grakker
June 29th, 2005, 02:06 AM
Is there a way to have a script bash, python, whatever, interact with the X server, or do the different window managers make this not work? What I would like to do is set up a keylaunch so that I can push cntrl-alt-p (or some other combination) and have do something like the following (very crappy psuedo code...)
if winactive "*Firefox" then
$data = copy URL (or screen capture or close the program....)
$hfile = fopen ("/something/file", append)
write ($data, $hfile)
$fclose($hfile)
fi
Or something along the lines of
If program is running
copy something
close running gui app
open a different gui app
wait for gui to open
do something with new gui
.... and so on
fi
or even simpler, someway to send a string to whatever is open. In other words, send "This is lame" when I hit F8. The string will enter in vim (if I'm in edit mode), or enter into oowriter, or ....
Is there anything like this. I'm thinking of something like AutoIt3 for windows, but for linux. I like using combinations of zenity + bash for doing stuff, but this doesn't really let me interact with other apps, it just gives the command line some candy.
Anyone?
if winactive "*Firefox" then
$data = copy URL (or screen capture or close the program....)
$hfile = fopen ("/something/file", append)
write ($data, $hfile)
$fclose($hfile)
fi
Or something along the lines of
If program is running
copy something
close running gui app
open a different gui app
wait for gui to open
do something with new gui
.... and so on
fi
or even simpler, someway to send a string to whatever is open. In other words, send "This is lame" when I hit F8. The string will enter in vim (if I'm in edit mode), or enter into oowriter, or ....
Is there anything like this. I'm thinking of something like AutoIt3 for windows, but for linux. I like using combinations of zenity + bash for doing stuff, but this doesn't really let me interact with other apps, it just gives the command line some candy.
Anyone?