colors: Set colors in linux tty.

This commit is contained in:
Dylan Araps 2018-01-03 09:14:13 +11:00
parent aadb470931
commit dd17579437
2 changed files with 31 additions and 0 deletions

View File

@ -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()

View File

@ -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