summaryrefslogtreecommitdiff
path: root/xtheme
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2019-04-08 09:44:56 -0700
committerBen Sima <ben@bsima.me>2019-04-08 09:44:56 -0700
commitcb5ed744ec217402e8a6651e3101c84f28321a01 (patch)
tree1d6974e58fa6f84181eca87447c30321b8b4b74f /xtheme
parentfa2f864d775677542d616e943f4305e71cf37ccf (diff)
Add xtheme script
Diffstat (limited to 'xtheme')
-rwxr-xr-xxtheme30
1 files changed, 30 insertions, 0 deletions
diff --git a/xtheme b/xtheme
new file mode 100755
index 0000000..e3f42cb
--- /dev/null
+++ b/xtheme
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+#
+# mostly stolen from jb55 https://github.com/jb55/bin/blob/master/themeswitch
+
+usage () {
+ printf "usage: xtheme <dark|light>\n"
+ exit 1
+}
+
+export XTHEME="$1"
+
+[ -z "$XTHEME" ] && usage
+[ "$XTHEME" != "dark" ] && [ "$XTHEME" != "light" ] && usage
+
+# switch terminal theme
+home-manager switch
+
+# set emacs theme using emacsclient
+if [ "$XTHEME" == "light" ]
+then
+ exec emacsclient \
+ --eval "(bs/switch-theme 'light)" &
+else
+ exec emacsclient \
+ --eval "(bs/switch-theme 'dark)" &
+fi
+
+systemctl --user restart polybar &
+
+wait