config.py (11275B)
1 # Import dependencies 2 import subprocess, os 3 4 # Autoconfig Default Settings 5 config.load_autoconfig() 6 7 # Auto Save Session (useful in Unpredictable Situations) 8 config.set("auto_save.session", True) 9 10 # Change Default Zoom to 75% 11 config.set("zoom.default", "80%") 12 13 # Change Downloads tab position 14 config.set("downloads.position","bottom") 15 16 # Custom keybinds 17 # This I use if I'm already inside the video page. 18 config.bind('em', 'spawn $HOME/.local/bin/open {url}') 19 config.bind('eM', 'hint links spawn $HOME/.local/bin/open {hint-url}') 20 21 # This help to fix youtube scrolling problem 22 config.bind('j', 'scroll-px 0 30') 23 config.bind('k', 'scroll-px 0 -30') 24 25 # Do not raise focus on new tab 26 c.new_instance_open_target = "tab-bg-silent" 27 28 # JS, cookies, encoding, headers, fonts, status-bar 29 c.content.autoplay = False 30 c.content.cookies.accept = "all" 31 c.content.default_encoding = "utf-8" 32 #c.content.headers.user_agent = ( 33 # "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko)" 34 # " Chrome/80.0.3987.163 Safari/537.36" 35 #) 36 c.fonts.default_family = ['FantasqueSansMono Nerd Font'] 37 c.fonts.default_size = '10pt' 38 c.statusbar.widgets = ["keypress", "progress", "url", "scroll"] 39 40 def read_xresources(prefix): 41 """ 42 read settings from xresources 43 """ 44 props = {} 45 x = subprocess.run(["xrdb", "-query"], stdout=subprocess.PIPE) 46 lines = x.stdout.decode().split("\n") 47 for line in filter(lambda l: l.startswith(prefix), lines): 48 prop, _, value = line.partition(":\t") 49 props[prop] = value 50 return props 51 52 xresources = read_xresources("*") 53 54 # Set Colors 55 palette = { 56 'background': xresources["*.background"], 57 'background-alt': xresources["*.background"], 58 'background-attention': xresources["*.color8"], 59 'border': xresources["*.background"], 60 'current-line': xresources["*.color8"], 61 'selection': xresources["*.color8"], 62 'foreground': xresources["*.foreground"], 63 'foreground-alt': xresources["*.color8"], 64 'foreground-attention': xresources["*.color15"], 65 'comment': xresources["*.color6"], 66 'cyan': xresources["*.color6"], 67 'green': xresources["*.color2"], 68 'orange': xresources["*.color9"], 69 'pink': xresources["*.color13"], 70 'purple': xresources["*.color5"], 71 'red': xresources["*.color1"], 72 'yellow': xresources["*.color3"] 73 } 74 spacing = { 75 'vertical': 4, 76 'horizontal': 4 77 } 78 padding = { 79 'top': spacing['vertical'], 80 'right': spacing['horizontal'], 81 'bottom': spacing['vertical'], 82 'left': spacing['horizontal'] 83 } 84 85 # Setting Dark Mode 86 config.set("colors.webpage.darkmode.enabled", True) 87 config.set("colors.webpage.preferred_color_scheme","dark") 88 89 # Default Background color of webpages. 90 c.colors.webpage.bg = palette['background'] 91 92 # Background color of the completion widget category headers. 93 c.colors.completion.category.bg = palette['background'] 94 95 # Bottom border color of the completion widget category headers. 96 c.colors.completion.category.border.bottom = palette['border'] 97 98 # Top border color of the completion widget category headers. 99 c.colors.completion.category.border.top = palette['border'] 100 101 # Foreground color of completion widget category headers. 102 c.colors.completion.category.fg = palette['foreground'] 103 104 # Background color of the completion widget for even rows. 105 c.colors.completion.even.bg = palette['background'] 106 107 # Background color of the completion widget for odd rows. 108 c.colors.completion.odd.bg = palette['background-alt'] 109 110 # Text color of the completion widget. 111 c.colors.completion.fg = palette['foreground'] 112 113 # Background color of the selected completion item. 114 c.colors.completion.item.selected.bg = palette['selection'] 115 116 # Bottom border color of the selected completion item. 117 c.colors.completion.item.selected.border.bottom = palette['selection'] 118 119 # Top border color of the completion widget category headers. 120 c.colors.completion.item.selected.border.top = palette['selection'] 121 122 # Foreground color of the selected completion item. 123 c.colors.completion.item.selected.fg = palette['foreground'] 124 125 # Foreground color of the matched text in the completion. 126 c.colors.completion.match.fg = palette['orange'] 127 128 # Color of the scrollbar in completion view 129 c.colors.completion.scrollbar.bg = palette['background'] 130 131 # Color of the scrollbar handle in completion view. 132 c.colors.completion.scrollbar.fg = palette['foreground'] 133 134 # Background color for the download bar. 135 c.colors.downloads.bar.bg = palette['background'] 136 137 # Background color for downloads with errors. 138 c.colors.downloads.error.bg = palette['background'] 139 140 # Foreground color for downloads with errors. 141 c.colors.downloads.error.fg = palette['red'] 142 143 # Color gradient stop for download backgrounds. 144 c.colors.downloads.stop.bg = palette['background'] 145 146 # Color gradient interpolation system for download backgrounds. 147 # Type: ColorSystem 148 # Valid values: 149 # - rgb: Interpolate in the RGB color system. 150 # - hsv: Interpolate in the HSV color system. 151 # - hsl: Interpolate in the HSL color system. 152 # - none: Don't show a gradient. 153 c.colors.downloads.system.bg = 'none' 154 155 # Background color for hints. Note that you can use a `rgba(...)` value 156 # for transparency. 157 c.colors.hints.bg = palette['background'] 158 159 # Font color for hints. 160 c.colors.hints.fg = palette['purple'] 161 162 # Hints 163 c.hints.border = '1px solid ' + palette['background-alt'] 164 165 # Font color for the matched part of hints. 166 c.colors.hints.match.fg = palette['foreground-alt'] 167 168 # Background color of the keyhint widget. 169 c.colors.keyhint.bg = palette['background'] 170 171 # Text color for the keyhint widget. 172 c.colors.keyhint.fg = palette['purple'] 173 174 # Highlight color for keys to complete the current keychain. 175 c.colors.keyhint.suffix.fg = palette['selection'] 176 177 # Background color of an error message. 178 c.colors.messages.error.bg = palette['background'] 179 180 # Border color of an error message. 181 c.colors.messages.error.border = palette['background-alt'] 182 183 # Foreground color of an error message. 184 c.colors.messages.error.fg = palette['red'] 185 186 # Background color of an info message. 187 c.colors.messages.info.bg = palette['background'] 188 189 # Border color of an info message. 190 c.colors.messages.info.border = palette['background-alt'] 191 192 # Foreground color an info message. 193 c.colors.messages.info.fg = palette['comment'] 194 195 # Background color of a warning message. 196 c.colors.messages.warning.bg = palette['background'] 197 198 # Border color of a warning message. 199 c.colors.messages.warning.border = palette['background-alt'] 200 201 # Foreground color a warning message. 202 c.colors.messages.warning.fg = palette['red'] 203 204 # Background color for prompts. 205 c.colors.prompts.bg = palette['background'] 206 207 # Border used around UI elements in prompts. 208 c.colors.prompts.border = '1px solid ' + palette['background-alt'] 209 210 # Foreground color for prompts. 211 c.colors.prompts.fg = palette['cyan'] 212 213 # Background color for the selected item in filename prompts. 214 c.colors.prompts.selected.bg = palette['selection'] 215 216 # Background color of the statusbar in caret mode. 217 c.colors.statusbar.caret.bg = palette['background'] 218 219 # Foreground color of the statusbar in caret mode. 220 c.colors.statusbar.caret.fg = palette['orange'] 221 222 # Background color of the statusbar in caret mode with a selection. 223 c.colors.statusbar.caret.selection.bg = palette['background'] 224 225 # Foreground color of the statusbar in caret mode with a selection. 226 c.colors.statusbar.caret.selection.fg = palette['orange'] 227 228 # Background color of the statusbar in command mode. 229 c.colors.statusbar.command.bg = palette['background'] 230 231 # Foreground color of the statusbar in command mode. 232 c.colors.statusbar.command.fg = palette['pink'] 233 234 # Background color of the statusbar in private browsing + command mode. 235 c.colors.statusbar.command.private.bg = palette['background'] 236 237 # Foreground color of the statusbar in private browsing + command mode. 238 c.colors.statusbar.command.private.fg = palette['foreground-alt'] 239 240 # Background color of the statusbar in insert mode. 241 c.colors.statusbar.insert.bg = palette['background-attention'] 242 243 # Foreground color of the statusbar in insert mode. 244 c.colors.statusbar.insert.fg = palette['foreground-attention'] 245 246 # Background color of the statusbar. 247 c.colors.statusbar.normal.bg = palette['background'] 248 249 # Foreground color of the statusbar. 250 c.colors.statusbar.normal.fg = palette['foreground'] 251 252 # Background color of the statusbar in passthrough mode. 253 c.colors.statusbar.passthrough.bg = palette['background'] 254 255 # Foreground color of the statusbar in passthrough mode. 256 c.colors.statusbar.passthrough.fg = palette['orange'] 257 258 # Background color of the statusbar in private browsing mode. 259 c.colors.statusbar.private.bg = palette['background-alt'] 260 261 # Foreground color of the statusbar in private browsing mode. 262 c.colors.statusbar.private.fg = palette['foreground-alt'] 263 264 # Background color of the progress bar. 265 c.colors.statusbar.progress.bg = palette['background'] 266 267 # Foreground color of the URL in the statusbar on error. 268 c.colors.statusbar.url.error.fg = palette['red'] 269 270 # Default foreground color of the URL in the statusbar. 271 c.colors.statusbar.url.fg = palette['foreground'] 272 273 # Foreground color of the URL in the statusbar for hovered links. 274 c.colors.statusbar.url.hover.fg = palette['cyan'] 275 276 # Foreground color of the URL in the statusbar on successful load 277 c.colors.statusbar.url.success.http.fg = palette['green'] 278 279 # Foreground color of the URL in the statusbar on successful load 280 c.colors.statusbar.url.success.https.fg = palette['green'] 281 282 # Foreground color of the URL in the statusbar when there's a warning. 283 c.colors.statusbar.url.warn.fg = palette['yellow'] 284 285 # Status bar padding 286 c.statusbar.padding = padding 287 288 # Background color of the tab bar. 289 # Type: QtColor 290 c.colors.tabs.bar.bg = palette['selection'] 291 292 # Background color of unselected even tabs. 293 # Type: QtColor 294 c.colors.tabs.even.bg = palette['selection'] 295 296 # Foreground color of unselected even tabs. 297 # Type: QtColor 298 c.colors.tabs.even.fg = palette['foreground'] 299 300 # Color for the tab indicator on errors. 301 # Type: QtColor 302 c.colors.tabs.indicator.error = palette['red'] 303 304 # Color gradient start for the tab indicator. 305 # Type: QtColor 306 c.colors.tabs.indicator.start = palette['orange'] 307 308 # Color gradient end for the tab indicator. 309 # Type: QtColor 310 c.colors.tabs.indicator.stop = palette['green'] 311 312 # Color gradient interpolation system for the tab indicator. 313 # Type: ColorSystem 314 # Valid values: 315 # - rgb: Interpolate in the RGB color system. 316 # - hsv: Interpolate in the HSV color system. 317 # - hsl: Interpolate in the HSL color system. 318 # - none: Don't show a gradient. 319 c.colors.tabs.indicator.system = 'none' 320 321 # Background color of unselected odd tabs. 322 # Type: QtColor 323 c.colors.tabs.odd.bg = palette['selection'] 324 325 # Foreground color of unselected odd tabs. 326 # Type: QtColor 327 c.colors.tabs.odd.fg = palette['foreground'] 328 329 # Background color of selected even tabs. 330 # Type: QtColor 331 c.colors.tabs.selected.even.bg = palette['background'] 332 333 # Foreground color of selected even tabs. 334 # Type: QtColor 335 c.colors.tabs.selected.even.fg = palette['foreground'] 336 337 # Background color of selected odd tabs. 338 # Type: QtColor 339 c.colors.tabs.selected.odd.bg = palette['background'] 340 341 # Foreground color of selected odd tabs. 342 # Type: QtColor 343 c.colors.tabs.selected.odd.fg = palette['foreground'] 344 345 # Tab padding 346 c.tabs.padding = padding 347 c.tabs.indicator.width = 1 348 c.tabs.favicons.scale = 1