fix(cursor): get rid of gtk4 warning and refactor
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
d6390db32d
commit
6b097eb53f
4 changed files with 40 additions and 60 deletions
|
@ -9,36 +9,21 @@ self: {
|
||||||
inherit (lib) mkIf;
|
inherit (lib) mkIf;
|
||||||
|
|
||||||
cfg = osConfig.roles.desktop;
|
cfg = osConfig.roles.desktop;
|
||||||
|
|
||||||
cursorTheme = dracula.hyprcursor;
|
|
||||||
cursorThemeName = "Dracula-cursors";
|
|
||||||
hyprcursorThemeName = "Dracula-hyprcursor";
|
|
||||||
cursorSize = 24;
|
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
home.pointerCursor = {
|
home.pointerCursor = {
|
||||||
name = cursorThemeName;
|
name = "Dracula-cursors";
|
||||||
package = dracula.gtk;
|
package = dracula.gtk;
|
||||||
size = cursorSize;
|
size = 24;
|
||||||
|
|
||||||
gtk.enable = true;
|
gtk.enable = true;
|
||||||
|
hyprcursor.enable = true;
|
||||||
x11 = {
|
|
||||||
enable = true;
|
|
||||||
defaultCursor = cursorThemeName;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
home.file.".local/share/icons/${hyprcursorThemeName}".source = cursorTheme;
|
# Fixes Gtk4 apps complaining about mismatched cursor size
|
||||||
|
|
||||||
wayland.windowManager.hyprland.settings = {
|
wayland.windowManager.hyprland.settings = {
|
||||||
envd = [
|
|
||||||
"XCURSOR_THEME, ${cursorThemeName}"
|
|
||||||
"XCURSOR_SIZE, ${toString cursorSize}"
|
|
||||||
];
|
|
||||||
|
|
||||||
exec-once = [
|
exec-once = [
|
||||||
"hyprctl setcursor ${hyprcursorThemeName} ${toString cursorSize}"
|
"gsettings set org.gnome.desktop.interface cursor-size 30"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,11 +14,6 @@ lib.makeScope pkgs.newScope (drac: {
|
||||||
|
|
||||||
gtk = import ./gtk.nix {inherit (inputs) gtk-theme-src pkgs;};
|
gtk = import ./gtk.nix {inherit (inputs) gtk-theme-src pkgs;};
|
||||||
|
|
||||||
hyprcursor = drac.callPackage ./hyprcursor.nix {
|
|
||||||
inherit (inputs) gtk-theme-src mkVersion;
|
|
||||||
inherit pkgs;
|
|
||||||
};
|
|
||||||
|
|
||||||
plymouth = drac.callPackage ./plymouth.nix {
|
plymouth = drac.callPackage ./plymouth.nix {
|
||||||
inherit (inputs) dracula-plymouth-src mkVersion;
|
inherit (inputs) dracula-plymouth-src mkVersion;
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,4 +6,39 @@
|
||||||
pkgs.dracula-theme.overrideAttrs (o: {
|
pkgs.dracula-theme.overrideAttrs (o: {
|
||||||
version = o.version + "+" + gtk-theme-src.shortRev;
|
version = o.version + "+" + gtk-theme-src.shortRev;
|
||||||
src = gtk-theme-src;
|
src = gtk-theme-src;
|
||||||
|
|
||||||
|
# Generate hyprcursor theme
|
||||||
|
buildInputs =
|
||||||
|
(o.buildInputs or [])
|
||||||
|
++ (builtins.attrValues {
|
||||||
|
inherit
|
||||||
|
(pkgs)
|
||||||
|
hyprcursor
|
||||||
|
xcur2png
|
||||||
|
;
|
||||||
|
});
|
||||||
|
|
||||||
|
preInstall = ''
|
||||||
|
${o.preInstall or ""}
|
||||||
|
|
||||||
|
mkdir -p $out/share/icons/Dracula-cursors
|
||||||
|
|
||||||
|
cd ./kde/cursors
|
||||||
|
|
||||||
|
hyprcursor-util --extract ./Dracula-cursors
|
||||||
|
|
||||||
|
# this creates a symlink to 'theme_Extracted Theme' for some reason
|
||||||
|
hyprcursor-util --create ./extracted_Dracula-cursors
|
||||||
|
mv 'theme_Extracted Theme' ./extracted
|
||||||
|
|
||||||
|
cat <<EOF > ./extracted/manifest.hl
|
||||||
|
name = Dracula-cursors
|
||||||
|
description = Automatically extracted with hyprcursor-util
|
||||||
|
version = 0.1
|
||||||
|
cursors_directory = hyprcursors
|
||||||
|
EOF
|
||||||
|
|
||||||
|
mv ./extracted/* $out/share/icons/Dracula-cursors/
|
||||||
|
cd ../..
|
||||||
|
'';
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
{
|
|
||||||
gtk-theme-src,
|
|
||||||
mkVersion,
|
|
||||||
pkgs,
|
|
||||||
stdenv,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
stdenv.mkDerivation {
|
|
||||||
pname = "dracula-hyprcursor";
|
|
||||||
version = mkVersion gtk-theme-src;
|
|
||||||
|
|
||||||
src = "${gtk-theme-src}/kde/cursors";
|
|
||||||
|
|
||||||
buildInputs = builtins.attrValues {
|
|
||||||
inherit
|
|
||||||
(pkgs)
|
|
||||||
hyprcursor
|
|
||||||
xcur2png
|
|
||||||
;
|
|
||||||
};
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
hyprcursor-util --extract ./Dracula-cursors
|
|
||||||
hyprcursor-util --create ./extracted_Dracula-cursors
|
|
||||||
|
|
||||||
cat <<EOF > ./extracted_Dracula-cursors/manifest.hl
|
|
||||||
name = Dracula-cursors
|
|
||||||
description = Automatically extracted with hyprcursor-util
|
|
||||||
version = 0.1
|
|
||||||
cursors_directory = hyprcursors
|
|
||||||
EOF
|
|
||||||
|
|
||||||
mv 'theme_Extracted Theme' $out
|
|
||||||
'';
|
|
||||||
}
|
|
Loading…
Reference in a new issue