Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion material-you-theme@asubbiah.com/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ function apply_theme(base_presets, color_mappings, notify=false) {
let css = "";
for (const key in base_preset.variables) {
css += "@define-color " + key + " " + base_preset.variables[key] + ";\n"
if (key === "window_bg_color") run_pywal(base_preset.variables[key], wall_path)
}
Comment on lines +155 to 156

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (key === "window_bg_color") run_pywal(base_preset.variables[key], wall_path)
}
}
run_pywal(base_preset.variables[window_bg_color], wall_path)

for (const prefix_key in base_preset.palette) {
for (const key_2 in base_preset.palette[prefix_key]) {
Expand All @@ -165,7 +166,7 @@ function apply_theme(base_presets, color_mappings, notify=false) {
write_str(css, config_path + "/gtk-4.0/gtk.css");
write_str(css, config_path + "/gtk-3.0/gtk.css");

if (ext_utils.check_npm()) {
if (ext_utils.check_bin('/usr/bin/sassc')) {
const version = Config.PACKAGE_VERSION.substring(0, 2);

modify_colors(
Expand Down Expand Up @@ -382,3 +383,15 @@ function map_colors(color_mapping, base_preset, scheme) {
}
return base_preset;
}

function run_pywal(background, image) {
if(!ext_utils.check_bin('/usr/bin/wal')) return
try {
Gio.Subprocess.new(
['/usr/bin/wal', '-b', background, '-i', image],
Gio.SubprocessFlags.NONE
);
} catch (e) {
logError(e);
}
}
4 changes: 2 additions & 2 deletions material-you-theme@asubbiah.com/utils/ext_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();
const EXTENSIONDIR = Me.dir.get_path();

function check_npm() {
const file = Gio.File.new_for_path(EXTENSIONDIR + "/node_modules/sass/sass.js");
function check_bin(path) {
const file = Gio.File.new_for_path(path);
return file.query_exists(null);
}