iTerm profile switch
This commit is contained in:
parent
2b90505d7b
commit
b132ed3ce1
|
@ -54,14 +54,14 @@
|
|||
(concat
|
||||
"<div class=\"content\">"
|
||||
(menu '("<a href=\"#postamble\">↓ bottom ↓</a>"))
|
||||
"<h1>"
|
||||
(format "%s" (car (plist-get info :title)))
|
||||
"</h1>"
|
||||
(when-let ((date (plist-get info :date)))
|
||||
(format "<span class=\"article-date\">%s</span>"
|
||||
(format-time-string "%Y-%m-%d"
|
||||
(org-timestamp-to-time
|
||||
(car date)))))
|
||||
"<h1>"
|
||||
(format "%s" (car (plist-get info :title)))
|
||||
"</h1>"
|
||||
(when-let ((subtitle (car (plist-get info :subtitle))))
|
||||
(format "<h2>%s</h2>" subtitle))
|
||||
"</div>"))
|
||||
|
|
BIN
project.el.sig
BIN
project.el.sig
Binary file not shown.
|
@ -766,7 +766,7 @@ blockquote:after, .main blockquote:after {
|
|||
pre span.org-builtin {color:var(--cyan);}
|
||||
pre span.org-string {color:var(--green);}
|
||||
pre span.org-doc {color:var(--green);}
|
||||
pre span.org-keyword {color:var(--blue);}
|
||||
pre span.org-keyword {color:var(--green);}
|
||||
pre span.org-variable-name {color:var(--blue);}
|
||||
pre span.org-function-name {color:var(--blue);}
|
||||
pre span.org-type {color:var(--yellow);}
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
#+DESCRIPTION: Small script to change the profile of iTerm in sync with macOS preferences
|
||||
#+OPTIONS: auto-id:t toc:t
|
||||
|
||||
#+begin_notes
|
||||
How to have dark/light profile selected when opening a new iTerm.
|
||||
#+end_notes
|
||||
|
||||
* The script
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: the-script
|
||||
|
@ -21,11 +25,11 @@ I use =fish= but you can easily adapt that in your =.bashrc=,
|
|||
Here is what I have in my =~/.config/fish/config.fish=:
|
||||
|
||||
#+begin_src fish
|
||||
function setItermProfile
|
||||
function setItermProfile
|
||||
echo -ne "\033]50;SetProfile=$argv\a"
|
||||
end
|
||||
end
|
||||
|
||||
function sync_appearance
|
||||
function sync_appearance
|
||||
|
||||
set -x MacOSThemeAutoSwitch \
|
||||
(defaults read -g AppleInterfaceStyleSwitchesAutomatically 2>/dev/null)
|
||||
|
@ -34,20 +38,16 @@ Here is what I have in my =~/.config/fish/config.fish=:
|
|||
set -x MacOSTheme (defaults read -g AppleInterfaceStyle 2>/dev/null)
|
||||
test -z $MacOSTheme; and set -x MacOSTheme 'nil'
|
||||
|
||||
# for debug purpose only
|
||||
# echo $MacOSThemeAutoSwitch
|
||||
# echo $MacOSTheme
|
||||
|
||||
if test -n $ITERM_PROFILE # check if we are using iTerm2
|
||||
switch $MacOSThemeAutoSwitch
|
||||
case 1
|
||||
case 1 # autoswitch on
|
||||
switch $MacOSTheme
|
||||
case 'nil'
|
||||
setItermProfile Light
|
||||
case '*'
|
||||
setItermProfile Dark
|
||||
end
|
||||
case 0
|
||||
case 0 # autoswitch off
|
||||
switch $MacOSTheme
|
||||
case 'Dark'
|
||||
setItermProfile Dark
|
||||
|
@ -58,13 +58,13 @@ Here is what I have in my =~/.config/fish/config.fish=:
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if status --is-login
|
||||
if status --is-login
|
||||
if status --is-interactive
|
||||
sync_appearance
|
||||
end
|
||||
end
|
||||
end
|
||||
#+end_src
|
||||
|
||||
If the appearance change, you can call =sync_appearance= function in your
|
||||
|
|
Loading…
Reference in a new issue