From bf087f2cf71cb1eef679f664bcf85eaa62234f49 Mon Sep 17 00:00:00 2001 From: suri-codes Date: Tue, 29 Sep 2026 17:18:22 -0700 Subject: [PATCH] A new Epoch. --- flake.lock | 12 +++++----- modules/home/wm/niri/config.kdl | 9 ++++--- modules/home/wm/niri/default.nix | 40 ++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 9 deletions(-) diff --git a/flake.lock b/flake.lock index c8534d6..21c3157 100644 --- a/flake.lock +++ b/flake.lock @@ -103,11 +103,11 @@ ] }, "locked": { - "lastModified": 1790365885, - "narHash": "sha256-iQ0ebhiVo64NktTnwft9hNxlFu4j5cvljVxyJaEVIP4=", + "lastModified": 1790726651, + "narHash": "sha256-zvULbL+SmLPPB1PwORjYU61W5SulQLjzUxFp4Vjl6B0=", "owner": "nix-community", "repo": "home-manager", - "rev": "7b4c5ec4bedaf1e062bbc1bcaeddbc6bd242aa1b", + "rev": "b0d0106ef6a7c7c36ebff9a74f803d23d9b383d3", "type": "github" }, "original": { @@ -294,11 +294,11 @@ "nixpkgs": "nixpkgs_5" }, "locked": { - "lastModified": 1790705793, - "narHash": "sha256-/LTg9cexAj3toLTGkc6eQWj6YyAbLGHGaRH0sio8fwI=", + "lastModified": 1790718664, + "narHash": "sha256-LWil4xgSyqIFZ9sydvL1glFOoiqAOknWUwykC4sqxuY=", "owner": "noctalia-dev", "repo": "noctalia", - "rev": "ebe17fdab3d55c79d8aeae0cca69701aebf21a6d", + "rev": "fd9759c892fe5034b682c185695f1bee121cd5b3", "type": "github" }, "original": { diff --git a/modules/home/wm/niri/config.kdl b/modules/home/wm/niri/config.kdl index c4c75b3..70a84dc 100644 --- a/modules/home/wm/niri/config.kdl +++ b/modules/home/wm/niri/config.kdl @@ -60,8 +60,10 @@ output "DP-3" { output "HDMI-A-1" { mode "1920x1080@74.973" + // Rotated to portrait: logical size becomes 1080x1920. + transform "90" // Secondary monitor: physically left of DP-3, vertically centered. - position x=-1920 y=180 + position x=-1080 y=-240 } layout { @@ -306,6 +308,7 @@ spawn-at-startup "zen"; spawn-at-startup "zulip"; spawn-at-startup "Spotify"; spawn-at-startup "vesktop"; +spawn-at-startup "niri-stack-chat"; spawn-at-startup "sh" "-c" "sleep 2; exec openrgb --client 127.0.0.1:6742 --mode direct --color CCC099"; spawn-at-startup "sh" "-c" "sleep 2; exec thunderbird" @@ -344,12 +347,12 @@ window-rule { window-rule { match at-startup=true app-id="vesktop" open-on-workspace "Chat" - default-column-width {proportion 0.66;} + default-column-width {proportion 1.0;} } window-rule { match at-startup=true app-id="zulip" open-on-workspace "Chat" - default-column-width {proportion 0.66;} + default-column-width {proportion 1.0;} } diff --git a/modules/home/wm/niri/default.nix b/modules/home/wm/niri/default.nix index 6c9a2a3..e0d1d54 100644 --- a/modules/home/wm/niri/default.nix +++ b/modules/home/wm/niri/default.nix @@ -7,6 +7,44 @@ with lib; let cfg = config.nyx.niri; + + # Waits for Discord (vesktop) and Zulip to open on the Chat workspace, then + # stacks them in one column: Zulip on top, Discord below. + niri-stack-chat = pkgs.writeShellApplication { + name = "niri-stack-chat"; + runtimeInputs = [ pkgs.jq ]; + text = '' + win() { + niri msg -j windows | jq -c --arg app "$1" 'first(.[] | select(.app_id == $app))' + } + + discord="" + zulip="" + for _ in $(seq 120); do + discord=$(win vesktop) + zulip=$(win zulip) + [ -n "$discord" ] && [ -n "$zulip" ] && break + sleep 0.5 + done + [ -n "$discord" ] && [ -n "$zulip" ] || exit 0 + + d_id=$(jq '.id' <<<"$discord") + z_id=$(jq '.id' <<<"$zulip") + d_col=$(jq '.layout.pos_in_scrolling_layout[0]' <<<"$discord") + z_col=$(jq '.layout.pos_in_scrolling_layout[0]' <<<"$zulip") + + # Consuming a window left appends it to the bottom of the neighbouring + # column, so pull Discord into Zulip's column when Discord is to the right; + # otherwise pull Zulip in and then move it up. + if [ "$d_col" -gt "$z_col" ]; then + niri msg action consume-or-expel-window-left --id "$d_id" + elif [ "$z_col" -gt "$d_col" ]; then + niri msg action consume-or-expel-window-left --id "$z_id" + niri msg action focus-window --id "$z_id" + niri msg action move-window-up + fi + ''; + }; in { options.nyx.niri = { @@ -14,6 +52,8 @@ in }; config = mkIf (cfg.enable && pkgs.stdenv.hostPlatform.isLinux) { + home.packages = [ niri-stack-chat ]; + home.file.".config/niri/config.kdl".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/nyx/modules/home/wm/niri/config.kdl"; -- 2.51.2