aboutsummaryrefslogtreecommitdiff
path: root/qutebrowser/.config/qutebrowser/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'qutebrowser/.config/qutebrowser/utils.py')
-rw-r--r--qutebrowser/.config/qutebrowser/utils.py22
1 files changed, 18 insertions, 4 deletions
diff --git a/qutebrowser/.config/qutebrowser/utils.py b/qutebrowser/.config/qutebrowser/utils.py
index 790bea2..c0247c2 100644
--- a/qutebrowser/.config/qutebrowser/utils.py
+++ b/qutebrowser/.config/qutebrowser/utils.py
@@ -1,4 +1,18 @@
-translucent = "#801a1a1a"
-background = "#1a1a1a"
-foreground = "#bcd0db"
-accent = "#a642c0"
+import subprocess
+
+def read_xresources(prefix):
+ props = {}
+ x = subprocess.run(['xrdb', '-query'], stdout=subprocess.PIPE)
+ lines = x.stdout.decode().split('\n')
+ for line in filter(lambda l : l.startswith(prefix), lines):
+ prop, _, value = line.partition(':\t')
+ props[prop] = value
+ return props
+
+xres = read_xresources('*')
+# can be userd now like `c.colors.statusbar.normal.bg = xres['*.background']`
+
+translucent = "#80" + xres['*background'].split('#')[1]
+background = xres['*background']
+foreground = xres['*foreground']
+accent = xres['*primary']