MCPcopy Index your code
hub / github.com/material-shell/material-shell / constructor

Method constructor

src/manager/msThemeManager.ts:73–158  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

71 throttledDisplaySetCursor: () => void;
72
73 constructor() {
74 super();
75 this.themeContext = St.ThemeContext.get_for_stage(global.stage);
76 this.theme = this.themeContext.get_theme();
77 this.themeSettings = getSettings('theme');
78 this.themeFile = Gio.file_new_for_path(
79 `${GLib.get_user_cache_dir()}/${
80 Me.instance.metadata.uuid
81 }-theme.css`
82 );
83 this.themeValue = this.themeSettings.get_string('theme')!;
84 this.primary = this.themeSettings.get_string('primary-color')!;
85 this.primaryColor = parseCoglColor(this.primary);
86 this.metaCursor = Meta.Cursor.DEFAULT;
87 let displayedCursor: Meta.Cursor = this.metaCursor;
88 this.throttledDisplaySetCursor = throttle(
89 () => {
90 if (displayedCursor == this.metaCursor) return;
91 displayedCursor = this.metaCursor;
92 return global.display.set_cursor(this.metaCursor);
93 },
94 16,
95 { leading: false }
96 );
97 this.observe(this.themeContext, 'changed', () => {
98 Debug.log('theme changed');
99 this.theme = this.themeContext.get_theme();
100
101 if (Main.layoutManager.uiGroup.has_style_class_name('no-theme')) {
102 Main.layoutManager.uiGroup.remove_style_class_name('no-theme');
103 }
104 if (!this.theme.application_stylesheet) {
105 Main.layoutManager.uiGroup.add_style_class_name('no-theme');
106 }
107 });
108 this.observe(this.themeSettings, 'changed::theme', (schema) => {
109 this.themeValue = schema.get_string('theme');
110 this.regenerateStylesheet();
111 });
112 this.observe(this.themeSettings, 'changed::primary-color', (schema) => {
113 this.primary = schema.get_string('primary-color');
114 this.primaryColor = parseCoglColor(this.primary);
115 this.regenerateStylesheet();
116 });
117 this.observe(
118 this.themeSettings,
119 'changed::vertical-panel-position',
120 () => {
121 this.emit(msThemeSignalEnum.VerticalPanelPositionChanged);
122 }
123 );
124 this.observe(
125 this.themeSettings,
126 'changed::horizontal-panel-position',
127 () => {
128 this.emit(msThemeSignalEnum.HorizontalPanelPositionChanged);
129 }
130 );

Callers

nothing calls this directly

Calls 13

regenerateStylesheetMethod · 0.95
getSettingsFunction · 0.90
throttleFunction · 0.90
parseCoglColorFunction · 0.85
has_style_class_nameMethod · 0.80
add_style_class_nameMethod · 0.80
get_themeMethod · 0.65
get_stringMethod · 0.65
set_cursorMethod · 0.65
logMethod · 0.65
emitMethod · 0.65

Tested by

no test coverage detected