Skip to content

Commit dc8ee02

Browse files
fix(niri): default wallpaper in store
feat(niri): fuzzel_dmenu as derivation
1 parent 8390186 commit dc8ee02

File tree

4 files changed

+81
-23
lines changed

4 files changed

+81
-23
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{ stdenv
2+
, lib
3+
, makeWrapper
4+
, niri
5+
, jq
6+
, fuzzel
7+
, coreutils
8+
, gnugrep
9+
}:
10+
11+
let
12+
buildInputs = [ niri jq fuzzel coreutils gnugrep ];
13+
in
14+
stdenv.mkDerivation {
15+
pname = "fuzzel_dmenu";
16+
version = "0.1.0";
17+
18+
src = ./fuzzel_dmenu.sh;
19+
20+
inherit buildInputs;
21+
nativeBuildInputs = [ makeWrapper ];
22+
23+
dontUnpack = true;
24+
dontBuild = true;
25+
26+
installPhase = ''
27+
mkdir -p $out/bin
28+
cp $src $out/bin/fuzzel_dmenu
29+
chmod +x $out/bin/fuzzel_dmenu
30+
patchShebangs $out/bin/fuzzel_dmenu
31+
wrapProgram $out/bin/fuzzel_dmenu --prefix PATH : ${lib.makeBinPath buildInputs}
32+
'';
33+
34+
meta = with lib; {
35+
description = "Fuzzel dmenu script for niri window manager";
36+
license = licenses.mit; # Adjust according to your license
37+
platforms = platforms.all;
38+
mainProgram = "fuzzel_dmenu";
39+
};
40+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
3+
set -x
4+
window_list=$(niri msg --json windows)
5+
name=$(echo $window_list | jq -r 'map(select(.is_focused | not)) | .[] | "[\(.app_id)(\(.id))]: \(.title)"' | fuzzel --dmenu --width 120)
6+
id=$(echo $window_list | jq -r '.[] | "[\(.app_id)(\(.id))]: \(.title)", "\(.id)"' | grep -F "$name" -x -A 1 | grep -F "$name" -vx)
7+
8+
niri msg action focus-window --id $id

nixos-modules/desktop/greetd+niri.nix

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -54,28 +54,39 @@ in
5454
services.greetd.settings.default_session.command = "${lib.getExe pkgs.tuigreet}";
5555
services.greetd.useTextGreeter = true;
5656

57-
environment.systemPackages = [ pkgs.alacritty pkgs.xwayland-satellite pkgs.fuzzel pkgs.grim pkgs.mako pkgs.slurp pkgs.swaylock pkgs.xwayland-satellite pkgs.satty pkgs.waypaper pkgs.swaybg pkgs.waybar pkgs.brightnessctl pkgs.wlsunset pkgs.wl-clip-persist pkgs.wl-clipboard pkgs.cliphist ];
58-
59-
environment.etc."niri/config.kdl".source = ./niri.kdl;
57+
environment.systemPackages = [
58+
pkgs.alacritty
59+
pkgs.xwayland-satellite
60+
pkgs.fuzzel
61+
pkgs.grim
62+
pkgs.mako
63+
pkgs.slurp
64+
pkgs.swaylock
65+
pkgs.xwayland-satellite
66+
pkgs.satty
67+
pkgs.waypaper
68+
pkgs.swaybg
69+
pkgs.waybar
70+
pkgs.brightnessctl
71+
pkgs.wlsunset
72+
pkgs.wl-clip-persist
73+
pkgs.wl-clipboard
74+
pkgs.cliphist
75+
];
76+
77+
environment.etc."niri/config.kdl".source =
78+
let
79+
fuzzelDmenu = pkgs.callPackage ./fuzzel_dmenu/fuzzel_dmenu.nix { };
80+
in
81+
(pkgs.replaceVars ./niri.kdl {
82+
wallpaper = ../../static/ocean.jpg;
83+
fuzzel_dmenu = lib.getExe fuzzelDmenu;
84+
}).overrideAttrs
85+
(_: {
86+
checkPhase = null;
87+
});
6088
environment.etc."xdg/waybar".source = ./waybar;
6189

62-
systemd.user.services.swaybg = {
63-
enable = true;
64-
after = [ "graphical-session.target" ];
65-
requisite = [ "graphical-session.target" ];
66-
partOf = [ "graphical-session.target" ];
67-
path = [ pkgs.swaybg ];
68-
serviceConfig = {
69-
Type = "forking";
70-
Restart = "on-failure";
71-
};
72-
script = ''
73-
${lib.getExe pkgs.waypaper} --fill fill --wallpaper ${../../static/ocean.jpg} --monitor All --backend swaybg &
74-
'';
75-
};
76-
77-
services.gnome.gnome-keyring.enable = true;
78-
7990
# Custom PAM config: fingerprint as first factor (rejects bad fingerprints),
8091
# then mandatory password - applied to greetd, sudo, and TTY logins
8192
security.pam.services.greetd = {
@@ -94,4 +105,3 @@ in
94105
};
95106
};
96107
}
97-

nixos-modules/desktop/niri.kdl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ layout {
276276

277277
// This line starts waybar, a commonly used bar for Wayland compositors.
278278
spawn-at-startup "waybar"
279-
spawn-at-startup "waypaper" "--fill" "fill" "--wallpaper" "/home/john/.config/niri/ocean.jpg" "--monitor" "All" "--backend" "swaybg"
279+
spawn-at-startup "waypaper" "--fill" "fill" "--wallpaper" "@wallpaper@" "--monitor" "All" "--backend" "swaybg"
280280
spawn-at-startup "wlsunset" "-l" "41.9695" "-L" "-71.1821" "-t" "3000" "-g" ".9"
281281
spawn-at-startup "wl-paste" "--watch" "cliphist" "store"
282282
spawn-at-startup "wl-clip-persist" "--clipboard" "regular"
@@ -375,7 +375,7 @@ binds {
375375
// Suggested binds for running programs: terminal, app launcher, screen locker.
376376
Mod+T hotkey-overlay-title="Open a Terminal: kitty" { spawn "kitty"; }
377377
Mod+P hotkey-overlay-title="Run an Application: fuzzel" { spawn "fuzzel"; }
378-
Mod+D hotkey-overlay-title="Select an Application: fuzzel --dmenu" { spawn "~/test.sh"; }
378+
Mod+D hotkey-overlay-title="Select an Application: fuzzel --dmenu" { spawn "@fuzzel_dmenu@"; }
379379
Super+Alt+L hotkey-overlay-title="Lock the Screen: swaylock" { spawn "swaylock"; }
380380

381381
// Use spawn-sh to run a shell command. Do this if you need pipes, multiple commands, etc.

0 commit comments

Comments
 (0)