all repos — nixfiles @ 2e2883cbb2f61bfebbad09fa2a082df7375e8fe4

System and user configuration, managed by nix and home-manager

user/settings/fish/per-term/set-terminal-theme.applescript (view raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env osascript
use scripting additions

to getSystemAppearance()
	tell application "System Events"
		set isDark to dark mode of appearance preferences
	end tell
	
	if isDark then
		return "dark"
	else
		return "light"
	end if
end getSystemAppearance

to setTerminalProfile(targetProfile)
	tell application "Terminal"
		set default settings to settings set targetProfile
		set startup settings to settings set targetProfile
		
		repeat with existingWindow in windows
			set current settings of existingWindow to settings set targetProfile
		end repeat
	end tell
end setTerminalProfile

on run argv
	set lightProfile to "Flexoki Light"
	set darkProfile to "Flexoki Dark"
	
	if length of argv is 0 then
		set targetMode to getSystemAppearance()
	else
		set targetMode to item 1 of argv
	end if
	
	if targetMode = "dark" then
		setTerminalProfile(darkProfile)
	else
		setTerminalProfile(lightProfile)
	end if
end run