A fork of the Materia GTK theme.

By using this site, you agree to have cookies stored on your device, strictly for functional purposes, such as storing your session and preferences.

Dismiss

 meson.build

View raw Download
text/plain • 2.49 kiB
ASCII text
        
            
1
gtk4_launch = find_program('gtk4-launch', required: false)
2
3
if get_option('gtk4_version') != ''
4
gtk4_full_version = get_option('gtk4_version')
5
elif gtk4_launch.found()
6
gtk4_full_version = run_command(gtk4_launch, '--version').stdout()
7
else
8
message('gtk4-launch not found, using styles for last gtk4 version availible')
9
gtk4_full_version = '4.0'
10
endif
11
12
gtk4_version_array = gtk4_full_version.split('.')
13
if gtk4_version_array[1].to_int().is_even()
14
gtk4_version = gtk4_version_array[0] + '.' + gtk4_version_array[1]
15
else
16
gtk4_version = gtk4_version_array[0] + '.' + (gtk4_version_array[1].to_int() + 1).to_string()
17
endif
18
message('Set gtk4 version to ' + gtk4_version)
19
20
gtk4_scss_depend_files = files([
21
'../_color-palette.scss',
22
'../_shadow.scss',
23
'../_theme.scss',
24
'../_theme-color.scss',
25
'../gtk-3.0/sass/_public-colors.scss',
26
'sass/_common.scss',
27
'sass/_drawing.scss',
28
'sass/_gtk.scss',
29
])
30
31
foreach theme: themes
32
gtk4_dir = join_paths(theme['dir'], 'gtk-4.0')
33
34
gtk4_variants = [
35
'gtk',
36
]
37
38
# Only non-dark themes need a dark variant.
39
if theme['color'] != '-dark'
40
gtk4_variants += 'gtk-dark'
41
endif
42
43
install_subdir(
44
'../gtk-3.0/assets',
45
install_dir: gtk4_dir,
46
)
47
48
install_subdir(
49
'../gtk-3.0/icons',
50
install_dir: gtk4_dir,
51
)
52
53
#
54
# SCSS
55
#
56
57
gtk4_scss_conf = configuration_data()
58
gtk4_scss_conf.set('dark_theme', theme['scss_dark_theme'])
59
gtk4_scss_conf.set('light_topbar', theme['scss_light_topbar'])
60
gtk4_scss_conf.set('compact', theme['scss_compact'])
61
gtk4_scss_conf.set('version', gtk4_version)
62
gtk4_scss_conf.set('current_source_dir', meson.current_source_dir())
63
64
foreach gtk4_variant: gtk4_variants
65
gtk4_temp_name = '@0@.gtk4.@1@'.format(theme['name'], gtk4_variant)
66
67
# Configure SCSS file
68
gtk4_scss = configure_file(
69
input: '@0@.scss.in'.format(gtk4_variant),
70
output: '@0@.scss'.format(gtk4_temp_name),
71
configuration: gtk4_scss_conf,
72
)
73
74
# Generate CSS file
75
gtk4_css = custom_target(
76
'@0@.css'.format(gtk4_temp_name),
77
input: gtk4_scss,
78
output: '@0@.css'.format(gtk4_temp_name),
79
command: [sass, sass_opts, '@INPUT@', '@OUTPUT@'],
80
depend_files: gtk4_scss_depend_files,
81
build_by_default: true,
82
)
83
84
# Install it while renaming to a valid name
85
meson.add_install_script(
86
sh, '-c', 'cp "@0@" "@1@"'.format(
87
gtk4_css.full_path(),
88
join_paths('$MESON_INSTALL_DESTDIR_PREFIX', gtk4_dir, '@0@.css'.format(gtk4_variant)),
89
),
90
)
91
endforeach
92
endforeach
93