config.py (11697B)
1 from qutebrowser.api import interceptor 2 # Autogenerated config.py 3 # 4 # NOTE: config.py is intended for advanced users who are comfortable 5 # with manually migrating the config file on qutebrowser upgrades. If 6 # you prefer, you can also configure qutebrowser using the 7 # :set/:bind/:config-* commands without having to write a config.py 8 # file. 9 # 10 # Documentation: 11 # qute://help/configuring.html 12 # qute://help/settings.html 13 14 # Change the argument to True to still load settings configured via autoconfig.yml 15 config.load_autoconfig(False) 16 17 # Which cookies to accept. With QtWebEngine, this setting also controls 18 # other features with tracking capabilities similar to those of cookies; 19 # including IndexedDB, DOM storage, filesystem API, service workers, and 20 # AppCache. Note that with QtWebKit, only `all` and `never` are 21 # supported as per-domain values. Setting `no-3rdparty` or `no- 22 # unknown-3rdparty` per-domain on QtWebKit will have the same effect as 23 # `all`. If this setting is used with URL patterns, the pattern gets 24 # applied to the origin/first party URL of the page making the request, 25 # not the request URL. With QtWebEngine 5.15.0+, paths will be stripped 26 # from URLs, so URL patterns using paths will not match. With 27 # QtWebEngine 5.15.2+, subdomains are additionally stripped as well, so 28 # you will typically need to set this setting for `example.com` when the 29 # cookie is set on `somesubdomain.example.com` for it to work properly. 30 # To debug issues with this setting, start qutebrowser with `--debug 31 # --logfilter network --debug-flag log-cookies` which will show all 32 # cookies being set. 33 # Type: String 34 # Valid values: 35 # - all: Accept all cookies. 36 # - no-3rdparty: Accept cookies from the same origin only. This is known to break some sites, such as GMail. 37 # - no-unknown-3rdparty: Accept cookies from the same origin only, unless a cookie is already set for the domain. On QtWebEngine, this is the same as no-3rdparty. 38 # - never: Don't accept cookies at all. 39 config.set('content.cookies.accept', 'all', 'chrome-devtools://*') 40 41 # Setting dark mode 42 config.set("colors.webpage.darkmode.enabled", False) 43 44 # Which cookies to accept. With QtWebEngine, this setting also controls 45 # other features with tracking capabilities similar to those of cookies; 46 # including IndexedDB, DOM storage, filesystem API, service workers, and 47 # AppCache. Note that with QtWebKit, only `all` and `never` are 48 # supported as per-domain values. Setting `no-3rdparty` or `no- 49 # unknown-3rdparty` per-domain on QtWebKit will have the same effect as 50 # `all`. If this setting is used with URL patterns, the pattern gets 51 # applied to the origin/first party URL of the page making the request, 52 # not the request URL. With QtWebEngine 5.15.0+, paths will be stripped 53 # from URLs, so URL patterns using paths will not match. With 54 # QtWebEngine 5.15.2+, subdomains are additionally stripped as well, so 55 # you will typically need to set this setting for `example.com` when the 56 # cookie is set on `somesubdomain.example.com` for it to work properly. 57 # To debug issues with this setting, start qutebrowser with `--debug 58 # --logfilter network --debug-flag log-cookies` which will show all 59 # cookies being set. 60 # Type: String 61 # Valid values: 62 # - all: Accept all cookies. 63 # - no-3rdparty: Accept cookies from the same origin only. This is known to break some sites, such as GMail. 64 # - no-unknown-3rdparty: Accept cookies from the same origin only, unless a cookie is already set for the domain. On QtWebEngine, this is the same as no-3rdparty. 65 # - never: Don't accept cookies at all. 66 config.set('content.cookies.accept', 'all', 'devtools://*') 67 68 # Value to send in the `Accept-Language` header. Note that the value 69 # read from JavaScript is always the global value. 70 # Type: String 71 config.set('content.headers.accept_language', '', 'https://matchmaker.krunker.io/*') 72 73 # User agent to send. The following placeholders are defined: * 74 # `{os_info}`: Something like "X11; Linux x86_64". * `{webkit_version}`: 75 # The underlying WebKit version (set to a fixed value with 76 # QtWebEngine). * `{qt_key}`: "Qt" for QtWebKit, "QtWebEngine" for 77 # QtWebEngine. * `{qt_version}`: The underlying Qt version. * 78 # `{upstream_browser_key}`: "Version" for QtWebKit, "Chrome" for 79 # QtWebEngine. * `{upstream_browser_version}`: The corresponding 80 # Safari/Chrome version. * `{qutebrowser_version}`: The currently 81 # running qutebrowser version. The default value is equal to the 82 # unchanged user agent of QtWebKit/QtWebEngine. Note that the value 83 # read from JavaScript is always the global value. With QtWebEngine 84 # between 5.12 and 5.14 (inclusive), changing the value exposed to 85 # JavaScript requires a restart. 86 # Type: FormatString 87 config.set('content.headers.user_agent', 'Mozilla/5.0 ({os_info}) AppleWebKit/{webkit_version} (KHTML, like Gecko) {upstream_browser_key}/{upstream_browser_version} Safari/{webkit_version}', 'https://web.whatsapp.com/') 88 89 # User agent to send. The following placeholders are defined: * 90 # `{os_info}`: Something like "X11; Linux x86_64". * `{webkit_version}`: 91 # The underlying WebKit version (set to a fixed value with 92 # QtWebEngine). * `{qt_key}`: "Qt" for QtWebKit, "QtWebEngine" for 93 # QtWebEngine. * `{qt_version}`: The underlying Qt version. * 94 # `{upstream_browser_key}`: "Version" for QtWebKit, "Chrome" for 95 # QtWebEngine. * `{upstream_browser_version}`: The corresponding 96 # Safari/Chrome version. * `{qutebrowser_version}`: The currently 97 # running qutebrowser version. The default value is equal to the 98 # unchanged user agent of QtWebKit/QtWebEngine. Note that the value 99 # read from JavaScript is always the global value. With QtWebEngine 100 # between 5.12 and 5.14 (inclusive), changing the value exposed to 101 # JavaScript requires a restart. 102 # Type: FormatString 103 config.set('content.headers.user_agent', 'Mozilla/5.0 ({os_info}; rv:90.0) Gecko/20100101 Firefox/90.0', 'https://accounts.google.com/*') 104 105 #Ad/Tracker blocking 106 def perish_evil(info: interceptor.Request): 107 url=info.request_url 108 if (( 109 url.host()=="mos.ru" 110 and url.path()=="/logs" 111 ) or ( 112 url.host()=="www.mos.ru" 113 and (url.path()=="/api/analytics-forwarder/v1/events" or url.path()=="/stproxy/services/") 114 ) or ( 115 url.host()=="school.mos.ru" 116 and (url.path()=="/v1/roles/allGlobal/" or url.path()=="/v1/allSubsystems/" or url.path()=="/v1/oauth/userinfo" or url.path()=="/api/ej/chat/family/v1/messages/count_unread_and_important" or url.path()=="/api/news/v2/banners/instance" or url.path()=="/api/ej/core/family/v1/banners" or url.path()=="/api/additional_education/v1/ae_groups" or url.path()=="/api/ej/core/family/v1/emias_medical_recommendations" or url.path()=="/v2/external-partners/check-for-vk-user") 117 ) or ( 118 url.host()=="dnevnik.mos.ru" 119 and url.path()=="/diary/schedules/undefined" 120 ) or ( 121 url.host()=="yastatic.net" 122 and url.path()=="/s3/distribution/yanalytics/v7/yanalytics.js" 123 ) or ( 124 url.host()=="apis.google.com" 125 and url.path()=="/js/googleapis.proxy.js" 126 ) or ( 127 url.host()=="drive.google.com" 128 and (url.path()=="/drivesharing" or url.path()=="/viewer2/prod-01/presspage") 129 ) or ( 130 url.host()=="ssl.gstatic.com" 131 and url.path()=="/docs/common/cleardot.gif" 132 ) 133 ): 134 info.block() 135 136 interceptor.register(perish_evil) 137 138 #Start pages 139 config.set('url.default_page', 'https://stellar-nexus.ru/en') 140 c.url.start_pages = ['https://stellar-nexus.ru/en'] 141 142 #File manager 143 config.set("fileselect.handler", "external") 144 config.set("fileselect.single_file.command", ['st', '-e', 'ranger', '--choosefile', '{}']) 145 config.set("fileselect.multiple_files.command", ['st', '-e', 'ranger', '--choosefiles', '{}']) 146 147 #Color scheme 148 config.set('colors.webpage.preferred_color_scheme', 'dark') 149 config.set('colors.completion.odd.bg', '#333333') 150 config.set('colors.completion.even.bg', '#222222') 151 config.set('colors.hints.bg', 'black') 152 config.set('colors.hints.fg', 'white') 153 config.set('hints.border', '1px solid #ce4404') 154 config.set('colors.completion.category.bg', '#ce4404') 155 config.set('colors.tabs.bar.bg', '#222222') 156 config.set('colors.tabs.odd.bg', '#222222') 157 config.set('colors.tabs.even.bg', '#222222') 158 config.set('colors.tabs.selected.odd.bg', '#ce4404') 159 config.set('colors.tabs.selected.even.bg', '#ce4404') 160 config.set('colors.tabs.pinned.odd.bg', '#444444') 161 config.set('colors.tabs.pinned.even.bg', '#444444') 162 config.set('colors.tabs.pinned.selected.odd.bg', '#ce4404') 163 config.set('colors.tabs.pinned.selected.even.bg', '#ce4404') 164 165 #Bindings for normal mode 166 config.bind('h', 'back') 167 config.bind('j', 'tab-prev') 168 config.bind('k', 'tab-next') 169 config.bind('l', 'forward') 170 config.bind('H', 'tab-clone;; back;; tab-move -') 171 config.bind('J', 'tab-move -') 172 config.bind('K', 'tab-move +') 173 config.bind('L', 'tab-clone;; forward') 174 config.bind('d', 'tab-move -;; tab-close') 175 config.bind('D', 'tab-close') 176 config.bind('cc', 'tab-clone') 177 config.bind('to', 'tab-only') 178 config.bind('R', 'spawn /home/plat/scripts/qutebrowser-redraw.sh') 179 config.bind('m', 'hint links spawn -d /home/plat/scripts/append_music.sh {hint-url}') 180 config.bind('M', 'hint links spawn -d /home/plat/scripts/play_video.sh {hint-url}') 181 config.bind('I', 'hint images download') 182 config.bind('sm', 'hint links spawn -d /home/plat/scripts/send_music.sh {hint-url}') 183 config.bind('W', 'spawn /home/plat/scripts/qutebrowser-pseudo-tran-switch.sh') 184 185 #Preferences 186 config.set('window.title_format', 'qutebrowser') 187 config.set('statusbar.show', 'never') 188 config.set('tabs.show', 'multiple') 189 config.set('tabs.position', 'bottom') 190 config.set('tabs.indicator.width', 0) 191 config.set('scrolling.bar', 'when-searching') 192 config.set('completion.scrollbar.width', 0) 193 config.set('tabs.title.format_pinned', '{audio}{index}') 194 config.set('fonts.tabs.unselected', '12pt default_family') 195 config.set('fonts.tabs.selected', '12pt default_family') 196 197 config.set('content.unknown_url_scheme_policy', 'allow-all') 198 199 #Search engines 200 c.url.searchengines = {'DEFAULT': 'https://searx.stellar-nexus.ru/searxng/search?q={}', 201 } 202 203 204 # User agent to send. The following placeholders are defined: * 205 # `{os_info}`: Something like "X11; Linux x86_64". * `{webkit_version}`: 206 # The underlying WebKit version (set to a fixed value with 207 # QtWebEngine). * `{qt_key}`: "Qt" for QtWebKit, "QtWebEngine" for 208 # QtWebEngine. * `{qt_version}`: The underlying Qt version. * 209 # `{upstream_browser_key}`: "Version" for QtWebKit, "Chrome" for 210 # QtWebEngine. * `{upstream_browser_version}`: The corresponding 211 # Safari/Chrome version. * `{qutebrowser_version}`: The currently 212 # running qutebrowser version. The default value is equal to the 213 # unchanged user agent of QtWebKit/QtWebEngine. Note that the value 214 # read from JavaScript is always the global value. With QtWebEngine 215 # between 5.12 and 5.14 (inclusive), changing the value exposed to 216 # JavaScript requires a restart. 217 # Type: FormatString 218 config.set('content.headers.user_agent', 'Mozilla/5.0 ({os_info}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99 Safari/537.36', 'https://*.slack.com/*') 219 220 # Load images automatically in web pages. 221 # Type: Bool 222 config.set('content.images', True, 'chrome-devtools://*') 223 224 # Load images automatically in web pages. 225 # Type: Bool 226 config.set('content.images', True, 'devtools://*') 227 228 # Enable JavaScript. 229 # Type: Bool 230 config.set('content.javascript.enabled', True, 'chrome-devtools://*') 231 232 # Enable JavaScript. 233 # Type: Bool 234 config.set('content.javascript.enabled', True, 'devtools://*') 235 236 # Enable JavaScript. 237 # Type: Bool 238 config.set('content.javascript.enabled', True, 'chrome://*/*') 239 240 # Enable JavaScript. 241 # Type: Bool 242 config.set('content.javascript.enabled', True, 'qute://*/*')