From b132ed3ce10b03cbb89b88787e169580d25a362d Mon Sep 17 00:00:00 2001 From: "Yann Esposito (Yogsototh)" Date: Sun, 10 Nov 2019 22:15:00 +0100 Subject: [PATCH] iTerm profile switch --- project.el | 6 +- project.el.sig | Bin 586 -> 586 bytes src/css/minimalist.css | 2 +- .../index.org | 78 +++++++++--------- 4 files changed, 43 insertions(+), 43 deletions(-) diff --git a/project.el b/project.el index 55ee334..9b98333 100644 --- a/project.el +++ b/project.el @@ -54,14 +54,14 @@ (concat "
" (menu '("↓ bottom ↓")) - "

" - (format "%s" (car (plist-get info :title))) - "

" (when-let ((date (plist-get info :date))) (format "%s" (format-time-string "%Y-%m-%d" (org-timestamp-to-time (car date))))) + "

" + (format "%s" (car (plist-get info :title))) + "

" (when-let ((subtitle (car (plist-get info :subtitle)))) (format "

%s

" subtitle)) "
")) diff --git a/project.el.sig b/project.el.sig index 1594060c568055f06ee5a128ef87fcdeaeb7d557..24e5852db5b88c6ae2a81d153f227a99a33a2740 100644 GIT binary patch delta 534 zcmV+x0_pwA1j+=EBLm2N$&n@?f3A-Y{xgaL(prY2KzEnu0~C~Hc`R26rNXl}-+RIy z^V)_#534?aThy0`qP~o|gcXA+X`J40O|79b?q<)hJXUB9cPO8BHj(oQ6H?oZ`#af` zbij5!t*RH3WbS_r1?;CAd&%1oGsC=Z)_DR^QVF?uXT1HI2CrQS=JBhXvNSc9oPy^ zK+NP~wht5lSB~X-sCpVP+i#C~4 zeNHa}QIVy+@OD`={Y< zH!g}IB=E#VvTkZ^T*V4|2JtEWk;Vw4qpo0=UL%P&v79&yt~jQrx5hu=AMF- zB=Vb4cJ)FoI`nGC>G(>5e@3Q$@!FJ6=YKHA;NBKO zvIp-G0U4e9w#}_9Br&&Dn_8BAqLpQ#wrP7^KbnptzF$tEqkHh_f7glPjzWtlkWxcV z9uPM=)}j*+PQxccE3~$cJ3tZuC!@hw>A)k9)Q!7PS8obr@qaHsv&3 zbI2Sq-Jsqhe({aEFy#N?@yW>@^a^12FKfTQ9-+a0bO~rUa$&cE1cJ(@r1o8Q1QaX= Yd}i)KgWx10$9u0t2m;VYw3>nEi}s5Ou>b%7 diff --git a/src/css/minimalist.css b/src/css/minimalist.css index d5aeae2..b619f28 100644 --- a/src/css/minimalist.css +++ b/src/css/minimalist.css @@ -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);} diff --git a/src/posts/0007-switch-iterm-profile-catalina/index.org b/src/posts/0007-switch-iterm-profile-catalina/index.org index ea28281..d582329 100644 --- a/src/posts/0007-switch-iterm-profile-catalina/index.org +++ b/src/posts/0007-switch-iterm-profile-catalina/index.org @@ -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,50 +25,46 @@ 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 - echo -ne "\033]50;SetProfile=$argv\a" - end +function setItermProfile + echo -ne "\033]50;SetProfile=$argv\a" +end - function sync_appearance +function sync_appearance - set -x MacOSThemeAutoSwitch \ - (defaults read -g AppleInterfaceStyleSwitchesAutomatically 2>/dev/null) - test -z $MacOSThemeAutoSwitch; and set -x MacOSThemeAutoSwitch 0 + set -x MacOSThemeAutoSwitch \ + (defaults read -g AppleInterfaceStyleSwitchesAutomatically 2>/dev/null) + test -z $MacOSThemeAutoSwitch; and set -x MacOSThemeAutoSwitch 0 - set -x MacOSTheme (defaults read -g AppleInterfaceStyle 2>/dev/null) - test -z $MacOSTheme; and set -x MacOSTheme 'nil' + 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 # autoswitch on + switch $MacOSTheme + case 'nil' + setItermProfile Light + case '*' + setItermProfile Dark + end + case 0 # autoswitch off + switch $MacOSTheme + case 'Dark' + setItermProfile Dark + case 'Light' + setItermProfile Light + case 'nil' + setItermProfile Light + end + end + end +end - if test -n $ITERM_PROFILE # check if we are using iTerm2 - switch $MacOSThemeAutoSwitch - case 1 - switch $MacOSTheme - case 'nil' - setItermProfile Light - case '*' - setItermProfile Dark - end - case 0 - switch $MacOSTheme - case 'Dark' - setItermProfile Dark - case 'Light' - setItermProfile Light - case 'nil' - setItermProfile Light - end - end - end - end - - if status --is-login - if status --is-interactive - sync_appearance - end - end +if status --is-login + if status --is-interactive + sync_appearance + end +end #+end_src If the appearance change, you can call =sync_appearance= function in your