mirror of
https://github.com/Swarsel/.dotfiles.git
synced 2026-04-14 05:09:09 +02:00
18 lines
661 B
Nix
18 lines
661 B
Nix
{ name, writeShellApplication, jq, ... }:
|
|
writeShellApplication {
|
|
inherit name;
|
|
runtimeInputs = [ jq ];
|
|
text = ''
|
|
WORKSPACE=$(niri msg -j workspaces | jq -r '.[] | select(.is_focused == true) | .id')
|
|
|
|
COUNT=$(niri msg -j windows | jq --argjson ws "$WORKSPACE" -r '.[] | select(.workspace_id == $ws and .is_floating == false) | .app_id' | wc -l)
|
|
|
|
while [[ $COUNT == "0" || $COUNT == "2" ]]; do
|
|
COUNT=$(niri msg -j windows | jq --argjson ws "$WORKSPACE" -r '.[] | select(.workspace_id == $ws and .is_floating == false) | .app_id' | wc -l)
|
|
done
|
|
|
|
if [[ $COUNT == "1" ]]; then
|
|
niri msg action maximize-column
|
|
fi
|
|
'';
|
|
}
|