1. 程式人生 > 其它 >去掉Wine微信和QQ的黑框

去掉Wine微信和QQ的黑框

1. 安裝xdotool 2. 使用下面的指令碼 import os import sys import time import getopt def remove_shadow(app_class): for wid in os.popen('xdotool search --onlyvisible --class ' + app_class).readlines(): if len(wid) > 1: wdn = os.popen('xdotool getwindowname %s' % wid[:-1]).readline()[:-1] print('window id: %s; window name: %s' % (wid[:-1], wdn)) if wdn == '': # 移除掉裝飾視窗 os.system('xdotool windowunmap %s' % wid[:-1]) def check_app_running(app_exe): result = os.popen( "ps -ef | grep %s | awk '{print \"/proc/\"$2\"/cwd\"}' | xargs ls -l | grep drive_c" % app_exe).readlines() return len(result) > 0 def handle(app_exe, app_class): check_app_alive_max_count = 0 while True: running = check_app_running(app_exe) if running: remove_shadow(app_class) check_app_alive_max_count = 0 else: check_app_alive_max_count = check_app_alive_max_count + 1 if check_app_alive_max_count > 3: # 三次沒有檢測程式啟動,退出 exit() time.sleep(5) # 休眠5秒 if __name__ == '__main__': opts, args = getopt.getopt(sys.argv[1:], "e:c:", ["exe=", "class="]) exe_name = None class_name = None for opt_name, opt_value in opts: if opt_name in ('-e', '--exe'): exe_name = opt_value elif opt_name in ('-c', '--class'): class_name = opt_value if exe_name is not None and class_name is not None: handle(exe_name, class_name)