You are not logged in.
Pages: 1
Okay, here's the situation:
I'm playing around with the Composite extension for X.org (drop-shadows, transparency, and such). My problem is that I want to automatically set certain programs to be transparent when they start up--in particular: Eterm. Now, after much experimentation, I have come up with a solution, but it seems really inefficient and terribly hackish to me. If possible, I would like to see if anyone knows of a better way.
Here is the solution I have come up with:
Since I am using OpenBox, I added the following to menu.xml:
<item label="Eterm">
<action name="Execute"><execute>Eterm</execute></action>
<action name="Execute"><execute>etermscript</execute></action>
</item>
Where etermscript is:
#!/bin/bash
# Wait until the Eterm we just ran is completely loaded so it gets caught, too
sleep .25
# Get the IDs of all the Eterm windows that are running (really inefficient!)
# NOTE: This is all one line:
IDS=$(xwininfo -root -children -all | grep '("Eterm" "Eterm")' | egrep -o 0x[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]? | sed ':a;N;$!ba;s/n/ /g')
# Make all of those IDs transparent
exec transallid $IDS
and transallid is:
#!/bin/bash
# for each ID, set that window to 75% transparent
while [ "$#" != "0" ]
do
transset-df .75 -i $1 > /dev/null
shift
done
(You can get transset-df here)
Even though this works (and better than I expected), I'm sure there's a much, much better way. Is there perhaps some way to directly access the ID of the last window created? Or initialize the window with the opacity property already set? Any thoughts?
Notes:
$! only gives the ID of the last process, not the last window.
transset-df .75 -n Eterm doesn't work because it stops at the first Eterm it finds (usually the first one run). I tend to use multiple Eterms at once.
(And if anyone wants to see, here's a screenshot.)
Thanks in advance.
Offline
Hmmm, this is cool... I'm going to move it to the programming forum (you'll probably get more responses there)...
Offline
Okay, thank you.
Offline
why not make etermscript:
#!/bin/bash
Eterm & pid=$!
sleep .25
transset-df .75 -i $pid > /dev/null
(or transallid $!)
and remove the call to execute Eterm from the OB menu
it seems like your script is setting ALL eterms transparent every time you start 1... if you start Eterm from a script, you're guarenteed to have $! as the pid of the Eterm..
Offline
why not make etermscript:
#!/bin/bash Eterm & pid=$! sleep .25 transset-df .75 -i $pid > /dev/null (or transallid $!)
and remove the call to execute Eterm from the OB menu
As I explained above, $! only gets the ID of the last process. But this is not usually the ID of the Window, so transset-df -i with that value won't work:
X Error of failed request: BadWindow (invalid Window parameter)
Major opcode of failed request: 15 (X_QueryTree)
Resource id in failed request: 0x18da
Serial number of failed request: 7
Current serial number in output stream: 7
it seems like your script is setting ALL eterms transparent every time you start 1
That's why I'm looking for a better way. There has to be something better than parsing the xwininfo output and setting all Eterms to transparent just to catch the last one opened.
Offline
As I explained above, $! only gets the ID of the last process. But this is not usually the ID of the Window, so transset-df -i with that value won't work
ahhh... ok, I didn't get that at first... what you need is a pid <-> window id utility.... dunno... sounds like a hassle...
devil's pie might work in your favor though:
http://www.burtonini.com/blog/computers/devilspie
Offline
Okay, thanks for the link. I'll have to check that out.
Offline
Okay, thanks for the link. I'll have to check that out.
for the record... the app allows you to perform actions when an app starts...
i.e.
"when firefox starts, maximize it"
"when gkrellm starts, show it on all workspaces"
"when xterm starts, remove decorations"
"when Eterm starts, execute *this* command"
worse comes to worse, I don't know if it'd be that hard to hack transset-df to work with all names... or even to accept a pid (this would require a NETWM compliant WM, otherwise the window props don't store the PID)
Offline
.. what you need is a pid <-> window id utility...
You can get WINDOWID from /proc/$PID/environ
;-)
Offline
Devil's pie worked like a charm with this configuration:
.devilspie.xml:
<?xml version="1.0"?>
<!DOCTYPE devilspie SYSTEM "devilspie.dtd">
<!-- The root element is devilspie -->
<devilspie>
<!-- Set Eterms to 75% transparent -->
<flurb name="Eterm opacity">
<matchers>
<matcher name="DevilsPieMatcherWindowName">
<property name="application_name" value="Eterm"/>
</matcher>
</matchers>
<actions>
<action name="DevilsPieActionOpacity">
<property name="opacity" value=".75"/>
</action>
</actions>
</flurb>
</devilspie>
Thank you very much for pointing me in that direction, phrakture.
Offline
phrakture wrote:.. what you need is a pid <-> window id utility...
You can get WINDOWID from /proc/$PID/environ
;-)
sweet!
Offline
Devil's pie worked like a charm with this configuration
yeah devil's pie is cool as hell - I used to use it alot when I was using fluxbox...
it does almost everything
Offline
Pages: 1