mirror of
https://github.com/sahinakkaya/dotfiles.git
synced 2025-05-11 02:22:05 +02:00
Implement auto theme switching
This commit is contained in:
parent
86701e30df
commit
c5bc242eb4
@ -1 +1 @@
|
||||
Subproject commit e0df6560b4ec5d48272dd5c8e7ed3017c11f6702
|
||||
Subproject commit 9e51cc6ca0fd00569827185557abbc4af169242e
|
20
Library/LaunchAgents/dev.sahinakkaya.dark-mode-notify.plist
Normal file
20
Library/LaunchAgents/dev.sahinakkaya.dark-mode-notify.plist
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
|
||||
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Label</key>
|
||||
<string>dev.sahinakkaya.dark-mode-notify</string>
|
||||
<key>KeepAlive</key>
|
||||
<true/>
|
||||
<key>StandardErrorPath</key>
|
||||
<string>/Users/sahin/.dark-mode-notify-stderr.log</string>
|
||||
<key>StandardOutPath</key>
|
||||
<string>/Users/sahin/.dark-mode-notify-stdout.log</string>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>/Users/sahin/.local/bin/dark-mode-notify</string>
|
||||
<string>/Users/sahin/scripts/change-background</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
40
scripts/change-background
Executable file
40
scripts/change-background
Executable file
@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
theme=$(defaults read -g AppleInterfaceStyle | tr '[:upper:]' '[:lower:]')
|
||||
else
|
||||
theme="$1"
|
||||
fi
|
||||
|
||||
PATH="/opt/homebrew/bin/:$PATH"
|
||||
|
||||
if [ "$theme" == "dark" ]; then
|
||||
gsed -i 's/kanagawa_light.conf/kanagawa.conf/g' "$HOME/.config/kitty/kitty.conf"
|
||||
gsed -i 's/tokyonight_day/tokyonight_storm/g' "$HOME/.config/kitty/kitty.conf"
|
||||
gsed -i 's/Light/Origin/g' "$HOME/.config/bat/config"
|
||||
gsed -i 's/flat-remix-light/tokyo-storm/g' "$HOME/.config/btop/btop.conf"
|
||||
gsed -i "\$s/.*/include dark-256.theme/" "$HOME/.config/task/taskrc"
|
||||
echo "dark" > "$HOME/.theme"
|
||||
else
|
||||
theme="light"
|
||||
gsed -i 's/kanagawa.conf/kanagawa_light.conf/g' "$HOME/.config/kitty/kitty.conf"
|
||||
gsed -i 's/tokyonight_storm/tokyonight_day/g' "$HOME/.config/kitty/kitty.conf"
|
||||
gsed -i 's/Origin/Light/g' "$HOME/.config/bat/config"
|
||||
gsed -i 's/tokyo-storm/flat-remix-light/g' "$HOME/.config/btop/btop.conf"
|
||||
gsed -i "\$s/.*/include light-256.theme/" "$HOME/.config/task/taskrc"
|
||||
echo "light" > "$HOME/.theme"
|
||||
fi
|
||||
|
||||
# pgrep -f kitty | xargs kill -SIGUSR1
|
||||
kill -SIGUSR1 $(pgrep -f kitty)
|
||||
# tmux source-file "$HOME/.config/tmux/$theme.conf"
|
||||
|
||||
|
||||
# This uses the neovim-remote python package to control other neovim instances.
|
||||
# see: https://github.com/mhinz/neovim-remote
|
||||
# Further, it is assumed that toggling the background in neovim is enough.
|
||||
# Anything else should be handled by the set color scheme.
|
||||
|
||||
for server in $(nvr --serverlist); do
|
||||
nvr --servername "$server" -cc "set background=$theme"
|
||||
done
|
Loading…
Reference in New Issue
Block a user