利用transset-df设置非活动窗口透明

[ad]

#!/usr/bin/python -OO

import os
import re
import time

#wait for XServer to start
time.sleep(5)

strp = "[0][x][0-9a-fA-F]+"
p = re.compile(strp)

## Get opened windows ids
winids = os.popen('xprop -root | grep "_NET_CLIENT_LIST(WINDOW):"').readlines()
ids = ",".join(winids)
winids = p.findall(ids)

## Get actived window's id
activewinid = os.popen('xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW):"' ).readlines()
ids = ",".join(activewinid)
ids = p.findall(ids)
if len(ids) != 0:
activewinid = ids[0]
else:
activewinid = ""

for id in winids:
    if (id == "0xc00001") or (id == activewinid):
        continue
    os.system("transset-df --id " + id + " 0.6")

os.system("transset-df --id " + activewinid + " 1")

while(1):
   newactid = os.popen('xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW):"').readlines()
   ids = ",".join(newactid)
   ids = p.findall(ids)
   if len(ids) != 0:
      newactid = ids[0]
   else:
      newactid = ""

   if activewinid == newactid :
      time.sleep(3)
      continue
   os.system("transset-df --id " + activewinid + " 0.6")
   os.system("transset-df --id " + newactid + " 1")
   activewinid = newactid

发表评论


注意 - 你可以用以下 HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>