zoukankan      html  css  js  c++  java
  • 去掉Wine微信和QQ的黑框

    1. 安装xdotool

    2. 使用下面的脚本

    #!/usr/bin/python3.8
    
    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)
  • 相关阅读:
    【小技巧】如何输入未知长度的数组,用回车结束输入
    Python基础(二)
    Python基础(一)
    Appium Mac 环境安装
    c# 多线程
    c# 并行计算
    C# 反射
    VI 编辑器
    Linq and Lambda
    WINDOWS 命令
  • 原文地址:https://www.cnblogs.com/soongkun/p/15074526.html
Copyright © 2011-2022 走看看