summaryrefslogtreecommitdiff
path: root/pywal/reload.py
diff options
context:
space:
mode:
authorDylan Araps <dylan.araps@gmail.com>2017-07-22 22:26:49 +1000
committerDylan Araps <dylan.araps@gmail.com>2017-07-22 22:26:49 +1000
commitde47c1beaaa77ee6f50235daba735ccc98ad608c (patch)
tree03fca45aead0204d0b8619d775077f1046230ba0 /pywal/reload.py
parenta4ea6a4f7addc3ada3c466a763331d793190a342 (diff)
api: Remove wal.py
Diffstat (limited to 'pywal/reload.py')
-rw-r--r--pywal/reload.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/pywal/reload.py b/pywal/reload.py
index 66fdea9..da09fe0 100644
--- a/pywal/reload.py
+++ b/pywal/reload.py
@@ -1,10 +1,12 @@
"""
Reload programs.
"""
+import re
import shutil
import subprocess
-from pywal import util
+from .settings import __cache_dir__
+from . import util
def reload_xrdb(cache_dir):
@@ -27,9 +29,25 @@ def reload_polybar():
util.disown("pkill", "-USR1", "polybar")
-def reload_env(cache_dir):
+def env(cache_dir=__cache_dir__):
"""Reload environment."""
reload_xrdb(cache_dir)
reload_i3()
reload_polybar()
print("reload: Reloaded environment.")
+
+
+def colors(vte, cache_dir=__cache_dir__):
+ """Reload the current scheme."""
+ sequence_file = cache_dir / "sequences"
+
+ if sequence_file.is_file():
+ sequences = "".join(util.read_file(sequence_file))
+
+ # If vte mode was used, remove the unsupported sequence.
+ if vte:
+ sequences = re.sub(r"\]708;\#.{6}", "", sequences)
+
+ print(sequences, end="")
+
+ exit(0)