feh -> nsxiv and nixpkgs overlay support

This commit is contained in:
LordMZTE 2024-05-09 08:28:26 +02:00
parent 0f82b41a63
commit 1d0fb8136d
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6
5 changed files with 46 additions and 16 deletions

View file

@ -5,6 +5,6 @@ bind = SUPER ALT, SPACE, exec, rofi -show emoji
bind = SUPER CTRL, B, exec, <% opt.commands.browser %>
bind = SUPER SHIFT, P, exec, gpower2
bind = ,PRINT, exec, grim -g "$(slurp; sleep 1)" ~/Downloads/screenshot.png
bind = SHIFT, PRINT, exec, grim -g "$(slurp; sleep 1)" - | feh -
bind = SHIFT, PRINT, exec, grim -g "$(slurp; sleep 1)" - | nsxiv-pipe
bind = SUPER CTRL, V, exec, vinput md
bind = SUPER CTRL, L, exec, physlock

View file

@ -261,9 +261,9 @@ bindsym $mod+Shift+Ctrl+space exec wired --show 1
bindsym Ctrl+Shift+F11 exec xdotool click --delay 10 --repeat 100 1
bindsym Ctrl+Shift+F12 exec xdotool click --delay 10 --repeat 100 3
# capture current screen and open in feh
bindsym Shift+Print exec shotgun -s - | feh --class feh-float -
for_window [class="feh-float"] floating enable
# capture current screen and open in nsxiv
bindsym Shift+Print exec shotgun -s - | nsxiv-pipe -e nsxiv-float
for_window [class="nsxiv-float"] floating enable
# catppuccin mocha theme
set $rosewater #<% opt.catppuccin.rosewater %>

View file

@ -12,16 +12,18 @@
}@inputs: utils.lib.eachDefaultSystem
(system:
let
pkgs = import nixpkgs { inherit system; };
common = pkgs.callPackage ./lib/common-nix { };
base-pkgs = (import nixpkgs { inherit system; });
common = base-pkgs.callPackage ./lib/common-nix { };
root-mod = {
root-mod = { config, pkgs, ... }: {
options.packages = nixpkgs.lib.mkOption { };
options.dev-shells = nixpkgs.lib.mkOption { };
options.nixpkgs.overlays = nixpkgs.lib.mkOption { default = []; };
config._module.args = {
config._module.args = rec {
pkgs = base-pkgs.appendOverlays config.nixpkgs.overlays;
inherit inputs;
inherit pkgs system;
inherit system;
inherit (pkgs) lib stdenv stdenvNoCC;
};
@ -64,7 +66,7 @@
in
{
config = modopt;
mzteinit = pkgs.callPackage ./scripts/mzteinit/package.nix { };
mzteinit = base-pkgs.callPackage ./scripts/mzteinit/package.nix { };
packages = modopt.config.packages;
devShells = modopt.config.dev-shells;
});

View file

@ -5,12 +5,40 @@ in
{
options.mzte-nix-packages = lib.mkOption { };
config.mzte-nix-packages = [
pkgs.nix-output-monitor
pkgs.nix-du
(pkgs.nsxiv.overrideAttrs {
patches = [ (common.confgenFile "cgassets/nix/nsxiv-config.patch") ];
config.nixpkgs.overlays = [
(final: prev: {
nsxiv = prev.nsxiv.overrideAttrs {
patches = [ (common.confgenFile "cgassets/nix/nsxiv-config.patch") ];
};
nsxiv-pipe = prev.stdenvNoCC.mkDerivation {
name = "nsxiv-pipe";
src = prev.fetchurl {
url = "https://codeberg.org/nsxiv/nsxiv-extra/raw/commit/7cdf1a8dba145f2aaf5734b3d084b1d56bea6554/scripts/nsxiv-pipe/nsxiv-pipe";
hash = "sha256-fphucoQzR5gWG78xr68AkclMDF6l9BsgVOVQzjK6vrU=";
};
dontUnpack = true;
dontBuild = true;
dontFixup = true;
installPhase = ''
runHook preInstall
mkdir -p $out/bin
substitute $src $out/bin/nsxiv-pipe \
--replace "nsxiv " "${final.nsxiv}/bin/nsxiv "
chmod +x $out/bin/nsxiv-pipe
patchShebangs $out/bin/nsxiv-pipe
runHook postInstall
'';
};
})
];
config.mzte-nix-packages = with pkgs; [
nix-output-monitor
nix-du
nsxiv
nsxiv-pipe
(flakePkg "github:nix-community/zon2nix")
];

View file

@ -32,7 +32,7 @@ pub fn init(alloc: std.mem.Allocator, initial: bool) !void {
.{ "Alt", "Space", "spawn", journal_prefix ++ "rofi -show combi" },
.{ "Super+Alt", "Space", "spawn", journal_prefix ++ "rofi -show emoji" },
.{ "None", "Print", "spawn", journal_prefix ++ "grim -g \"$(slurp; sleep 1)\" ~/Downloads/screenshot.png" },
.{ "Shift", "Print", "spawn", "grim -g \"$(slurp; sleep 1)\" - | " ++ journal_prefix ++ " feh -" },
.{ "Shift", "Print", "spawn", "grim -g \"$(slurp; sleep 1)\" - | " ++ journal_prefix ++ " nsxiv-pipe" },
// media keys
.{ "None", "XF86Eject", "spawn", journal_prefix ++ "eject -T" },