summaryrefslogtreecommitdiff
path: root/pywal
diff options
context:
space:
mode:
authorDylan Araps <dylan.araps@gmail.com>2018-01-03 09:14:13 +1100
committerDylan Araps <dylan.araps@gmail.com>2018-01-03 09:14:13 +1100
commitdd17579437fcb18bc3dc326ee750117d9fbafe31 (patch)
treebaf1737927dd4a42424efc36919ca4e45f2b5073 /pywal
parentaadb4709318380b9612aa802e5873bc988a42f66 (diff)
colors: Set colors in linux tty.
Diffstat (limited to 'pywal')
-rw-r--r--pywal/reload.py9
-rw-r--r--pywal/templates/colors-tty.sh22
2 files changed, 31 insertions, 0 deletions
diff --git a/pywal/reload.py b/pywal/reload.py
index 65b43bb..ea1fb99 100644
--- a/pywal/reload.py
+++ b/pywal/reload.py
@@ -10,6 +10,14 @@ from .settings import CACHE_DIR, HOME, MODULE_DIR, OS
from . import util
+def tty():
+ """Load colors in tty."""
+ tty_script = os.path.join(CACHE_DIR, "colors-tty.sh")
+
+ if os.path.isfile(tty_script):
+ subprocess.Popen([tty_script])
+
+
def xrdb(xrdb_files=None):
"""Merge the colors into the X db so new terminals use them."""
xrdb_files = xrdb_files or \
@@ -77,3 +85,4 @@ def env(xrdb_file=None):
sway()
polybar()
print("reload: Reloaded environment.")
+ tty()
diff --git a/pywal/templates/colors-tty.sh b/pywal/templates/colors-tty.sh
new file mode 100644
index 0000000..5c8e4bb
--- /dev/null
+++ b/pywal/templates/colors-tty.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+if [ "${{TERM:-none}}" = "linux" ]; then
+ printf "%b" "\\e]P0{color0.strip}"
+ printf "%b" "\\e]P1{color1.strip}"
+ printf "%b" "\\e]P2{color2.strip}"
+ printf "%b" "\\e]P3{color3.strip}"
+ printf "%b" "\\e]P4{color4.strip}"
+ printf "%b" "\\e]P5{color5.strip}"
+ printf "%b" "\\e]P6{color6.strip}"
+ printf "%b" "\\e]P7{color7.strip}"
+ printf "%b" "\\e]P8{color8.strip}"
+ printf "%b" "\\e]P9{color9.strip}"
+ printf "%b" "\\e]PA{color10.strip}"
+ printf "%b" "\\e]PB{color11.strip}"
+ printf "%b" "\\e]PC{color12.strip}"
+ printf "%b" "\\e]PD{color13.strip}"
+ printf "%b" "\\e]PE{color14.strip}"
+ printf "%b" "\\e]PF{color15.strip}"
+
+ # Fix artifacting.
+ clear
+fi