dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit 0b53cb6a8d014ccbab3739c6950133d34a07dbc2
parent f4814df148f2e3660b869cd349064ad6889526ae
Author: Alex Balgavy <a.balgavy@gmail.com>
Date:   Wed, 21 Oct 2020 12:04:11 +0200

Simpler way to toggle theme

Instead of calling osascript, just have an empty file
~/.config/dark-theme to indicate when dark theme is enabled. Speeds up
Vim loading as well.


Former-commit-id: 7d4c3e881d45e99a7fa125bfc398e846250bd574
Diffstat:
Mscripts/set-theme | 14++++++++++++--
Mvim/vimrc | 8+++-----
2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/scripts/set-theme b/scripts/set-theme @@ -62,11 +62,21 @@ set_tmux() { [ $# -eq 1 ] || { printf "Arguments: dark, light\n" && exit 1; } case "$1" in - dark) THEME="dark";; - light) THEME="light";; + dark) + THEME="dark";; + light) + THEME="light";; + toggle) + if [ -f "$HOME/.config/dark-theme" ]; then THEME="light" + else THEME="dark"; fi;; *) printf "Arguments: dark, light\n" && exit 1;; esac +case "$THEME" in + light) rm "$HOME/.config/dark-theme";; + dark) touch "$HOME/.config/dark-theme";; +esac + os=$(uname -s | tr '[:upper:]' '[:lower:]') case "$os" in darwin*) diff --git a/vim/vimrc b/vim/vimrc @@ -424,12 +424,10 @@ if has('termguicolors') set termguicolors endif -if system("osascript -e 'tell application \"System Events\" to tell appearance preferences to return (get dark mode as text)'") == "false\n" - colorscheme jokull -elseif system("gsettings get org.gnome.Terminal.Legacy.Settings theme-variant") == "'light'\n" - colorscheme jokull -else +if filereadable($HOME."/.config/dark-theme") colorscheme junipero +else + colorscheme jokull endif " where to find tags files