diff options
| author | Linnea Gräf <nea@nea.moe> | 2025-05-20 23:48:10 +0200 |
|---|---|---|
| committer | Linnea Gräf <nea@nea.moe> | 2025-05-20 23:48:10 +0200 |
| commit | 9b82c65e458baa0768eab9e31c76c6a49a4a7764 (patch) | |
| tree | 1d5f5cd501197dfb6a22fc20c93e27f1bed9a367 | |
| parent | c99368c306a1e84b580dbed029edf7bc83ef4838 (diff) | |
| download | nix-infra-9b82c65e458baa0768eab9e31c76c6a49a4a7764.tar.gz nix-infra-9b82c65e458baa0768eab9e31c76c6a49a4a7764.tar.bz2 nix-infra-9b82c65e458baa0768eab9e31c76c6a49a4a7764.zip | |
snapshot: Di 20. Mai 23:48:10 CEST 2025
| -rw-r--r-- | flake.nix | 2 | ||||
| -rw-r--r-- | pkgs/default.nix | 1 | ||||
| -rw-r--r-- | pkgs/swaykill/default.nix | 2 | ||||
| -rw-r--r-- | pkgs/swayprop/default.nix | 27 | ||||
| -rw-r--r-- | pkgs/swayprop/swayprop.sh | 3 |
5 files changed, 34 insertions, 1 deletions
@@ -95,7 +95,7 @@ }; in { - formatter = pkgs.nixfmt-rfc-style; + formatter = pkgs.nixfmt-tree; } ); in diff --git a/pkgs/default.nix b/pkgs/default.nix index 8611a51..aa1aecb 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,3 +1,4 @@ final: prev: { swaykill = final.callPackage ./swaykill { }; + swayprop = final.callPackage ./swayprop { }; } diff --git a/pkgs/swaykill/default.nix b/pkgs/swaykill/default.nix index e811f65..285065f 100644 --- a/pkgs/swaykill/default.nix +++ b/pkgs/swaykill/default.nix @@ -3,6 +3,7 @@ sway, makeWrapper, jq, + swayprop, coreutils, pkgs, }: @@ -17,6 +18,7 @@ symlinkJoin rec { script sway jq + swayprop coreutils ]; buildInputs = [ makeWrapper ]; diff --git a/pkgs/swayprop/default.nix b/pkgs/swayprop/default.nix new file mode 100644 index 0000000..c0baf01 --- /dev/null +++ b/pkgs/swayprop/default.nix @@ -0,0 +1,27 @@ +{ + symlinkJoin, + slurp, + sway, + makeWrapper, + jq, + coreutils, + pkgs, +}: +let + script-name = "swayprop"; + script = (pkgs.writeScriptBin script-name (builtins.readFile ./swayprop.sh)).overrideAttrs (old: { + buildCommand = "${old.buildCommand}\n patchShebangs $out"; + }); +in +symlinkJoin rec { + name = script-name; + paths = [ + script + sway + jq + slurp + coreutils + ]; + buildInputs = [ makeWrapper ]; + postBuild = "wrapProgram $out/bin/${name} --prefix PATH : $out/bin"; +} diff --git a/pkgs/swayprop/swayprop.sh b/pkgs/swayprop/swayprop.sh new file mode 100644 index 0000000..a2e7d33 --- /dev/null +++ b/pkgs/swayprop/swayprop.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +id=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | "\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height) \(.id)"' | slurp -f %l) +swaymsg -t get_tree | jq -r ".. | select(.pid? and .id? and .id == $id)" |
