You are not logged in.
Pages: 1
I use this in Openbox to give a very nice effect which is great for usability and looks.
The script is by ADComp and here is how your windows look when you use it
here is the script:
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
# script that uses transset-df to allow opacity to follow the focused window.
# The focused window get opacity 1.0 while all others have opacity set by 'OPACITY'
#
# by ADcomp <david.madbox@gmail.com> [ http://www.ad-comp.be/ ]
#
# This program is distributed under the terms of the GNU General Public License
# For more info see http://www.gnu.org/licenses/gpl.txt
##
import os
import signal
import gobject
import gtk
import wnck
import re
global transset
def SigUSR1Handler(signum, frame):
global transset
if transset:
transset.doquit()
CMD = 'transset-df -i'
## opacity when not active
OPACITY = 0.78
## tempo [ ms ]
TEMPO = 30
exceptions = ['^GNU Image Manipulation Program$','GIMP','VLC','Chromium','Swiftfox','Midori']
class Transset():
def __init__(self):
self.screen = wnck.screen_get_default()
self.screen.force_update()
self.update()
self.screen.connect("active_window_changed", self.active_window_changed)
def update(self):
win_list = self.screen.get_windows()
active_ws = self.screen.get_active_workspace()
active_win = self.screen.get_active_window()
for window in win_list:
## don't check window if skip tasklist
if not window.is_skip_tasklist():
tmp = True
for entries in exceptions:
if re.search(entries,window.get_name()) != None: tmp = False
if tmp:
#print window.get_name()
## only window open on active workspace
if window.get_workspace() == active_ws:
if window == active_win:
## remove transparency
cmd = "%s %s 1" % ( CMD, window.get_xid() )
else:
## set transparency
cmd = "%s %s %s" % ( CMD, window.get_xid(), OPACITY )
os.system(cmd)
return False
def clean(self):
win_list = self.screen.get_windows()
for window in win_list:
## don't check window if skip tasklist
if not window.is_skip_tasklist():
cmd = "%s %s 1" % ( CMD, window.get_xid() )
os.system(cmd)
def active_window_changed(self, screen, window):
gobject.timeout_add(TEMPO, self.update)
def doquit(self, widget=None, data=None):
self.clean()
gtk.main_quit()
def run(self):
gtk.main()
#-------------------------
if __name__ == "__main__":
#-------------------------
global transset
transset = None
signal.signal(signal.SIGUSR1, SigUSR1Handler)
transset = Transset()
transset.run()
Automatically as you load a new window, terminal or program the other things on screen fade back one step. Sweet.
Offline
Thanks! I'll most likely use this! I have been looking for a way to automate transparency, and this should do the trick :]
Supergirl: But fortunately I printed out everything I could find, not just the beginner's guide.
Supergirl: I printed out internet.
Offline
Great! This little thing rocks
Thank you tawan!
See, you're unpacking.
Offline
Extremely nice, thanks!
Offline
I can't seem to get this working. When I run the script it gives me these errors:
[jente@Lappy .scripts]$ ./inactivetrans.sh
Traceback (most recent call last):
File "./inactivetrans.sh", line 16, in <module>
import gobject
ImportError: No module named gobject
Also for import wtk, import wnck and import re.
When I comment those out, it gives me this error:
[jente@Lappy .scripts]$ ./inactivetrans.sh
Traceback (most recent call last):
File "./inactivetrans.sh", line 91, in <module>
transset = Transset()
File "./inactivetrans.sh", line 38, in __init__
self.screen = wnck.screen_get_default()
NameError: global name 'wnck' is not defined
Am I missing some dependencies? Thanks in advance
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
What happens if you change the first line from
#!/usr/bin/python
to
#!/usr/bin/python2
Offline
That also gives me
ImportError: No module named wnck
Strangely though, it now doesn't show
ImportError: No module named gobject
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
Do you have the package called "python-wnck" installed?
Offline
I have now. It doesn't throw those errors at me now anymore, it gives me these instead:
sh: transset-df: command not found
EDIT: I do have transset installed.
EDIT2: I changed transset-df to transset -df. The error is gone but my mouse cursor stays on the transset crosshair - had to reboot.
Last edited by Unia (2010-10-23 18:58:51)
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
Try installing the package called "transset-df"
Offline
Thanks, that did the trick.
Last edited by Unia (2010-10-23 19:12:46)
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
Pages: 1