mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-04-24 04:29:25 +02:00
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
2 changed files with 30 additions and 0 deletions
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…
Add table
Add a link
Reference in a new issue