From 6b097eb53f873898fec7657b8b4045b066640fcc Mon Sep 17 00:00:00 2001 From: matt1432 Date: Sun, 5 Jan 2025 22:19:36 -0500 Subject: [PATCH] fix(cursor): get rid of gtk4 warning and refactor --- modules/desktop/theme/cursors/default.nix | 25 ++++------------ scopedPackages/dracula/default.nix | 5 ---- scopedPackages/dracula/gtk.nix | 35 +++++++++++++++++++++++ scopedPackages/dracula/hyprcursor.nix | 35 ----------------------- 4 files changed, 40 insertions(+), 60 deletions(-) delete mode 100644 scopedPackages/dracula/hyprcursor.nix diff --git a/modules/desktop/theme/cursors/default.nix b/modules/desktop/theme/cursors/default.nix index 3b6a445c..40a09334 100644 --- a/modules/desktop/theme/cursors/default.nix +++ b/modules/desktop/theme/cursors/default.nix @@ -9,36 +9,21 @@ self: { inherit (lib) mkIf; cfg = osConfig.roles.desktop; - - cursorTheme = dracula.hyprcursor; - cursorThemeName = "Dracula-cursors"; - hyprcursorThemeName = "Dracula-hyprcursor"; - cursorSize = 24; in { config = mkIf cfg.enable { home.pointerCursor = { - name = cursorThemeName; + name = "Dracula-cursors"; package = dracula.gtk; - size = cursorSize; + size = 24; gtk.enable = true; - - x11 = { - enable = true; - defaultCursor = cursorThemeName; - }; + hyprcursor.enable = true; }; - home.file.".local/share/icons/${hyprcursorThemeName}".source = cursorTheme; - + # Fixes Gtk4 apps complaining about mismatched cursor size wayland.windowManager.hyprland.settings = { - envd = [ - "XCURSOR_THEME, ${cursorThemeName}" - "XCURSOR_SIZE, ${toString cursorSize}" - ]; - exec-once = [ - "hyprctl setcursor ${hyprcursorThemeName} ${toString cursorSize}" + "gsettings set org.gnome.desktop.interface cursor-size 30" ]; }; }; diff --git a/scopedPackages/dracula/default.nix b/scopedPackages/dracula/default.nix index 9f7d4c3a..4129b2b6 100644 --- a/scopedPackages/dracula/default.nix +++ b/scopedPackages/dracula/default.nix @@ -14,11 +14,6 @@ lib.makeScope pkgs.newScope (drac: { 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 { inherit (inputs) dracula-plymouth-src mkVersion; }; diff --git a/scopedPackages/dracula/gtk.nix b/scopedPackages/dracula/gtk.nix index 864ed269..59adb23a 100644 --- a/scopedPackages/dracula/gtk.nix +++ b/scopedPackages/dracula/gtk.nix @@ -6,4 +6,39 @@ pkgs.dracula-theme.overrideAttrs (o: { version = o.version + "+" + gtk-theme-src.shortRev; 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 < ./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 ../.. + ''; }) diff --git a/scopedPackages/dracula/hyprcursor.nix b/scopedPackages/dracula/hyprcursor.nix deleted file mode 100644 index 806df66f..00000000 --- a/scopedPackages/dracula/hyprcursor.nix +++ /dev/null @@ -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 < ./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 - ''; -}