diff --git a/flake.lock b/flake.lock index d98061f..e97efda 100644 --- a/flake.lock +++ b/flake.lock @@ -74,6 +74,22 @@ "type": "github" } }, + "app-grid": { + "flake": false, + "locked": { + "lastModified": 1794872137, + "narHash": "sha256-JRO9X4pEQWTAzcaZJCPsr/V9KofZPxCSqoDwd1JvVwk=", + "ref": "refs/heads/main", + "rev": "7a4867aafd4925731fb64eb04b2aad6f8a48d75a", + "revCount": 1, + "type": "git", + "url": "file:///home/quadradical/Documents/Code/app-grid" + }, + "original": { + "type": "git", + "url": "file:///home/quadradical/Documents/Code/app-grid" + } + }, "base16": { "inputs": { "fromYaml": "fromYaml" @@ -935,10 +951,10 @@ "niri-mobile": { "flake": false, "locked": { - "lastModified": 1794870539, - "narHash": "sha256-vLHkvy05FsJ4TtQmIKRAHJ3zOhZ438xciJP9W87gcSo=", + "lastModified": 1794874359, + "narHash": "sha256-4WkEfXu32FSa7OCoOY41h5lsz5ZDq5xofmqeveTXNv0=", "ref": "quad/mobile-testing", - "rev": "4d18f5be39c918d02f0e87d3deda9a4be7833cbd", + "rev": "bec4ace7571bda589c0f589097b143e5c7171ae3", "shallow": true, "type": "git", "url": "file:///home/quadradical/Documents/Code/niri" @@ -1208,6 +1224,7 @@ "inputs": { "agenix": "agenix", "agenix-cli": "agenix-cli", + "app-grid": "app-grid", "continuwuity": "continuwuity", "cozybot": "cozybot", "degoog": "degoog", diff --git a/flake.nix b/flake.nix index 3ae915f..a5785f3 100755 --- a/flake.nix +++ b/flake.nix @@ -8,6 +8,10 @@ url = "github:sorki/nixos-gadgetfs-proto"; flake = false; }; + app-grid = { + url = "git+file:///home/quadradical/Documents/Code/app-grid"; + flake = false; + }; niri-mobile = { url = "git+file:///home/quadradical/Documents/Code/niri?ref=quad/mobile-testing&shallow=1"; flake = false; diff --git a/modules/mobile/niri.nix b/modules/mobile/niri.nix index dce93c0..63e8136 100644 --- a/modules/mobile/niri.nix +++ b/modules/mobile/niri.nix @@ -19,33 +19,7 @@ let }; }); - # Placeholder app grid, from test-shell/ in the clone. - grid = pkgs.stdenvNoCC.mkDerivation { - name = "niri-test-grid"; - src = "${src}/test-shell/grid.js"; - dontUnpack = true; - - nativeBuildInputs = with pkgs; [ - gobject-introspection - makeWrapper - wrapGAppsHook4 - ]; - buildInputs = with pkgs; [ - gjs - gtk4 - gtk4-layer-shell - libadwaita - ]; - - installPhase = '' - install -Dm644 $src $out/share/niri-test-grid/grid.js - # gtk4-layer-shell has to be loaded before libwayland-client. - makeWrapper ${lib.getExe' pkgs.gjs "gjs"} $out/bin/niri-test-grid \ - --add-flags "-m $out/share/niri-test-grid/grid.js" \ - --set LD_PRELOAD ${pkgs.gtk4-layer-shell}/lib/libgtk4-layer-shell.so \ - --set NIRI_BIN ${lib.getExe niri} - ''; - }; + grid = pkgs.callPackage "${inputs.app-grid}/package.nix" { }; swayosdStyle = pkgs.writeText "swayosd.css" '' @import url("file://${pkgs.swayosd}/etc/xdg/swayosd/style.css"); @@ -65,6 +39,13 @@ let lock = pkgs.writeShellScript "lock" '' ${lib.getExe' pkgs.procps "pidof"} gtklock || exec ${lib.getExe config.programs.gtklock.package} ''; + + hypridleConfig = pkgs.writeText "hypridle.conf" '' + general { + lock_cmd = ${lock} + before_sleep_cmd = loginctl lock-session + } + ''; in { programs.niri = { @@ -87,13 +68,15 @@ in left -16 right -16 top -16 + bottom -16 } center-focused-column "always" default-column-width { proportion 1.0; } background-color "transparent" + focus-ring { off; } } - // zoom and workspace-anchor have to match the constants in test-shell/grid.js. + // zoom and workspace-anchor have to match the constants in the app grid. overview { zoom 0.25 workspace-anchor 0.15 @@ -109,8 +92,9 @@ in } layer-rule { - match namespace="^niri-test-grid$" - follow-overview true + match namespace="^app-grid$" + place-within-backdrop true + backdrop-input true } layer-rule { @@ -130,9 +114,9 @@ in spawn-at-startup "${lib.getExe' pkgs.swayosd "swayosd-server"}" "--style" "${swayosdStyle}" // We log in automatically, so lock straight away. spawn-at-startup "${lock}" + spawn-at-startup "${lib.getExe pkgs.hypridle}" "--config" "${hypridleConfig}" binds { - XF86PowerOff { spawn "${lock}"; } XF86AudioRaiseVolume allow-when-locked=true { spawn "${swayosd-client}" "--output-volume" "raise"; } XF86AudioLowerVolume allow-when-locked=true { spawn "${swayosd-client}" "--output-volume" "lower"; } }