Add plugin for dynamic switch iTerm2 theme
I want to dynamically change the theme in iterm2 depending on the time of day
This commit is contained in:
parent
a38d7cf54a
commit
131a08eff9
10
plugins/iterm2-dynamic-theme/Readme.md
Normal file
10
plugins/iterm2-dynamic-theme/Readme.md
Normal file
@ -0,0 +1,10 @@
|
||||
##
|
||||
|
||||
**Maintainer:** [@idoo](https://github.com/idoo)
|
||||
|
||||
This plugin switch iTerm2 theme depends on the time of day
|
||||
|
||||
### Usage
|
||||
|
||||
Please create two profile with name `dark` and `light`
|
||||
|
20
plugins/iterm2-dynamic-theme/iterm2-dynamic-theme.plugin.zsh
Normal file
20
plugins/iterm2-dynamic-theme/iterm2-dynamic-theme.plugin.zsh
Normal file
@ -0,0 +1,20 @@
|
||||
function set_iterm_profile() {
|
||||
echo -e "\033]50;SetProfile=$1\a"
|
||||
}
|
||||
|
||||
function start_dynamic_theme() {
|
||||
HOUR=`date +%H`
|
||||
if [ $HOUR -ge 8 -a $HOUR -le 17 ]; then
|
||||
set_iterm_profile light
|
||||
else
|
||||
set_iterm_profile dark
|
||||
fi
|
||||
}
|
||||
|
||||
start_dynamic_theme &!
|
||||
|
||||
while true
|
||||
do
|
||||
start_dynamic_theme
|
||||
sleep 600
|
||||
done
|
Loading…
Reference in New Issue
Block a user