Skip to content

Commit 5395b18

Browse files
authored
feat: iTerm2 scripts as Applescript files (#8)
* feat: iTerm2 scripts as Applescript files * doc: fix instructions * chore: generate iTerm2 applescript themes * chore: decommission iterm2-scripts; emit migration guide for users * chore: add headers
1 parent c986711 commit 5395b18

File tree

579 files changed

+14990
-7193
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

579 files changed

+14990
-7193
lines changed

README.md

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -398,12 +398,11 @@ There are two types of theme files for iTerm2:
398398

399399
1. Standard themes which can be imported from iTerm2 itself,
400400
instructions below under "Manual".
401-
2. Script themes can be executed from a script to change the iTerm2
402-
theme.
401+
2. Applescripts that can be executed to change the iTerm2 theme.
403402

404403
**Theme directory**: [themes/iterm2/]
405404

406-
**Script Theme directory**: [themes-16/iterm2-scripts/]
405+
**Applescripts directory**: [themes-16/iterm2-applescripts/]
407406

408407
### Tinty
409408

@@ -413,16 +412,33 @@ There are two types of theme files for iTerm2:
413412
[[items]]
414413
path = "https://github.com/tinted-theming/tinted-terminal"
415414
name = "tinted-terminal"
416-
themes-dir = "themes-16/iterm2-scripts"
417-
hook = "sh %f"
415+
themes-dir = "themes-16/iterm2-applescripts"
416+
hook = '''
417+
command cp -f %f ~/Library/Application\ Support/iTerm2/Scripts/AutoLaunch.scpt \
418+
&& osascript %f
419+
'''
418420
supported-systems = ["base16", "base24"]
419421
```
420422

421423
2. `tinty apply base16-ayu-dark` to change the theme to
422424
`base16-ayu-dark`
423425

424-
For more information on Tinty setup or usage, have a look at the [Tinty]
425-
GitHub page.
426+
> [!NOTE]
427+
>
428+
> This also adds an item under the `Scripts` menu-bar item that can be invoked to re-apply the theme.
429+
> You should be able to map a keyboard shortcut to trigger this as you like.
430+
431+
> [!IMPORTANT]
432+
>
433+
> The AutoLaunch script is only ran at iTerm2 startup. It will not run when opening new windows or tabs.
434+
> You may want to add the following line in your rc file:
435+
436+
```sh
437+
# Only run if the shell is running in iTerm2.
438+
if [ "$TERM_PROGRAM" = "iTerm.app" ]; then
439+
osascript "~/Library/Application Support/iTerm2/Scripts/AutoLaunch.scpt"
440+
fi
441+
```
426442

427443
### Manual
428444

templates/config.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,16 @@ iterm2-base24:
5656
filename: themes/iterm2/{{ scheme-system }}-{{ scheme-slug }}.itermcolors
5757
supported-systems: [base24]
5858

59-
iterm2-scripts-base16-16:
59+
iterm2-scripts-migration-notice:
6060
filename: themes-16/iterm2-scripts/{{ scheme-system }}-{{ scheme-slug }}.sh
61+
supported-systems: [base16, base24]
62+
63+
iterm2-applescript-base16-16:
64+
filename: themes-16/iterm2-applescripts/{{ scheme-system }}-{{ scheme-slug }}.scpt
6165
supported-systems: [base16]
6266

63-
iterm2-scripts-base24-16:
64-
filename: themes-16/iterm2-scripts/{{ scheme-system }}-{{ scheme-slug }}.sh
67+
iterm2-applescript-base24-16:
68+
filename: themes-16/iterm2-applescripts/{{ scheme-system }}-{{ scheme-slug }}.scpt
6569
supported-systems: [base24]
6670

6771
# Kermit

templates/iterm2-scripts-base16-16.mustache renamed to templates/iterm2-applescript-base16-16.mustache

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
#!/bin/sh
21
{{=<% %>=}}
3-
4-
osascript <<EOF
2+
(*
3+
<%scheme-system%> <%scheme-name%>
4+
Scheme author: <%scheme-author%>
5+
Template author: Tinted Theming (https://github.com/tinted-theming)
6+
*)
57
tell application "iTerm2"
68
tell current session of current window
79
set background color to {<%base00-rgb16-r%>, <%base00-rgb16-g%>, <%base00-rgb16-b%>}
@@ -28,4 +30,3 @@ tell application "iTerm2"
2830
set ANSI bright white color to {<%base07-rgb16-r%>, <%base07-rgb16-g%>, <%base07-rgb16-b%>}
2931
end tell
3032
end tell
31-
EOF

templates/iterm2-scripts-base24-16.mustache renamed to templates/iterm2-applescript-base24-16.mustache

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
#!/bin/sh
21
{{=<% %>=}}
3-
4-
osascript <<EOF
2+
(*
3+
<%scheme-system%> <%scheme-name%>
4+
Scheme author: <%scheme-author%>
5+
Template author: Tinted Theming (https://github.com/tinted-theming)
6+
*)
57
tell application "iTerm2"
68
tell current session of current window
79
set background color to {<%base00-rgb16-r%>, <%base00-rgb16-g%>, <%base00-rgb16-b%>}
@@ -28,4 +30,3 @@ tell application "iTerm2"
2830
set ANSI bright white color to {<%base07-rgb16-r%>, <%base07-rgb16-g%>, <%base07-rgb16-b%>}
2931
end tell
3032
end tell
31-
EOF
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/sh
2+
3+
green_color=$(tput setaf 2)
4+
red_color=$(tput setaf 1)
5+
reset_color=$(tput sgr0)
6+
7+
1>&2 cat <<EOF
8+
9+
╔═══════════════════════════════════════════════════╗
10+
║ IMPORTANT NOTICE: ║
11+
║ ║
12+
║ You are using an out-of-date template for iTerm2! ║
13+
╚═══════════════════════════════════════════════════╝
14+
15+
To migrate, update the ${red_color}themes-dir${reset_color} & ${red_color}hook${reset_color} in the tinted-terminal entry in
16+
$HOME/.config/tinted-theming/tinty/config.toml:
17+
18+
${red_color}themes-dir${reset_color} = ${green_color}"themes-16/iterm2-applescripts"${reset_color}
19+
${red_color}hook${reset_color} = ${green_color}'''
20+
command cp -f %f ~/Library/Application\\ Support/iTerm2/Scripts/AutoLaunch.scpt \\
21+
&& osascript %f
22+
'''${reset_color}
23+
24+
For more info: https://github.com/tinted-theming/tinted-terminal#iterm2
25+
26+
EOF
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
(*
2+
base16 3024
3+
Scheme author: Jan T. Sott (http://github.com/idleberg)
4+
Template author: Tinted Theming (https://github.com/tinted-theming)
5+
*)
6+
tell application "iTerm2"
7+
tell current session of current window
8+
set background color to {2313, 771, 0}
9+
set foreground color to {42405, 41634, 41634}
10+
11+
-- Set ANSI Colors
12+
set ANSI black color to {14906, 13364, 12850}
13+
set ANSI red color to {56283, 11565, 8224}
14+
set ANSI green color to {257, 41634, 21074}
15+
set ANSI yellow color to {65021, 60909, 514}
16+
set ANSI blue color to {257, 41120, 58596}
17+
set ANSI magenta color to {41377, 27242, 38036}
18+
set ANSI cyan color to {46517, 58596, 62708}
19+
set ANSI white color to {54998, 54741, 54484}
20+
21+
-- Set Bright ANSI Colors
22+
set ANSI bright black color to {19018, 17733, 17219}
23+
set ANSI bright red color to {56283, 11565, 8224}
24+
set ANSI bright green color to {257, 41634, 21074}
25+
set ANSI bright yellow color to {65021, 60909, 514}
26+
set ANSI bright blue color to {257, 41120, 58596}
27+
set ANSI bright magenta color to {41377, 27242, 38036}
28+
set ANSI bright cyan color to {46517, 58596, 62708}
29+
set ANSI bright white color to {63479, 63479, 63479}
30+
end tell
31+
end tell
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
(*
2+
base16 Apathy
3+
Scheme author: Jannik Siebert (https://github.com/janniks)
4+
Template author: Tinted Theming (https://github.com/tinted-theming)
5+
*)
6+
tell application "iTerm2"
7+
tell current session of current window
8+
set background color to {771, 6682, 5654}
9+
set foreground color to {33153, 46517, 44204}
10+
11+
-- Set ANSI Colors
12+
set ANSI black color to {2827, 13364, 11565}
13+
set ANSI red color to {15934, 38550, 34952}
14+
set ANSI green color to {34952, 15934, 38550}
15+
set ANSI yellow color to {15934, 19532, 38550}
16+
set ANSI blue color to {38550, 34952, 15934}
17+
set ANSI magenta color to {19532, 38550, 15934}
18+
set ANSI cyan color to {38550, 15934, 19532}
19+
set ANSI white color to {42919, 52942, 51400}
20+
21+
-- Set Bright ANSI Colors
22+
set ANSI bright black color to {6168, 20046, 17733}
23+
set ANSI bright red color to {15934, 38550, 34952}
24+
set ANSI bright green color to {34952, 15934, 38550}
25+
set ANSI bright yellow color to {15934, 19532, 38550}
26+
set ANSI bright blue color to {38550, 34952, 15934}
27+
set ANSI bright magenta color to {19532, 38550, 15934}
28+
set ANSI bright cyan color to {38550, 15934, 19532}
29+
set ANSI bright white color to {53970, 59367, 58596}
30+
end tell
31+
end tell
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
(*
2+
base16 Apprentice
3+
Scheme author: romainl
4+
Template author: Tinted Theming (https://github.com/tinted-theming)
5+
*)
6+
tell application "iTerm2"
7+
tell current session of current window
8+
set background color to {9766, 9766, 9766}
9+
set foreground color to {24415, 24415, 34695}
10+
11+
-- Set ANSI Colors
12+
set ANSI black color to {44975, 24415, 24415}
13+
set ANSI red color to {17476, 17476, 17476}
14+
set ANSI green color to {65535, 65535, 44975}
15+
set ANSI yellow color to {34695, 44975, 34695}
16+
set ANSI blue color to {34695, 34695, 44975}
17+
set ANSI magenta color to {24415, 44975, 44975}
18+
set ANSI cyan color to {34695, 44975, 55255}
19+
set ANSI white color to {24415, 34695, 34695}
20+
21+
-- Set Bright ANSI Colors
22+
set ANSI bright black color to {24415, 34695, 24415}
23+
set ANSI bright red color to {17476, 17476, 17476}
24+
set ANSI bright green color to {65535, 65535, 44975}
25+
set ANSI bright yellow color to {34695, 44975, 34695}
26+
set ANSI bright blue color to {34695, 34695, 44975}
27+
set ANSI bright magenta color to {24415, 44975, 44975}
28+
set ANSI bright cyan color to {34695, 44975, 55255}
29+
set ANSI bright white color to {27756, 27756, 27756}
30+
end tell
31+
end tell
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
(*
2+
base16 Ashes
3+
Scheme author: Jannik Siebert (https://github.com/janniks)
4+
Template author: Tinted Theming (https://github.com/tinted-theming)
5+
*)
6+
tell application "iTerm2"
7+
tell current session of current window
8+
set background color to {7196, 8224, 8995}
9+
set foreground color to {51143, 52428, 53713}
10+
11+
-- Set ANSI Colors
12+
set ANSI black color to {14649, 16191, 17733}
13+
set ANSI red color to {51143, 44718, 38293}
14+
set ANSI green color to {38293, 51143, 44718}
15+
set ANSI yellow color to {44718, 51143, 38293}
16+
set ANSI blue color to {44718, 38293, 51143}
17+
set ANSI magenta color to {51143, 38293, 44718}
18+
set ANSI cyan color to {38293, 44718, 51143}
19+
set ANSI white color to {57311, 58082, 58853}
20+
21+
-- Set Bright ANSI Colors
22+
set ANSI bright black color to {22102, 24158, 25957}
23+
set ANSI bright red color to {51143, 44718, 38293}
24+
set ANSI bright green color to {38293, 51143, 44718}
25+
set ANSI bright yellow color to {44718, 51143, 38293}
26+
set ANSI bright blue color to {44718, 38293, 51143}
27+
set ANSI bright magenta color to {51143, 38293, 44718}
28+
set ANSI bright cyan color to {38293, 44718, 51143}
29+
set ANSI bright white color to {62451, 62708, 62965}
30+
end tell
31+
end tell
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
(*
2+
base16 Atelier Cave Light
3+
Scheme author: Bram de Haan (http://atelierbramdehaan.nl)
4+
Template author: Tinted Theming (https://github.com/tinted-theming)
5+
*)
6+
tell application "iTerm2"
7+
tell current session of current window
8+
set background color to {61423, 60652, 62708}
9+
set foreground color to {22616, 21074, 24672}
10+
11+
-- Set ANSI Colors
12+
set ANSI black color to {58082, 57311, 59367}
13+
set ANSI red color to {48830, 17990, 30840}
14+
set ANSI green color to {10794, 37522, 37522}
15+
set ANSI yellow color to {41120, 28270, 15163}
16+
set ANSI blue color to {22359, 28013, 56283}
17+
set ANSI magenta color to {38293, 23130, 59367}
18+
set ANSI cyan color to {14649, 35723, 50886}
19+
set ANSI white color to {9766, 8995, 10794}
20+
21+
-- Set Bright ANSI Colors
22+
set ANSI bright black color to {35723, 34695, 37522}
23+
set ANSI bright red color to {48830, 17990, 30840}
24+
set ANSI bright green color to {10794, 37522, 37522}
25+
set ANSI bright yellow color to {41120, 28270, 15163}
26+
set ANSI bright blue color to {22359, 28013, 56283}
27+
set ANSI bright magenta color to {38293, 23130, 59367}
28+
set ANSI bright cyan color to {14649, 35723, 50886}
29+
set ANSI bright white color to {6425, 5911, 7196}
30+
end tell
31+
end tell
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
(*
2+
base16 Atelier Cave
3+
Scheme author: Bram de Haan (http://atelierbramdehaan.nl)
4+
Template author: Tinted Theming (https://github.com/tinted-theming)
5+
*)
6+
tell application "iTerm2"
7+
tell current session of current window
8+
set background color to {6425, 5911, 7196}
9+
set foreground color to {35723, 34695, 37522}
10+
11+
-- Set ANSI Colors
12+
set ANSI black color to {9766, 8995, 10794}
13+
set ANSI red color to {48830, 17990, 30840}
14+
set ANSI green color to {10794, 37522, 37522}
15+
set ANSI yellow color to {41120, 28270, 15163}
16+
set ANSI blue color to {22359, 28013, 56283}
17+
set ANSI magenta color to {38293, 23130, 59367}
18+
set ANSI cyan color to {14649, 35723, 50886}
19+
set ANSI white color to {58082, 57311, 59367}
20+
21+
-- Set Bright ANSI Colors
22+
set ANSI bright black color to {22616, 21074, 24672}
23+
set ANSI bright red color to {48830, 17990, 30840}
24+
set ANSI bright green color to {10794, 37522, 37522}
25+
set ANSI bright yellow color to {41120, 28270, 15163}
26+
set ANSI bright blue color to {22359, 28013, 56283}
27+
set ANSI bright magenta color to {38293, 23130, 59367}
28+
set ANSI bright cyan color to {14649, 35723, 50886}
29+
set ANSI bright white color to {61423, 60652, 62708}
30+
end tell
31+
end tell
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
(*
2+
base16 Atelier Dune Light
3+
Scheme author: Bram de Haan (http://atelierbramdehaan.nl)
4+
Template author: Tinted Theming (https://github.com/tinted-theming)
5+
*)
6+
tell application "iTerm2"
7+
tell current session of current window
8+
set background color to {65278, 64507, 60652}
9+
set foreground color to {28270, 27499, 24158}
10+
11+
-- Set ANSI Colors
12+
set ANSI black color to {59624, 58596, 53199}
13+
set ANSI red color to {55255, 14135, 14135}
14+
set ANSI green color to {24672, 44204, 14649}
15+
set ANSI yellow color to {44718, 38293, 4883}
16+
set ANSI blue color to {26214, 33924, 57825}
17+
set ANSI magenta color to {47288, 21588, 54484}
18+
set ANSI cyan color to {7967, 44461, 33667}
19+
set ANSI white color to {10537, 10280, 9252}
20+
21+
-- Set Bright ANSI Colors
22+
set ANSI bright black color to {42662, 41634, 35980}
23+
set ANSI bright red color to {55255, 14135, 14135}
24+
set ANSI bright green color to {24672, 44204, 14649}
25+
set ANSI bright yellow color to {44718, 38293, 4883}
26+
set ANSI bright blue color to {26214, 33924, 57825}
27+
set ANSI bright magenta color to {47288, 21588, 54484}
28+
set ANSI bright cyan color to {7967, 44461, 33667}
29+
set ANSI bright white color to {8224, 8224, 7453}
30+
end tell
31+
end tell
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
(*
2+
base16 Atelier Dune
3+
Scheme author: Bram de Haan (http://atelierbramdehaan.nl)
4+
Template author: Tinted Theming (https://github.com/tinted-theming)
5+
*)
6+
tell application "iTerm2"
7+
tell current session of current window
8+
set background color to {8224, 8224, 7453}
9+
set foreground color to {42662, 41634, 35980}
10+
11+
-- Set ANSI Colors
12+
set ANSI black color to {10537, 10280, 9252}
13+
set ANSI red color to {55255, 14135, 14135}
14+
set ANSI green color to {24672, 44204, 14649}
15+
set ANSI yellow color to {44718, 38293, 4883}
16+
set ANSI blue color to {26214, 33924, 57825}
17+
set ANSI magenta color to {47288, 21588, 54484}
18+
set ANSI cyan color to {7967, 44461, 33667}
19+
set ANSI white color to {59624, 58596, 53199}
20+
21+
-- Set Bright ANSI Colors
22+
set ANSI bright black color to {28270, 27499, 24158}
23+
set ANSI bright red color to {55255, 14135, 14135}
24+
set ANSI bright green color to {24672, 44204, 14649}
25+
set ANSI bright yellow color to {44718, 38293, 4883}
26+
set ANSI bright blue color to {26214, 33924, 57825}
27+
set ANSI bright magenta color to {47288, 21588, 54484}
28+
set ANSI bright cyan color to {7967, 44461, 33667}
29+
set ANSI bright white color to {65278, 64507, 60652}
30+
end tell
31+
end tell

0 commit comments

Comments
 (0)