Update
This commit is contained in:
@@ -73,7 +73,7 @@ let
|
||||
|
||||
in {
|
||||
|
||||
# imports = [ ./duckduckgo-colorscheme.nix ];
|
||||
imports = [ ./duckduckgo-colorscheme.nix ];
|
||||
|
||||
programs.qutebrowser = {
|
||||
enable = true;
|
||||
|
||||
@@ -1,36 +1,38 @@
|
||||
{ config, ... }: {
|
||||
home.file.".duckduckgo-colorscheme.js".text = ''
|
||||
// Go to DuckDuckGo settings page, open the console, paste the code and hit enter.
|
||||
// based on https://ddg.codingcodax.dev/
|
||||
// Cookies string for your theme
|
||||
const cookie = '7=${config.var.theme.colors.bg}; j=${config.var.theme.colors.bg}; 9=${config.var.theme.colors.fg}; aa=${config.var.theme.colors.fgalt}; 8=${config.var.theme.colors.c7}; x=${config.var.theme.colors.accent}; 21=${config.var.theme.colors.bgalt};';
|
||||
home.file.".duckduckgo-colorscheme.js".text =
|
||||
# js
|
||||
''
|
||||
// Go to DuckDuckGo settings page, open the console, paste the code and hit enter.
|
||||
// based on https://ddg.codingcodax.dev/
|
||||
// Cookies string for your theme
|
||||
const cookie = '7=${config.lib.stylix.colors.base00}; j=${config.lib.stylix.colors.base00}; 9=${config.lib.stylix.colors.base05}; aa=${config.lib.stylix.colors.base06}; 8=${config.lib.stylix.colors.base05}; x=${config.lib.stylix.colors.base0D}; 21=${config.lib.stylix.colors.base01};';
|
||||
|
||||
// Converts cookie string into formatted JSON
|
||||
const cookieToJSON = (cookieRaw) => {
|
||||
const cookieJson = {};
|
||||
const items = cookieRaw.split(/[ ,]+/);
|
||||
// Converts cookie string into formatted JSON
|
||||
const cookieToJSON = (cookieRaw) => {
|
||||
const cookieJson = {};
|
||||
const items = cookieRaw.split(/[ ,]+/);
|
||||
|
||||
items.forEach((item) => {
|
||||
const parts = item.split('=');
|
||||
cookieJson[parts[0]] = parts[1];
|
||||
});
|
||||
items.forEach((item) => {
|
||||
const parts = item.split('=');
|
||||
cookieJson[parts[0]] = parts[1];
|
||||
});
|
||||
|
||||
return cookieJson;
|
||||
};
|
||||
return cookieJson;
|
||||
};
|
||||
|
||||
// Iterates over JSON, and adds to browser cookie store
|
||||
const setCookies = (cookieJson) => {
|
||||
Object.keys(cookieJson).forEach((key) => {
|
||||
document.cookie = `''${key}=''${cookieJson [ key ]}`;
|
||||
});
|
||||
};
|
||||
// Iterates over JSON, and adds to browser cookie store
|
||||
const setCookies = (cookieJson) => {
|
||||
Object.keys(cookieJson).forEach((key) => {
|
||||
document.cookie = `''${key}=''${cookieJson [ key ]}`;
|
||||
});
|
||||
};
|
||||
|
||||
alert('The Nixy theme will be applied.');
|
||||
alert('The Nixy theme will be applied.');
|
||||
|
||||
// Call set cookies, passing in formated cookie data
|
||||
setCookies(cookieToJSON(cookie));
|
||||
// Call set cookies, passing in formated cookie data
|
||||
setCookies(cookieToJSON(cookie));
|
||||
|
||||
// All done, reload page for changes to take effect :)
|
||||
location.reload();
|
||||
'';
|
||||
// All done, reload page for changes to take effect :)
|
||||
location.reload();
|
||||
'';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user