stylix: optionalize cursor and disable by default (#943)
Closes: https://github.com/danth/stylix/issues/940 Link: https://github.com/danth/stylix/pull/943 Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com> Reviewed-by: Daniel Thwaites <danth@danth.me>
This commit is contained in:
parent
08e0c91d76
commit
6a2e525887
10 changed files with 88 additions and 64 deletions
|
|
@ -55,15 +55,19 @@ in
|
|||
|
||||
# Cursor settings are usually applied via Home Manager,
|
||||
# but the login screen uses a separate database.
|
||||
environment.systemPackages = [ config.stylix.cursor.package ];
|
||||
programs.dconf.profiles.gdm.databases = [
|
||||
{
|
||||
lockAll = true;
|
||||
settings."org/gnome/desktop/interface" = {
|
||||
cursor-theme = config.stylix.cursor.name;
|
||||
cursor-size = lib.gvariant.mkInt32 config.stylix.cursor.size;
|
||||
};
|
||||
}
|
||||
environment.systemPackages = lib.mkIf (config.stylix.cursor != null) [
|
||||
config.stylix.cursor.package
|
||||
];
|
||||
programs.dconf.profiles.gdm.databases =
|
||||
lib.mkIf (config.stylix.cursor != null)
|
||||
[
|
||||
{
|
||||
lockAll = true;
|
||||
settings."org/gnome/desktop/interface" = {
|
||||
cursor-theme = config.stylix.cursor.name;
|
||||
cursor-size = lib.gvariant.mkInt32 config.stylix.cursor.size;
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -280,18 +280,26 @@ let
|
|||
|
||||
configPackage =
|
||||
pkgs.runCommandLocal "stylix-kde-config"
|
||||
{
|
||||
kcminputrc = formatConfig kcminputrc;
|
||||
kded5rc = formatConfig kded5rc;
|
||||
kdeglobals = formatConfig kdeglobals;
|
||||
}
|
||||
''
|
||||
mkdir "$out"
|
||||
(
|
||||
{
|
||||
kded5rc = formatConfig kded5rc;
|
||||
kdeglobals = formatConfig kdeglobals;
|
||||
}
|
||||
// (lib.optionalAttrs (config.stylix.cursor != null) {
|
||||
kcminputrc = formatConfig kcminputrc;
|
||||
})
|
||||
)
|
||||
(
|
||||
''
|
||||
mkdir "$out"
|
||||
|
||||
printf '%s\n' "$kcminputrc" >"$out/kcminputrc"
|
||||
printf '%s\n' "$kded5rc" >"$out/kded5rc"
|
||||
printf '%s\n' "$kdeglobals" >"$out/kdeglobals"
|
||||
'';
|
||||
printf '%s\n' "$kded5rc" >"$out/kded5rc"
|
||||
printf '%s\n' "$kdeglobals" >"$out/kdeglobals"
|
||||
''
|
||||
+ (lib.optionalString (
|
||||
config.stylix.cursor != null
|
||||
) ''printf '%s\n' "$kcminputrc" >"$out/kcminputrc"'')
|
||||
);
|
||||
|
||||
# plasma-apply-wallpaperimage is necessary to change the wallpaper
|
||||
# after the first login.
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ in
|
|||
font = {
|
||||
inherit (config.stylix.fonts.sansSerif) name package;
|
||||
};
|
||||
cursorTheme = {
|
||||
cursorTheme = lib.mkIf (config.stylix.cursor != null) {
|
||||
inherit (config.stylix.cursor) name package;
|
||||
};
|
||||
theme = {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,9 @@
|
|||
border-color-unfocused = "0x${colors.base03}";
|
||||
border-color-urgent = "0x${colors.base08}";
|
||||
background-color = "0x${colors.base00}";
|
||||
xcursor-theme = "${cursor.name} ${toString cursor.size}";
|
||||
xcursor-theme = lib.mkIf (
|
||||
config.stylix.cursor != null
|
||||
) "${cursor.name} ${toString cursor.size}";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,8 +63,9 @@ in
|
|||
|
||||
output."*".bg =
|
||||
lib.mkIf cfg.useWallpaper "${config.stylix.image} ${config.stylix.imageScalingMode}";
|
||||
seat."*".xcursor_theme =
|
||||
''"${config.stylix.cursor.name}" ${toString config.stylix.cursor.size}'';
|
||||
seat."*".xcursor_theme = lib.mkIf (
|
||||
config.stylix.cursor != null
|
||||
) ''"${config.stylix.cursor.name}" ${toString config.stylix.cursor.size}'';
|
||||
};
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -1,21 +1,26 @@
|
|||
{ pkgs, lib, ... }:
|
||||
{ lib, ... }:
|
||||
|
||||
{
|
||||
options.stylix.cursor = {
|
||||
name = lib.mkOption {
|
||||
description = "The cursor name within the package.";
|
||||
type = lib.types.str;
|
||||
default = "Vanilla-DMZ";
|
||||
};
|
||||
package = lib.mkOption {
|
||||
description = "Package providing the cursor theme.";
|
||||
type = lib.types.package;
|
||||
default = pkgs.vanilla-dmz;
|
||||
};
|
||||
size = lib.mkOption {
|
||||
description = "The cursor size.";
|
||||
type = lib.types.int;
|
||||
default = 32;
|
||||
};
|
||||
options.stylix.cursor = lib.mkOption {
|
||||
description = "Attributes defining the systemwide cursor.";
|
||||
type = lib.types.nullOr (
|
||||
lib.types.submodule {
|
||||
options = {
|
||||
name = lib.mkOption {
|
||||
description = "The cursor name within the package.";
|
||||
type = lib.types.str;
|
||||
};
|
||||
package = lib.mkOption {
|
||||
description = "Package providing the cursor theme.";
|
||||
type = lib.types.package;
|
||||
};
|
||||
size = lib.mkOption {
|
||||
description = "The cursor size.";
|
||||
type = lib.types.int;
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
default = null;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,11 +10,18 @@ let
|
|||
|
||||
in
|
||||
{
|
||||
config = lib.mkIf (config.stylix.enable && pkgs.stdenv.hostPlatform.isLinux) {
|
||||
home.pointerCursor = {
|
||||
inherit (cfg) name package size;
|
||||
x11.enable = true;
|
||||
gtk.enable = true;
|
||||
};
|
||||
};
|
||||
config =
|
||||
lib.mkIf
|
||||
(
|
||||
config.stylix.enable
|
||||
&& config.stylix.cursor != null
|
||||
&& pkgs.stdenv.hostPlatform.isLinux
|
||||
)
|
||||
{
|
||||
home.pointerCursor = {
|
||||
inherit (cfg) name package size;
|
||||
x11.enable = true;
|
||||
gtk.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,21 +36,6 @@ let
|
|||
path = [
|
||||
"stylix"
|
||||
"cursor"
|
||||
"name"
|
||||
];
|
||||
}
|
||||
{
|
||||
path = [
|
||||
"stylix"
|
||||
"cursor"
|
||||
"package"
|
||||
];
|
||||
}
|
||||
{
|
||||
path = [
|
||||
"stylix"
|
||||
"cursor"
|
||||
"size"
|
||||
];
|
||||
}
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
config = lib.mkIf config.stylix.enable {
|
||||
config = lib.mkIf (config.stylix.enable && config.stylix.cursor != null) {
|
||||
environment.variables.XCURSOR_SIZE = toString config.stylix.cursor.size;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -142,6 +142,7 @@ let
|
|||
stylix.polarity
|
||||
"image${lib.optionalString (stylix.image or null == null) "less"}"
|
||||
"scheme${lib.optionalString (stylix.base16Scheme or null == null) "less"}"
|
||||
"cursor${lib.optionalString (stylix.cursor or null == null) "less"}"
|
||||
]
|
||||
);
|
||||
|
||||
|
|
@ -226,6 +227,17 @@ let
|
|||
image = images.dark;
|
||||
polarity = "dark";
|
||||
}
|
||||
{
|
||||
enable = true;
|
||||
image = images.dark;
|
||||
base16Scheme = "${inputs.tinted-schemes}/base16/catppuccin-macchiato.yaml";
|
||||
polarity = "dark";
|
||||
cursor = {
|
||||
name = "Vanilla-DMZ";
|
||||
package = pkgs.vanilla-dmz;
|
||||
size = 32;
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
in
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue