vesktop: add support for multiple themes (#6860)
This commit is contained in:
parent
ca8367117a
commit
08b85bd000
3 changed files with 35 additions and 30 deletions
|
|
@ -50,12 +50,15 @@ in
|
|||
|
||||
vencord = {
|
||||
useSystem = lib.mkEnableOption "Vencord package from Nixpkgs";
|
||||
theme = lib.mkOption {
|
||||
description = "The theme to use for Vencord";
|
||||
default = null;
|
||||
themes = lib.mkOption {
|
||||
description = ''
|
||||
Themes to add for Vencord, they can be enabled by setting
|
||||
`programs.vesktop.vencord.settings.enabledThemes` to `[ "THEME_NAME.css" ]`
|
||||
'';
|
||||
default = { };
|
||||
type =
|
||||
with lib.types;
|
||||
nullOr (oneOf [
|
||||
attrsOf (oneOf [
|
||||
lines
|
||||
path
|
||||
]);
|
||||
|
|
@ -89,24 +92,29 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable (
|
||||
lib.mkMerge [
|
||||
{
|
||||
home.packages = [
|
||||
(cfg.package.override { withSystemVencord = cfg.vencord.useSystem; })
|
||||
];
|
||||
xdg.configFile."vesktop/settings.json".source = jsonFormat.generate "vesktop-settings" cfg.settings;
|
||||
xdg.configFile."vesktop/settings/settings.json".source =
|
||||
jsonFormat.generate "vencord-settings" cfg.vencord.settings;
|
||||
}
|
||||
(lib.mkIf (cfg.vencord.theme != null) {
|
||||
programs.vesktop.vencord.settings.enabledThemes = [ "theme.css" ];
|
||||
xdg.configFile."vesktop/themes/theme.css".source =
|
||||
if builtins.isPath cfg.vencord.theme || lib.isStorePath cfg.vencord.theme then
|
||||
cfg.vencord.theme
|
||||
else
|
||||
pkgs.writeText "vesktop/themes/theme.css" cfg.vencord.theme;
|
||||
})
|
||||
]
|
||||
);
|
||||
config = lib.mkIf cfg.enable {
|
||||
home.packages = [
|
||||
(cfg.package.override { withSystemVencord = cfg.vencord.useSystem; })
|
||||
];
|
||||
xdg.configFile =
|
||||
lib.attrsets.unionOfDisjoint
|
||||
{
|
||||
"vesktop/settings.json".source = jsonFormat.generate "vesktop-settings" cfg.settings;
|
||||
"vesktop/settings/settings.json".source =
|
||||
jsonFormat.generate "vencord-settings" cfg.vencord.settings;
|
||||
}
|
||||
(
|
||||
lib.mapAttrs' (
|
||||
name: value:
|
||||
lib.nameValuePair "vesktop/themes/${name}.css" {
|
||||
source =
|
||||
if builtins.isPath value || lib.isStorePath value then
|
||||
value
|
||||
else
|
||||
pkgs.writeText "vesktop-themes-${name}" value;
|
||||
}
|
||||
) cfg.vencord.themes
|
||||
);
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
discordBranch = "stable";
|
||||
};
|
||||
vencord = {
|
||||
theme = ''
|
||||
themes.my_theme = ''
|
||||
.privateChannels_f0963d::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
|
|
@ -51,8 +51,8 @@
|
|||
assertFileExists $configDir/settings/settings.json
|
||||
assertFileContent $configDir/settings/settings.json \
|
||||
${./basic-vencord-settings.json}
|
||||
assertFileExists $configDir/themes/theme.css
|
||||
assertFileContent $configDir/themes/theme.css \
|
||||
assertFileExists $configDir/themes/my_theme.css
|
||||
assertFileContent $configDir/themes/my_theme.css \
|
||||
${./basic-theme.css}
|
||||
'';
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,9 +2,6 @@
|
|||
"autoUpdate": false,
|
||||
"autoUpdateNotification": false,
|
||||
"disableMinSize": true,
|
||||
"enabledThemes": [
|
||||
"theme.css"
|
||||
],
|
||||
"notifyAboutUpdates": false,
|
||||
"plugins": {
|
||||
"FakeNitro": {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue