From 968ae8999819ce2e868881dd2fc1734fa499308b Mon Sep 17 00:00:00 2001 From: Noratrieb <48135649+Noratrieb@users.noreply.github.com> Date: Sat, 13 Sep 2025 17:54:28 +0200 Subject: [PATCH] gamer --- custom-pkgs/default.nix | 1 + custom-pkgs/sl/default.nix | 9 +++++++++ custom-pkgs/sl/sl.sh | 30 ++++++++++++++++++++++++++++++ home-manager/common-packages.nix | 1 + home-manager/config.kdl | 19 +++++++++++++++---- home-manager/waybar.nix | 1 + 6 files changed, 57 insertions(+), 4 deletions(-) create mode 100644 custom-pkgs/sl/default.nix create mode 100644 custom-pkgs/sl/sl.sh diff --git a/custom-pkgs/default.nix b/custom-pkgs/default.nix index 79e173a..2fa44fa 100644 --- a/custom-pkgs/default.nix +++ b/custom-pkgs/default.nix @@ -1,6 +1,7 @@ pkgs: { cargo-bisect-rustc = import ./cargo-bisect-rustc/default.nix pkgs; monaspace = import ./monaspace.nix pkgs; + sl = import ./sl { inherit pkgs; }; run = import ./run { inherit pkgs; }; unpem = import ./unpem { inherit pkgs; }; u = import ./u { inherit pkgs; }; diff --git a/custom-pkgs/sl/default.nix b/custom-pkgs/sl/default.nix new file mode 100644 index 0000000..f1a2e16 --- /dev/null +++ b/custom-pkgs/sl/default.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: pkgs.writeShellApplication { + name = "sl"; + runtimeInputs = with pkgs; [ niri jq ]; + derivationArgs = { + # shellcheck can't comprehend our amazingly new bash syntax + checkPhase = null; + }; + text = builtins.readFile ./sl.sh; +} diff --git a/custom-pkgs/sl/sl.sh b/custom-pkgs/sl/sl.sh new file mode 100644 index 0000000..92e4f03 --- /dev/null +++ b/custom-pkgs/sl/sl.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +win_id=$(niri msg --json windows | jq '.[] | select(.is_focused==true) | .id') + +niri msg action move-window-to-floating + +position() { + niri msg --json windows | jq ".[] | select(.id==${win_id}) | .layout.tile_pos_in_workspace_view.[0] | round" +} + +while true; do + before_pos_x=${ position; } + niri msg action move-floating-window --id "$win_id" -x +50 + after_pos_x=${ position; } + + if [[ "$before_pos_x" == "$after_pos_x" ]]; then + break; + fi +done + +while true; do + niri msg action move-floating-window --id "$win_id" -x -50 + after_pos_x=${ position; } + + if (( $after_pos_x <= 0 )); then + break; + fi +done + +niri msg action toggle-window-floating --id "$win_id" diff --git a/home-manager/common-packages.nix b/home-manager/common-packages.nix index a2f039b..47f9510 100644 --- a/home-manager/common-packages.nix +++ b/home-manager/common-packages.nix @@ -30,5 +30,6 @@ with pkgs; [ samply tokei customPkgs.u + customPkgs.sl uwuify ] ++ crates diff --git a/home-manager/config.kdl b/home-manager/config.kdl index 8537573..04d2bde 100644 --- a/home-manager/config.kdl +++ b/home-manager/config.kdl @@ -540,17 +540,28 @@ binds { // * adjust width as a percentage of screen width: "-10%" or "+10%" // Pixel sizes use logical, or scaled, pixels. I.e. on an output with scale 2.0, // set-column-width "100" will make the column occupy 200 physical screen pixels. - Mod+Minus { set-column-width "-10%"; } - Mod+Equal { set-column-width "+10%"; } + // requires the numpad but at least makes it possible at all + Mod+KP_Subtract { set-column-width "-10%"; } + Mod+KP_Add { set-column-width "+10%"; } // Finer height adjustments when in column with other windows. - Mod+Shift+Minus { set-window-height "-10%"; } - Mod+Shift+Equal { set-window-height "+10%"; } + // requires the numpad but at least makes it possible at all + Mod+Shift+KP_Subtract { set-window-height "-10%"; } + Mod+Shift+KP_Add { set-window-height "+10%"; } // Move the focused window between the floating and the tiling layout. Mod+V { toggle-window-floating; } Mod+Shift+V { switch-focus-between-floating-and-tiling; } + // move around floating windows, sadly not available via binds directly. + Mod+Alt+Up { spawn "niri" "msg" "action" "move-floating-window" "-y" "-50"; } + Mod+Alt+Down { spawn "niri" "msg" "action" "move-floating-window" "-y" "+50"; } + Mod+Alt+Right { spawn "niri" "msg" "action" "move-floating-window" "-x" "+50"; } + Mod+Alt+Left { spawn "niri" "msg" "action" "move-floating-window" "-x" "-50"; } + + Mod+S { set-dynamic-cast-window; } + Mod+Shift+S { set-dynamic-cast-monitor; } + // Toggle tabbed column display mode. // Windows in this column will appear as vertical tabs, // rather than stacked on top of each other. diff --git a/home-manager/waybar.nix b/home-manager/waybar.nix index 7ff41bf..0de184e 100644 --- a/home-manager/waybar.nix +++ b/home-manager/waybar.nix @@ -207,6 +207,7 @@ rgb(131, 80, 117) 45%, #db88c5 ); + border-bottom: none; color: black; }