diff --git a/overlays/default.nix b/overlays/default.nix new file mode 100644 index 0000000..148688c --- /dev/null +++ b/overlays/default.nix @@ -0,0 +1,15 @@ +{pkgs, ...}: { + nixpkgs.overlays = [ + (self: super: { + nsxiv = super.nsxiv.overrideAttrs (old: { + buildInputs = old.buildInputs ++ [pkgs.xorg.libXcursor]; + env.NIX_LDFLAGS = "-lXcursor"; + patches = [./nsxiv.diff]; + }); + maim = super.maim.overrideAttrs (old: { + buildInputs = old.buildInputs ++ [pkgs.xorg.libXcursor]; + env.NIX_LDFLAGS = "-lXcursor"; + }); + }) + ]; +} diff --git a/overlays/nsxiv.diff b/overlays/nsxiv.diff new file mode 100644 index 0000000..ff7e712 --- /dev/null +++ b/overlays/nsxiv.diff @@ -0,0 +1,61 @@ +--- a/config.def.h ++++ b/config.def.h +@@ -191,9 +191,9 @@ + static const button_t buttons_img[] = { + /* modifiers button function argument */ + { 0, 1, i_cursor_navigate, None }, +- { ControlMask, 1, i_drag, DRAG_RELATIVE }, + { 0, 2, i_drag, DRAG_ABSOLUTE }, +- { 0, 3, g_switch_mode, None }, ++ { 0, 3, i_drag, DRAG_RELATIVE }, ++ { ControlMask, 3, g_switch_mode, None }, + { 0, 4, g_zoom, +1 }, + { 0, 5, g_zoom, -1 }, + }; +--- a/window.c ++++ b/window.c +@@ -31,6 +31,7 @@ + #include + #include + #include ++#include + + #if HAVE_LIBFONTS + #include "utf8.h" +@@ -53,15 +54,18 @@ + static GC gc; + static int barheight; + static struct { +- int name; ++ union { ++ char *name; ++ int num; ++ }; + Cursor icon; + } cursors[CURSOR_COUNT] = { +- { XC_left_ptr }, ++ { "left_ptr" }, + { XC_dotbox }, +- { XC_fleur }, ++ { "dnd-move" }, +- { XC_watch }, ++ { "wait" }, +- { XC_sb_left_arrow }, ++ { "left-arrow" }, +- { XC_sb_right_arrow } ++ { "right-arrow" } + }; + + #if HAVE_LIBFONTS +@@ -272,7 +276,10 @@ + + for (i = 0; i < (int)ARRLEN(cursors); i++) { + if (i != CURSOR_NONE) +- cursors[i].icon = XCreateFontCursor(e->dpy, cursors[i].name); ++ if (cursors[i].num < 0x100) ++ cursors[i].icon = XCreateFontCursor(e->dpy, cursors[i].num); ++ else ++ cursors[i].icon = XcursorLibraryLoadCursor(e->dpy, cursors[i].name); + } + if (XAllocNamedColor(e->dpy, e->cmap, "black", &col, &col) == 0) + error(EXIT_FAILURE, 0, "Error allocating color 'black'"); diff --git a/system/default.nix b/system/default.nix index a150792..58d4279 100644 --- a/system/default.nix +++ b/system/default.nix @@ -9,6 +9,7 @@ ./plasma.nix ./security.nix ./virt.nix + ../overlays ]; options.u = { has = { diff --git a/user/bin/default.nix b/user/bin/default.nix index 6ca9b82..eea9693 100644 --- a/user/bin/default.nix +++ b/user/bin/default.nix @@ -5,8 +5,8 @@ }: let deps = { bell = [pkgs.pipewire pkgs.libnotify]; - #nsxiv-rifle = [pkgs.nsxiv]; - #screenshot = [pkgs.maim pkgs.xclip]; + nsxiv-rifle = [pkgs.nsxiv]; + screenshot = [pkgs.maim pkgs.xclip]; }; ln = config.u.lib.ln "${config.u.confPath}/user/bin"; in { diff --git a/user/default.nix b/user/default.nix index 7e22862..05ace81 100644 --- a/user/default.nix +++ b/user/default.nix @@ -15,6 +15,7 @@ ./share ./theme.nix ./xdg.nix + ../overlays ]; home.homeDirectory = lib.mkDefault "/home/${config.home.username}"; home.stateVersion = "24.05"; diff --git a/user/options.nix b/user/options.nix index cfa0df7..1563148 100644 --- a/user/options.nix +++ b/user/options.nix @@ -71,11 +71,6 @@ ln = base: x: config.lib.file.mkOutOfStoreSymlink "${base}/${x}"; lnh = ln "${config.home.homeDirectory}"; lnn = ln "${config.u.confPath}"; - fixXcursor = pkg: - pkg.overrideAttrs { - buildInputs = pkg.buildInputs ++ [pkgs.xorg.libXcursor]; - env.NIX_LDFLAGS = "-lXcursor"; - }; localHome = pkg: name: bin: pkgs.symlinkJoin { name = name; diff --git a/user/packages.nix b/user/packages.nix index 0b956df..557b314 100644 --- a/user/packages.nix +++ b/user/packages.nix @@ -33,10 +33,10 @@ (config.u.lib.localHome pkgs.firefox-bin "firefox" "bin/firefox") alacritty mpv - (config.u.lib.fixXcursor nsxiv) + nsxiv rofi sct - (config.u.lib.fixXcursor maim) + maim xclip copyq picom