You are not logged in.

#1 2010-06-14 19:06:23

x5x_tim
Member
Registered: 2010-06-13
Posts: 86

Applying transset to all xterm windows automatically

Hi,

I would like to know if it's possible to auto apply transset to all terminal windows.

x5x_tim

Offline

#2 2010-06-14 19:33:09

hbekel
Member
Registered: 2008-10-04
Posts: 311

Re: Applying transset to all xterm windows automatically

A simple (but not too elegant) solution using xdotool:

while true; do for wid in $(xdotool search --class XTerm); do transset-df --id $wid 0.85 &>/dev/null; done; sleep 0.1; done

If you use something other than xterm, find out the --class argument to xdotool by using:

xprop WM_CLASS

and click on your terminal. Use the second string reported.

Last edited by hbekel (2010-06-14 19:34:44)

Offline

#3 2010-06-14 19:47:19

x5x_tim
Member
Registered: 2010-06-13
Posts: 86

Re: Applying transset to all xterm windows automatically

Thanks, that works.
By not too elegant, did you mean 'take up 30% of your CPU'-non elegant?
The reason I came to Arch is mainly because I like having a 0% load when I am not really doing much but browing and IM.

Offline

#4 2010-06-14 19:47:22

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: Applying transset to all xterm windows automatically

you could use wmctrl -l | awk to find all your terminal's winid's and apply the transset-df command to each.  you could also write a wrapper script to act as your terminal.  this wrapper could launch a term and (re)apply the transparencies.  i alway try to avoid while true loops idling in the background...

seems easier to just use urxvt + Xdefaults though...

Offline

#5 2010-06-14 19:53:31

x5x_tim
Member
Registered: 2010-06-13
Posts: 86

Re: Applying transset to all xterm windows automatically

How do I get urcvt, I'm quite new, and I can't find it with pacman.

Offline

#6 2010-06-14 19:56:38

hbekel
Member
Registered: 2008-10-04
Posts: 311

Re: Applying transset to all xterm windows automatically

x5x_tim wrote:

Thanks, that works.
By not too elegant, did you mean 'take up 30% of your CPU'-non elegant?

Exactly smile It was just the first thing that came to mind... it's probably simpler to do what brisbin33 suggests.

Offline

#7 2010-06-14 20:32:53

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: Applying transset to all xterm windows automatically

x5x_tim wrote:

How do I get urcvt, I'm quite new, and I can't find it with pacman.

hehe, you could [spell it right, and] search the wiki tongue.

Offline

#8 2010-06-14 21:16:50

portix
Member
Registered: 2009-01-13
Posts: 757

Re: Applying transset to all xterm windows automatically

If you still want to use xterm and transset, i wrote a (rather useless) bash script  tairu, that uses a small c-application (tairu_notify) which does nothing but waiting until a new window is opened or closed, the source-code can be found here (can be compiled with gcc -lX11 tairu_notify.c -o outputname). So

while :; do 
  tairu_notify
  for wid in $(xdotool search --class XTerm); do 
    transset-df --id $wid 0.85 &>/dev/null 
  done 
done

only checks for new xterms, if a new window is opened or closed.
If you  change line 16 in tairu_notify.c to

if (e.type == CreateNotify) {

it will only check, if a new window is created.

Offline

#9 2010-06-14 22:25:40

hbekel
Member
Registered: 2008-10-04
Posts: 311

Re: Applying transset to all xterm windows automatically

@portix: That's what I was looking into, too, but I didn't get very far with my limited c. Thanks for posting!

Offline

#10 2010-06-14 22:35:41

portix
Member
Registered: 2009-01-13
Posts: 757

Re: Applying transset to all xterm windows automatically

I have also a modified version here.
It takes the window class as an argument and prints out the window id.

Offline

#11 2010-06-14 23:37:52

Stebalien
Member
Registered: 2010-04-27
Posts: 1,238
Website

Re: Applying transset to all xterm windows automatically

Devilspie?

Last edited by Stebalien (2010-06-14 23:39:01)


Steven [ web : git ]
GPG:  327B 20CE 21EA 68CF A7748675 7C92 3221 5899 410C

Offline

#12 2010-06-14 23:51:39

kazuo
Member
From: São Paulo/Brazil
Registered: 2008-03-18
Posts: 413
Website

Re: Applying transset to all xterm windows automatically

yeas devilspie (extra/devilspie) look like the correct solution for me I have this

(if

(matches (window_class) "URxvt")
(begin
  (spawn_async (str "transset-df -i " (window_xid) " .95" ) )
)
)

And never noticed any cpu usage. (and have another 6 or so files like this)

Last edited by kazuo (2010-06-14 23:52:15)

Offline

#13 2010-06-15 06:09:39

x5x_tim
Member
Registered: 2010-06-13
Posts: 86

Re: Applying transset to all xterm windows automatically

brisbin33 wrote:
x5x_tim wrote:

How do I get urcvt, I'm quite new, and I can't find it with pacman.

hehe, you could [spell it right, and] search the wiki tongue.

Thank you, I tried pacman -S urxvt, but the package was called rxvt-unicode. I am going to try this, the config I found in you sig looks cool.

Offline

Board footer

Powered by FluxBB