Addition scripts to qutebrowser config.py
Go to file
2024-04-30 14:51:36 +00:00
configs first 2024-04-30 14:51:36 +00:00
README.md first 2024-04-30 14:51:36 +00:00

Define this function in your config.py

import os
from qutebrowser.api import config as api_config
sCONFIG_DIR = config.configdir
def config_load_configs(lArgs: list|None = None, sDir: str = sCONFIG_DIR) -> None:
    i = 0
    if not lArgs: return i
    for foo in lArgs:
        sFile = os.path.join(sDir, 'configs', foo)
        for bar in sFile, sFile+'.py':
            if not os.path.exists(bar): continue
            try:
                # ResourceWarning: unclosed file
                oFd = open(bar, 'rt')
                sCode = oFd.read()
                oFd.close()
                exec(sCode)
            except Exception as e:
                log.init.warning(f'error execing {bar}\n{e}')
                log.init.debug(traceback.print_exc())
            else:
                log.init.info(f'execed {bar}')
                i = i + 1
    return i

Then make a list of configs you want to load:

lCONFIGS = ['chromium-flags',
            'chrome-urls',
            'privacy-settings',
            'tab-manager',
            'search-engines',
            'user-agents',
            'interceptor-cloudflare',
            'interceptor-ytadds',
            'init_custom_plugins',
            'patch-qute3.1.0',
            'atexit-cleanup',
]

Then load the configs:

i = config_load_configs(lCONFIGS)
log.init.info(f'loaded {i} configs')